Saturday, May 29, 2010

Exercise_PHP MySQL Connection

PHP MySQL Connect to a Database

Before we can access data in a database, we need to create a connection to the database.
In PHP, this is done with the mysql_connect() function.
Syntax
mysql_connect(servername,username,password);
Example:

In the following example we store the connection in a variable ($con) for later use in the script. The "die" part will be executed if the connection fails:

Closing a Connection

The connection will be closed automatically when the script ends. To close the connection before, use the mysql_close() function:




Exercise_Week 10_b

COM and Distributed COM

Component Object Model (COM): The Component Object Model (COM) is a software architecture that allows applications to be built from binary software components. COM is the underlying architecture that forms the foundation for higher-level software services, like those provided by OLE. OLE services span various aspects of commonly needed system functionality, including compound documents, custom controls, inter application scripting, data transfer, and other software interactions.

Distributed COM (DCOM): Microsoft® Distributed COM (DCOM) extends the Component Object Model (COM) to support communication among objects on different computers—on a LAN, a WAN, or even the Internet. With DCOM, an application can be distributed at locations that make the most sense to customer and to the application.
Because DCOM is a seamless evolution of COM, the world's leading component technology, an organization can take advantage of existing investment in COM-based applications, components, tools, and knowledge to move into the world of standards-based distributed computing. As organization do so, DCOM handles low-level details of network protocols so organization can focus on real business: providing great solutions to customers.

Reference:

  • Kindel, C. The Rules of the Component Object Model, Microsoft Development Network Library
  • Microsoft and Digital Equipment Corporation (1996b), Distributed Component Object Model Specification (Draft Version 0.9) Microsoft and Digital Equipment Corporation.

Exercise_Week 10_a

Parallel Processing, Semaphore, Microsoft .Net Framework, Microsoft .Net, E-commerce and Mobile Commerce

Parallel Processing: Parallel Processing is simultaneous use of more than one computer or processor to solve a problem. The processors may communicate in order to be able to cooperate in solving a problem or they may run completely independently, possibly under the control of another processor which distributes work to the others and collects results from them.

Semaphore: A semaphore is an integer counter associated with a thread wait queue. Two atomic operations are available on semaphores: P (or pass) and V (or free). The P operation decrements the counter, and blocks the thread if the counter has reached a negative value. The V operation increments the counter and wakes up a thread, if any, in the semaphore wait queue.

Microsoft .Net Framework: The Microsoft .NET Framework is a software component which can be added to the Microsoft Windows operating system. It provides a large body of pre-coded solutions to common program requirements, and manages the execution of programs written specifically for the framework. The .NET Framework is a key Microsoft offering, and is intended to be used by most new applications created for the Windows platform.

Microsoft .Net: Microsoft .Net is an umbrella term that applies to a collection of products and technologies from Microsoft. All have in common a dependence on the Microsoft .NET Framework, a component of the Windows operating system.

E-commerce: E-commerce (electronic-commerce) refers to business over the Internet. Web sites such as Amazon.com, Buy.com, and eBay are all e-commerce sites. The two major forms of e-commerce are Business-to-Consumer (B2C) and Business-to-Business (B2B). While companies like Amazon.com cater mostly to consumers, other companies provide goods and services exclusively to other businesses. The terms "e-business" and "e-tailing" are often used synonymously with e-commerce.

Mobile Commerce: Mobile Commerce describes business processes which are integrated in a mobile device. Mobile commerce is exactly the same as e-commerce except that the access mechanism is via a wireless phone or terminal rather than the fixed telephone network. The security aspect of transactions is addressed by the encryption inherent in the GSM specification. Internet access is being addressed by initiatives such as the Wireless Application Protocol (WAP) which provides an easy-to-use system for Internet access from mobile terminals.

Reference:

  • Klenke, R.H.; Williams, R.D.; Aylor, J.H., “Parallel-processing techniques for automatic test pattern generation”, IEEE Computer, Volume 25, Issue 1, Jan. 1992 Page(s):71 – 84
  • Rosen, Anita. 2000. The E-commerce Question and Answer Book: A Survival Guide for Business Managers. American Management Association
  • Lamont, Douglas. 2001. Conquering the Wireless World: The Age of m-Commerce. United Kingdom: Capstone Publishing Inc.
  • Young Patrick, Thomas Theys 1999. Capital Market Revolution: The Future of Markets in an Online World. Great Britain: Pearson Education Limited.

Friday, May 28, 2010

Exercise_Week 9

Designing distributed systems

A distributed system is a collection of independent computers that appear to its users as a single coherent system.
Characteristics of distributed system

  • Multiple, independent processing units
  • Processors communicate via a hardware interconnect
  • Processing unit failures are independent
  • Manage resource sharing
  • State is shared among processors

A distributed system is a collection of independent computers that are used jointly to perform a single task or to provide a single service.
Examples of distributed systems
Probably the simplest and most well known example of a distributed system is the collection of Web servers—or more precisely, servers implementing the HTTP protocol—that jointly provide the distributed database of hypertext and multimedia documents that we know as the World-Wide Web. Other examples include the computers of a local network that provide a uniform view of a distributed file system and the collection of computers on the Internet that implement the Domain Name Service (DNS).
Why do we use distributed systems?
The alternative to using a distributed system is to have a huge centralized system, such as a mainframe. For many applications there are a number of economic and technical reasons that make distributed systems much more attractive than their centralized counterparts.
Cost: Better price/performance as long as commodity hardware is used for the component computers.
Performance: By using the combined processing and storage capacity of many nodes, performance levels can be reached that are beyond the range of centralized machines.
Scalability: Resources such as processing and storage capacity can be increased incrementally.
Reliability: By having redundant components the impact of hardware and software faults on users can be reduced.
Inherent distribution: Some applications, such as email and the Web (where users are spread out over the whole world), are naturally distributed. This includes cases where users are geographically dispersed as well as when single resources (e.g., printers, data) need to be shared.

Reference:

  • B. Clifford Neuman. Scale in distributed systems. In T. Casavant and M. Singhal, Readings in Distributed Computing Systems, pages 463–489, IEEE Computer Society Press, Los Alamitos, CA, USA
  • Andrew S. Tanenbaum and Maarten van Steen. Distributed Systems: Principles and Paradigms, Prentice Hall, 2nd edition, 2007

Thursday, May 27, 2010

Exercise_Week 8

Concurrency and transactions

Transaction is an action or series of actions, carried out by user or application, which accesses or changes contents of database.

Concurrent execution of user programs is essential for good database management system (DBMS) performance.

Because disk accesses are frequent, and relatively slow, it is important to keep the CPU humming by working on several user programs concurrently.

A user’s program may carry out many operations on the data retrieved from the database, but the DBMS is only concerned about what data is read/write from/to the database.

A transaction is the DBMS abstract view of a user program: a sequence of reads and writes.

When multiple users access a database simultaneously, their data operations have to be coordinated in order to prevent incorrect results and to preserve the consistency of the shared data. This activity is called concurrency control and should provide each concurrent user with the illusion that he is referencing a dedicated database. The classical transaction concept defines a transaction as the unit of concurrency control, that is, the DBMS has to guarantee isolated execution for an entire transaction. This implies that its results as derived in a multi-programming environment should be the same as if obtained in a serial execution schedule. Other important transaction properties are atomicity, consistency, and durability. In a DBMS, the component responsible for achieving these properties is transaction management which includes concurrency control as a major function.

Concurrency control and recovery are among the most important functions provided by a DBMS.

Users do not need to worry about concurrency.

System automatically inserts lock/unlock requests and schedules actions of different Xacts in such a way as to ensure that the resulting execution is equivalent to executing the Xacts one after the other in an order.

Reference:

  • Beeri, C., Bernstein, E.A., and Goodman, N., A model for concurrency in nested transaction systems, Journal oftheACM, 36(1):230-269.
  • Bernstein, P.A. and Goodman, N. Concurrency control in distributed database systems. ACM Computing Surveys, 13(2):185-221.

  • Bernstein, E.A., Hadzilacos, N., and Goodman, N. Concurrency Control and Recovery in Database Systems, Addison-Wesley: Reading, Pennsylvania.

Wednesday, May 26, 2010

Exercise_Week 7

Internet Security

Security has become one of the primary concerns when an organization connects its private network to the Internet. Regardless of the business, an increasing number of users on private networks are demanding access to Internet services such as the World Wide Web (WWW), Internet mail, Telnet, and File Transfer Protocol (FTP). In addition, corporations want to offer WWW home pages and FTP servers for public access on the Internet. Network administrators have increasing concerns about the security of their networks when they expose their organization’s private data and networking infrastructure to Internet crackers. To provide the required level of protection, an organization needs a security policy to prevent unauthorized users from accessing resources on the private network and to protect against the unauthorized export of private information. Even if an organization is not connected to the Internet, it may still want to establish an internal security policy to manage user access to portions of the network and protect sensitive or secret information.

Internet Firewalls

An Internet firewall is a system or group of systems that enforces a security policy between an organization’s network and the Internet. The firewall determines which inside services may be accessed from the outside, which outsiders are permitted access to the permitted inside services, and which outside services may be accessed by insiders. For a firewall to be effective all traffic to and from the Internet must pass through the firewall, where it can be inspected. The firewall must permit only authorized traffic to pass, and the firewall itself must be immune to penetration. Unfortunately, a firewall system cannot offer any protection once an attacker has gotten through or around the firewall. It is important to note that an Internet firewall is not just a router, a bastion host, or a combination of devices that provides security for a network. The firewall is part of an overall security policy that creates a perimeter defense designed to protect the information resources of the organization. This security policy must include published security guidelines to inform users of their responsibilities; corporate policies defining network access, service access, local and remote user authentication, dial-in and dial-out, disk and data encryption, and virus protection measures; and employee training. All potential points of network attack must be protected with the same level of network security. Setting up an Internet firewall without a comprehensive security policy is like placing a steel door on a tent.

Benefits of an Internet Firewall

Internet firewalls manage access between the Internet and an organization’s private network

Without a firewall, each host system on the private network is exposed to attacks from other hosts on the Internet.

Internet firewalls allow the network administrator to define a centralized “choke point” that keeps unauthorized users such as hackers, crackers, vandals, and spies out of the protected network; prohibits potentially vulnerable services from entering or leaving the protected network; and provides protection from various types of routing attacks. An Internet firewall simplifies security management, since network security is consolidated on the firewall systems rather than being distributed to every host in the entire private network.

Reference:

  • Building Internet Firewalls D. Brent Chapman and Elizabeth Zwicky. O’Reilly & Associates

  • Firewalls and Internet Security: Repelling the Wily Hacker Bill Cheswick and Steve Bellovin. Addison-Wesley


Tuesday, May 25, 2010

Exercise_Week 6

Distributed Objects and CORBA

The term distributed objects, describes objects which reside in separate address spaces and methods of which can be subject of remote method calls (a remote call is issued in an address space separate to the address space where the target object resides). By convention, the code issuing the call is referred to as the client; the target object is referred to as the server object (or simply remote object); the set of methods which implements one of the server object’s interfaces is sometimes designated as a service that this object provides. Similarly, the process in which the server object is located is referred to as a server. (Orfali, Harkey and Edwards, Wiley Computer Publishing Group)
CORBA
CORBA stands for Common Object Request Broker Architecture, is the result of the work done by major actors of the hardware and software industry to set up a communication framework. The goal is to facilitate the development of distributed applications over a heterogeneous network. In a distributed environment, clients are talking to objects. The services that can be delivered to a client by an object are described in an interface. The means of communication are handled by an Object Request Broker (ORB). The idea behind CORBA is to provide an intermediary layer that handles access requests on data. It frees the developer from most of the portability issues. It enables the development of distributed objects. (Jon Siegel, Wiley Computer Publishing Group)
Distributed objects in CORBA
Basic principles
1. Request & response
In CORBA, a client issues a request to execute a method of an object implementation. There is no constraint imposed on the location of the client and the requested object implementation (remote object); they can share an address space, can be located in separate address spaces on the same node, or can be located on separate nodes. A server (process) can contain implementation of several objects or a single object, or even provide an implementation of one particular method only. However, typically, a multithreaded server encapsulates implementations of multiple objects.
2. Remote reference
Remote references are called Object References and the target of an Object Reference must be an object that supports the CORBA::Object IDL interface (such objects are called CORBA objects).
3. IDL Interface
CORBA specifies the CORBA IDL Language and its mapping to several programming languages (e.g., C++, Java, and Smalltalk). The IDL language provides means for interface definitions; there are no constructs related to object implementation (object state definitions have been proposed recently by OMG).
4. Proxy: local representative
Using the Broker Pattern terminology, the client-side proxy code is called IDL stub; the server-side proxy code is referred to as IDL skeleton. However, in CORBA, the concept "proxy" is used to denote an object created on the client side which contains the IDL stub plus provides some other functionality, e.g. support for dynamic invocation.

Reference:

  • Robert Orfali, Dan Harkey, and Jery Edwards. The Essential Distributed Objects Survival Guide. Wiley Computer Publishing Group
  • Stal, M. Worldwide CORBA: Distributed Objects and the Net, Object magazine
  • Szyperski,C.: Component Software, Beyond Object-Oriented Programming. Addison Wesley
  • Jon Siegel. CORBA, Fundamentals and Programming. Wiley Computer Publishing Group.

Sunday, May 23, 2010

Workshop 10

Server Side Form Validation

An important aspect of creating Web Forms pages for user input is to be able to check that the information users enter is valid.

Functionality: Workshop 10 is CSU Registration Form - PHP program that grants an easy-to-use but powerful way to check for errors and, if necessary, display messages to the user.
When the user submits a form to the server, PHP code is invoked to review the user's input.
If an error has occurred in any of the input controls, the page itself is set to an invalid state (validation failed) and user is redirected back to the form page with displayed error messages.
If validation passed, user’s registration details specified on form processing page are invoked. Thus, this program doesn't change HTML forms behavior except it always redirects user to the form page until user enters fully valid data.

Test Code

Saturday, May 22, 2010

Workshop 9

Decimal to Binary and Binary to Decimal Conversion

This program converts decimal value to binary value, and vice-versa.
Functionality: This program asks user to enter valid value in binary or decimal input box.
The validations are as follows:
Binary Input Box:

* The binary input box should not be left blank for the purpose of decimal conversion.
* User can not enter decimal value or any character value in binary input box. User need to enter only binary number that is made of 0s and 1s.
Decimal Input Box:

* The decimal input box should not be left blank for the purpose of binary conversion.
* User can not enter any character value in decimal input box.
This program validates submitted value at Server Side. If user submits invalid value then the program will display error message in Red color. This is possible because of Server Side validation script.

Test Code

Friday, May 21, 2010

Workshop 8

PHP If...Else Statements

Conditional statements are used to perform different actions based on different conditions.
The if statement is used to execute some code only if a specified condition is true.
Syntax:
if (condition) code to be executed if condition is true;
Functionality: This program asks user to input temperature. This program converts temperature from Celsius to Fahrenheit and vice-versa.
Two radio buttons have been provided for selection. They are 1. Convert temperature from Celsius to Fahrenheit and 2. Convert temperature from Fahrenheit to Celsius.

Test Code

Thursday, May 20, 2010

Workshop 7

AJAX Tool Tip and PHP Form Reading

This workshop demonstrates how to use PHP forms. Forms are a special component which allows site visitors to supply information on another web page or server.
AJAX: Asynchronous JavaScript and XML (AJAX) have been used to display tool tip for text box. Whenever user places a cursor in any of the three text boxes, program will display a corresponding tool tip message. Web server might be some where in United States, however using AJAX this program is able to retrieve data from the server asynchronously in the background without refreshing the web page. Data is retrieved using the XMLHttpRequest object. This object has been used to send HTTP or HTTPS requests directly to a web server and load the server response data directly back into the script.
Functionality: This program asks user to input his name, birth year and favorite color. JavaScript validation has been used to validate the input values. Finally, this program calculates user's age and display the text - name and age in user's favorite color.

Test Code

Wednesday, May 19, 2010

Workshop 6

while Loop in PHP

The meaning of a while statement is simple. It tells PHP to execute the nested statement(s) repeatedly, as long as the while expression evaluates to TRUE. The value of the expression is checked each time at the beginning of the loop, so even if this value changes during the execution of the nested statement(s), execution will not stop until the end of the iteration (each time PHP runs the statements in the loop is one iteration). Sometimes, if the while expression evaluates to FALSE from the very beginning, the nested statement(s) won't even be run once. We can group multiple statements within the same while loop by surrounding a group of statements with curly braces.

Syntax:


Functionality: Workshop 6 program asks user to input a number. A JavaScript validation has been used to validate the numerical value. Then program prints Table using PHP while loop.

Test Code

Tuesday, May 18, 2010

Elevator Pitch 2

Elevator Pitch

Here is Elevator Pitch for Assignment 2.
CORBA stands for Common Object Request Broker Architecture. CORBA is an industry standard developed by The Object Management Group to support distributed objects programming. CORBA is just a specification for creating and using distributed objects; CORBA is not a programming language.
The CORBA architecture is based on the object model. This model is derived from the abstract core object model defined by the OMG in the Object Management Architecture Guide
The model is abstract in the sense that it is not directly realized by any particular technology; this allows applications to be built in a standard manner using basic building blocks such as objects. Therefore, a CORBA-based system is a collection of objects that isolates the clients from the servers by a well-defined encapsulating interface. It is important to note that CORBA objects differ from typical programming objects in three ways:
• CORBA objects can run on any platform.
• CORBA objects can be located anywhere on the network.

• CORBA objects can be written in any language that has IDL mapping.


Wednesday, April 14, 2010

Web 2.0

The term "Web 2.0" is commonly associated with web applications that facilitate interactive information sharing, interoperability, user-centered design, and collaboration on the World Wide Web. Examples of Web 2.0 include web-based communities, hosted services, web applications, social-networking sites, video-sharing sites, wikis, blogs, mashups, and folksonomies. A Web 2.0 site allows its users to interact with other users or to change website content, in contrast to non-interactive websites where users are limited to the passive viewing of information that is provided to them. (Crook pp. 831 – 836)
Characteristics of Web 2.0
  • Participation: Every aspect of Web 2.0 is driven by participation. The transition to Web 2.0 was enabled by the emergence of platforms such as blogging, social networks, and free image and video uploading, that collectively allowed extremely easy content creation and sharing by anyone.
  • Standards: Standards provide an essential platform for Web 2.0. Common interfaces for accessing content and applications are the glue that allows integration across the many elements of the emergent web.
  • Decentralization: Web 2.0 is decentralized in its architecture, participation, and usage. Power and flexibility emerges from distributing applications and content over many computers and systems, rather than maintaining them on centralized systems.
  • Openness: The world of Web 2.0 has only become possible through a spirit of openness whereby developers and companies provide open, transparent access to their applications and content.
  • Modularity: Web 2.0 is the antithesis of the monolithic. It emerges from many, many components or modules that are designed to link and integrate with others, together building a whole that is greater than the sum of its parts.
  • User Control: A primary direction of Web 2.0 is for users to control the content they create, the data captured about their web activities, and their identity. This powerful trend is driven by the clear desires of participants.
  • Identity: Identity is a critical element of both Web 2.0 and the future direction of the internet. We can increasingly choose to represent our identities however we please, across interactions, virtual worlds, and social networks. We can also own and verify our real identities in transactions if we choose.
Domains
  • Open web: The entire space of the World Wide Web opens to anyone to access and participate. This has been the initial domain in which Web 2.0 technologies, applications, and attitudes have developed.
  • Enterprise: The power of Web 2.0 technologies, originally developed on the open web, is now being applied within enterprises to enhance performance and achieve business outcomes. This domain is sometimes termed Enterprise 2.0.
Technologies
Web2.0 technologies are as follows
  • Aggregation: Aggregation brings multiple content sources together into one interface or application.
  • AJAX: (Asynchronous JavaScript and XML) AJAX is combination of technologies that enables highly interactive web applications.
  • API: (Application Programming Interface) API is defined interface to a computer application or database that allows access by other applications.
  • Embedding: Embedding supports integration content or an application into a web page, while the original format is maintained.
  • RSS: RSS stands for Really Simple Syndication. RSS is group of formats to publish (syndicate) content on the internet so that users or applications automatically receive any updates.
  • Ruby on Rails: Ruby on Rails is an open source web application framework. It is frequently used in Web 2.0 website development.
  • Tagging: Tagging means attaching descriptions to information or content.
  • Virtual architecture: Virtual architecture is creation of avatars (alternative representations of people), buildings, objects, and other artifact inside virtual spaces.
  • Widget: Widget is small, portable web application that can be embedded into any web page.
  • XML: (Extensible Markup Language) XML is an open standard for describing data, which enables easy exchange of information between applications and organizations.
Reference: Crook E., "Web archiving in a Web 2.0 world", The Electronic Library, Vol. 27, no. 5, pp. 831 - 836

Sunday, April 11, 2010

Elevator Pitch 1

Elevator Pitch
Here is my Elevator Pitch for Assignment 1.

Electronic commerce, commonly known as e-commerce , consists of the buying and selling of products or services over electronic systems such as Internet and other computer networks. The amount of trade conducted electronically has grown rapidly since the spread of Internet. A wide variety of commerce is conducted in this way, encouraging and drawing on innovations in electronic funds transfer, supply chain management, Internet marketing, online transaction processing, electronic data interchange (EDI), inventory management systems, and automated data collection systems. Modern electronic commerce typically uses the World Wide Web at least at some point in the transaction's lifecycle, although it can encompass a wider range of technologies such as e-mail as well.
PHP is a server-side HTML integrated scripting language, which is used for designing dynamic web pages. PHP is mainly used in world-class operating system, such as, UNIX, LINUX and also in Windows. In the true sense, PHP is the perfect combination of practical programming rules and object oriented programming (OOPs). Since PHP uses desktop applications and command line interface, it is considered to be the best traditional server side scripting language.
Most of the well-known database connections, such as, Oracle, My SQL, ODBC and SQL get support from PHP programming. So, it is indeed a good choice for the freelance programmers to use PHP development for creating their dynamic e-commerce websites.

Workshop 5

Predefined Variables
Additionally, PHP scripts have access to information about your environment. These variables are stored in special hashes called $_ENV and $_SERVER. Most scripts, which use these variables, only use one or two at a time. The following script accesses 2 different _SERVER variables.

Test Code

Workshop 4

Arrays

Arrays can also be created using a key/value pair combination. These are often referred to as associative arrays or hashes. In a hash each value is associated with a unique key. Unlike list arrays that use a number as an index value, associative arrays use any value. The easiest way to comprehend how a hash works is to think of it as a table. In the following table the state name serves to role as key and the city is the value.

State (key)

City (value)

Victoria

Melbourne

NSW

Sydney

South Australia

Adelaide

Queensland

Brisbane

Tasmania

Hobart

Test Code

Workshop 3

Arrays

An array is an ordered collection of values. Each value can be referenced individually using its position in the array. The first element of an array is in position 0 and the second element is in position 1. Creating arrays in PHP can be done in multiple ways, though the following example is one of the simplest.
$cities = array('Beijing', 'Oaxaca', 'Habana', 'Jakarta');
For example, to access the third element of the $cities array u
se $cities[2].

Test Code

Workshop 2

Variables

The Workshop 2 introduces some variables to our PHP script. Variables in PHP begin with the $ symbol. PHP uses arrays and variables to store different values. Variables begin with a $ followed by characters, digits, and underscores. Variable names are case sensitive and are assigned with the '=' operator. Variables are incredibly useful. For example, you may need to keep track of information submitted via a web form or perform calculations on data and store the results.

Here's a simple example:

Test Code

Workshop 1

Workshop 1 - Hello World in PHP

The first PHP example will print "Hello World" in the browser window.

The PHP statement:

print("Hello World");

displays the message "Hello World" in the browser window. Here PHP statement is embedded into HTML documents and PHP statement appears between symbols.

The PHP print function displays the value or string within parentheses in the browser window.

Several important things to note about PHP scripts:

  • PHP is case sensitive, print is different from PRINT
  • PHP statements appear between
  • PHP statements end with a semi-colon
  • You can include comments in your PHP code by beginning the line or lines with // characters
  • Your PHP files should have a .php extension rather than a .html extension. If scripts have a .html extension the server will not know that they are PHP files and will not parse and execute the PHP commands.

Test Code

Exercise_Week 5

XML: eXtensible Markup Language

What is XML?

  • XML is not a markup language like HTML, it is a language used to describe a markup language. The technical term for such a language is meta language
  • Using XML a developer can define markup languages which describe electronic circuitry, information for electronic data interchange, the files produced by Web servers, mechanical parts of aircraft and so on.
  • A developer define a particular language using XML and a tool or utility then takes XML documents which contain text expressed in the language and carries out some process such as converting it to an MS Word document or into some other form.

XML as Internet standard

The major goals of the language are as follows.

  • That it should be easy to use in the Internet.
  • Capable of supporting a large number of applications eg browsers, search engines.
  • That it should be compatible with SGML, the text processing language which was the inspiration for HTML.
  • That it should not be a complicated process to develop processors for documents written in languages defined in XML.
  • Easy to write a program to check that a source text reflects its definition.
  • That the number of optional facilities of the language should be very low.
  • That XML documents should be easy to read and understand.
  • That document written using a language defined by XML should be easy. to develop using simple editors.

XML at work

  • For structuring data on the Web
  • Hierarchical model
  • Define your own tags
  • Tags are like field names in a database
  • Tags define elements
  • Elements may have attributes
  • Tags are case sensitive

Building block of XML

  • Elements
  • Tags
  • Attributes
  • Entities
  • PCDATA
  • CDATA

Elements and tags

  • Elements
    • The main building block
    • May hold data, other elements, or be empty.
  • Tags
    • “Markup” (delimit) elements

Attributes

  • Provide extra information about elements
  • Placed inside the starting tag of an element
  • Always come in name/value pairs

PCDATA

  • Parsed character data
  • Text between the start tag and the end tag of an XML element
  • Will be parsed by a parser
    • Tags inside the text will be treated as markup
    • Entities will be expanded

CDATA

  • Character data
  • Will be ignored parsed by a parser
    • Tags NOT treated as markup
    • Entities NOT expanded

What is XSLT?

  • A language for transforming between XML vocabularies
  • Standardized by the World Wide Web Consortium
  • Integrated with .NET, Apache, IE, Java, Oracle, …
  • XSLT is a slightly new twist:
    • Not a scripting language
    • Not, strictly-speaking, “open source”
  • But not radically different:
    • Typically interpreted
    • Open source implementations
    • Not vendor dominated

XSLT as a programming language

  • XSLT has
    • looping constructs
    • function calling
    • variables
    • parameters
    • math functions
    • module combination

XSLT summary

  • XSLT can be used to compute anything that can be computed
  • It is “Turing complete”
  • But….
    • Certain coding paradigms are VERY awkward
    • Non-textual Input/Output is typically not possible
  • Scripting languages are designed to be general purpose
  • “Modern” scripting languages go well beyond “scripting”
  • They are general purpose multi-paradigm languages
    • But XSLT wins for specificity
  • XSLT has deep native support for XML
  • “Built-in”, highly consistent parser
  • “XPath” XML navigation (“query”) language
  • Special syntax for working with elements
  • XSLT makes input-based recursion easy:
    • Sections within sections within …
    • Part descriptions within part descriptions …
  • XSLT automatically selects the right rule to go with the right element in the input document
  • XSLT keeps track of context: namespaces, current node, current node list etc.
  • Relevant contexts are in both the stylesheet and the document.
  • In most traditional programming languages, the programmer would have to be explicit
Reference: Eustace, K. (2004). Lecture 5: XML: eXtensible Markup Language [PowerPoint slides]. Retrieved from Charles Sturt University, Melbourne Study Centre

Exercise_Week 4

Programming Web servers: Languages for the Web

Hypertext Markup Language

  • HTML was developed by Tim Berners-Lee while at CERN, and popularized by the Mosaic browser developed at NCSA.
  • HTML is a markup language used to create platform-independent hypertext documents on the World Wide Web
  • During the 1990s it blossomed with the growth of the Web.
  • HTML has been extended in a number of ways.
  • Most hypertext documents on the web are written in HTML.
  • The current recommendation is XHTML 1.0, which is a reformulation of HTML 4.01 as an XML 1.0 application.

Common Gateway Interface CGI

  • CGI is a standard for the construction of 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 performing 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.

CGI alternatives

  • JavaScript, PHP, Active Server Pages (ASP), Java Server Pages (JSP)
  • A variety of other proprietary sources such as Cold Fusion products, all provide an alternative to CGI interactivity and security.

JavaScript popularity

JavaScript has been popular for including

  • event-driven, user interface features (display a pull-down menu);
  • interactive multimedia (display a message or image when a mouse arrow passes over a screen area);
  • To validate data and user types into a form.
Java Virtual Machine
  • The Java language is much secured and platform independent when compared to alternative languages.
  • Java's secret is the tightly integrated language model.
  • The steps on the next slide show how the Java Virtual Machine implements a Java Program…

Java Virtual Machine at work

  • Coding - Human-readable Java code is produced
  • Building - A Java Development Tool "build’s the Java program into bytecode, which is saved as a ".class" file.
  • 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.
  • Bytecode Verification - The Java VM verifies the digital signature.
  • 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.
  • 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.
  • Execution - Program execution begins.

The rise of the application servers

  • high-speed caching,
  • rapid application development,
  • secure enterprise portals,
  • identity and content management,
  • business intelligence,
  • application and business integration,
  • Wireless capabilities.

Microsoft .NET

  • .NET is Microsoft’s software development architecture and strategy for developing large distributed software systems.
  • .NET is not meant as a replacement for Java but as an alternative.
  • .NET is component based meaning that as a function is developed, it gets plugged into the framework.

Advantages of Microsoft .NET

  • Before .NET it was difficult for different languages to provide a solution to every problem every time and the language libraries and runtime were not able to be shared.
  • But now, looking at the next slide it can be seen that .NET enables any language to provide a solution because the libraries can be shared.
  • You can share a C# library with C++ or Visual Basic.
  • If you need a web site it can be developed in any language using any of the available language library… even Object COBOL
  • .NET uses XML, has an “n” tier architecture
  • .NET is an easier way to build Windows applications.
  • Documentation was excellent and an increasing amount of textbooks are available.
Reference: Eustace, K. and Bytheway, A. (2004). Lecture 4: Programming Web servers: Languages for the Web [PowerPoint slides]. Retrieved from Charles Sturt University, Melbourne Study Centre

Saturday, April 10, 2010

Exercise_Week 3

Database Servers

A database server is a computer program that provides database services to other computer programs or computers, as defined by the client-server model. The term may also refer to a computer dedicated to running such a program. Database management systems frequently provide database server functionality, and some DBMSs (e.g., MySQL) rely exclusively on the client-server model for database access.

Such a server is accessed either through a "front end" running on the user’s computer which displays requested data or the back end which runs on the server and handles tasks such as data analysis and storage.

In a master-slave model, database master servers are central and primary locations of data while database slave servers are synchronized backups of the master acting as proxies.

Some examples of Database servers are Oracle, DB2, Informix, Ingres, SQL Server. Every server uses its own query logic and structure. The SQL query language is more or less same in all the database servers.

Reference: Eustace, K. (2004). Lecture 3: Database Servers [PowerPoint slides]. Retrieved from Charles Sturt University, Melbourne Study Centre

Exercise_Week 2

Client Server Architecture

The client-server characteristic describes the relationship of cooperating programs in an application. The server component provides a function or service to one or many clients, which initiate requests for such services.

Functions such as email exchange, web access and database access, are built on the client-server model. For example, a web browser is a client program running on a user's computer that may access information stored on a web server on the Internet. Users accessing banking services from their computer use a web browser client to send a request to a web server at a bank. That program may in turn forward the request to its own database client program that sends a request to a database server at another bank computer to retrieve the account information. The balance is returned to the bank database client, which in turn serves it back to the web browser client displaying the results to the user.

Client Server Diagram

The client-server model has become one of the central ideas of network computing. Many business applications being written today use the client-server model. So do the Internet's main application protocols, such as HTTP, SMTP, Telnet, and DNS. In marketing, the term has been used to distinguish distributed computing by smaller dispersed computers from the "monolithic" centralized computing of mainframe computers. But this distinction has largely disappeared as mainframes and their applications have also turned to the client-server model and become part of network computing.

Each instance of the client software can send data requests to one or more connected servers. In turn, the servers can accept these requests, process them, and return the requested information to the client. Although this concept can be applied for a variety of reasons to many different kinds of applications, the architecture remains fundamentally the same.

The most basic type of client-server architecture employs only two types of hosts: clients and servers. This type of architecture is sometimes referred to as two-tier. It allows devices to share files and resources. The two tier architecture means that the client acts as one tier and application in combination with server acts as another tier.

The interaction between client and server is often described using sequence diagrams. Sequence diagrams are standardized in the Unified Modeling Language.

Specific types of clients include web browsers, email clients, and online chat clients.

Specific types of servers include web servers, ftp servers, application servers, database servers, name servers, mail servers, file servers, print servers, and terminal servers. Most web services are also types of servers.

Reference: Eustace, K. (2005). Lecture 2: Clients, servers and distributed paradigms [PowerPoint slides]. Retrieved from Charles Sturt University, Melbourne Study Centre

Exercise_Week 1

E-commerce, distributed applications and the Internet

Introduction

In the first week we examine the type of system which is described by the umbrella term ‘e-commerce’. A number of typical application areas are examined including retailing using the internet, supply chain management and online auctions. We look at some of the underlying technologies used to implement e-commerce applications, for example web technology. We also look at some of the problems which are encountered when developing distributed e-commerce systems, for example problems in ensuring that a system is kept secure from criminal activity. It concludes with an examination of a typical retailing system, how some of the technologies fit together and business models used in the internet.

Distributed Systems

There is no doubt that there is great demand for large-scale distributed applications. Indeed, tremendously expensive special-purpose distributed systems have been deployed and today are used extensively in the banking, airline, and telecommunication industries. The major barrier to supporting these, and even richer, applications on the Internet is the difficulty of designing, building, testing, and maintaining distributed applications using the tools that comprise the state-of-the-art today.

The guiding principles of distributed multi-tiered architectures like J2EE and .net / Windows DNA are Web computing; faster time to market; true interoperability; Scalability, reduced complexity; language, tool, and hardware independence; and lower cost of ownership.

The life cycle of a distributed application can typically be viewed as having four phases:

  • Design phase
  • Implementation and testing phase
  • Deployment and utilization phase
  • Maintenance and evolution phase

It is a collection of experiences and best practices that have been taken from real-world development engagements, providing development teams with access to shared experiences and a proven, repeatable process. The Distributed Application Development Process encompasses modern design principles and proven practices to facilitate the development task and provide developers with a blueprint for building robust and correct distributed applications.

E-Commerce and Internet

There are a number of ways in which companies can make money from the internet. Probably the best known way of making money is by selling some commodity; this could be a non-IT commodity such as a CD or item of clothing or it could be some piece of application software, a font, a browser plug-in or an operating system. Other forms of revenue rising are:

  • Auction sites which auction items on the internet and make profits by taking some commission from the sales.
  • Shopping malls where a number of e-commerce sellers congregate together on the same website; often these sellers will be related to each other, for example they may all sell luxury goods. The mall owner takes a percentage of their profit.
  • Portals which contain massive amounts of material on a particular topic, for example a portal devoted to fishing. Such sites will contain thousands of resource links, tutorials and indexes. They will also contain links to merchants who sell goods associated with the portal topic. There may be a number of ways that the portal owner would make money, for example they could be paid by a merchant for each visit from the portal or the merchant may pay a flat fee for being included in the portal.
  • Digital publishing sites which are effectively magazines on the web. They make profits in a number of ways including advertising and charging vendors for references to their website.
  • Licensing sites which make some software available to other sites, for example search engines which allow a visitor to the site to search for material more easily.
  • Community sites. These are like portals but involve the visitors more, for example a community site devoted to nurses might include a number of chat rooms which allow nurses to talk together in real time and swap advice. Money is made from such sites in the same way as with portals.

Such applications have changed the face of retailing, for example the fast communication of the internet has made bulk buying sites feasible and popular and has given rise to a number of novel commercial models.

Reference: Eustace, K. (2004). Lecture 1: E-Commerce, distributed applications and the internet [PowerPoint slides]. Retrieved from Charles Sturt University, Melbourne Study Centre