Harshdeep 2.0

June 8, 2009

Biggest stock price movement ever

Filed under: Uncategorized — harshdeep @ 8:44 am

According to Google, Adobe’s stock opened at 29.45, touched 100000 and then came back to 29.98. There goes another chance of making piles of money 😦


May 2, 2009

The Wagner Principle

Filed under: Uncategorized — harshdeep @ 1:30 am

If something can happen and may not happen there’s a 50% chance of it happening. Now don’t shake your head like that. This insight comes from Dr. Wagner, the guy who took upon himself to save the world by filing lawsuits against the Large Hadron Collider (as there’s a 50% chance that it would annihilate the world). You can’t ask for more reliable sources of information.

This is good news for Bobby Deol as there’s a 50% chance that his next movie, Bichu Badal aur Bobby, will be a superhit (partly due to these tough times, almost all of the scenes are directly picked up from his previous movies as the directors thought they fit the storyline of this one too).

Researchers are looking at other implications of the Wagner Principle. What we have till now is not too promising though. There’s a 50% chance that you locked your car with your key inside, a 50% chance that you have Swine flu and a 50% chance that your apartment is on fire right now.

However, there are people who disbelieve everything (like landing on the moon, RajniKanth’s two kills with one bullet routine and the fact that IPL matches are all computer generated). But I have this to say to the skeptics of the Wagner Principle – if you prove it wrong, you only prove its correctness as the Principle directly implies that there’s a 50% chance that it’s wrong. There you go.

Btw, here is the Daily Show clip where Dr. Wagner candidly introduces his insight to the world.

PS: It hurts me that Dr. Wagner beat my undergrad buddy who I think understood the fact back in the day. On being asked how his exam went, he always used to say “Either I’ll pass or I won’t. So it’s 50-50”

April 24, 2009

Games based on Bollywood movies

Filed under: Uncategorized — harshdeep @ 12:32 am

Just noticed this 3D game based on Ghajini (that, for the uninitiated, is a part Memento part song and dance Hindi movie). It’s claimed to be “India’s First 3D PC Game”. Of course it is no GTA, but the trailer doesn’t look bad and game levels look decent too, though Amir Khan walks in a weird jumpy way. I wish there was a trial version available – the only way to get it is to order a DVD from Eros Entertainment. That’s right – you can’t download the game even after you pay for it – they ship you the disc.


While googling this, I ran into year-old news stories about the “upcoming” release of a game based on Dhoom 2. Seems like it got abandoned midway. They did generate some screenshots based on the movie posters though –

I couldn’t find any data on how well the Ghajini game did, but I think such games have a huge potential. There are two enormous categories of people – those who watch Bollywood movies and those who play casual games. I think there are a large number of people who do both.

An important thing to realize, I think, is that these games have short shelf lives. People are more likely to try them out while the movie is still running in the theaters or winning awards.

Secondly, these games would generate more excitement in casual gamers rather than hardcore gamers. It should be easy for the casual gamers to discover and start playing them. So ordering a disc online is probably not the best way to engage this audience. Ideally, the game should be playable in the browser – the user shouldn’t have to install anything (well, maybe the Shockwave plugin, but that’s most likely already installed). The game can be released in short episodes with, say, an hour’s play time for each. Also, it has to be easy enough so that a casual gamer can finish it. It’s a bonus if the stories tie up with that of the movie (stories aren’t the strongest part of Bollywood movies, but things are changing).

There should be plenty of alternate ways to make money from such games, like selling movie merchandise on the website, introducing the gamer to movie’s soundtrack through background music, in-game ads (the Ghajini game shows ads of PVR and Intel within the game) and so on.

If only there was a game based on Gadar. If it was integrated with Facebook, you’d probably get something like this in your newsfeed “Your friend killed 167 people with a handpump. How many can you kill?” (with apologies to people who’ve not seen the movie starring the legendary Sunny Deol)

March 9, 2009

Race to the PATH variable

Filed under: Uncategorized — harshdeep @ 11:07 am

I need to implement a parallel algorithm using MPI for an assignment. I wanted to develop and test the algorithm locally on my Windows machine before evaluating it on the university’s mega cluster with 8-core nodes. I had heard about MPICH2 before, so decided to try it out.

MPI programs are run with mpiexec.exe. When I tried running my short sample program, I got this error

Aborting: unable to connect to HARSHDEEP, smpd version mismatch

I did what I generally do in such cases – google the error string (excluding my machine name of course).

The problem was surprisingly hard to uncover. It turns out that Matlab comes with its own mpiexec. That mpiexec is also in the path. What needs to be done is to put MPICH2’s path before Matlab’s path in the PATH variable. I found this solution in a forum post here. Apparently it didn’t work for the original poster.

PS: Here is another way to run MPI on Windows.

February 24, 2009

Don’t give mail passwords to random websites

Filed under: Uncategorized — harshdeep @ 10:13 pm

In the last hour, I have got three chat messages of this form –

hey, check out this video:  <some_tinyurl_link>

The link takes me to viddyho.com that conveniently asks me to login using my GMail password.

Yea right

It hurts me to see that people are actually falling for this – even CS students. This is Common Sense 101. They should be made to write “I won’t give my passwords to arbitrary websites” on the blackboard 100 times.

February 16, 2009

Had a bad Valentine’s Day?

Filed under: Uncategorized — harshdeep @ 10:01 pm

Some students brought an already mostly trashed car, probably from some salvage yard and put it in the middle of the busiest street (in the number of pedestrians, vehicles are not allowed) in the University today. The sign next to it said “Had a bad Valentine’s Day? Smash the car. $1 for 4 shots. $2 for 10.”

I didn’t see anyone taking up the offer when I passed. I guess that’s a good thing – everybody had a good Valentine’s 🙂

February 13, 2009

Incompetent Thief

Filed under: Uncategorized — harshdeep @ 10:22 pm

If somebody breaks into my car, I would rather hope it’s a competent thief with some relevant experience. Not like the clumsy person who, in the desperation to take out the stereo from my car, tore apart the entire surrounding panel and chopped up all the cables behind that. Even the wipers stopped working. I think this person should try some other profession. The detective found traces of blood on the panel.

Contrast this to the thief who stole a friend’s stereo – it was so clinically removed that she didn’t see a single scratch anywhere on her car. Now that’s professional.

Note: For concerned friends and family, this does not mean that I live in an unsafe area. Such acts are very rare and it’s safe here J

January 27, 2009

The Making of Latest in Music – Using Youtube API

Filed under: Latest in Music, Programming, Video — harshdeep @ 2:12 pm

This is the second part of the Making of Latest in Music trilogy (here is part 1). Latest in Music is a Youtube mashup that scrapes the listings of top songs from various websites and shows their music videos by searching for them on Youtube. This is the first time I built a web application and I’m amazed by how quickly one can build something interesting with the available tools.

An important part of LiM is interaction with Youtube. Youtube generously provides an API to access the service. Initially I didn’t feel the need to use it. All I had to do was search for a song. This can be done simply by inserting the query string at the right place in the URL – http://www.youtube.com/results?search_query=<my_query_string> and fetching that page. However, this approach turned out to be insufficient for two reasons.

Firstly, some videos on Youtube cannot be embedded on external pages (like this one). Extending the basic approach to determine whether a video is embeddable would require another http page fetch. With Youtube API however, it is only a matter of setting an additional parameter in the search request (format=5).

Secondly, the initial users complained that there is no way to play all songs one after the other. I figured this could be done by creating a Youtube playlist with those songs. This definitely required the use of the API.

Using the API was pretty straightforward. But I learnt a few things the hard way. This might be a useful read if you are going to use the Youtube API for the first time

  1. Login

    The generic Google login does not work for the Youtube API calls that require authentication. It probably works fine for other Google APIs like the ones for Google Docs. But for Youtube API, you’ll get “Service Forbidden” errors with it. You need to create a login specifically on Youtube.

  2. HTTP version

    Youtube API requires the HTTP version 1.1. If you are using Ruby (version >1.6), the default http version is 1.2 and that causes errors. You need to call Net::HTTP.version_1_1 before sending any requests to make sure the Google servers are happy with you.

  3. API call frequency

    If you make a lot of Youtube API calls in a short time, you would start getting Forbidden errors. I couldn’t think of a better way to handle it than reducing the call frequency artificially by putting a sleep between them.

January 21, 2009

Useless Comments

Filed under: Uncategorized — harshdeep @ 9:20 pm

I am sure that when Randall Munroe published this XKCD cartoon…

… he had not seen Amitabh Bachchan’s blog. Here is a sampling of comments on the latest post of India’s most popular person –

Ravi g says: January 19, 2009 at 2:29 am
Dear Sir,
waiting for ur post for so long……..great to see you back….thanks to you..

Nikki (London) says: January 19, 2009 at 2:50 am
Parnam mere dost
Good morning, I don’t know where you are at this moment, but I’ve just got back from the gym after a 45 min workout, 30 min swim, 15 min jacuzzi, 15 min sauna, feel totally pooped but refreshed.
About to start the eve family meal of khadhi chawal, so will enter your world laters, my love.

Shachi says: January 19, 2009 at 2:50 am
I dont belive is becoming a fan of a person without meeting that person….
dont kknow why but i am a huge fan of urs….
ur in perfect in everything in the world i can think of…
i am not from ur field… but for sure wana be like u at 67 all overloaded with energy… full of passion ….
and most imp. i am glad ur not in plotics…

Joshua David says: January 19, 2009 at 3:08 am
Dearest Amit ji,
Happy to read that U had a safe journey and are back home.. It snowed in scotland today, i guess the city realised that the warmt of Amit ji was not with them any more !!!
Sir ji do reply to my comment at least once… Please..
Do take care
Luv u hamesha
Luv n respects
Joshua D

shakir says: January 19, 2009 at 3:10 am
Dear Sir,
please sir show some more pictures like this.

… you get the drift. There may be some well thought out comments worth reading in there but they are lost in this sea of abject fan adulation. That makes it more like a newspaper column than a blog – no two way communication.

Update: There is a Firefox extension that removes ‘undesirable’ comments from the Youtube comment stream – Youtube Comment Snob. It uses various rules to identify the comments to be removed including the formatting (all caps/no caps) and use of profanity. I’m sure the same rules could be used to weed out undesirable comments from other sites (like Big B’s blog) as well in a generic way.

January 14, 2009

The Making of Latest in Music – Ruby on Rails

Filed under: Latest in Music, Programming — harshdeep @ 11:28 am

Last week I unleashed www.latestinmusic.com to the unsuspecting world. Keeping in touch with music is never going to be the same again. You don’t go finding the new songs, they come to you (in your RSS reader).

Coming back to Planet Earth, it’s a modest little site that I thought would be useful for me. Hopefully it would be useful to others as well. It took me less than a week to build it. This being my first web application, I was learning as I went – a seasoned web developer would probably take less than a day.

I used Ruby on Rails for development. The decision was primarily based on all the hype that the platform has been getting for simplicity and elegance. In my case, the hype turned out to be completely justified. Ruby, as a language, is sheer pleasure to write code in. Rails takes care of the mundane low-level things like maintaining connections with the databases, providing a set of powerful abstractions to work on top of. It does take some time getting used to and there is definitely a lot of scope of improvement in documentation, but once you cross the initial hurdles, it lets you be very productive.

One of the hang-ups that I have from my desktop/mobile development experience is the availability of an all-encompassing IDE like Visual Studio, XCode and Eclipse. Nobody should have to do serious development in Notepad anymore. Thankfully I discovered Aptana RadRails pretty early. It’s not without its share of annoying bugs, but I think it does the job pretty well. You can edit Ruby code, JavaScript code, layouts in .html.erb files and css stylesheets in the coziness of the same IDE and it lets you visually debug the code while running the application locally. TextMate is a popular choice of Ruby developers but it is available for Mac OSX only. Aptana is cross-platform.

The next question was where to get the application hosted. I first tried GoDaddy because I’d used it before to register domains. They do support Ruby on Rails but for some reason I could not get my app running with them. I tried contacting their customer care and they duly told me that it’s not them, it’s me.

Being a newbie, I thought it would be easier for me to host my app with one of the new hosting providers that focus exclusively on Ruby on Rails apps. Surely enough, I could set it all up with HostingRails in a couple of hours. Their FAQs section turned out to be particularly useful.

Overall, it was fun working with Ruby on Rails. I’ll hopefully use it for more projects.

Older Posts »

Blog at WordPress.com.