Monday, September 22, 2008

Trimpath open source with javascript

Trimpath provides quite interesting project with javascript:
  1. Next Action - a web-based todo-list manager in the Getting Things Done style. You can use Next Action even when your network is offline
  2. The JavaScript Templates engine is a lightweight, standards-based, open-source component that lets web application developers have template-based programming (like PHP/ASP/JSP) while running in a web browser.
Check it out at url: http://code.google.com/p/trimpath/

Wednesday, September 17, 2008

Rest Uniform Interface

Rest defines a uniform interface, but it doesn't say how. It says, we should define the interface that other HTTP service used in common and understand the same way.

The most 4 popular HTTP methods that we already know (GET, POST, PUT and DELETE) can be defined as a uniform interface to communicate with the resources.
Let take a look at GET. HTTP GET is the best name for read operation. Let say two web sites, A and B, if we use HTTP GET to get some resource from web site A then web site B will have the same interface of getting its resource through the same HTTP GET, meaning all services on every website should have a uniform interface in providing it services or resources.

The Four Commonly Used Methods
  1. POST: HTTP POST is commonly used to create a resource which is a subordinate to any existing parent resource. Some time POST is also being used to the information we posted to its own state rather then creating a new resource. POST neither safe or idempotent, when you making two identical requests to a factory resource, may result in creating two subordinate resources with the same information.
  2. GET: HTTP GET is commonly used to request some data. we should implement the service that GET is a safe and idempotent method, meaning to say every request with GET should not result in changing server state. The client machine can make 10 or 100 times request, he/she will still get the same resource. It a bad idea to implement a resource that will increment any time client sends a request with GET to access the resources.

Monday, September 15, 2008

know this 'document.createDocumentFragment()'?

I know some of you already knew and even very skillful with 'document.createDocumentFragment()', I'm here just to present some new finding that I second time encounter this method, first time I just happend to come across that method when I was searching some technique with dom on W3School site, but yesterday I found that 'document.createDocumentFragment()' is useful and even easy to use.

Creating "createDocumentFragment()" is needed when you want to store a newly created nodes before you wish to append them to ocument. You may find more detail with this link url: http://ronsguide.com/js/docfrag/

Table's Attributes

I just happened to know that we can traverse rows columns in table easily with the table's dom method like tBodies, rows and cells, they all are array.

Example

Var tbody = document.getEelementById('myTable').tBodies , will return the array of tBody inside the tablbe.

Var tableRows = tbody.rows, will return the array of row inside tbody.

Var tableCells = tableRows.cells, will return the array of cells inside tableRows.

From that, you can traverse all the elements inside the table, and one of application that people are using now is sorting the row of a table. You may find it in 'Professional Javascript for Web Developer ' by Nicholas C.zakas.



Sunday, September 7, 2008

Javascript UI Libraries

Fore those of you who wants to build a rich UI in javascript, these are the famous libraries that will save years of your developing time.

1. Yahoo UI at url : http://developer.yahoo.com/yui/
2. Mochikit: at url: http://mochikit.com/index.html
3. Scriptaculous at url: http://script.aculo.us/visual-effects
4. Sproutcore at url: http://www.sproutcore.com/
5. Jquery at url: http://ui.jquery.com/themeroller/
6. Prototype at url: http://www.prototype-ui.com/
7. dojo at url: http://dojotoolkit.org/projects/dijit

Wednesday, September 3, 2008

JSON.stringify and JSON.parse

Before sending the json data to server, we used json.stringify to serialize the json object.

When retrieved the json object, we used json.parse to formate it into human readable json object.