< Browse > Home

| RSS

Atlast I managed to find the link for Ubuntu version of Google chrome. Please check below. This one runs faster and takes up very very less memory when compared to firefox. Very cool download :)

The minimalistic approach of Google chrome gives itself an unique edge over other browsers in terms of speed comparison ratios. Google has always pioneered in offering technology to meet the exact needs of people and thus attracting users by simplicity. It is so very evident in all their engineering, take Google search, Gmail, Gtalk, and now chrome. Google has been successful by offering just the basics in a perfect manner. And thats the same reason why I was attracted to install Google Chrome in Linux.

Also check this link for an interesting comparison of Linux based browsers, looks like Firefox is way behind when compared to Opera or Chrome..

http://penguininside.blogspot.com/2009/08/web-browser-comparison-and-benchmarks.html

Download Link: http://www.google.com/chrome/intl/en/eula_dev.html?dl=unstable_i386_deb

[ View Post ]

Google wave

[ More ] Oct 15, 2009 | No Comments | Posted in General, Web Development |

Last week, one of the developer in my office was talking about Google Wave, although I had heard about wave before, I thought it was just a social networking tool just in lines of flock , more to do with service integration (assumption is the biggest evil). but only until i saw this small(but long) video about Wave on Google I/O did i realize .. that this technology has the potential to bring a change in the way we communicate, interact and do things with the internet.

Look at this video

This is too cool :)

I am anxiously waiting to get my wave invite..

[ View Post ]

Often when working with large datasets, you will come across issues related to intense event overload for objects like table cells. This could translate to poor client JavaScript performance. The root cause for the performance lag is the large number of events that are associated and handled by web page at the client. Lets consider a scenario of highlighting cells in a table as follows

HTML


<table id="resultSetTable">
<tr id="row1">
<td class="nameCell"> UPS </td>
<td class="priceCell"> 2500 </td>
</tr>
<tr id="row2">
<td class="nameCell"> Mouse</td>
<td class="priceCell"> 300 </td>
</tr>
.
.
.
<tr id="row859">
<td class="nameCell"> Keyboard </td>
<td class="priceCell"> 250 </td>
</tr>
</table>

Javascript to highlight the selected cell


<script type="text/javascript">
$(function(){
$('.nameCell').click(function(){
if ($(this).css('background-color') != 'rgb(255, 0, 0)')
$(this).css('background-color', 'red');
else
$(this).css('background-color', 'green');
});

});
</script>

Although the code above works properly, the inefficiency of the above list code can be identifeid if the code is put through large datasets, since the javascript has to assign the event handler to all cells of the class “nameCell”, the Javascript engine gets overloaded with events, in a scenario of a few thousand rows, there are equal number of events being declared and handled simultaneously. This in some cases might cause the browser to crash. I got the following error when I tested this code with a large dataset on Firefox.

A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.
Script: jquery-1.3.2.min.js:18

An alternate way to handle this problem will be to assign the event handler to a larger parent object, and to execute the event handler by validating the properties of the event. In this case the larger parent object is the Table. We can drill down to the class of the clicked cell of the table, see if it matches the ‘nameCell’ class type and then run the instructions, based on the validation. This mechanism is known as event delegation.


<script type="text/javascript">
$(function(){
$('table').click(function(event) {
var $thisCell, $tgt = $(event.target);
if ($tgt.is('td')) {
$thisCell = $tgt;
} else if ($tgt.parents('td').length) {
$thisCell = $tgt.parents('td:first');
}
// now do something with $thisCell
if ($($thisCell).attr("class")=="nameCell")
{
if ($($thisCell).css('background-color') != 'rgb(255, 0, 0)')
$($thisCell).css('background-color', 'red');
else
$($thisCell).css('background-color', 'green');
}
});
});
</script>

The web application saves lots of client computing power by avoiding the replication of thousands of events by delegating the event to a parent object. Proper use of event delegation in jQuery can help in excellent performance optimization of the web application.

References

  • Working with Events by Karl Swedberg -
    http://www.learningjquery.com/2008/03/working-with-events-part-1
[ View Post ]

Best captcha form ever

[ More ] Apr 3, 2009 | 2 Comments | Posted in General |

This one is a really cool captcha validation that I came across in a blog. The site was probably meant for some maths wizards I guess and they wanted to auto disqualify people who didn’t have enough level of maths understanding.

[ View Post ]

A lot of you may very well know what happens behind the scenes when a webpage is requested or being served, this article will explain the details and internals of what goes behind when you type http://www.clickoffline.com/index.php

The Internet Architecture

What is meant by internet is a collection of networks that interconnect a large number of content providing servers with the end users. Internet typically is a network of much smaller networks which are interconnected. Any network/machine that is connected to the internet can provide and retrieve content from the internet.

Since internet is a network, just like any other network it supports a wide range of protocols, one of the most frequently used protocols is the HTTP protocol. The HTTP (Hyper Text Transfer Protocol) is the main medium for content retrieval and delivery over the internet. Some of the other protocols that are frequently used are as follows

  • FTP – File Transfer Protocol
  • SMTP – Simple Mail Transfer Protocol
  • POP – Post Office Protocol
  • IMAP – Internet Message Access Protocol
  • HTTPS – Secure HTTP Protocol

All these protocols are dependent on the internet as the backbone for providing the infrastructure needed to communicate. However these protocols may be used in a wide range of networks, not just the internet, for example, you may run an ftp server in an intranet (local LAN), which is not exactly internet.

DNS Service

Internet also has services that are used by other applications. DNS or Domain Name System is the one of the most important one. DNS works like a telephone directory. DNS typically is a collection of servers, which have a list of domain names matched with their internet IP addresses. Since every machine in the internet can be assigned with a unique IP address, and remembering the IP address is not so easy. DNS helps in referencing these Domains with IP addresses

A sample DNS table is shown below.

Domain Name IP Address
www.google.com [209.85.153.104]
analytics.google.com [209.85.175.147]
www.yahoo.com [69.147.76.15]
www.clickoffline.com [74.220.219.58]

So when you request a page from Google.com, the browser sends a request to the DNS server to find a match for ‘www.google.com’, the DNS servers will in turn, return the IP address of the respective Domain Name by doing a looking in the DNS table. When this operation is performed in reverse, i.e identifying the default domain name from a given IP address, it is referred to as Reverse DNS Lookup or rDNS.

Steps and processes involved in obtaining an html webpage


Request a web page

Once you type the URL in your browser, which may be IE or Firefox; the steps as described above happen sequentially before we get to see the page on our browsers. Let’s look at each of these steps in detail.

Components of the URL

The first phase is to understand the URL or identifying the components of the URL. A typical URL consists of the following components

•    Protocol
•    Domain Name
•    Resource Name

However there are other components that can be plugged into a URL which include, usernames, passwords and port numbers; we can ignore them as they are not used prominently.

The figure above explains the components of the URL. Now were ready to send the HTTP Request.

Construction of the HTTP Request

The browser composes a request called the HTTP Request that should be sent to the server to retrieve information from the server.

Sample


GET /index.php HTTP/1.1
Host: www.clickoffline.com

Since HTTP is a connection-less protocol, all information related to the session are sent along the request every time, this includes, resource name, protocol version, browser name, version and OS, supported content types, cookies if any, etc.

Identifying the server

Before sending out a HTTP request, we will need to identify the remote server; this is done by identifying the IP address using DNS for the domain specified in the URL. The HTTP Request is sent to eth remote server by establishing a route between the local machine and the remote server.

Wait For Response

The client browser waits for the response for the server.

Analysis/ Rendering of HTTP Response

The HTTP Response consists of a HTTP Response Header and the HTTP Response Data.
The Response Headers provide information related to the HTTP Response, the most important field is the Response code. Different response codes mean different statuses

200 OK
301 Moved permanently
302 Found
303 See Other
403 Forbidden
404 Not Found

The browser analyzes the HTTP response and renders the response one the screen, any dependencies like Images, CSS, java scripts that arise from the source html page follow the same processes to load int eh client, except that the URLs of the  resources is loaded automatically by the client browser instead of a user typing it.


HTTP/1.1 200 OK
Date: Wed, 18 Feb 2009 16:19:57 GMT
Server: Apache/2.2.11 (Unix)
X-Powered-By: PHP/5.2.8
X-Pingback: http://www.clickoffline.com/xmlrpc.php
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

Advanced Resources
•    Specfications for URL (RFC 1738): http://www.w3.org/Addressing/URL/url-spec.txt
•    Specifications for DNS (RFC 1035): http://www.ietf.org/rfc/rfc1035.txt
•    HTTP Protocol Details: http://en.wikipedia.org/wiki/HTTP

Disclaimer: The views expressed on this webpage are my personal views and do not necessarily reflect views of my employer.

[ View Post ]