Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Wednesday, 5 September 2007

AJAX & Web 2.0 Tutorial (Section 2) - Web Services




  1. Web Services are a way for disparate applications to work with each other over the web;
  2. In order for different applications to communicate with each other they need to agree on a protocol, webservices have three common protocols, JavaScript throws a fourth into the mix;
  3. REST - Simple request protocol, looks identical to a form being filled out, response is a basic XML document;
  4. XML-RPC - XML request-response protocol, format chosen is sub-optimal for parsing with DOM tools;
  5. SOAP - Heavy but well defined XML based request-response protocol;
  6. JSON - JavaScript Object Notation - information is passed back and forth in the JavaScript notation;
  7. Ditch SOAP & XML-RPC, (SOAP is too heavy for frequent small requests, XML-RPC is just ugly);
  8. REST - Light weight requests, some basic frameworks are available. Define your own response XML format;
  9. JSON - The JSON format is relatively lightweight but still ‘new’ enough that it’s not too widely supported (JSON support was added in PHP 5.2.0);
  10. It’s critical to remember that HTTP is a stateless protocol, every request must stand alone, independent of each other request. While technologies like sessions help can help when dealing with end users, they are inappropriate when using web services;
  11. When developing web services leverage and re-factor existing code, rather than duplicating;
  12. Objects are rather... different compared to other languages. Rather than defining a specific
    class, than instantiating instances of it, objects are created from functions that pull in their own required methods. This can be done on the fly, or by defining functions inside other functions.

Sunday, 2 September 2007

MagicJavascript - Flying Images




Open a website and paste the following code into the URL on your browser, and then hit Enter ... ...

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.right=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0);

I tried on google.com, and here is the screenshot:

Saturday, 18 August 2007

Learn from yahoo.com



Every developer dreams to have a website whose pagerank is 10 or daily reach percentage is 20+, but are you sure your sites wouldn't breakdown when facing with millions of clicks on a daily basis? Let's open the box of yahoo.com and have a look whats inside, shall we? :-)


Total Requests: 37
Page Size: 208K
Loading time: 1.68s

If we are not so sure how brilliant yahoo.com is, I am not being cruel, but lets have a look at sugarcrm.com:

Total Requests: 85
Page Size: 419K
Loading time: 8.68s

A Brief Conclusion:
[1] If an image/javascript is not really necessary, REMOVE it.
[2] If an image/javascript is considerably big, REPLACE it.
[3] Every little help :-)

Thursday, 16 August 2007

Web 2.0 is a feature




Too many people are doing too many different and irreconcilable things all at once on the web, should we say that web 2.0 (Web 2.0 is a phrase coined by O'Reilly Media in 2003 (and later popularized by the first Web 2.0 conference in 2004) in reference to a perceived second generation of web-based communities and hosted services) is the future capabilities of the internet? No, it is just a feature, same as speed, security, compatibility. You don't have to participate as long as you are satisfied with your current approach on site exposure and application handling.


But most of the early Web 2.0 successes are consumer-focused, with many dedicated to social networking. Like AdSense, which has given Madison Avenue executives the collective jitters, the Open Architecture Network suggests that 2.0's cocktail of collaborative technologies can have an equally radical influence on business and industry practices. In the case of the OAN, the industry in question is architecture.

Thursday, 2 August 2007