Friday, February 20, 2009

bad programmer, no cookie!

One of things that I'd been thinking of while trying to optimize the website we've been working on is cookies. One of the issue with a non-www site is that it generally is the root domain, so any cookie that is issued by the root domain will result in the browser sending that cookie with all the subsequent requests (even requests to a sub-domain and for static content). So, let's say you have a site hosted at http://example.com and all the static content is served through a sub-domain (say http://cdn.example.com) by a CDN, any cookies set by example.com have to be sent to cdn.example.com, even though the static content hosted at CDN doesn't need the cookies set by root domain. Most of the perf guides that I've read, generally recommend using a cookie-less domain , by hosting the main site on a www subdomain or by using a new domain altogether for serving the static content. Using a www or non-www version is sometimes a corporate choice (which might be influenced by the company's branding; as in our case), and using a different "cookie-less" domain might run you into XSS limitations of the browser. So, wouldn't it be nice if I could provide some kinda hint to the browser as to when not to send the cookies using some meta tag. For instance, if I want to exclude a sub-domain from receiving any parent domain's cookies, I could do:
<meta name="no-cookies" content="cdn.example.com,cdn1.example.com...">
And, in case I want to exclude certain file types on the same parent domain itself from receiving any cookies, I could do:
<meta name="no-cookies-for-files" content="jpg,js,css...">
The second meta tag will ensure that browser doesn't send back the cookies for any (static) content which doesn't need the cookies even though the content is served by the same domain. The no-cookies-for-files has to be file extension based instead of MIME based cause to figure out the MIME type, the browser has to make a request first. We can extend this idea even further; but I guess adding these two meta tag support (call it anything that you wish) would be great!
thoughts?

Thursday, February 19, 2009

bloomr: what's blooming?

Very few people know that I love gardening and I love flowers (one of my new found interests while I was on a 8 month job break). One of the challenges for a budding gardener is to find out what all is blooming during this time of the year, and though you can make a dash to a nursery; lazy bums like me prefer the e-way! So, my way of finding the (good & not so common) flowers is by scurrying flickr to find recent blooms in my city. This method has served me well but since I've been completely bored off-late; I decided to automate the entire process.
Enter popfly:I had played with popfly when it was launched; and couple of days back I decided to log in to see if there was any new features/improvements to it; first thing that I figured out was that none of my blocks were working! Fixing them wasn't tough and since I had long ago written a flickr block to retrieve photos from flickr; I decided to re-use it for my flower search. The logic is quite straight-forward; the block expects the city name (actually, a place) as a user input; hits flickr to get the place id for the user entered text and then hits flickr again with a hard-wired query (currently set to: flower+bloom). Since, I would most probably be only interested in finding the recent blooms (instead of flowers blooming last summer), the code also limits the photos to the ones which were taken in last two months (current month-2). Finally, the block wires the output to a display block to display the flowers in some kinda slide show. I ran into couple of issues with the wiring of display block I decided to use (ImageSlideShow): it wouldn't clear the images before starting a new slideshow; this would mean if I search for say Boston first, and in the mid of slideshow; decide to search for Seattle; the seattle flowers are appended to the boston list! Fixing this issue meant, ripping off the ImageSlideShow block; exposing the clearImages method and calling it in the glue code between flickr block and ImageSlideShow block. Once, the mashup was all set; I decided to create a web-page around it in popfly; unfortunately the html generated is not the best (understatement) and I haven't felt like tweaking it (yet). I generally don't like iframes but that's what you get with popfly and I still haven't figured out a way to change the background of my mashup. Anyway, in case you are interested in giving [i]bloomrtm a twirl; you can give it a shot here: on popfly or here

Sunday, February 01, 2009

A thousand times over

Six years ago; on this day i'd asked myself a question, a question which I answered without any hesitation...an answer which changed my life and is more or less responsible for where i am today. So would i now have come up with a different answer, given how life has been all these years? No, i still would have given the same answer, a thousand times over.