Friday, August 29, 2008

Review: Rock on!!

So, last night I was conned into buying discounted paid preview tickets for Rock On screening at Metro Adlabs. I went there all hyped up thinking of catching a glimpse of the Rock On crew and general P3 types crowd. But I was let down. Cast/crew chhodo, acchi ladkiyon ki bhi kami thi! Anyways, but I was not let down by the movie.

Superb music - especially if you like rock (you'll like it even otherwise). Heard such good Hindi rock after a long time - nice lyrics and singing. Superb acting by the entire cast - never knew Arjun Rampal could act well. Superb singing by Farhaan Akhtar.

Movie is a tad slow and dwells upon each character and relationship and lets it build. But, I guess that's required. That's how the audience connects with each character.

Loved the end note - "Don't download the music. Buy the CD!" Heh, I will. Hope you will too. I wonder why these guys don't sell music CDs + posters + t-shirts right outside the movie hall. I'm sure I would've bought a CD without a second thought had I seen a stall right after I stepped out after watching the movie.

PS: Vote for it on the IMDB page for Rock On!!

Tuesday, August 12, 2008

FM

BMC aur Dharmendra mein ab zyaada farak nahin hai bacha, kutton ka khoon peene mein dono ko aata hai maza!

That's Mallishka on Red FM! Absolutely hilarious.

I'm hooked onto FM these days. Especially Rainbow FM in the mornings and late nights - they play amazing English music. The RJs mostly suck, but the music rocks.

Why do the other stations play the same songs over and over and over again? They haven't yet gotten over Jab We Met. I'm sick of listening to those songs. Get a new playlist guys!

Wednesday, July 09, 2008

Lazy programmer and why Lisp templates suck

I was reading some random article on Rediff and happened to notice this block shoved in one corner. What caught my eye was the first question - "Are commodity exchanges responsible for price raise of food grains?" - but I got easily distracted by the sheer laziness of the developer who implemented this. Check out the screenshot below:

1 answer(s)
5 answer(s)

I mean for god's sake! On one hand we have people who're trying to teach computers natural language processing, and artificial intelligence; and on the other hand computers can't figure out if was one answer or five answers.

Then I thought, how easy it would be to implement this in ERb:
<%= post.answer_count %> <%= post.answer_count==1 ? "answer" : "answers" %>

And then I got thinking how damn painful it would be to implement this in Lisp and HTML-Template. You'd first have to create a flag for each post indicating whether it had a single or multiple answer. Then you'd have to pass all those flags (or list of flags) down to the template filler function. Then you'd have to put a big TMPL_IF statement in the template to achieve the same thing:
<!-- TMPL_VAR answer-count --> <!-- TMPL_IF single-answer -->answer<!-- TMPL_ELSE -->answers<!-- /TMPL_IF -->
You could of course, for each post, simply compose the exact string to be displayed ("1 answer", "5 answers") and pass that down to the template. But what's the point of having templates if you can't separate view logic cleanly.

Lisp is a great language, which will probably help you achieve a lot of intellectual orgasms (Meta-object protocol, macros, reader macros, etc.) But it sure does need a good templating tool. I tried hacking around in CL-EMB, but it doesn't really cut it.

[End rant]

Wednesday, July 02, 2008

IIT Kanpur Suicides - Werther Effect/Copycat Suicides?

Yet another suicide rocks IIT Kanpur. Yet another round of introspection. More statement blaming the student-faculty relationship, internet usage, grading system and academic pressure. Media bites with ridiculous statements from, both, the students and the faculty.

I'm not sure how much the situation has changed from my times - and they're not too far in the past, I'm a 2005 graduate - but, I really don't think that the academic pressure is too high at IIT Kanpur. Any lower, and it'll risk getting lost amongst the gazillions of second and third rung engineering institues in the country.

Ditto with the grading system. It's not the best, but it's not the pits either. Every system has its pros and cons. And the cons are not that bad that they'd cause students to start committing suicides over them.

I think the suicides are because of an individual's intrinsic character and the Werther Effect. I first came across the Werther Effect while reading the chapter on social proof in Robert B. Cialdini's book, "Influence - The Psychology of Persuasion." The Werther Effect talks about how a highly publicized suicide can cause a number of follow up copy-cat suicides amongst people in the same situation. And suicides in IIT Kanpur (or any other IIT for that matter) are surely highly publicized. You have it splashed on the front pages of all local newspapers, the in-campus newsgroups would be flooded with posts, discussions in the quads & wings, special committees and reports, etc.

When I first read about the Werther Effect, I scoffed. But, now I've started believing in it. An extract from the Wikipedia article:

The well-known suicide serves as a model, in the absence of protective factors, for the next suicide. This is referred to as suicide contagion. They occasionally spread through a school system, through a community, or in terms of a celebrity suicide wave, nationally. This is called a suicide cluster[1]. Examples of celebrities whose suicides have inspired suicide clusters include the Japanese musician Hide and Yukiko Okada.


I think some psychology/sociology professor from the IITs should be looking at this angle as well. In my opinion, the grading system and the academic pressure is just fine. Let's not degrade the quality of IITs any further - we've got politicians to do that for us!

Saturday, April 19, 2008

[HTML] The under-used <label> tag

I've seen so many web sites not using the label HTML tag. It's a very nifty usability tool whenever you're writing captions for form fields - especially checkboxes and radio buttons.

The problem with checkboxes and radio buttons is that they're small. You have to position your mouse pointer very accurately to be able to turn it on or off. With labels you can associate the form field with its accompanying caption. Clicking on the caption will turn the associated checkbox/radio button on or off. Give it a spin here:

Without the label tag



With text boxes clicking on the label will shift the cursor into the associated text box:

Enter your name (without label):



All you need to do is give the form field an id tag and associate the label with it:
<input type="checkbox" id="example2" /> <label for="example2"> With the label tag</label>

Impulse Purchase

I've seen people purchase clothes on an impulse. Shoes, deodorants, shades, food, whatever. But I don't think I've seen anyone purchase a domain name on impulse!

A few days ago I was following a truck on my bike and saw the ubiquitous "Horn OK Please" written on the back. And suddenly out of nowhere I thought of "horny" please. What a cool domain name to have! I came to the office, and purchases it for Rs 599 at Net4Domains.

What the fuck do I do with it now? Any ideas?

Saurabh Nanda. Proud (confused?) owner of www.hornyplease.com!

Wednesday, April 09, 2008

Composing blog posts in Textile Markup

Why can't I compose posts in Textile Markup? It's so damn simple and guarantees conversion to clean HTML. I hate using the rich text editor for composing posts. It's too complicated and I don't like the superfluous markup it generates. Plus I've also gotten addicted to Textile, thanks to the amount of time I spend on Basecamp.

I've submitted a feature request and also posted about it on the Blogger Help Group.

Tuesday, April 08, 2008

Clueless with Computers...

... that's how non-geeks feel. I'm extremely sure of that now.

I had been spending some time planning my parents' trip to Kerala. I had every event (flight, car travel, hotel stay, etc.) added neatly to my Evolution calendar. (Given the number of meetings I now have to attend - I've been using Evolution avidly for the past month or so - but that's a different story). Finally, I sent out notifications for each event to my parents.

I called up my Mom expecting the entire travel-plan communication process to be a breeze. What's the complication, I thought. You get a bunch of meeting invites; you click "Accept" for each one and boom! you have a proper travel calendar right in front of you.

She got the mails alright, she even clicked "Accept" on each one of them. But I had one hard of a time trying to get her to the calendar.

Me: Okay, now that you've accepted them, you can see the schedule in the calendar.
Mom: How do I get to the calendar?
Me: Okay, do you use Outlook? [That's what most offices use.]
Mom: Yes.
Me: So, the left pane, sorry column, sorry left side of the screen will have a button for calendar. Click on it.
Mom: It's not there.
Me: Can you see your mail folders?
Mom: Yes. But no calendar.
Me: Okay, I'll call you back in 5 min.

Then I rushed to a guy with Microsoft Windows on his machine. Fired up Outlook and noted the exact location of the Calendar button. It was pretty visible. But then I realized, probably it's been turned off on her machine. I asked the guy with M$ installed, he showed me how to configure your left pane to show/hide various buttons. I was like, yeah right. "Mom look at the left pane, there's a teeny-weeny arrow there which will lead to a menu, which will have an option called 'configure', which will have various checkboxes...." Not happening!

I spent the next 10 mins trying to figure out how to get to the calendar in Outlook without clicking on an onscreen button or going through the configuration process. It's bloody un-intuitive. It's "Go > Calendar" if you don't already know. The shortcut for it is Ctrl+2.

Back to the phone:

Me: Okay, press Ctrl+2.
Mom: [After 30 sec] I did, nothing happened.
Me: Are you in Outlook? [Damn!]
Mom: Yes.
Me: Do you have a Menu item called "Go"? You know, right at the top where file, edit, etc. are? Can you see a "Go" there?
Mom: No, there's no "Go" option!
Me: Are you sure you're using Outlook?
Mom: Yes.
Me: Are you sure it's not Netscape?
Mom: [getting irritated] yes!
Me: okay, are you using Outlook on your own desktop? Or do you sign in to Outlook using the Internet Explorer? [Ah, probably she was on one of the M$ web mail box thingies]
Mom: No. It's on my desktop. We have two different icons. One for Internet Explorer and the other for Outlook Express. [!!]

I wanted to pull my hair out! And as it turn out, Outlook Express, indeed does not have a calendar application.

I just gave up on the entire cool iCal stuff. Took a screenshot of my Evolution Calendar screen and mailed it to her.

Sunday, April 06, 2008

[Ruby] A few points about Ruby threading...

... it's green threaded.

That means, the threading is simulated by the Ruby VM and they are not "true OS threads".

That means, if a thread in your Ruby program makes a call that the VM can't suspend, all threads running in that VM will block. In effect, your Ruby VM will "hang" until the rogue thread returns.

A few links about how threads in Ruby work:

Basically, the recommended way to achieve concurrency, if each concurrent thread/process is doing even moderately complex I/O tasks, is to fork a new process. (The much-touted "shared nothing" architecture)

PS: And in case you're wondering, ActiveRecord *is* thread-safe. It's just that most apps don't use it because of the preferred way of achieving concurrency in Ruby (forking processes).

Saturday, April 05, 2008

[Ruby] Madness with the 'require' command

I spent around 30 minutes trying to figure out why a particular Ruby file was being loaded twice, only to be struck in my face with this gotcha.

Basically, when you use require 'file' the method Ruby uses to determine whether the file has been loaded earlier is pretty stupid. It looks for the filename passed verbatim in it's internal data structure/hash/whatever. So, if you give require 'file' and require './file' the damn file will be loaded twice.

WTF?! Seriously!

Anyways, I thought this was undocumented behaviour but I found this in the RDoc entry for 'require' - should have looked there before.

Ruby tries to load the library named string, returning true if successful. If the filename does not resolve to an absolute path, it will be searched for in the directories listed in $:. If the file has the extension ``.rb’’, it is loaded as a source file; if the extension is ``.so’’, ``.o’’, or ``.dll’’, or whatever the default shared library extension is on the current platform, Ruby loads the shared library as a Ruby extension. Otherwise, Ruby tries adding ``.rb’’, ``.so’’, and so on to the name. The name of the loaded feature is added to the array in $". A feature will not be loaded if it‘s name already appears in $". However, the file name is not converted to an absolute path, so that ``require ‘a’;require ’./a‘’’ will load a.rb twice.