Archive for December, 2005


December 30, 2005

Cookie is probably one of the most interesting development for the HTTP.
Cookies are small text files generally not larger than 8 kbs (I’m still exaggerating). These NOT downloaded from the web. They are saved by the Browser (yes the browser, your own client). The cookie is saved when server directs the browser.

The Server sends a response header of Set-Cookie

Set-Cookie: favColor=blue; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/;



Creating a Bookmarklet

December 28, 2005

A bookmarklet is nothing but a simple Link. All that differs in the link is the href attribute value.

Lets make a simple whois bookmarklet (bkmlt), On clicking that bookmarklet, a prompt will ask for the domain, and on submitting the information… takes you to the whois page

The href attribute in bkmlt is all javascript

var dm = prompt(“Enter IP / Domain”, “”);
if (dm.length > 0) {
window.location = “Enter IP / Domain”, “” + dm;

The above javascript is very simple, prompts for a domain/IP, and changes the window’s location to the url…


DOM Source

December 28, 2005

In firefox you can view, the runtime view-source of the html page. All you need to do is

  1. Select a particular piece of text
  2. Right Click
  3. Click “View Selection Source”

DOM source

So if you have anything that is generated by JavaScript at Runtime, you can select that part of the document and see it’s source

Firefox Google Search

December 28, 2005

The most efficient way to search the web is using Firefox and Google

Firefox Google Search

The best way to search.

  1. Ctrl + K, This will focus the search area.
  2. Type search keyword, u can use google search patterns, like “define”, etc.
  3. Alt + Enter, opens the search in a new tab.

Conditional GET Request

December 27, 2005

The HTTP Protocol defines a caching mechanism, in which the proxy web-servers can cache pages, files, images etc. Since caching is in place, There is a method which the servers are asked to return the document, either the “cached” or “live” document.

This request of asking the server for a document considering a specific parameter is called a Conditional GET Request. In this request, a specific request header is sent If-Modified-Since. This header sends a RFC 2822 formatted date as the value. The proxy which is between the Server and the client checks the date, and the cached document, if the condition matches, A 304 Not Modified header is sent back to the client in the response.



December 25, 2005

Many of you must be aware that a “form” element in HTML has a method attribute, most of you set it to either GET or POST. In my previous post, I explained what is a simple GET request. This time… Its POST’s turn.

There is a common knowledge, that if you want to hide the data that is submitted, you use POST. But is it that the data is really hidden? The browser is a client and the client MUST send the data to the server, in a GET request the data is sent in a query string.

Consider you have a form with two elements “name” and “sex”. Consider the first scenario where the form’s method attribute is set to GET.

form .. method=”GET” .. action=”/somepage.php”

When the user submits the data, the name-value pairs of the form elements are url-encoded and transmitted in the URL as..



MySQL CSV , Tab separated Data Dump

December 24, 2005

Commonly we use the “mysqldump” tool to generate or backup data. But the standard output of the utility is SQL, or bunch of SQL statements starting from the “CREATE TABLE …” .. to the “INSERT INTO …”

Most of the times we just need a simple CSV or a tab separated data dump. And then we start searching for options, phpMyAdmin.

To get a CSV dump, the mysqldump utility needs some parameters.

mysqldump -T /folder_path –fields-terminated-by=’,’ –fields-enclosed-by='”‘ –lines-terminated-by=’\r\n’ -u root -p database_name table_name


HTTP GET Request

December 24, 2005

My first post here would be what is an HTTP Request.

When you fetch a page by typing the URL in the browser, The browser connects to the Host on port 80. Let us take an example, You type and press enter

The browser first parses the URL and makes a Socket connection to on port 80. The browser also parses the requested Resource or the page that is /index.html

The browser then writes the following to the socket

GET /index.html HTTP/1.1

The request is completed when the last charecters are \r\n\r\n