I’m Away, Leave a Message

Past couple of days have been slow around here, with my end of term exams, my new job at Racked Hosting, and my faulty hardware. I’ve been quite busy, and realised there is no reason to make updating Geekaholic a stressful and deadline-oriented task.

So this is a “I’m on leave” notice. There are some things in the pipeline though:

  • Geekaholic will be changing servers. I’ll be moving to company servers (faster, more reliable), and take my beloved data out of MidPhase hands and the annual cost of a webhost.

  • I have a couple of projects in the pipes, and they’ll be released by the time I’m back. Nothing too big. One is for RackedHosting, and one is a personal dabble at more UI controllers in Javascript.


You can still keep track of me on Twitter, I’ll be active. I might throw in a post here from time to time, if there is something I really have to say. But I’ll be gone for about a month and a half.

So, not making this a overstretched goodbye, see you on the other side!


The New Facebook Profile

New Facebook Profile

Boy does it look ugly, except for some parts. A more detailed write-up later in the day.


A Week Without Twitter

On the 8th of May, I was drawn to chatter about a new hangout for Indian tweeters: # at irc.freenode.org. I decided to give it a shot and see what the fuss was all about. Things just snowballed from there (get the whole time line over at the wiki), and I spent a whole week with minimal Twitter activity; like one-to-two tweets a day minimal. In that time, I learnt a few things which interested me.

My view vs. Their view

When I asked that question out on Twitter, the reply I got was “for lifestreaming”. At first I thought that I used it for the same purpose, but as it turned out, I don’t. My usage of Twitter is to “think out loud”, to put it in the simplest terms. Whenever a thought strikes me that makes me think about how others perceive the same thing, I tweet it. May that be a news article, or a service feature. I (usually) get replies from people which either reinforces the thought, or gives me new angles to understand it better. Either way, it’s a positive interaction.

People use Twitter as an IM service (which is what the IRC channel was initially supposed to cut out), and even more use it as a tracker of their daily activity (“I’m going to bed”). Very few use it to actually enhance their ideas and thoughts. Twitter is perceived as the 2.0 version of IRC, a room full of people who are always listening and one return key away from a conversation. Hence, the moment we (about 7-8 regulars) switched to #, our Twitter activity went down because we had our outlet — it didn’t matter it wasn’t Twitter, because that’s what Twitter is for us. Unconventional uses of services always make the creators happy, because it’s being used in ways they never thought it would. But this is one case where I think the founders will hope people use it only for conventional means. The heavy use is what cripples their servers. The service architecture was built to be used in a certain way, and is unfortunately a little too rigid to cushion itself against quakes.

Twitter isn’t new

Like I said, Twitter is the Web 2.0 version of IRC. Internet Relay Chat was the geekfest of the early Internet. I still can’t put a finger on the “why”, but the whole scriptable nature of the protocol left the creative opportunities limitless. The first thing I did after joining the channel was write a bot to handle administration. The geek/programmer in me immediately took over.

The same is how I see Twitter: A platform for endless creativity. It is amazing how much you can do with 140 character messages1, and how much scope it opens up in front of you. You just have to allow yourself to see it. You can write “bots” to perform special functions based on what you tweet, or integrate other services controlled by tweets (or direct messages if it’s private). Do you see where I’m going with this?

I hailed Twitter as the “new way to communicate” and stay in touch. Obviously I was wrong (with memory of my IRC days long gone), and seeing it in this new light again opens up a lot of avenues that I’d like to check out. But that’s only for a programmer. The normal person will still use Twitter for conversation, lifestreaming, or whatever they’ve been using it for all this time. It’s amazing how something that’s so old, can still change the way you look at the web and its possibilities.


  1. It should be pretty clear by now seeing the umpteen sites all popping up that augment Twitter with various features — from context to search. 


Comet: Notes and Caveats

In reply to a tweet about wanting PUSH-based construct for web applications, @prasnation pointed me to Comet, which Wikipedia defines as a “WWW architecture in which a web server sends data to a client program (normally a web browser) asynchronously without any need for the client to explicitly request it”. I’ve been reading about it for the past couple of days, and it’s beginning to look like the next thing to hit web-applications. Standardised adoption in browsers will allow mass adoption in applications. That, will make hosting companies work to offer more powerful servers (dedicated/VPS) at cheaper costs, so that they can handle “always alive” connections for more people.

How does Comet work?

Simply put, it is a PUSH based alternative to current methods. The way HTTP works right now, the connection between the browser and the server is severed the moment the transfer of the page data is complete. Any changes happening on the server post-initial transfer, are not reflected on the already loaded page until the user explicitly refreshes. This has absolutely nothing to do with AJ (more on it later), and is purely about the transfer of data between a browser and the server.

Comet works by keeping the connection alive, so as to allow the server to PUSH data to the page as and when it changes. This allows for a more efficient method of serving dynamic pages, one that doesn’t require constant GET calls using AJAX or fancy IFRAMEs. Comet (as proposed) plans to work natively (without client side scripting) in a page, with certain blocks marked out as Comet elements, so that the browser knows that those elements will be updated in the future of the session.

Examples of places where the Comet architecture can be most beneficial are web-chat clients, notification systems — like Facebook’s Beacon or news tickers, and services of the same form. Any page that needs to stay in touch with an ever updating server for “fresh” data, should use the Comet model.

Unfortunately, no browser supports it completely (Opera 8.5+ supports it sparingly), because this is a part of the HTML5 specification1. HTML5 is still in the decision-making phase, so the entire specification is not complete, which means it will take further time to finally get this out of the door, after which the browsers will have to implement it properly, and back-end servers will have to become powerful enough to handle such connections. It’s safe to say there’s a long wait before we see it peeking out of the hood. That’s why people have already come up with techniques to make up for it’s absence.

Alternatives to Comet

There are many ways of imitating a PUSH-based model, but I prefer only 3 — keeping efficiency in mind. I’ve tried out the following on my shared host, and have discovered a few things which might help you if you want to create an application that uses these alternatives.

XHR polling: The loaded page contains a recursive XHR call to the server that checks for updates every ‘n’ seconds (assuming data changes quickly, like in a chat client). The next XHR is fired the moment the previous is closed, which can be achieved by either polling the server again onSuccess, or making the server send a callback, in which case the second poll is only called in case the previous one was a success. This is a very intensive method, and is the fastest way to bring down weak-shared hosts (I’ve done it twice), so I wouldn’t recommend it unless you’re on dedicated servers. If you do use this, make sure you poll at decent time intervals; 5 seconds is too low, while 30 seconds makes your application seem unresponsive.

XHR streaming: A big improvement on the previous method, this uses the concept of streaming — letting data trickle in in bits and pieces — to make the page dynamic. Of course, this involves keeping the connection open all the time so that the server can continue sending data through. It uses the onreadystatechange (state 3) of XHR to take action every time new data is available. The problem is that existing shared hosts put a maximum execution time on scripts (usually 30), and we need infinite loops to keep the connection alive. This connection will automatically be closed when you hit that execution time limit. So, if you have access to your PHP configuration (which is highly unlikely), you can change the values and fix the issue. Otherwise, this method is pretty useless.

“Forever” IFRAME: This is a spin off the XHR streaming method. An invisible IFRAME is pointed to the server script, while the server spits out callbacks to functions on the main document (by using the top object). The IFRAME will continue to load, which might make the browser behave as if the page is still loading, but that’s a minor setback. Again, for shared hosts, the maximum execution time will limit how long the IFRAME can continue loading the script, but this is where things branch out from the streaming method. You can simple refresh the IFRAME to reset the execution timer, and the user won’t know the difference. The refresh can be a setInterval every ‘x’ seconds, where ‘x’ is the same number as the maximum execution time limit. This is cleaner, and is a much lesser headache.


All the above methods require server power, so dedicated hosts are your best bet at the moment. A shared host is alright if you want to play around with this and get the hang of it, but a full blown application will not hold.

Comet is a new way of doing an old thing. Most importantly, it is the correct way of doing it. I want it to get implemented quickly, even if alternatives exist. As the web comes closer and closer to the desktop in terms of applications and their usability, it is much better to work with the correct model than buggier, harder to maintain alternatives. Really.


  1. I have been vocal about not liking the HTML5 spec, and prefer XHTML2 to get implemented instead. But I must say that if XHTML2 doesn’t add support for an event-source type element, I will back HTML5 wherever I go. 

Copyright © 2006-08 Aditya Mukherjee | Valid XHTML 1.0 Transitional Valid CSS!