Monday, April 19, 2010

Workshop 4 : MANIPULATING FILES and DIRECTORIES

Files




1. Testing files, lets test for some existence and status of a file called text1.txt



<?php



// Checking its existence

if (file_exists("text1.txt")) {

echo "The file text1.txt exists!";

}



// checking the status of files

if (is_readable("text1.txt")) {

echo "The file text1.txt is readable";

}



if (is_writeable("text1.txt")) {

echo "The file text1.txt is writeable";

}



if (is_executable("text1.txt")) {

echo "The file text1.txt is exectuable";

}

?>



You probably only see "The file text1.txt exists". If you only see this, you will need to chmod the read,write and execute settings on that file.



2. Reading data from files



<?php



$filename = "text1.txt";

$fp = fopen($filename, "r") or die ("Could not open $filename");

while (!feof($fp)) { // While not end of file

$data = fread($fp, 16); // Reading the file in chunkcs of 16 bytes

echo "$data <br>";

}

?>



There are multiple ways you can read from a file includes

Fgets() : Reading line by line

Fgetc() : Reading a character







3. Writing to a file



<?php



$filename = "text1.txt";

echo "Begin writing to file $filename <br>";

$fp = fopen($filename, "w") or die ("Could not open $filename"); // OPen for writing

fwrite ($fp, "I'm making changes \n");

fclose($fp);

?>



If you have trouble writing to the file, it could be a permission setting. Try chmod 777 <filename>. This will give all permissions to the file only. Chmod 777 to the directory give all permissions to the directory and not advisable.



4. Appending to a file



<?php



$filename = "text1.txt";

echo "Appending to a file $filename <br>";

$fp = fopen($filename, "a") or die ("Could not open $filename"); // OPen for writing

fputs ($fp, "\n Another thing I want to add \n");

fclose($fp);

?>



The file text1.txt will have a new line called Another thing I want to add.





Directories



1. Creating a new directory



<?php



mkdir ("testdir", 0755);

?>



If you failed to create a directory, again it usually means you have incorrect permissions settings.





2. Directory listing



<?php



$dirname = ".";

$dn = opendir($dirname) or die ("Could not open directory");



while (!(($file = readdir($dn)) === false ) ) {

if (is_dir("$dirname/$file")) {

echo "(D) "; // To signify a folder

}

echo "$file <br>";

}

closedir ($dn);

?>

Workshop 3 : STRINGS, DATES, FORMS and SESSIONS

Working with Strings




1. Up to now, we've only been working on the echo statement. The printf() statement does the same thing except it can accept arguments passed onto the function.



<?php



// This outputs the integer as a decimal number instead of part of a string

printf("This is my number : "%d", 60) ;



?>





2. You can also specify the start position of your string displayed



<?php



echo "<pre">;

// This will leave 15 spaces before printing

printf ("%15s\n", " Name");

printf ("%15s\n", " Address");

printf ("%15s\n", " Mobile Number");

printf ("%15s\n", " Email");

echo "<pre">;

?>



3. You can look up more string functions on www.php.net

• strlen() , to determine the length of a string

• strstr (), to determine the existence of a string within a string

• strpos(), to find the position of a substring





Working with Time and Date



1. PHP stores time as number of seconds that have elapsed since GMT midnight 1 January 1970. This is the time stamp



<?php



// This is the timestamp, It is the number of seconds since Unix Epoch (Midnight GMT 1 Jan 1970)



echo "The number of seconds that have passed since Midninght GMT 1 January 1970 is ";

echo time();

echo "<br>";



?>



2. With the timestamp you can convert it to date using getdate(). This is a an array that stores the vales of date.



<?php

$date_array = getdate(); // no argument passed so today's date will be used

foreach ($date_array as $key => $val) {

echo "$key = $val<br>";

}

?>

<hr>

<?

echo "Today's date: ".$date_array['mday']."/".$date_array['mon']."/".

$date_array['year']."<p>";

?>



Creating Forms



1. Use the following files for testing.

1.1 Listing 9.1.html

<html>

<head>

<title>Listing 9.1 A simple HTML form</title>

</head>

<body>

<form action="listing9.2.php" method="POST">

<p><strong>Name:</strong><br>

<input type="text" name="user">

<p><strong>Address:</strong><br>

<textarea name="address" rows="5" cols="40"></textarea>

<P><input type="submit" value="send"></p>

</form>

</body>

</html>



1.2 Listing 9.2.php

<html>

<head>

<title>Listing 9.2 Reading input from a form </title>

</head>

<body>

<?php

echo "<p>Welcome <b>$_POST[user]</b></p>";

echo "<p>Your address is:<br><b>$_POST[address]</b></p>";

?>

</body>

</html>



There are two input boxes available from listing9.2.html called text and address. When the user submits the form it will invoke the script called listing9.2.php. The $_POST command will grab the value values corresponding to the text boxes value in listing9.1.html.





2. Getting data from a multi valued text box

2.1 Listing9.3.html

<html>

<head>

<title>Listing 9.3 An HTML form including a SELECT element</title>

</head>

<body>

<form action="listing9.4.php" method="POST">

<p><strong>Name:</strong><br>

<input type="text" name="user">



<p><strong>Address:</strong><br>

<textarea name="address" rows="5" cols="40"></textarea>



<p><strong>Select Some Products:</strong> <br>

<select name="products[]" multiple>

<option value="Sonic Screwdriver">Sonic Screwdriver</option>

<option value="Tricoder">Tricorder</option>

<option value="ORAC AI">ORAC AI</option>

<option value="HAL 2000">HAL 2000</option>

</select>



<p><input type="submit" value="send"></p>

</form>

</body>

</html>



2.2 Listing9.4.php

<html>

<head>

<title>Listing 9.4 Reading input from the form in Listing 9.3</title>

</head>

<body>

<?php

echo "<p>Welcome <b>$_POST[user]</b></p>";

echo "<p>Your address is:<br><b>$_POST[address]</b></p>";

echo "<p>Your product choices are:<br>";

if (!empty($_POST[products])) {

echo "<ul>";

foreach ($_POST[products] as $value) {

echo "<li>$value";

}

echo "</ul>";

}

?>

</body>

</html>



3. Sending out emails



3.1 Listing9.10.html

3.2 Listing.9.11.php

Sessions



Sessions are unique identifier of a user, which can be used to store and retrieve information attached to the user. Therefore enabling the website to know what the user have seen, browse through etc. The user would need to have cookies enabled for session to work.



1. Initializing a session



<?php

session_start();



echo "<p>Your session ID is ".session_id()."</p>";

?>



Your session id stays the same all the time.



2. Storing and accessing session variables

We'll store the variables first in a separate file



<?php

session_start();



$_SESSION[product1] = "Sonic Screwdriver";

$_SESSION[product2] = "HAL 2000";

echo "The products have been registered.";



?>





Once you have executed this script, run the next script. The above script will attached the data onto session variables.



<?php

session_start();



echo "Your chosen products are:";

echo "<ul><li>$_SESSION[product1] <li>$_SESSION[product2]\n</ul>\n";

?>





3. Destroying sessions and variables. Once executed it would remove the session and the corresponding variables



<?php

session_start();

session_destroy();

unset($session[product1]); // Remove product 1

unset($session[product2]); // Remove product 2



// This should print nothing

echo "Your chosen products are:";

echo "<ul><li>$_SESSION[product1] <li>$_SESSION[product2]\n</ul>\n";

?>

Workshops 2 : Beginning PHP Coding

1. All PHP files have an extension of .php

2. All PHP will start with the following code


<?php


code

?>


3. In order to comment a code, it begins with two forward slashes // or a # sign. PHP engine usually ignores these lines. Comments can be used to annotate codes to make them more readable




# This starts the comments

// This also starts the comments



Multi lines comment is also possible. It stars /* and ends with */.



/*

This is the start of the comment.

Anything within this lines will not

Be interpreted by the PHP engine

*/





4. Every line in PHP needs a terminator. The terminator is a semicolon ;



<?php

echo "This is my first PHP program " ;

?>





Variables



1. In PHP variables starts with $ sign followed by the name.



$variable1



<?php

// Adding two numbers together



// Assigning the variable with the value 88

$num1 = 88;

$num2 = 100;



echo "The first number is", $num1;

echo " The second number is ", $num2 ;



// Adding the two numbers

echo " The total is ", $num1 + $num2;

?>



For the list of logical and mathematical operators, please refer to the prescribed text.



Data Types



The six standard data types in PHP are



• Integer - Whole number, 10

• Double - Floating point number , 9.999

• String - AlphaNumeric characters, " This is PHP "

• Boolean - True/False values, TRUE

• Object - Instance of class

• Array - An ordered set of keys and values



Testing the variable types



<html>

<head>

<title>Listing 4.1 Testing the type of a variable</title>

</head>

<body>

<?php

$testing; // declare without assigning

print gettype($testing); // null

print "<br>";

$testing = 5;

print gettype($testing); // integer

print "<br>";

$testing = "five";

print gettype($testing); // string

print("<br>");

$testing = 5.0;

print gettype($testing); // double

print("<br>");

$testing = true;

print gettype($testing); // boolean

print "<br>";

?>

</body>

</html>



FLOW CONTROL





1. If Statements

<?php



$subject = "ITC382" ;

If ($subject == "ITC382") {

Echo " I am in ITC382 class";

}

?>





2. If .. else statements



<?php



$subject = "ITC254" ;

If ($subject == "ITC382") {

Echo " I am in ITC382 class";}

Else {echo " I am in the wrong class";) }

?>



3. If..elseif ..else statements



<?php



$subject = "ITC254" ;

If ($subject == "ITC382") {

Echo " I am in ITC382 class";}

Else if ($subject == "ITC254") {

echo "I am in ITC254 class ";}

else { echo " I'm not too sure which class I should be in. Maybe I should be in $subject"; }

?>





4. Switch statements

Switch is commonly used to execute different codes based on each expression used.



<?php



$subject = "ITC382";



switch ($subject) {



case "ITC254":

echo "I am in ITC254 class";

break;

case "ITC382":

echo "I am in ITC382 class";

break;

default:

print "I must have gotten lost again, I am suppose to be in $subject";

break;

}

?>





5. While statements

A continuos loop until a condition is reached.



<?php



$count = 1;



while ($count < 10) {

echo " This is line $count", "<br>";

$count++; // Increment count by 1

}

?>



6. Do..While statements

It is similar to the Do statement except that termination is at the end of the code.



<?php



$count = 0;



do {

echo " This is line $count", "<br>";

$count++; // Increment count by 1

} while ($count < 10);

?>



7. For statements

For statements are also similar to while statements, it is a more structured way to write looping statements with the initialization, testing and modification expression nested within the command.



<?php

for ($count =1; $count <10; $count++) {

echo "This is line $count", "<br>";

}

?>





FUNCTIONS



Functions are blocks of code that you can call from the main program.



<?php



function print2lines() {

echo "This is line 1", "<br>";

echo "This is line 2", "<br>";

}

print2lines();

?>





You can also pass arguments into a function



<?php



function printlines($txt) {

echo " $txt <br>";

}

printlines("This is line 1");

printlines("This is line 2");

printlines("This is line 3");

?>



You can also get the function to return an argument



<?php



function addnums ($num1, $num2) {

$result = $num1 + $num2;

return $result;

}

echo addnums(5,9);

// print 14



?>



Variables declared in a function remains only in the function. You can however use global variables should you wish to use variables within a function.



<?php



$value = 100;



function currentmoney() {

global $value;

echo " I currently have RM $value <br>";

}

currentmoney();

?>



ARRAYS



Creating arrays



In order to create an array, you would need to you the array function:



$lecturers = array("Yann", "Sam", "Ven Yu", "Tony", "Anitha");



You can also do this as well



$lecturers[] = "Yann" ;

$lecturers[] = "Sam";

$lecturers[] = "Ven Yu";

$lecturers[] = "Tony";

$lecturers[] = "Anitha";



Both will create an array called lecturers with 5 elements. By default the first element starts at position 0.



<?php

$lecturers = array("Yann", "Sam", "Ven Yu", "Tony", "Anitha");

echo $lecturers(1) ; // This will print Sams name

?>



Associative Arrays



Instead of using numbers, you can also use named keys to number the arrays instead as illustrated in the following example.



$lecturers = array (

"name" => "Yann",

"dept" => "VIGIM",

"subjects" => "ITC382"

);



If you write



Echo $lecturers['dept']; // this will return VIGIM



You can also make additions to an already existing associative array.



$lecturers['interests'] = "Video Games";





Multidimensional Arrays



This holds arrays of an array.



<?php



$lecturers = array (

array (

"name" => "Yann",

"dept" => "VIGIM",

"subjects" => "ITC382"

),

array (

"name" => "Sam",

"dept" => "VIGIM",

"subjects" => "ITC211"

),

array (

"name" => "Tony",

"dept" => "MT",

"subjects" => "ITC123"

),

);



echo $character[1]['subjects']; // this will print out ITC211



?>



OBJECTS



An object is typically a sort of container that consists of

• variables

• functions

• etc

It is similar to a class ohject in JAVA



<?php



class lecturers {

var $name = "Yann";

var $subjectcode = "ITC382" ;

var $subjectname = "Client Server Applications";

}



$mylecturer = new lecturers();

echo "My name is ".$mylecturer -> name. " and I teach " .$mylecturer -> subjectcode." " .$mylecturer -> subjectname;



?>



You can also change the properties of an object in the code as illustrated.



<?php



class lecturers {

var $name = "Yann";

var $subjectcode = "ITC382" ;

var $subjectname = "Client Server Applications";

}



$mylecturer = new lecturers();

echo "My name is ".$mylecturer -> name. " and I teach " .$mylecturer -> subjectcode." " .$mylecturer -> subjectname;





// changing the object properties

echo "<br> This is to relfect the changes in object properties <br>";

$mylecturer -> name = "Sam";

$mylecturer -> subjectcode = "ITC211";

$mylecturer -> subjectname = "Multimedia Systems";



echo "My name is ".$mylecturer -> name. " and I teach " .$mylecturer -> subjectcode." " .$mylecturer -> subjectname;



?>



You can also add methods into your class objects as illustrated.



<?php



class displayname {

function name() {

echo "My name is Yann " ;

}

}



$name = new displayname();

$name -> name();

?>

Workshops 1 : PHP

Writing PHP scripts

1. You can download many PHP editors that is freely available online. I recommend PHP Designer which can be downloaded from www.download.com

2. If you prefer you can also write using notepad and naming the file with *.php

3. Lets start using notepad to write a simple PHP script to test the following tasks.

4. Click on Start >> Programs >> Accessories >> Notepad

5. Write the following code


<?php


echo "Hello World";

?>


6. Save the file with the name helloworld.php. Remember to save it as helloworld.php since by default Notepad can save it as helloworld.php.txt.

Access to PHP

In order to get access to PHP server, you will need to run telnet from the labs. The IP address to telnet to is 10.1.1.200 or 192.168.68.42. You will need to upload your files from this telnet access.

A. Configuring your Linux account


1. From Start-Run, type telnet 10.1.1.200. Click OK button.

2. At the prompt, enter your Student ID (e.g aXXXXXXX or bXXXXXXX - case sensitive) as login name and welcome for password.

YOUR ID starts with lowercase.

3. Type passwd to set the password for your account. (Recommended so that you can have a unique password)

4. Type cd ..

5. Type ls -l, you will see a list of directories, ensure that you have your own directory based on your student id

6. Type chmod 755 this will set permissions for your directory to enable read access.

7. Type mkdir public_html to create a new directory (folder) called public_html.

8. Type chmod 755 public_html (Set permissions for the user, the group, and the others to access public_html directory )


B. Uploading files to the Linux account

1. From Start-Run, type ftp 10.1.1.200. Click OK button. Enter your login name(student ID) and password.

2. Type cd public_html. (Change to public_html directory)

3. Type put path\(source file name) (destination file name).

E.g. put a:\tutorial1.html tutorial1.html.

(You can upload any the HTML files)

4. Omit destination file name if you want to use the same file name. E.g. put a:\tutorial1.html

5. Type bye to quit ftp.

6. Alternatively if you find it troublesome to use telnet, you can also use Netscape to FTP to your site

7. Simply start Internet Explorer with the following address,

ftp://:@10.1.1.200

8. Drag the files you wish to upload onto the FTP window.


C. Using Web Browser to view HTML files in the Linux account

1. Launch Netscape/IE

2. In the location bar, type 10.1.1.200/~(your student ID)/(destination HTML file name).

E.g. 10.1.1.200/~a1234567/helloworld.php

3. You should be able to view your HTML file.

Access to MYSQL

1. You will need to start a telnet session before logging onto MYSQL>

2. Type the following command mysql -u -p, therefore the command line would look something like this mysql -u lohky -p

Wednesday, April 14, 2010

Exercise 8: XML introduction

XML was designed to transport and store data.
HTML was designed to display data.

What is XML?


•XML stands for EXtensible Markup Language

•XML is a markup language much like HTML

•XML was designed to carry data, not to display data

•XML tags are not predefined. You must define your own tags

•XML is designed to be self-descriptive

•XML is a W3C Recommendation


XML and HTML have many differences:
•XML was designed to transport and store data, with focus on what data is.

•HTML was designed to display data, with focus on how data looks.

HTML is about displaying information, while XML is about carrying information.

Exercise 7: Application server platforms in e-commerce

1. Why is the perception getting stronger that integration will become a critical factor in coming days?




2. What is the relationship of AJAX to JQuery (jquery.com) and the lightweight Web 2.0 javascript framework called MooTools (mootools.net) within the enterprise software architecture?



3. What are the similarities between the object-oriented development using model-view-controller (MVC) in Ruby on Rails 2.0 and Action Script 2.0 (Flash animations)?



4. What does it mean to develop RESTful practices into our web applications?



Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Exercise 6: Web form design and processing: A basis for e commerce interaction

1. Design the form


'Retrofit' the form data string above:



name=Evan+Burke&card=Visa&number=8443261344895544&order=French+perfume



for buying some French perfume into the HTML form fields and submit button on the Web page form.

2. Write the script

Script archives exist for PERL, Python and JavaScript. Search the Web for a script that processes the HTML forms data. Read the code and list the steps involved in processing the form.

3. Can you modify the script to process the form?

4. Improve the user experience by add a Javascript feature.

CGI alternatives

JavaScript, PHP, Active Server Pages (ASP), Java Server Pages (JSP) and a variety of other proprietary sources such as Cold Fusion, all provide an alternative to CGI interactivity and security. [See Figure 2-4 on Web server-enabling technologies in Conallen, p. 23]



JavaScript has been popular for including event-driven, user interface features (display a pull-down menu) and interactive multimedia (display a message or image when a mouse arrow passes over a screen area), as well as to validate data and user types into a form.



MouseOver event sample:



Go Home



Many JavaScript samples are available from http://javascript.internet.com/

Take a video lesson under 10 minutes

There are lots of video lessons on learning to use Javascript.

Douglas Crockford is my favourite: See http://video.yahoo.com/watch/111593

Code generation: Constructing a program or script

Constructing a program can be done in various ways:

• Constructing a sequence of machine language instructions to simulate the parsed statements.

• An Interpreter can execute a source program in a one-step process, with no permanent copy of the program being produced or saved. The use of an interpreter is handy when testing a program under development, as found in the Python IDE.

• Programming languages such as Pascal and C use an option to compile the final program file as one that can 'stand and run alone' as an independent application. A compiler creates a version in the native machine language of the computer.

• The Java Virtual Machine arises from a process that combines the use of a Compiler and an Interpreter. The original Java source code is translated by a Java compiler into Java bytecodes, which are similar to the machine language form. The Java interpreter on ANY machine can read the bytecodes OR another compiler can translate the bytecode form into the machine language of the host machine. Such is the distinct advantage of Java as it is:

 architecturally neutral;

 portable to all systems.

Java virtual machine

The Java language is very secure and platform-independent when compared to alternative languages. Java's secret is the tightly integrated language model. The steps below show how the Java Virtual Machine implements a Java Program:



Coding – Human-readable Java code is produced by the programmer.

1. Building – A Java Development Tool builds the Java program into bytecode, which is saved as a '.class' file.

2. Loading – Via the web or command line, the class file is sent to the Java Virtual Machine (VM) with an attached digital signature. The Java VM is simply an interpreter.

3. Bytecode verification – The Java VM verifies the digital signature.

4. Isolation – When downloaded remotely, the Java VM isolates the Java program in a restricted part of memory. The Java program is not allowed to access local Hard drives and System resources.

5. Internal integrity – Verification checks are made to insure that the loaded Java program is well formed. Data types are verified along with other syntax structure.

6. Execution – Program execution begins.

Web application frameworks: From RSS and RDF to Ruby on Rails

Any development framework, from Java technologies (Java servets, JSP and JavaBeans) to Microsoft .NET and ZOPE, has provided a set of standard software components to reduce the amount of work to be done by the developer. Just as ASP.NET was one development framework for Web-based applications, others have emerged in the open source community to give us more choices – perhaps too much choice and too many to cover in his subject.



While Really Simple Syndication (RSS) introduced the notion of syndicated and subscription services to blogs, wikis and podcasts, other changes have emerged in the way we do business on the Web since 2005, though new rapid development tools.



The rise of Web 2.0 and 'Asynchronous JavaScript & XML' or AJAX has altered and extended development with an enhanced collaborative approach to building dynamic Web interfaces. Begin your understanding of Web 2.0 with Tim O'Reilly's article at http://www.oreillynet.com/pub/a/oreilly/tim/news/2005/09/30/what-is-web-20.html

What is AJAX? Visit http://developer.mozilla.org/en/docs/AJAX  as your starting point for this completely different way of developing Web applications. When I started developing Web pages in 1994 we never called it Web 1.0 so what has happened to transform the Web into its second generation? Maybe you can sense or predict the arrival of Web 3.0?



Many well known online communities are using AJAX and other new programming paradigms for the Web and has also influenced Microsoft's .NET framework. See http://www.asp.net/ajax/ Prior to AJAX, a typical Web interaction had the client browser send messages to the server via a link, a URL or submitted form data and then wait for a response from the server, which may take time for server processing and for the client browser to receive and render a result on the screen. In AJAX the communication with the server is asynchronous so the browser does not wait long for the server response as small parts are displayed, resulting overall in a faster interaction 'look and feel' between the browser and the server.



Rapid database application development using 'frameworks' like Ruby on Rails, AJAX on Rails, TurboGears or Google Gears present a new architecture as part of the Web 2.0 developments. Three cases to look at here are:



• TurboGears at http://turbogears.org/  Do you agree with its rapid development approach?

• GoogleGears at http://gears.google.com/  See how the notion of 'an offline database' works. Examine the tools and reflect on the new knowledge that may be required in using Google Gears.

• Ruby on Rails at http://www.rubyonrails.org/  You can even download a pre-packaged solution that includes everything in one bundle: Web server, database, Ruby on Rails for both Windows (Instant Rails) and for MacOS X (Locomotive). [If you have time to go further then also test AJAX on Rails].


Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Exercise 5: Database case study

Do EITHER Case A or Case B as your database case study for this exercise.




On your own machine, setup and test either database system and report your findings.

Case A: Microsoft SQL server

The relational DBMS uses Structured Query Language (SQL) as a standard. Microsoft SQL Server 2008 has support for .NET Framework, so that stored procedures can used be in any of the .NET languages. Microsoft Dreamspark at dreamspark.com is an interesting site for the student/developer using Microsoft products.



1. Investigate the. SQL Server 2008 architecture available from the Dreamspark website.



2. Test out the SQL Server Express as a lightweight application development tool. SQL Server 2008 Express Edition and report your findings.

Case B: PHP and MySQL

Since over three million PHP/MySQL open-source relational model and web-based database systems are over the Internet, let us taker a closer look at this popular system - as we can learn how many of the other systems operate, in similar ways.



As a GUI admin tool the phpMyAdmin tool is still widely used to setup and maintain a MySQL database and is available from phpmyadmin.net The most frequently used operations include creating and editing tables, fields, relations, indexes, users, permissions and deletions, as well as executing any SQL statement. Other MySQL GUI tools are found for Windows, MacOS and Linux users at dev.mysql.com/downloads/gui-tools/5.0.html



PHP is at http://php.net/ . The PHP engine works well with the Apache Web server

- and a MySQL server is also needed. PHP files end in .php; this triggers the web server to pass the file to the PHP program for parsing and execution. The PHP code is placed within an XML (or HTML) compliant tag and a semi-colon is used to end PHP instructions.



Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Exercise 4: Network and Web programming frameworks

1. Describe the important and distinguishing properties of Peer to Peer computing with the client/server architecture?


2. Frameworks for development. Compare and contrast any TWO of:

a. Java

b. .NET

c. Ruby on Rails

d. Turbo Gears

e. Google Gears

f. AJAX frameworks



Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Exercise 3: From DNS and DHCP to Clouds and Grids

1. Explain DNS and DHCP. How does DNS differ from DCHP configuration?


2. Why is it important for your online business application to use a static IP address rather than have it dynamically assigned?

3. What role can the following play in business-to-business e-commerce?

a. Virtual Private Network (VPN) or Grid computing services

b. Next generation of wireless mesh networks

c. Cloud or Social Cloud applications.

4. If clouding computing is the 'black box', then grid computing is a component as the 'white box'.



Explain what you interpret about that statement.



Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Exercise 2: Finding some common ground

Describe the steps involved with the Rapid Evolutionary Prototyping Approach


as it applies to developing a Web application. How is it related to agile development?

Components of the online store

IBM (http://www.ibm.com/ ) describes some key e-commerce Web page terms relating to online business development. While the list can be quite long, here are a few terms those IBM uses, which give you an indication of the components of online shopping as a common form of e-commerce:



order list – A list of products that the user has identified as being under consideration for purchase, common to shopping cart sites.



order list page – A page that contains the order list.



product list – A list of products in the e-catalogue. Typically, the product list contains each product's name, price, and a very brief description. It is linked to more detailed information and may also include a mechanism for adding items to the order list.



product category navigation page – A page that presents product offerings grouped by categories, such as brand or intended usage.



product description page – A page that describes a product in detail and allows the user to add the product to the order list.



store front – A point or entry to an online store. Sometimes this page is the same as the company home page (http://www.companyname.com/ ). Other times it is separate (perhaps http://www.companyname.com/shop ).

Where did you find the e-commerce model?

An organisation needs to have an e-commerce model in place as a blueprint for

the development of the whole e-systems infrastructure. The e-commerce model is an abstraction of the infrastructure to be developed and serves as a

communication mechanism for the e-business application project team. A well developed application model, using Model View Controller (MVC) and Unified Modelling Language (UML), supports traceability throughout its elements and artefacts.



Figure 1.1 shows how an e-commerce model relates to business application development and the increasing use of new web and multimedia technologies. Part of your job may be to make connections from the current e-business application (e.g. E-catalogue, Shopping Cart), the E-commerce model and the latest technologies to the E-systems Infrastructure plans.







Figure 1.1: E-systems infrastructure as an expression of an e-commerce model.



The Internet: Architecture, protocols, standards and services

The Internet is an information pipeline, which grew out of ARPANet - a USA Department of Defense experiment. It was originally used exclusively for non- commercial (primarily academic) purposes, but the rules against commercial exploitation of the network have relaxed considerably in past years.



The Internet is a global network of networks or internetwork, which connects millions of users by packet switching technology. Packets are a constant length bit string transmitted as individual entities. Each packet sent across the Internet must follow the format of the Internet Protocol (IP), in order to distinguish between others type of data packets. IP packets are also called IP datagrams. Dedicated routers interconnect the various computer networks.



The Internet Architecture Board (IAB) is responsible for setting standards

relating to the Internet. The Internet Society (ISOC) ratifies IAB standards, which is a large body that all users of the Internet have the option of joining. Most of

the work that is carried out prior to a new standard being approved is by working parties of the Internet Engineering Task Force (IETF). Although most new standards are proposed initially be the IETF, any organisation can propose that a new protocol or technology becomes an approved standard.



To establish a new standard, you first need to submit a document as an Internet Draft. After a period of consultation with the research community you will then submit a modified version of the proposal as a Request For Comment (RFC). The IAB's RFC editor will allocate an RFC number to the proposal and it will be made available through the main RFC archive (along with mirror sites around the world). Finally, after a further period of consultation, the IAB may recommend that the RFC be submitted to the ISOC as a proposed new standard.

W3C

Standards associated with the World Wide Web are dealt with by a separate body, the World Wide Web Consortium (W3C) at http://w3.org. W3C develops interoperable technologies (specifications, guidelines, software, and tools) to lead the Web to its full potential as a forum for information, commerce, communication, and collective understanding. This body is a consortium of representatives of the main companies involved in Web development. It was created to provide a faster mechanism for new standards to be approved, as the delays involved in the ISOC process were leading to defacto standards emerging and being superseded long before they were approved by the ISOC.

HTTP and HTTPS

Tim Berners-Lee defined HTTP in 1992 as a connectionless, stateless protocol where a transaction consists of:



Connection

The establishment of a connection by the client to the server - when using TCP/IP port 80 is the well-known port, but other non-reserved ports may be specified in the URL;

Request

The sending, by the client, of a request message to the server;

Response

The sending, by the server, of a response to the client.

Close

The closing of the connection by either both party



This is what happens when you use a browser to view the page at csu.edu.au



For secure transactions with the Secure Sockets Layer (SSL), the HTTP protocol is enhanced by the use of encryption to provide a secure link. This new protocol with SSL was called HTTPS. SSL is often used to transfer credit card numbers and other sensitive information and can be configured to appear in the location box (e.g. in your CSU online Subject Outline). The browser also uses a closed lock icon to indicate a secure site. More about security later in Topic 7.



Let us start with the fundamental Internet protocol suite and work our way through to the security aspects. TCP/IP takes us on a trip back in time . . .

TCP/IP

Transmission Control Protocol/Internet Protocol was developed in the late

1960's. TCP/IP is the protocol that is used by the Internet and World Wide Web. The layers do not follow the OSI model because it preceded the OSI model by almost a decade. Most of the services that we normally associate with the Internet are delivered via TCP/IP. These services include file transfer via File Transfer Protocol (FTP), remote login via the Telnet protocol, electronic mail distribution via the Simple Mail Transfer Protocol (SMTP), and access to the Web pages via the Hypertext Transfer Protocol (HTTP).

FTP

FTP (for File Transfer Protocol), allows users to move data files from computer to computer. The vast quantity and range of resources available through FTP made

it one of the most popular features of the Internet. Much of what is available this way is software - including anti-virus utilities, printer typefaces, games, graphics and updates of commercial software. There are FTP archives of software for most computers. Books, journals, reports and other documents are available through FTP. You can find and acquire copies of the lecture notes, status reports, e.g. NASA missions, and numerous reports. A typical session involves commanding an FTP program to connect to a remote FTP host specified by its network address; moving around in the directories on the host; and requesting the system to get the desired files. Unregistered or anonymous users can use access via FTP where users identify themselves literally as anonymous.

Remote Login – Telnet

Remote login, also called Telnet, allows users to connect to other computers and the services they run. One of the original ideas behind the Internet was to allow researchers to use programs and resources mounted on computers at other facilities. The Internet features tens of thousands of computers accessible via remote login. This worked fine when networks gave limited access, but now using raw telnet exposes your username and password to an 'eavesdropper'. So now we need the added protection of SSH.

SSH – secure shell protocol

The need for better security than FTP or telnet for corporate network services, and the use of HTTP as an FTP alternative, has led to the use of more secure ways to remotely access a network.



One of these secure alternatives is secure shell – SSH. A freely available Telnet/SSH client can be used called PuTTY. Secure copy or PSCP is another free tool to replace an FTP client on the Win32 platform. Secure Shell is a program to log into another computer over a network, to execute commands in a remote machine, and to move files from one machine to another. It provides strong authentication and secure communications (encryption) over unsecured channels. It is intended as a replacement for telnet, rlogin, rsh, and rcp. For SSH2, there is a replacement for FTP: sftp.

Recognising the Web 2.0 and other changes since 2005

You should recognise the way in which an online distributed business application is used, as it may have various technologies gathered over time - component technologies of HTTP, HTML, CGI, XML, dynamic clients, or session management mechanisms that use cookies to index a dictionary for a shopping cart site may creep into the infrastructure without quality planning.



Recent developments with Web 2.0 tools since 2005 has spawned the growth of social networks through use of RSS and development frameworks like Ruby On Rails and the move towards the use of common business applications online by 37signals.com and google.com



That is why it is important to get the technical knowledge of competing frameworks that has been developing for some years through efforts by SUN Java Systems or Microsoft .NET, or application servers like ZOPE and other open source systems.



These application servers built upon the previous foundations laid by the earlier Web servers from Apache or Microsoft IIS, as well as scripting environments like Python, ASP.net VB script and PHP etc. An understanding of the role of XML as a core technology in developing an e- systems architecture is also useful.

Cloud and grid architecture

Cloud and grid computing offer a cost effective solution to providing business, education and other services, often called 'utility computing'. They offer a solution to the many problems dealing with how to provide services, data storage and computing power to the user without the cost of maintaining and upgrading in the organisation alone. Grid computing is a cluster of computers using a parallel processing architecture where the CPU resources are shared across the network acting as one large computer. Cloud computing is a set of dynamically scalable, virtual services over the Internet. All you need is an Internet connection! Like a black box, you need not have control the 'cloud' that provides services, such as Google Documents or the applications and services at 37signals.com



Coupled with developments in mobile devices and geo-location in high speed broadband networks and service-oriented computing, cloud and grid computing subsequently involves increased use of remote services shared by many users.



As an example, Google applications offer the common business application online approach through its Goggle Documents, Google Maps and Google Earth applications, offering APIs for others to include their services in their own Web sites or applications.



Hence a trend towards complex applications being processed in the cloud, will involve infrastructure changes to include grid computing as an extension to the use of clustered data farms with large processing power and enormous storage capacity. All this would be beyond the capability of many small to medium businesses.

Take a video lesson under 10 minutes

What is Cloud Computing? Search for your own video lesson or try this: http://www.youtube.com/watch?v=6PNuQHUiV3Q



Reference:
Charles Sturt University ITC 594 E-system infrastructure development student study guide

Exercise 1: Analysis of the online communities' paradigm

1. Visit http://yahoo.com/  and http://facebook.com/  as examples of online communities.


a. What is meant by an online community and how is it important for e-commerce?

b. Is there a common thread and a local community sense in action?

2. Visit the famous online store front at http://www.amazon.com/

a. Why has it been a successful site? How does the purchase of a book work?

b. Are there any secure transactions not involving money?

3. What happens with new models emerging such as price comparison sites?

What is your perspective? Developer or IT manager?

You may be interested in building Web applications, or network design or IT management. This subject has you researching and working with using some technologies for designing, building or managing Web applications. Whichever role you are to play, the learning journey will build concepts and ideas as a either a developer or IT manager.



At the same time, you are asked to consider examining the big picture - how each application contributes to the large scale needs of an organisation – planning, policy, competitive edge, knowledge management and the need for secure electronic transactions. You may want to do some research into the Model-View-Controller design approach, the Object-oriented UML design work and project management or into the use of extreme programming (XP) methods. One useful approach is to use rapid evolutionary prototyping.

Rapid evolutionary prototyping approach

A case history

In 1996, I was consulted on building an inaugural e-commerce site and intranet for a national insurance broking business, with over ninety branch offices across the nation. A lot of new Web technologies have developed since that time. We used a professional graphics designer for all logos, buttons and image maps and used PERL and CGI for all server-side interactivity. This was the beginning of a developing e-systems infrastructure for the company.



For the work breakdown structure, I used the 'builder metaphor' for developing Web applications. This is similar to a project homebuilder sub-contracting work to others, e.g. carpenter, electrician, concreter, cabinetmaker, carpet layer and painter. This approach was easier for me to handle as project manager and easier for the business client to understand the apparent costs associated with the Web site development. It was used in tandem with a Rapid Evolutionary Prototyping Approach.



The Rapid Evolutionary approach is recommended for small projects as a fluid approach consisting of two main phases:



1. evolutionary application prototyping; and

2. implementation.

After capturing the business requirements and the system specifications, the object modelling focused on what the system should do, rather than the how to. One of the attractions of this approach is that users see a visible, tangible system as construction takes place. One of the pitfalls occurs if the system becomes unstable or hard to maintain, once it is moved to the production site. Make sure that you include proper project management and quality techniques in your e-business application development.



In the final project report I recommended that any maintenance or site makeover be done with an outsourcing company. The intranet was in constant use, with some 'fine tuning' until 2001. A new site was released in early 2002 but looks vastly different in 2010. The reason the first design lasted for five-six years was that the site did what was required and the business needs were slow to change – until a corporate re-structuring.


Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Tuesday, April 13, 2010

Topic 6: Distributed objects – RMI and CORBA

Why use distributed objects? The reason is quite transparent!


Programmers must generally resort to primitive, object-disoriented communication techniques, such as sockets, to build distributed applications. However distributed object technology extends the benefits of object-oriented technology across process and machine boundaries to encompass entire networks. This means that remote objects now appear to programmers as if they were local objects (that is, simple programming-language objects in the same process). This effect is called location transparency.

A transparency occurs when some mechanism causes an obstacle to disappear. This is a software abstraction that allows programmers to cross a computing boundary without having to be aware of the boundary at all, or without performing an explicit transformation. The object's programming interface is identical in all cases.

Distributed objects glossary

This topic is full of acronyms so a short glossary of terms may be useful.

Client: In the world of distributed objects, a slight change is made to the standard client definition for this topic. A distributed object client can be any computing context that invokes operations on the object (sends it a message, invokes a

method etc.).

CORBA: An acronym for Common Object Request Broker Architecture, as set by the OMG. See http://www.omg.org. In the CORBA model, the ORB provides location transparency.

Location transparency: This occurs when an object's client invokes the object's methods in a natural manner, regardless of where the object resides on the network.

Interface: The boundary layer that separates a consumer of an object's service (a client) from the supplier of the object's service (an object implementation).

IDL: Interface Description Language is an abstract interface description

language used to create an IDL file. This is used to map abstract descriptions and to generate the stubs, skeletons, and servants that are actually used when programming.

OMG: The Object Management Group is the technical group that defines a lot of specifications for technologies such as CORBA and UML. At http://www.omg.org – 'The Object Management Group (OMG) is an open membership, not-for-profit consortium that produces and maintains computer industry specifications for interoperable enterprise applications.'

ORB: The Object Request Broker is the central technical component, or foundation, on which the other OMG specifications are built. An ORB is any mechanism that mediates between an object and one of its clients, on different computers, using some kind of network communication. The ORB can provide various types of transparency such as programming language transparency, platform transparency and representation transparency.

RMI: Remote Method Invocation.

RPC: Remote Procedure Method.

UML: Unified modelling Language for OO design.

Components and distributed objects

Distributed objects technology raises the level of abstraction for distributed application design and development. A component is a standardised and interchangeable software module that is executable, has a unique identifier and has a well-known interface. Components are important in modern software development because complex programs and applications can be constructed for small, previously developed parts. Component-based design and construction (JavaBeans) provides similar benefits to complex software products. Component developers can deliver their product as a ready-to-use executable function (CORBA and COM+). It is important to distinguish the differences between CORBA as an OMG specification for use with Java, Python and C++, and the layered RMI architecture in Java, and ActiveX controls with Microsoft's DCOM.

Developers of a software package simply plug in the component into the existing software. Interoperability among hardware and software components requires well-defined and widely adopted standards. Software components require similar standards for connections and services. Components located on different machines running different operating systems requires a standard network protocol. Recent work in this area is with using XML with SOAP – Simple Object Access Protocol.

ORB programming

ORB programming in Java or Python or C++ etc. all focus on the object's interface. The interface defines what a client can know about an object and how a client may interact with it. A neat feature is that low-level details (network protocols, programming language idiosyncrasies, physical data organisation) on one side of the boundary are hidden from the other side. (So it can be a paradox to describe interfaces as 'hiding' things and providing 'transparencies'.)

As you will see in the Web services notion of contractual agreement later in this course, an interface may also be a contract between an object's client and implementation; and is called a servant.

The servant agrees on the information that will be exchanged in a given operation - a contract to interact between client and object for proper behaviour. CORBA interfaces may be composed from other interfaces through inheritance. This is called IDL programming. The Interface Description Language is used to develop an IDL file that can be used to map abstract descriptions and to generate the stubs, skeletons, and servants that are actually used when programming. Transformation into equivalent constructs in a concrete programming language is useful; the way in which these transformations are made for a particular language is called a mapping for that language. IDL language mappings exist for Java, C, C++, Smalltalk, and Python.

In Java language mapping, as an example, a stub takes the form of a Java interface - which is the Java equivalent of the IDL interface from which it was generated. Stubs are used by clients to invoke operations on target CORBA objects.

Reading the notion of a stub, here is some more information.

Using stubs

Stubs are used by clients to invoke operations on target CORBA objects. In Java language mapping, a stub takes the form of a Java interface, which is the Java equivalent of the IDL interface from which it was generated. An instance of the stub type is used indirectly by a client of a remote object (a consumer of the remote object's service) to invoke operations on the object.

A stub is often called a proxy or surrogate, as it is not the CORBA object itself; it is a Java object that represents the CORBA object and is partly responsible for invoking requests made on itself, to the real target object.

As you can see, CORBA applications can be quite involved, expensive and mostly used by large corporations for developing distributed objects applications for small-to-medium enterprises. The boundaries get fuzzy when a client of one CORBA object may be the server for other objects, and programs are sharing each others' objects in a variety of client/server roles as peers!

Servants

Servants are a CORBA interface (package of code) used to build object implementations. It is in a concrete programming language that provides the real behaviour of the object type. A servant is an interface with methods that correspond to the operations in the IDL interface; programmers construct an implementation by deriving a new type from the servant interface, then provide method implementations for the methods inherited from the servant interface. CORBA determines matching servants and stubs from a common interface mapped to the IDL interface, thereby making certain that a given stub/servant pair have identical interfaces.

Skeletons in the closet?

Skeletons are responsible for unpacking the parameters of the request sent by a stub and delivering them to a servant to implement the CORBA operation. They are used to delegate CORBA requests to servants. When the operation is finished, the skeleton must package any results into a reply to send back to the stub.

RMI and CORBA case study: On the road to distributed systems

Tim Austin discussed Java applications with RMI, CORBA and SOAP, and provided the source code for the HelloWorld RMI and HelloWorld CORBA examples as a case study for this Study Guide.

NOTE: You can download a copy of the source code used by Tim in this RMI

and CORBA Case Study at:

http://ispg.csu.edu.au/subjects/workshops/java/rmi and http://ispg.csu.edu.au/subjects/workshops/java/corba

Why bother with distributed systems?

Provision of a new level of automation across business intranets saves money and allows:

• distributed users to work with the same application;

• distributed data sources to be used with the same application; and

• computation to best be matched with machine resources.

What are distributed component architectures all about?

Distributed Component Architectures are designed to allow many machines to work together to form a distributed application. The use of components can allow an organisation to wrap existing 'legacy' applications in forming a new application, using object-oriented principals to make the system operate over a network – therefore reaping the benefits of the OO approach. Like a heavyweight boxing tournament, the contenders are:

• Common Object Request Broker Architecture (CORBA)

• Microsoft Distributed Component Object Model (DCOM)

• Sun's Java Remote Method Invocation (RMI)

• Simple Object Access Protocol (SOAP) The newest challenger



Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Topic 5: XML – eXtensible Markup Language

XML


Extensible Markup Language is another language used to define the syntax of markup languages. XML is a subset of SGML, and is designed to represent arbitrary structured data in a text format. SGML is the Standard Generalised Markup Language, and is an enabling technology used in publishing applications such as HTML and XML - so a working knowledge of SGML

may be handy. XSL is a style sheet language for styling XML documents.
Some sites to examine are:

• W3C's XML 1.0 Recommendation

• W3C's 'XML in 10 Points'



• W3C's XSL Specification

What's my line?

When I put forward my opinion, I am reminded of the public speakers that get up on their soapbox each Sunday morning in Hyde Park, London to push forward their thoughts to the gathering crowd. You are my audience! Last year I started sending soapbox e-mail messages to my colleagues amusement, as well-formed XML, using my root tag element:



XML was designed to describe data with tags. It is not predefined like HTML, so you must define your own tags (as XML is self-describing). Soon I had a set of child tags for issues, facts, examples, questions and thoughts – like a developing schema or document type definition (DTD). I found that XML helped to 'see' the relationship of each element with indenting. Maybe those Hyde Park speakers practiced XML in their speeches, popular in the 19th century, without us really knowing! ☺

Instead of reading about my perspective on this subject in 12 point, Times Roman, formatted text, the notes are now presented as 'well formed' XML, using 10 point Courier New font. Note how hard it is for the eye and brain to 'parse' the raw XML content:







I hold the tenet that e-commerce and indeed many e-business applications, are not about commerce at all. I suggest that an e-commerce framework provides a system for secure electronic transactions of a diverse nature.





A bank or credit card company desires a secure transaction for moving numbers and money around the Internet. Many Internet users need the same secure system for transactions without money involved at all.



a student and teacher need a secure system to exchange

assignments and marks;





a farmer and a government agency exchange water quota

figures for irrigation, also require a private, secure

transaction without money involved.







In this subject, you will use object modelling as a tool for designing a secure E-business application or Web object component, such as an E-catalogue, an interactive multimedia product for sale or a Shopping Cart.





What is the significance of the thing you do?





For each E-business component that you build and attach to Web site – the online store front, you should discuss how your component connects or relates to your UML-based model, the Online Store (Web site); its business plan for online transactions and the secure E-commerce model in the business plan.





Such thinking and decision-making by you, will assist the organization (and you) to see not only how all the bits fit together, but also how your work fits into a secure, portable, scalable, reusable and persistent (big picture) development plan for the E-systems infrastructure of the business entity.





XML is widely supported as an open technology for data exchange and is better designed to handle the task of managing information. XML was designed to describe data, where XML tags are not predefined in XML. You must define your own tags, hence XML is self-describing. XML uses a DTD (Document Type Definition) to formally describe the data.

XML is not a replacement for HTML. XML and HTML were designed with different goals: XML was designed to describe data and to focus on what data is; HTML was designed to display data and to focus on how data looks. HTML is about displaying information, XML is about describing information.

In the future development of the Web it is most likely that XML will be used to structure and describe the Web data, while HTML will be used to format and display the same data. It is strongly believed that XML will be as important to the future of the Web as HTML has been to the foundation of the Web. XML is the future for all data transmission and data manipulation over the Web, using new protocols like SOAP.

XML is extensible and portable

The tags used to markup HTML documents and the structure of HTML documents is predefined. The author of HTML documents can only use tags that are defined in the HTML standard. However, XML allows you to define your own tags and your own document structure. Since XML tags describe the data they contain, it is possible to search, sort, manipulate and render an XML document using related technologies such as XSL (Extensible Style sheet Language).

XML parser

XML docs are highly portable – any text editor can be used. XML is both human and machine-readable. When processing XML, and XML document end with a .xml extension. An XML parser is required to check doc syntax and can support the Document Object Model (DOM) and/or the Simple API for XML (SAX).

Several parsers are available free of charge for Java, Python and other languages. DOM-based parsers build a tree structure containing the XML doc's data in memory – it allows data to be programmatically manipulated. SAX-based parsers process the docs and generate events when tags, text, comments etc. are encountered – returning data from XML doc. XML parsers are kept at http://www.xml.com/.

XML DTD

An XML doc can reference an optional Document Type Definition (DTD) file – this defines how the XML doc is structured.


XML Doc + XML DTD

(optional)


XML - Parser

Application


XML can be used as 'well formed', using the rules of XML or 'validated' by use of a DTD.
How can XML be used?

XML can keep data separated from your HTML - HTML pages are used to display data. Data is often stored inside HTML pages. With XML this data can now be stored in a separate XML file. This way you can concentrate on using HTML for formatting and display, and be sure that changes in the underlying data will not force changes to any of your HTML code.

XML can be used to store data inside HTML documents - XML data can also be stored inside HTML pages as 'Data Islands'. You can still concentrate on using HTML for formatting and displaying the data. XML can be used as a format to exchange information. (In the real world, computer systems and databases contain data in incompatible formats.) One of the most time-consuming challenges for developers has been to exchange data between such systems over the Internet. Converting the data to XML can greatly reduce this complexity and create data that can be read by different types of applications. XML can be used to store data in files or in databases - XML can also be used to store data in files or in databases. Applications can be written to store and retrieve information from the store, and generic applications can be used to display the data.

XML schema design for XML data structures

Several tools and XML schema languages exist. Interesting suggestions (and hints) are provided by Kennedy (2003) and Fitzgerald, M. (2002). Kennedy (2003) recommends an XML schema tool called RelaxNG, in association with RelaxNC. The key features of RELAX NG as an XML schema development tool is that it:

• is simple

• is easy to learn

• has both an XML syntax and a compact non-XML syntax

• does not change the information set of an XML document

• supports XML namespaces

• treats attributes uniformly with elements so far as possible

• has unrestricted support for unordered content

• has unrestricted support for mixed content

• has a solid theoretical basis

• can partner with a separate data typing language (such W3C XML Schema Data types).

Kennedy (2003) also suggests using ELM tree diagrams for mapping the data and structures, in conjunction with another tool called RELAX NC - which is the human friendly form of RELAX NG. A lot of students new to XML analysis take an instance, write it up in XML and then reverse-engineer the DTD or XML schema from that instance. However, ELM tree diagrams have been found to be useful in faster and effective forward engineering of the XML schema. Here are some steps to follow:

1. Do the data analysis using an Elm tree diagram for data and structure - see http://www.w3.org/XML/1998/06/xmlspec-report.htm#AEN101

2. Write the XML schema using RNC/RNG e.g. use a recipe.

3. Write up the document in XML.

Seven (7) rules for XML analysis

1. Code only the data

2. Use collection elements

3. Use groups of 'like' elements

4. Use elements to represent multi-valued data

5. Avoid mixed content

6. Use meaningful names and a standard case

7. Note that it is an iterative process.

Further tips

• With the XML tree structure, avoid 'tall trees' or 'wide hedges'

• Elements represent the data

• Attributes used for element meta-data

• Do not use attributes for content

• Mark-up documents e.g. user manual

• Mark-up documents for data transfer e.g. invoices.

The steps of: (1) mark-up XML; (2) create DTD (reverse engineer); (3) write XSL; are replaced by steps involving (1) Elm tree; (2) RelaxNC; (3) Mark-up XML; (4) write XSL.

Information integration as the problem: Is XML the solution?

While companies starting with a 'blank piece of paper' are at an advantage because they can store data in XML from scratch (and this is of increasing importance), most existing data repositories are still managed by relational database systems. Recent XML database research has focused on extending relational database backend to handle XML data efficiently. Special algorithms need to be designed and implemented on top of existing relational databases to support efficient database queries. For large systems, the update performance of the database in addition to query execution time will be scrutinised.

Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Topic 4: Web application servers

Common Gateway Interface – CGI


CGI is a standard for the construction of completely dynamic HTML documents by use of an external script (small program) installed on the same machine as the Web server. Common CGI scripts require a local interpreter or compiler. PERL and Python are popularly used to process HTML forms, and can verify user inputs as well as control the return of messages and perform further processing of the forms data. On a secure Web site, CGI can still be used for some e-commerce transactions, such as ordering some perfume for your mother's birthday. The forms data is concatenated into a string of delimited name/value pairs as the following example reveals:



name=Evan+Burke&card=Visa&number=8443261344895544&order=French+perfume



Note how each variable (name, card, number and order) is delimited by an &, and the each value by a + sign.



For notes on How to setup CGI on athene (PythonCGI), go to:

http://ispg.csu.edu.au/subjects/itc594/resources/apachecgi

Common Gateway Interface Demonstrations

1. Flat-file system



A Python CGI script that runs the flat-file system at http://athene.csu.edu.au/~keustace/friends.html

Enter some dummy test data and see the flat file grow.



2. Environment variables: ZOPE and Apache web servers



The environment variable display exercise begins at ZOPE using a local Python script and end with a look at Cookies and the same environment variables display at the Apache Web server on athene. Go to : http://ispg.csu.edu.au/subjects/itc594/resources/zopecgi/envform to begin.

Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Topic 3: Database servers

Types of databases


Database servers have long been the client/server arena for development.
Flatfile

The flat file database, is usually just a text file. It can suit many applications whereby the database's to function like a rolodex. The records can be delimited, non-delimited or position delimited. The delimited records can be by CSV (comma-quote) or a Tab character in the text.
Relational DBMS

The relational model has advantages of 'one to many' between tables and the use of simultaneous updates. Many are ODBC/SQL compliant, allowing communication across data sources/servers.
Object-oriented OODBMS

The object oriented model has data objects which are encapsulated by classes that have pre-defined characteristics. Such as a player, room or container classes used in virtual worlds and multi-user games. Objects added to the database automatically acquire (inherit) the characteristics of their class. These data are accessible only through messages which they recognise. The ZOPE application server from zope.org uses an OODBMS inside its core as shown in Figure 3.1.
Figure 3.1: E-systems infrastructure as an expression of an e-commerce model.
Source: zope.org/WhatIsZope/ZopeArchitecture

The CouchDB

Apache CouchDB is a distributed, schema-free document-oriented database accessible via a RESTful HTTP/JSON API with JavaScript as the main view definition language.
Figure 3.2: CouchDB architecture diagram
Source: couchdb.apache.org
Database servers can use Thick or Thin clients. In a thick client like a modern Web browser, the client does much of the work, and so is relatively large and complex. A thin client is simple and light as the server handles most of the work, but can be network intensive.

2- and 3-tier database models

The 2-tier database model is a standalone application with data tightly bound, and includes many mainframe and workgroup database systems. Microsoft Access, as an example, may have all actions take place within a single Visual Basic application and the data may be in a separate or integrated file.
The 3-tier model is more popular for business, where the database backend is an Enterprise Relational Database such as Sybase or Oracle - with generally no direct access to the database. A Middleware component (API, controls or scripts) does most of the work in controlling access, building relational database tables and tracking changes. The clients are either thin, a Web browser, or a custom application - and of more than one type. The API support usually includes Perl, C, Java and Python, as well as Web submission forms, e.g. MyCSU and the CSU E-box system.

The advantages of the 3-tier database model are load distribution; transparency (changes at one level transparent at other levels, e.g. New client or backend); the ease of building custom application, business and data rules; as well as security controlled at the middleware layer.

Database design issues

Consider the following design aspects:
The number of users

1. How will the system scale? Does it need to?

2. What's your timeline?

3. What kind of output do you need?

4. Paper forms, web, wireless devices?

5. Will your application serve all needs?
Security issues

1. Where is your security coming from?

2. Who needs access to what?

3. Need for agility in your code base.

4. Will you need to migrate? (Yes, you will!)

5. Do you need to add specialised applications?

Take a video lesson under 10 minutes

A: Microsoft SQL Server 2008: http://www.youtube.com/watch?v=gfzEZTiGNIc

or at http://www.microsoft.com/latam/sql/2008/learning/presentations.mspx
B: phpMyAdmin Tutorial at:

http://www.youtube.com/watch?v=1-81n_vuwug&feature=related

Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Topic 2: Clients, servers and distributed paradigms

What is client/server computing?


Will the real client/server please stand up? This is a question often posed due to changes in architecture and technologies over the last twenty-five years. According to Orfali (1999), several client server types exist such as:

1. File servers

2. Database servers (SQL calls)

3. Transaction servers (1-3 seconds)

4. Groupware servers (Microsoft Exchange and Sharepoint, MOO, CSU Interact, MOODLE)

5. Object servers (ORB-communicating objects)

6. Web application servers (HTML, Java, CGI, ASP).

The Orfali text also gave an excellent overview of client/server computing for over ten years and is a still good reference text. Orfali stated that 'the road to bandwidth heaven' will govern future development and migration towards wireless and mobile device networks requiring further protocol and network design. As bandwidth availability will grow with 'fibre to the premises' many changes beyond those endured by Web 2.0 will proliferate.
Various client/server systems just shuffle the location of the application logic around – from the client end to the server end of the networked relationship. See the 'see-saw' diagram below in Figure 2.1.
Figure 2.1: Which way client/server? The migration of the application logic from the client or server end.
E-business applications development: Architectures, models, methods, and methodologies

Many of the new client server development projects are related to E-Commerce and M Commerce systems - or E-Systems; so the term 'client/server', with its roots in the paradigms of distributed computer applications over a network, takes on a new image.

Burying your treasure

Several common layers, or tiers, exist in the way that a client/server application is developed. The historical development from 1, 2, 3 to 'n' tiers is shown below:
1-tier client-server architecture - all the application logic is at the server end.

2-tier client-server architecture - either client or server has application logic buried inside.

3-tier client-server architecture - the application logic is in the middle tier.

'n'-tier client-server architecture - many component services exist in the middle tier.

Communications and networking

Data communications and the underlying network architecture and operating systems largely determine and enable the type of e-commerce that can be carried out by an organisation:
• The Internet and mobile e-commerce

• Architecture of web systems

• Data interchange (mobile devices, SMS, GPS)

• Bandwidth and Bluetooth devices(access)

• Cryptographic security

• Electronic payments

• Databases

• Multimedia (videoconferencing).
As bandwidth, viewing devices and mobile connection prices improve remote devices such as mobile phones and PDAs will play an increasingly important role in the expansion of e-systems and services. Corporate solutions such as database, e-mail servers, enterprise-wide intranet and extranets are changing due to new technologies such as the availability of broadband services, and the use of new protocols and language definitions such as SOAP, XML, RSS and new API's.

Client/server architecture: Some background information

E-commerce models and e-business applications are really just current themes in the longer history of client/server applications and the architecture that supports that interaction - so some basic definitions may be handy. Distributing parts of an information system across many computer systems and locations has been called distributed computing. Client-server architecture is the dominant architectural model for distributing information system resources across a network.
Client-server architecture divides software into two parts - client and server. A server manages one or more system resources and provides access to those resources through a well-defined communication interface. A client uses the communication interface to request resources and the server responds to those requests. Modern variants of client-server architecture divide application software into the following set of client and server processes - called layers of tiers: data layer, business logic layer and presentation layer. The term middleware describes software that 'glues' together multiple components in a client-server or multi-tier application.
Connections to remote resources can be either static or dynamic. A static connection is initialised by the user or system administrator prior to accessing a remote resource. Static connections are inherently difficult to initialise and maintain. The resource locator maintains a resource registry containing the names and locations of known resources and services. The interaction between a

resource locator and a primary resource registration repository is inherently dynamic. Connections established through those interactions are dynamic connections.
A server can be stateful or stateless. When the state is maintained by a 'statefull'

server, it tracks states such as location, selections made, and user information. For a 'stateless' server like a Web server - no information is maintained on the server (e.g. HTML page in a browser - but you can use cookies to get around this if needed).

Interprocess communication

When an application is split into multiple processes, those processes must communicate with one another to share data and coordinate their activities. A variety of protocols and standards have been developed to address the problem of process coordination across networks. Peer-to-peer communication protocols and the use of sockets, named pipes and remote procedure calls assist with such coordination.

Sockets, ports, pipes and your operating system

A socket is a unique combination of an IP number and a port number. Some port numbers are permanently assigned for standard Internet or vendor-specific services, but many port numbers are available for other uses including client-server or peer-to-peer communication among application programs. A named pipe is a pipe that has a name that is permanently placed within a file system directory and has the ability to communicate among processes on different computers. The operating system at both ends of the pipe manages communications to and from the pipe. With a remote procedure call (RPC), a process on one machine can call a process on another machine.

Common port numbers

See the list of TCP and UDP port numbers at http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

From Client/Server to Web frameworks

The section on Web Application Architecture Patterns require you to determine what are the significant components of your system. The basic idea is: where do you put the business logic? On the server, in an ASP page, or in a distributed object? Conallen (2003) describes the three most common patterns as:

1. Thin client with business logic on the server.

2. Thick client with business logic executed on the client machine (Java applets, ActiveX controls etc.).

3. Web delivery with distributed objects - RMI, CORBA using IIOP, Java Beans and DCOM to support delivery by using the browser client as a delivery and container device.

Thin client means the normal desktop that sits on clients' desktop, and does not have much in the way of processing power, disk space or memory. All of the processing is performed on a central server, rather than on the clients' PCs. On the desktop appears a desktop window, though the difference between this and a normal PC is that the processing and saving of files is not happening locally. Clients use the web browser to interact with the server.
The 3-tier client/server architecture can be mapped to the newer Web application frameworks like Ruby on Rails or Django with the Model-View-Controller design approach, as shown below:

data layer (guarded by the server) … the MODEL

business logic layer (middleware) … the CONTROLLER

presentation layer (text or GUI client) … the VIEW

The client/server term middleware (CONTROLLER) describes software that 'glues' together multiple components in a client-server or multi-tier application.

Reference:


Charles Sturt University ITC 594 E-system infrastructure development student study guide

Topic 1: E-commerce, distributed applications and the Internet

Introduction


The aim of this subject is to provide guidance for you to address the architectures, models, methods, methodologies and technologies that can be used for all types of business application development. Many of the e-commerce models like B2B, B2C, C2C, E2C, E2B, and social networking require an underlying infrastructure including technologies such as:
• Broadband Communications and Networking

• Internet and mobile E-commerce via wireless data communications

• Client/server or MVC architecture of web framework systems

• Data interchange

• Access and cryptographic security

• Electronic payments, databases and multimedia

Some of the core e-business services that can then be provided by an organisation's e-systems architecture include:
• Online merchant account facilities

• Secure credit card processing and electronic payment systems

• Custom order processing to meet your organisation's specific needs

• Catalogue management

• Shopping cart facilities

• Daily site traffic and ordering statistics

• Instant updates early

• Ease for consumers to browse and collect prices

• Convenient for the consumer

• No face to face communication.

As increased broadband bandwidth helps build online business services, other influences such as the development of 10 Gigabit Ethernet and the release of Web 2.0 tools since 2005 and Web application frameworks have led to the emergence of social networks as a new business model and marketplace.
What is the big push behind E-commerce?

The list of advantages below may help answer this question:

• Efficiency gains.

• User friendly.

• Open 24 hours a day, 7 days a week. Unlike real stores, staff need not be employed 24 hours a day for a business to receive orders and process payments.

• Orders can be processed online in real time, or offline in batch processing.

• Globalisation – shops are not geography constrained and can compete with national and multinational companies for consumers located anywhere in the world. It is much cheaper than opening a shop and advertising in numerous countries.

• Provides flexibility.

• Reduction in processing costs - especially when large volume of business occurs between certain companies.

• Speed.

• Market freedom.

• New ways to fundraising activities.

• Competitive.
However your feelings towards doing business online may be moderated when we look at some of the issues or risks involved:

• Security.

• Vandalism.

• Sabotage.

• Theft and fraud.

• Breach of privacy or confidentiality.

• Violations of data integrity.


Reference:

Charles Sturt University ITC 594 E-system infrastructure development student study guide

Monday, April 12, 2010

Web 2.0

The client-side/web browser technologies typically used in Web 2.0 development are Asynchronous JavaScript and XML (Ajax), Adobe Flash and the Adobe Flex framework, and JavaScript/Ajax frameworks such as Yahoo! UI Library, Dojo Toolkit, MooTools, and jQuery. Ajax programming uses JavaScript to upload and download new data from the web server without undergoing a full page reload.

To permit the user to continue to interact with the page, communications such as data requests going to the server are separated from data coming back to the page (asynchronously). Otherwise, the user would have to routinely wait for the data to come back before they can do anything else on that page, just as a user has to wait for a page to complete the reload. This also increases overall performance of the site, as the sending of requests can complete quicker independent of blocking and queueing required to send data back to the client.

The data fetched by an Ajax request is typically formatted in XML or JSON (JavaScript Object Notation) format, two widely used structured data formats. Since both of these formats are natively understood by JavaScript, a programmer can easily use them to transmit structured data in their web application. When this data is received via Ajax, the JavaScript program then uses the Document Object Model (DOM) to dynamically update the web page based on the new data, allowing for a rapid and interactive user experience. In short, using these techniques, Web designers can make their pages function like desktop applications. For example, Google Docs uses this technique to create a Web-based word processor.

Adobe Flex is another technology often used in Web 2.0 applications. Compared to JavaScript libraries like jQuery, Flex makes it easier for programmers to populate large data grids, charts, and other heavy user interactions. Applications programmed in Flex, are compiled and displayed as Flash within the browser. As a widely available plugin independent of W3C (World Wide Web Consortium, the governing body of web standards and protocols), standards, Flash is capable of doing many things which are not currently possible in HTML, the language used to construct web pages. Of Flash's many capabilities, the most commonly used in Web 2.0 is its ability to play audio and video files. This has allowed for the creation of Web 2.0 sites where video media is seamlessly integrated with standard HTML.

In addition to Flash and Ajax, JavaScript/Ajax frameworks have recently become a very popular means of creating Web 2.0 sites. At their core, these frameworks do not use technology any different from JavaScript, Ajax, and the DOM. What frameworks do is smooth over inconsistencies between web browsers and extend the functionality available to developers. Many of them also come with customizable, prefabricated 'widgets' that accomplish such common tasks as picking a date from a calendar, displaying a data chart, or making a tabbed panel.

On the server side, Web 2.0 uses many of the same technologies as Web 1.0. Languages such as PHP, Ruby, ColdFusion, Perl, Python, JSP and ASP are used by developers to dynamically output data using information from files and databases. What has begun to change in Web 2.0 is the way this data is formatted. In the early days of the Internet, there was little need for different websites to communicate with each other and share data. In the new "participatory web", however, sharing data between sites has become an essential capability. To share its data with other sites, a web site must be able to generate output in machine-readable formats such as XML, RSS, and JSON. When a site's data is available in one of these formats, another website can use it to integrate a portion of that site's functionality into itself, linking the two together. When this design pattern is implemented, it ultimately leads to data that is both easier to find and more thoroughly categorized, a hallmark of the philosophy behind the Web 2.0 movement.