Sunday, March 29, 2009

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

1. Design the form

"Retrofit the form data string above for buying some French perfume into the HTML fields and submit button on the web page form.

Code of the form:




Display result of the form:


2. Write the script
Script archive exists for PERL, Python and Javascript. Search the Web for a script that processes the HTML forms data. Read the code and list the steps involoved in processing the form.

The source code to process the form is found in the tutorialspoint.com. It uses the PERL as language to process form at server side.


Figure 1. HTML code from tutorialspoint.com


Figure 2. PERL code from tutorialspoint.com

The first line is the header of the program which locates the PERL interpeter.

The second part is to extract the information from the string from the form and put them into variables.

The string send from the FORM to PERL program after clicking submit:
http://127.0.0.1/cgi-bin/checkout.pl?name=Raymond+TANG&email=ray@hotmail.com&item=French+Perfume&qty=2&paym=VISA&cname=Raymond+Tang&cno=00123456789&submit=Checkout

The final part displays the information according to the user to screen as normal webpage.


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

The script is modified as follows:


Due to the difference in the platform (Operating System), the starting part (Header) for perl language is changed. The perl interpeter in use is called strawberryperl from strawberryperl.com. It is a perl interpeter for Windows platform. The version I used to run the script is 5.10.0.3.

Result of the trial run with the designed form:



Reference:
TutorialsPoint.com (2009), PERL and CGI Tutorial, Retrieved 8 April 2009 from http://www.tutorialspoint.com/perl/perl_cgi.htm

Exercise 10: Application server platfoms in e-commerce

1. Go to the website of IBM, Oracle, Microsoft and Sybase. Is there any mention of e-commerce associated with their database products? What suite or partnership do they list with related e-commerce offerings? How do they compare with open source product like MySQL?

IBM
In the website of IBM, the product associated to e-commerce is WebSphere Commerce.
This product comes with three difference versions: Enterprise, Professional and Express. Each version is designed for difference size of companies and the business use.

The database associated with the WebSphere Commerce is the DB2 database from IBM.
The DB2 is the unique choice for the express version of Websphere. In the Professional and Enterprise version of the WebSphere, Oracle Database can be chosen as the database backend as shown in Figure 1.


Figure 1. Database Choice for Websphere (IBM)

Oracle
In Oracle website, the product found for the e-commerce is E-Business Suite.
However, the E-Business suite provide Oracle's database product to their customers only.

During 2002, Red Hat India partner with Oracle to deploy the products into Linux platform.

There are several partners with Oracle including Independent software vendor, Platform partners, System integrator and reseller and distribution Alliances.

Microsoft

The Micrsoft provide e-commerce solution with Microsoft Commerce Server.

According to Microsoft (2009), the commerce server requires Microsoft SQL server as its database (Figure 2).


Figure 2. Partial requirement of the Commerce Server 2009 (Microsoft MSDN)

Sybase

Sybase provides Sybase Enterprise Application Server as its product for e-commerce.
The database system used by the server is the Sybase Adaptive Server.

The database comes with three editions: express, developer, small business and enterprise (Figure 3).


Figure 3. Sybase Adaptive Server Enterprise Editions (Sybase 2007)

Comparasion between databases:


Figure 4. Hardware requirement of the database (Alesheikh, A. A., Dodge, S.)


Figure 5. Comparasion on features of database (Alesheikh, A. A., Dodge, S.)


Figure 6. Comparasion on database as review (Alesheikh, A. A., Dodge, S.)

MySQL is a free SQL server with minimum system reqirement and resources. Oracle and DB2 and MySQL database can run on all operating systems. By comparing the storage space and easy to use, Microsoft's SQL Server provide friendly-to-use interface while DB2 and Oracle database can support terabytes data. (Alesheikh, A. A., Dodge, S.)

2. Why is the perception getting stronger that integration will become critical factor in coming days? What is the role of AJAX within enterprise software architecture?

The traditional way (Figure 7) which only use the web server to handle the users requests for dynamic information leads heavy server requests. The loading time and response time of the web application become long and may be unacceptable. When there is a web application require user to interact frequently, the web application server and web server may not be able to handle with.

With the use AJAX, the faster response time is made and a large number of the server requests decreases. It is because of the use the AJAX engine. The AJAX engine like a hidden layer to both web server and user interface. It is used to handle the requests which does not transfer back to server, for example, simple data validation and editing data in memory. When there is a request requiring servers' response, the request will be handled asynchronously. (Garrett 2005)


Figure 7. Classic Web Application Architecture (Denis)


Figure 8. The traditional model for web applications (left) compared to the Ajax model (right). (Garrett 2005)


Figure 9. The synchronous interaction pattern of a traditional web application (top) compared with the asynchronous pattern of an Ajax application (bottom). (Garrett 2005)

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

There are several similarities between them:

Both emphize DRY (don't repeat yourself) / code reuse concept.

According to Colin (2004), the classes and interfaces of the mvc in Adobe Actionscript 2.0 are:

View: An interface all views must implement
Controller: An interface all controllers must implement
AbstractView: A generic implementation of the View interface
AbstractController: A generic implementation of the Controller interface

According to Michael (2007), the classes and interfaces of the MVC in Ruby on Rails are:

Controller: Interacts with Model and View.
Model: Data representation and business logic.
View: Rends the Model in to a View

Model: ActiveRecord
Contains business logics

View: ActionView
It is used to renders the view

Controller: ActionController
It is used to control application flow and the view to use

Reference:
IBM (n.d.),
WebSphere Commerce V6.0 software requirements - Windows, Retrieved 10 April 2009 from http://www-01.ibm.com/support/docview.wss?rs=3046&uid=swg27007591

Microsoft (n.d.), Commerce Server 2009, Retieved 10 April 2009 from http://www.microsoft.com/commerceserver/en/us/overview.aspx

Oracle (2002), Red Hat India Partners With Oracle India,
Retrieved 10 April 2009 from http://www.oracle.com/global/in/pressroom/redhatpartner.html

Oracle (n.d.), Oracle E-Business Suite Tools and Technology,
Retrieved 10 April 2009 from http://www.oracle.com/technology/products/applications/ebs/index.html

Sybase (n.d.), Sybase EAServer 6.0 Data Sheet, Retrieved 10 April 2009 from http://www.sybase.com/detail?id=1061861

Sybase (2007), Sybase Adaptive Server Enterprise Editions, Retrieved 10 April 2009 from http://www.sybase.com/files/Data_Sheets/ase_clusters_ds.pdf

Alesheikh, A. A., Dodge, S. (n.d.), Evaluating different approaches of spatial database management for moving objects, Retrieved 10 April 2009 from http://www.gisdevelopment.net/technology/gis/me05_021b.htm

Interakt (10 November 2005), AJAX: Asynchronously Moving Forward, Retrieved 10 April 2009 from http://www.interaktonline.com/support/articles/Details/AJAX%3A+Asynchronously+Moving+Forward-Introduction.html?id_art=36&id_asc=306

Garrett, J. J. (18 February 2005), Retrieved 10 April 2009 from http://www.adaptivepath.com/ideas/essays/archives/000385.php

Denis, H. (n.d.), Software Architecture, Retrieved 10 April 2009 from http://coronet.iicm.tugraz.at/sa/s5/sa_www.html

Colin, M. (2004), Essential ActionScript 2.0 [Electronic verion], O'Reilly, Retrieved 10 April 2009 from http://www.adobe.com/devnet/flash/articles/mv_controller/as2ess_ch18.pdf

Michael P. J. (2007), MVC Demystified: Essence of Ruby on Rails, Retrieved 10 April 2009 from http://www.slideshare.net/codeinmotion/mvc-demystified-essence-of-ruby-on-rails

Exercise 11: XML Introduction

1. Conduct research on the Internet to find out what tools can be used to parse an XML document and encure the document is well formed and valid.

XML parsers are used to paese an XML document. There are two type of parsers, validating and non-validating.

According to the Ken (2000), the two type of parsers are:

"non-validating: the parser does not check a document against any DTD (Document Type Definition); only checks that the document is well-formed (that it is properly markedup according to XML syntax rules)

validating: in addition to checking well-formedness, the parser verifies that the document conforms to a specific DTD (either internal or external to the XML file being parsed)."

There are several tools can be used to parse an XML document and ensure that the document is well formed and valid.

Xerces
There are several version for Xerces which are written in different language for different platforms.

Apache Xerces C++ is written in C++
Apache Xerces2 Java is written in Java
Apache Xerces Perl is written in Perl

IBM's XML Parser for Java
IBM stated that it is a validating XML parser, written in Java to allow applications to read and write XML data.

MSXML
Microsoft XML Core Services (MSXML) allows Microsoft Development tools to run as native XML-based applications.

2. What are the benefits of adopting a schema standardized for a business sector?

The w3schools.com stated that the benefits of using the schema standardized are in FOUR sectors:

a. XML Schemas Support Data Types
By defining the data formats in the schema, the correctness of data can be checked. Some of the restricted information can be restricted from viewing by others. The conversion of the data become easier. (W3schools)

b. XML Schemas use XML Syntax
As the schema uses XML syntax, it is not necessary to learn a new programming language. By changing the content of the schema and parse it, the schema can be converted into other format such as XSLT and XML DOM easily. (W3schools)

c. XML Schemas Secure Data Communication
With the Schema, the information is standardized in a proper format and can easily be understand. For example: the format of the date, in XML data type, the format of date is "YYYY-MM-DD". (W3schools)

d. XML Schemas are Extensible
Due to the fact that the schemas are written in XML, the schema can be reused. Different schemas can be reference to a docuemnt. (W3schools)

3. SMIL is an application of XML. What is the purpose of this technology? Where does it apply?

SMIL is stand for Synchronized Multimedia Integration Language. It is used for presenting and interacting the synchronize multimedia such as video, audio and pictures.
The SMIL control the timing of the medias, produce different versions of products by controlling the bandwidth and languages. (SOA Definitions)

Reference:
Apache.org (27 March 2009), The Apache Xerces Project, Retrieved 10 April 2009 from http://xerces.apache.org/

Ken S. (29 July 2000), XML Software Guide: XML Parsers, Retrieved 10 April 2009 from http://wdvl.internet.com/Software/XML/parsers.html

SOA Definitions (31 July 2001), SMIL, Retrieved 10 April 2009 from http://searchsoa.techtarget.com/sDefinition/0,,sid26_gci214217,00.html

W3Schools (n.d.), Why Use XML Schemas?, Retrieved 10 April 2009 from http://www.w3schools.com/Schema/schema_why.asp

Exercise 6: Some server practice with PHP

1. Try the code by replaceing with $REMOTE_ADDR, $SERVER_NAME or $PHP_SELF

Replace with $REMOTE_ADDR

Code:
\

Result:


Replace with $SERVER_NAME

Code:


Result:



Replace with $PHP_SELF

Code:


Result:


2. Create application "hello_world.php" which contains in the body:

Code:


Result:

Exercise 7: User input for database access with PHP

1. Create an HTML page with the form:


2. create PHP file named submit.php with code:


Result input form:


Result after submit:

Exercise 8: PHP and MySQL database access

Setup and Create database and table in MySQL

a. Change the root password


b. Login MySQL database system


c. Create database named "mydatabase"


d. Access the created database with command "USE"


e. Create table named "employees"


f. Assign privileges to a user to access the database


Questions in exercise 8
1. Start with a simple table in the database:



2. Create a web page with the following PHP:
Code:


Result:


3. Create a file called add_record.html
Code:


Result:


4. Create a PHP file caleed add_record.php for POST method in web page.
Code:


Result:


5. Show multiple records as webpage.
Code:


Result:


I've found that the result is not as expected, I make changes to the code as follow:
that the field start from the left and the index is start from zero.

Fixed Code:


Result:

Tuesday, March 24, 2009

Exercise 5: Network and programming frameworks

1. Investigate a simple chat client/server system. Look at some program code and describe how it works with multiple users.

Source code of Chat Client Server by Boby, T. P., (2006)

Server Side Main program:

**********************************************************************************
int main(int argc, char* argv[])
{
int nRetCode = 0;
char buf[4096];

cout << "This is written by Boby Thomas.\r\n";
cout << "This aplication act as a chat server.\n";
cout << "Messages from any pc will be broadcasted to all connected pcs.\n";
cout << "Connect to the server pc port 8084(Digital BOBY).\n";
cout << "Press ONLY ENTER to quit.\n";
cout << "=================================================\n";

if(!CServerObj.IsConnected())
{
cout<<"\nFailed to initialise server socket";
cout<<"\nThis is boby signing off : Bye";
getch();
return 1;
}
AfxBeginThread(ServerListenThread,0);

while(gets(buf))
{
if(strlen(buf) == 0)
break;
if(CServerObj.SendMessagePort(buf))
{
cout<<"Problem in connecting to server. Check whether server is running\n";
break;
}
}

cout<<"This is Boby signing off.";
getch();

return nRetCode;
}
**********************************************************************************


Client Side Main program:

**********************************************************************************
int main(int argc, char* argv[])
{
char buf[4096];
cout<<"This is a client TCP/IP application\nConnecting to port 8084\n";
cout<<"\nPress ONLY ENTER to quit";
cout<<"\nWritten by Boby Thomas";
cout<<"\n===============================================\n";

FILE *fp = fopen("server.ini","r");
if(fp == NULL)
{
cout<<"\nUnable to open server.ini. Please specify server IPsddress in server.ini";
return 1; // main failed
}
string sServerAddress;
while((fgets(buf,4096,fp)) != NULL)
{
if(buf[0] == '#')
continue;
sServerAddress = buf;

}
fclose(fp);

if(sServerAddress.size() == 0)
{
cout<<"\nUnable to find server IPaddress in server.ini";
cout<<"\nPlease set server IPaddress";
cout<<"\nThis is Boby Signing off. BYE:";
getch();
return 0;
}

MyMessObj.Init(sServerAddress.c_str(),8084);
if(!MyMessObj.IsConnected())
{
cout<<"\nUnable to connect to the IPaddress specified in server.ini";
cout<<"\nPlease check server IPaddress";
cout<<"\nThis is Boby Signing off. BYE:";
getch();
return 0;
}

AfxBeginThread(MessageRecThread,0);
while(gets(buf))
{
if(strlen(buf) == 0)
break;
if(MyMessObj.SendMessagePort(buf))
{
cout<<"Problem in connecting to server. Check whether server is running\n";
break;
}
}

cout<<"\nThis is Boby Signing off. BYE:";
getch();
return 0;
}
**********************************************************************************


The chat program uses thread to serve multiple users. The server starts and listen to the network for client. The client side locates the server and starts chat. While each client connected to the server, a new thread creates in the server side for that client. As multiple threads created in the server side, multiple users can be served.

2. Describe the important and distinguishing properties of Peer to Peer computing and the Grid. How is this peer to peer and the Grid architecture changing work flow and service-oriented applications?

There are two common use of Grid computing. Both uses several computer to solve a problem. One of the usage is that the problem is complex and require a lot of computer cycle to complete such as a scientific problem.

The other usage is to handle a large amount of data. When a single server cannot handle all the requests, by using the grid computing, the servers are linked up to form a cluster, the transaction are distributed to the server members and is handled in parallel manner. (Wikipedia)

This is important for service-oriented applications. In e-commerce, all the transactions are handled in server. The server's power for handling the transaction become important. Instead of the security concern, the user or customer requires fast and efficient service via e-commerce. The slow transaction time leads the wait of customers or users, there will be a bad impact to the company goodwill and customer satisfaction.

Peer to Peer computing (P2P) links the computers in a ad hoc manner to increase the total bandwidth for sharing common interests such as audio, video and data files.

There are two roles for each computer that is linked up in Peer to Peer computing - server and client. It is a full duplex (two ways) communications to all computers that linked up. When a computer a linked to the P2P network, for example, download a Linux distribution, the computer downloads portions of the file from all the computers that it connected to, at the same time, the downloaded portions is uploaded to someone else who is connected and requiring that portion of file. (Wikipedia)

This is useful when a company cannot provide enough bandwidth for distribute their files. For example: RedHat and Novell SUSE, their files are in DVD format, if it provides only FTP service for download the file, there are not enough bandwidth to serve all the customers and users. By using the P2P techniques, the file can be distribute faster than the FTP to the customers and users.


3. Frameworks for development. Compare and contrast any TWO of:
a. Java
b. .NET
c. Ruby on Rails
d. Google Gears
f. AJAX frameworks

I would like to discuss on the frameworks for Java and Ruby on Rails.

The Ruby on Rails (RoR) providing Model-View-Controller approach as its development framework. It is the unique framework for the development platform. JAVA can adopt itself to different kind of the development frameworks. Some of the frameworks for Java are MVC framework.

While some of the development framework supporting Pull and Push architecture, the RoR only support Push technology. There is a weak point to the Java, most of the framework for Java is not able migrate with the database, but RoR does.

Most of the framework for Java supports AJAX while RoR does not support or still in prototype.


Table 1. Comparison of web application frameworks on Java and Ruby on Rails (Wikipedia)


Table 2. Comparison of web application frameworks components on Java and Ruby on Rails (Wikipedia)

Reference:
Boby, T. P., (2006), Chat Client Server, Retrieved 24 March 2009, from http://www.codeproject.com/KB/cpp/chat_client_server.aspx

GridCafe, (n.d.), How does grid computing work?, Retrieved 25 March 2009, from http://www.gridcafe.org/version1/gridatwork/architecture.html

Joseph, J., Ernest, M., Fellenstein, C. (2004) ,Evolution of grid computing architecture and grid adoption models, Retrieved 25 March 2009, from http://www.research.ibm.com/journal/sj/434/joseph.html

Wikipedia (n.d.), Peer-to-peer, Retrieved 25 March 2009, from http://en.wikipedia.org/wiki/Peer-to-peer

Wikipedia (n.d.), Grid computing, Retrieved 25 March 2009, from http://en.wikipedia.org/wiki/Grid_computing_infrastructure

Wikipedia (n.d.), Comparison of web application frameworks, Retrieved 30 March 2009, from http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks

Exercise 4: Virtual private networks

Describe the IP Protocol. What is DNS?

IP stands for Internet Protocol. It is a protocol on network layer and responsible for packet delivery from host to host. It is a connectionless and unreliable protocol for data transmission (Hollinger, 2001). It represents the host and network addressing. It is an unique identifier for the computer to the network for data and information transmission. When a computer connects to the internet, a unique IP is required.

There are two version of the IP Protocol, version 4 (IPv4) and version 6 (IPv6). The IPv4 uses 32-bits to address itself and according to the Brendan (2009), it supports more than four billion unique addresses. As the internet population growth during the years and each computer required to have a unique IP address for direct internet connection, the number of the IP address reduces. The IPv6 provides two to the one-hundred twenty-eighth power of unique addresses which is enough for the future growth of the internet population. (Brendan, 2009)

DNS stands for Domain Name System. It is a service on the top of the Internet Protocol. The DNS is used to resolve the name entered at browser to IP and vesa visa. DNS is used because user requires meaningful name to browse the internet instead of browsing a website by entering non-meaningful IP address. (Brendan, Webopedia 2009)

Describe the TCP protocol. How is it related to the IP protocol?

TCP stands for Transmission Control Protocol. It is a protocol on transport layer. The TCP is connection-oriented and reliable protocol to make the completeness of data transfer.

A three way handshake and virtual connection is made before transmission. With it packet structure, the lost of packets by lost or error in connection can be detectd by its sequence number and request number. The corruption of the packet also detected with the checksum of the segment in TCP packet (Hollinger, 2001).


Figure 1: TCP segment structure (Hollinger, 2001)

What do you know about building e-business application as an Intranet, Extranet, Web portal, B2B, B2C or Virtual Private Network (VPN)? Find some examples on the web.

Intranet is a network can be accessed by authorized personnel within an organization only such as employees. With the use networking technologies such as TCP/IP, the user shares the current informaiton such as calendars, sending internal emails and even access the employee contact information. (Randolph)


Figure 2. Intranet (Randolph)

Extranet is intranet network that mapped to the internet or specificed private network. (Wikipedia)

FedEx
http://customcritical.fedex.com/us/owneroperator/signin.shtml

Web portal is a managed online system providing different kind of service via single point of access. It usually manage the information into customable channels for users to subscribe.

HKU SPACE
http://soul.hkuspace.org/

CSU
http://my.csu.edu.au/

According to the wikipedia, B2B is Business-to-Business that involve transactions between manufacturer and a wholesaler or between a wholesaler and a retailer. B2C is defined as Business to Customer that usually involve single transaction between them.

Vitual Private Network uses the public network for transferring information with encryption for security purposes.

What role can VPN play in business-to-business e-commerce?

Vitual Private Network play the role for security in business-to-business in e-commerce. Since it uses encryption such as IPsec, hashing techniques, DES and AES for validation and data transfer, the security of the information is enchanced.

Furthermore, there is a tunnel mode in VPN that allows to form a connection like a leased line in the internet between them, the capturing of the data stream from someone else is minimized. (Wikipedia)


Reference:
Webopedia (2009), IP address, Retrieve 25 March 2009 from http://www.webopedia.com/TERM/I/IP_address.html

Brendan M.G. (2009), What is IP or Internet Protocol?, Retrieved 25 March 2009, from http://www.wisegeek.com/what-is-ip-or-internet-protocol.htm

Hollinger D. (2001), Internet Protocol: The IP in TCP/IP
Retrieved 29 March 2009 from http://www.cs.rpi.edu/~hollingd/javanetprog/notes/tcpip/tcpip.ppt

Wikipedia (n.d.), Virtual private network, Retrieved 30 March 2009 from http://en.wikipedia.org/wiki/VPN

Randolph B. (2004), Intranet v/s E-commerce sites, Retrieved 30 March 2009 from www.ischool.utexas.edu/~i385grb/Intranet_vs_E-commerce.ppt

Wikipedia (n.d.), Extranet, Retrieved 30 March 2009 from http://en.wikipedia.org/wiki/Extranet

SearchEnterpriseWAN.com (4 March 2009), extranet, Retrieved 1 April 2009 from http://searchenterprisewan.techtarget.com/sDefinition/0,,sid200_gci212089,00.html

Indiana University (2 March 2009), What is a web portal?, Retrieved 1 April 2009 from http://kb.iu.edu/data/ajbd.html

webopedia.com (7 June 2006), intranet, Retrieved 1 April 2009 from http://www.webopedia.com/TERM/I/intranet.html

Dennis P. G. (n.d.), Finding Your Way Around E-commerce, Retrieved 1 April 2009 from http://www.intranetjournal.com/features/Ecommercetut.html