Pain - an urban rhyme

February 10, 2007, 1:02 pm
Pain, A lame, urban poem.


Life is pain.
I know, no pain, no gain.
But how long can one take pain,
a lot of pain, with no gain?

Is this God’s game ?
Will all my effort go down the drain?
Or am I just worrying in vain.
Pain leaves stain, for you to see and learn,
My dear friend, use your brain for there is nothing you cant attain.
Now dont call this poem lame,
You and I know, its not method main() but word-rain.
- Kailash Nadh

Ajax and URLs

February 1, 2007, 5:44 pm
I know this solutions exists but doubt whether its existence is ubiquitous. The Wikipedia article on Ajax [ http://en.wikipedia.org/wiki/Ajax_(programming) ] mentions it in 'Cons'.

Straight to the point. One very common problem with ajax->dynamically updated pages is that, since content is fetched and updated within the page itself, the original webpage url doesn't change and hence it is impossible to bookmark/remember them.

For example, the video comments on youtube. If a video has ten pages of comments, when clicking the page numbers, the comments are updated dynamically without the url ever changing. So what if you want to bookmark page no:9 ? Not possible.

The simplest solution is to make use of the 'url fragment identifier' or whatever that comes after the # in a url. eg: http://something.com/page#here-it-goes

Javascript can update the fragment identifier dynamically with a simple

CODE:
document.location.href = '#whatever';


On page load, something like RegEx could be used to parse the query

CODE:
var thisUrl = document.location.href;
var query = thisUrl.split('#');
alert(query[1]);


So if page numbers or required variables are set as the fragment identifiers, it is possible to efficiently make Javascript process it (nearly) and make Ajax act normal with page urls.
Page :  1