Refresh Course In Java

15 08 2009

8 years since I last touched Java? It’s not a good thing mind you. Rusty as ever. Having to remember how to install the Java Compiler was another problem. The one I had previously has definately phased out.

For those that want to install Java click on the address below:
http://java.sun.com/javase/downloads/index.jsp

Java Documentation and Java Tutorials can be found under the “Links”.





Optional Add Ons for Firefox Browser

15 08 2009

Additional add ons for Firefox that one may find useful if they want to see what is happening LIVE.

  • Live HTTP Headers and
  • Firebug




Hypertext Transfer Protocol (HTTP)

15 08 2009

Defines and connects how clients talk to servers and how servers transfers the pages back to clients.
clients = browsers

Request – Response Protocol
Send req to server
Server responds

HTTP = stateless
Server doesn’t keep any past transaction information of requests.
Every request is on its own.

HTTP Requests to Servers
[Source Pic: Dr Liu Zehua lecture notes 2]
Method: GET / POST / HEAD
Headers is one per row (name and value pair). Meaningful to the server.
Entity body is usually empty data.
How long of the session is dependent on the content and headers.

Most of the request a response will be returned which is usually a document.

HTTP Response to Servers
[Source Pic: Dr Liu Zehua lecture notes 2]
Phrase = Status message
Header lines consumed by the client and are relevant to the client.
Entity body contains the content which the client requested (eg HTML text)

5 cats
1 – informational
2 – success
3 – redirection
4 – client error
5 – server error

Eg
200         ok
404         client error
500         server error

Some browsers look at the response message header “Last-Modified” to be used as a caching process. This is to identify whether there has been any changes made last to the content type.
Headers that may be important to client is “Contect-Type” for it to know how to interpret the data. “Content-Length” determines the session – standard counting is bytes.

*Above situation is referred as synchronous communication. If multiple browsers communicate to server, multiple sessions will be opened accordingly for each browsers.

HTTP sits on top of the TCP.

HTTP 1.0
Mostly at that time was “nonpersistent connections”.
Q) What is “nonpersistent connections”?
Each time you want to make a request you have to establish a channel of communication before the HTTP Request and HTTP Response can happen. Once the HTTP Response is finished, it then has TCP/IP disconnection.
Designed for not so many requests. If requesting a HTML document for 20 images in this case will have 20 HTTP requests.

HTTP 1.1
Has “persistent connections” – server keeps connection open after the first request. Connection closed via client or server passing a header or time-out.
For multiple requests can use “pipeline”. Server will send the response based on the request order. However, server has to be intelligent enough to hold on responses if the previous response will take much longer.

Persistent connection advantages
Latency is reduced. Time and memory resources use is reduced.
eg Sometimes if the computers are very far. The cost for connection to establish could be high. For persistent connection only pay one time connection than nonpersistent.

Methods of Requests
GET is most common.
Allow one to retrieve a document.
Entity body section is empty.
Conditional GET has the caching part in the header field (If-Modified-Since <date>, If-Unmodified-Since, If-Match, If-Range)
Partial GET get to requests a document in parts. Has the Range in header field.

POST also allows to retrieve a document. “Stated purpose”.
Attaching some data to your request to server whereby the server will use the data to replace, append, etc.

HEAD same as GET but the server doesn’t return an entity body in the response.

HTTP Headers
General headers is in both request and response.

Desired to have some form of authentication before servers respond to client requests = Basic Authentication Type.
Client authenticates user name, password
Server responds only if can validate the Clients information.
Header is: Authorization:
Uses Base64 encoding
The popup window of user name and password box is done by the browser side inclusive of “Remember my Password”. Ticking of this box will cache the username and password in a local store and not on the Server side.

State Management
To maintain and remember the state, it can be done by using Cookies.

Client requests.
Server responds using Set-Cookie response header:
Set-Cookie:; Max-Age=seconds; Path=PATH; Domain=DOMAIN_NAME; secure

Client stores in the browser on the local machine.

To send valid cookies client to server,
Cookie: NAME1=VALUE1; NAME2=VALUE2;
Cookie: user=diongoh; shoppingid=ABC123

Server will then check this information of the Cookie
[Source Pic: Dr Liu Zehua lecture notes 2]





Basic Concepts – Evolution of Web 1.0

15 08 2009

At the beginning all comps were centralized and there were no networks.

Q) Why comps networks?
Allows sharing / more efficiency in work performance

Traditional uses of sharing – network printer
New generation uses of sharing – music, p2p, entertainment, ecomm, automation of business processes

Most popular network = Intenet (interconnected networks)
Hosts run networks / Internet applications.
Hosts are computing devices on each network.

P2P you are a client and a server at the same time.

Internet and it’s Evolution
Don’t have to look at the low level implementation part. It’s already done. Aimed at designing the complex high level.
It’s open standards. Has plug and play components.
Packet switching tech can’t guarantee the response times.
Binary based protocol is more efficient.
New standards have to work with the old standards that were in placed before hand. (not so easy)
Connecting diff networks = internetting, handle the communication between networks = TCP/IP
API / socket to give high level usage of the TCP/IP protocol (standard protocol).
DNS maps host names to IP adds
Before 1991 Internet used for defence and academia.
WWW develop by Tim Berners Lee / 1993 graphical web browser.
1994 W3C founded – World Wide Web Consortium.
1995 Internet moved away and became commercialized for ISP to handle.
2004 first web 2.0 conference
2005 / 2006 AJAX, MySpace / Flicker /  Facebook – Social networking grows.

Internet standards done by Internet Engineering Task Force. Docs describing standards as Request for Comments (RFCs).
Web standards (“Recommendations”) by international organization W3C.
DNS systems organized by Internet Corporation for Assigned Names and Numbers (ICANN).

THE WEB’S NEXT BIG THING = WEB 2.0?? (Just a marketing term) ~ social media / social computing / user generated content – people writing reviews on services provided.
Shift in paradigm that the web is becoming a platform rather than just presenting content. Having more websites look more like “desk top applications” – giving a richer user experience. Using programming models (XML / JSON?)
Bringing and accumulating opinions (intelligence?)

Web as a platform -
Now focused on services and contents and not which browser is being used.
end users – web pages; developers – web services
Web services 3 approaches (SOAP based / REST based / RSS)

Data has evolved and are being shared world wide– reusable information sources
Past: only can be seen within the drawn boundaries.
Now: opened to all.
eg google maps exposing things that use to be hidden: Myanmar nuclear manufacturing plant can be seen?
Exposing APIs for developers to develop value added applications and add on to the data.
eg del.icio.us API
Linking maps with to tags from pictures, comments, blogs, etc

Using WEB 1.0 – If you write a program to take the repository data and accommodate to one’s site, PROBLEM: At the mercy of the provider giving the information. Limited in the sense that you have to structure according to them. If they made any changes to layout, your program wouldn’t be able to work.

Collective Intelligence – when you collect large amounts of data, you will find a certain statistic habit when you analyze it. This must be on a broader scale.
eg Google PageRank algorithm searching.
eg Facebook suggesting friend mod is using some form of collective intelligence.
Quality of the content being addressed – issues that occur is that certain sites such as professional site have a set standard in comparison to reviews on certain sites that may not have valid truthful information.

Web applications moving to behave like desktop application experience due to rich Internet applications (RIA or rich client)
eg applets, flash, SMIL / SVG, DHTML, AJAX
eg Gmail, Google  Maps, MS Exchange Web client

Web no longer only on computer has reached mobile phones, PDAs, etc.

Nutshell about Web 2.0 (3 main factors)
Users: real time interaction with others
Functionality: involvement of APIs and RIAs
Data: bringing together all sources of information (proprietary and user generated) and using it.





IP Program Overview

15 08 2009

50% exam, 50% project

Looking at server side and client side programming.

Uploading of material is 1-2 days before actual day of class.

Technology talk 10% (2 pax grp): research on a specific topic
AJAX based user interface 15% (indiv)
Web 2.0 app proj 25%

AJAX
Servlets
JSP

ASP.NET is an alternative technology. Will not be touching on that but looking at Java.








Follow

Get every new post delivered to your Inbox.