Monday, December 31, 2007

Open a beer bottle with paper


If I knew this during my college years my teeth would've been in better shape now :)

For more life hacks head here.

Wednesday, December 19, 2007

Giving up on Ubuntu


I have an old hp laptop (1.3 GHz, 512 mb RAM) lying around on which I'm trying to install Ubuntu. There's no reason for it, but I had just backed up all stuff on it to another machine and I thought I'll give Ubuntu a spin.

I downloaded Ubuntu 7.10 burned it onto a CD and booted it up. After that the experience so far has been real bad. I ran into all sorts of issue. Listed some of them below

  1. Initially I tried various languages in the installation screen, complex script was completely broken. I understand if an installer doesn't support Bengali or Hindi, but in that case the option shouldn't be in the screen, specially when it's not even readable. On top of it language switch wasn't painting the screen correctly
  2. Installer went on broadcasting some sort of weird garbled sound (I guess garbled due to CPU stress)
  3. It booted up into a brown screen without any option to do anything. I waited couple of hours and figured out something is wrong and rebooted again into some safe mode
  4. After a long time it did come up but the UI was sluggish to the point of not working
  5. I clicked on the install icon and nothing happened for a long time.
  6. Now I'm stairing at a fancy screen where the cursor is frozen and the CD is making sounds as if it wants to join F1 racing.

I know the Linux fanatics will sham me as a fool and point me to all sorts of hacks and stuff I can do. The problem is that I'm really not interested in tinkering with installation, I'm used to them just work. I'm not an admin and couldn't care less about these things. For me getting it up and running so that I can do the stuff I wanted to do is more important.

Right now I'm at the point of giving up and moving to some other Linux distro. I'm out of touch with Linux for a long time (~6 years) and I guess I need to look around. Hopefully Red-Hat and Mandrake will work for me.

Friday, December 14, 2007

Bar Charts on the console

Golconda fort arches

I work on the UI action recorder and it has a strict performance requirement. The tool dumps the time it takes to record each action in it's log and that is compared against the maximum allowed value (otherwise the system will seem sluggish). To do this obviously we need fancy charts, as everyone likes them, other than of course the alpha-geeks :).

However, I like the console chart. Way back my mom used to work on Main-frames that ran COBOL on them and dumped out business data on paper at the end of the day. These reports had these printed bar charts.

I wrote a small ruby script to dump these charts on the console. The output looks like

D:\MyStuff\Code\Ruby>perf c:\logs\Recorder_20071118_144855.843.log
c:/logs/Recorder_20071118_144855.843.log ===============================>
640 ********************************************************************************
0 *
109 *************
0 *
46 *****
0 *

Serves the same purpose as their fancier counterpart but manages to look uber geeky.

Support for range in programming languages


The .NET platform and the languages on top of it have limited or no support for range of values. Data ranges are one of the most common data-types and somehow it's not there. Funnily most programmers do not even seem to miss it (unless of course if you have used Ruby).

How would you specify a valid range of age and validate user data against it? If you know the maximum and minimum values, at max you'd define a MaxAge and MinAge consts and strew the code with if(age < MinAge|| age >MaxAge). Or maybe you'll define a class to encapsulate this and add a IsValid method.

However, in Ruby, Range is a standard DataType like say string. To do the above processing you'd do

age = 1..120

print age.include?(50)
print age.include?(130)

print age === (50) # more easier way to do include? test using the === operator

So intuitively you create a range using start..stop.

Creating a range of data is also very simple. Say you want to generate the column numbers for an excel sheet, you'd do the following

column = 'A'..'ZZ'

column.to_a # creates an array of all the values

column.each {|v| puts "#{v}\n"}

Similarly ranges can be easily created for any class by implementing some special methods. On ruby the support of Range is in the compiler and makes the code very easy to develop and intuitive.

>>Cross posted here

Wednesday, December 05, 2007

Fun Windows Home Server site


Windows Home Server team has a nice light-hearted site up at All of it was funny, until I reached the page It says "daddy wants to give mommy a special gift.... So he buys a stay-at-home server".  That's not funny, "Wife Acceptance Factor" would be reflecting nitrogen freezing point for a home server.

You can sneak one in, understate the price and show all the image streaming to kinda buy acceptance, but a gift, no way :)

Saturday, December 01, 2007

Choose your company name well


Picture 057

Sometime back Hutch phone in India got bought over by the international phone giant vodafone. They re-branded Hutch in India to Vodafone.

Now when I call up home and the phone is busy I get a recorded message in Bengali which means "The Vodafone number you're trying to call is busy". All that is good but the problem is that vodafone in Bengali exactly means foolish phone. So I just hang up and wait for the foolish-phone to get free.

Friday, November 30, 2007

Ravenous Bugblatter beast on Indian roads

From the HitchHiker's Guide to the Galaxy.

"The Ravenous Bugblatter Beast of Traal is a creature that hails from the planet of Traal, and will eat anything. If you are to encounter one, the Guide tells you that it's impossible to slay, so you should wrap a towel around your head. This creature is so mind-bogglingly stupid that it assumes that if you can't see it, then it can't see you."

I felt like one while on a road-trip to Visakhapatnam and surely you'll feel like one on Indian roads. We were going at high speed and suddenly we see someone crossing the highway. We honked hard and the person simply looked down. So the idea is that, if he can't see you, then you don't exist. Or maybe they were using the SEP field technology.

In the following video watch the first person crossing the road and next a cyclist goes in the wrong direction as we wiz past at 120kmph (75 miles/hour).

Newbie Question: How do I figure out the inheritance chain of a type


I got this question from someone just starting out on the .NET platform. He is used to hit F12 (go to definition) on types and then figure out the inheritance chain. However, he couldn't do that say on a number (int) or array.

The solution is to write a simple recursive routine as follows

static void Dump(Type t)
if (t != null)

The routine can be called as follows

No marks for guessing the output though :)

Thursday, November 29, 2007

Woohoo - Rosario November CTP is out...


...and I can finally talk about what I'm working on for the last so many months.

First things first, for more information on Microsoft Visual Studio Team System code name "Rosario" November CTP release head on to Jeff Beehler's blog

A small bullet in the list of features is Manual Test execution. What it means is that you can now record you manual tests and play them back. Yes, it means you have a UI record and playback feature in the Manual Test Runner!! It's not a full fledged UI automation solution for now. It is mainly targeted to speed up manual testing so that the manual tester can zip past the part which she is not interested in testing. E.g. the manual tester can record the login, purchase pages so that she can play them to directly land in the final checkout page and do manual actions/validations on it.

The solution works for web-UI (IE pages) and also has very limited support for Win32 applications.

I work as a part of the team that develops the record and playback (RnP) framework. It's been an excruciating working on a great technology but not being able to publicly talk about it. Thankfully that time has ended :)

Wednesday, November 28, 2007

How do you name your computer


Windows gives examples of "Kitchen Computer" or "Mary's Computer" for setting the name of a computer (Computer Name tab in System Properties). But I'm sure that most people don't name their computers that way and show off a bit of creativity in it.

Previously I used to use names from Asterix like GetAFix for my main dev box. Now I exclusively use names from Hitchhiker's Guide to the Galaxy. Some of the machines I use are named as below

  1. traal: My test box
  2. Krikkit: My dev box
  3. Vogon: A old vintage machine I have at work which I use to test some perf scenarios (Vista on 512mb RAM :^) )
  4. Hooloovoo : My personal laptop
  5. Bugblatter: Another laptop

What name do you use?

Tuesday, November 20, 2007

True object oriented language



Today I was spreading the goodness of Ruby and why I love it so much (and you can expect multiple posts on it). SmallTalk programmers can sneer at me, but hey I wasn't even born when SmallTalk came into being and hence I can be pardoned for pretending that Ruby invented this :)

Languages like Ruby are "truly" object oriented. So even a number like 2 is an instance of the FixNum class. So the following is valid Ruby code which returns the absolute value of the number.


Taking this to an extreme is the iteration syntax. In C# to write something in a loop "n" time I'd be needed to get into for/foreach syntax, however in Ruby I can do the following

5.times { puts "Hello"}

Which prints Hello 5 times.

However, I actually lied about having to use for/foreach statement in C#. With the new extension-method/lambda goodness we can very well achieve something close in C#.

For that first we create the following extension method

public static class Extensions
public static void times(this int n, Action a)
for (int i = 0; i < n; i++)

Then we can call "times" on an int as easily (well almost as I still need some lambda ugliness).

5.times(() => Console.WriteLine("Hello"));
// Or
6.times(delegate { Console.WriteLine("Hello"); });

All programming languages evolve towards Lisp


2007_01_28 120

In an internal DL people were debating what all should be included in the next version of C#. One of the things I suggested turned into an interesting thread.

Abhinaba: Add if as expression (like in Ruby) so that I can do the following

var ageGroup = if age < 2
               else if age < 19

SomeOne: Can't we do

var ageGroup = ((age < 2) ? "Infant" : ((age < 19) ? "Teen" : String.Empty));

Abhinaba: We can but put 4 more cases and it’ll start looking like Lisp :) with all the parenthesis.

SomeTwo: All programming languages evolve towards Lisp.

Yeah, right!!!

Monday, November 19, 2007

Lack of Aspect Oriented Programming support in .NET

I was preparing for a presentation on Aspect Oriented Programming and I started re-looking for the solutions in .NET.

I'm personally not interested about any of the dynamic methodologies, be it dynamic weaving or any other form of dynamic proxying. To me CLR is static-typed and I'd want any solution to be the same (on DLR I'd definitely accept a dynamic solution). Predictability, performance, debugability are  major concerns that are not well addressed in dynamic methodologies. Some of the Dynamic approaches also have special requirements like they can only support virtual methods as join-points.

To me the perfect AOP solution on .NET would either be an IL weaver which ships as a post-compilation tool or an extension language. AspectDNG and EOS are good example for the two approaches respectively.

Wikipedia had a bunch of links and I tried couple of them. It seemed like most of the tools uses dynamic approaches and had the same issues mentioned above. From the static tools I tried AspectDNG's IL weaver. Even though the weaving was good it didn't update the pdb files resulting in very poor (or no) debugging experience. I tried EOS and liked it a lot. However, the project seemed to have died with no updates for a long time.

I think something serious needs to happen in this space. Either Microsoft or some other large body (serious open source project ?) needs to pick AOP up to make it successful in .NET. To me the tool of choice would be extension to the C# language in the same lines as EOS (or AspectJ).

There seems to be already some work going on like the Policy Injection Application Block which works over .NET remoting.

Saturday, November 17, 2007

The WOW factor in software


I care a lot about the nice nifty features that takes a software from being just a good software to a great software. It makes me feel that the developer really cared. I know how features are cut and these making it to the product indicate a mature, well thought-out execution.

Joel in his How to demo software writes

"bump into all the nice little “fit and finish” features of your product. Oh look, that column is halfway off screen. No problem. I’ll just drag it over. (“Wha!” the audience gasps, “you dragged a column in HTML?”) Oh, look, this feature is supposed to be done by next Tuesday. I’ll type “next tuesday” in the due date box. (“OMG!” they squeal. You typed “next tuesday” and it was replaced with “11/20/2007”)."

I absolutely agree to this. I've seen Microsoft Office time and again do that. The first time I fired up a PowerPoint presentation on a dual screen I gave that same squeal "OMG! the slide show start on one and I get the presenter view on the other with full access to the notes!!!!". Even 3 days back I used the same mode for a presentation on Aspect Oriented Programming and felt happy about using the product.

However, there's the other category of software which doesn't work in first place and tries to be smart on top of it. There's nothing worse than this. You look at these in disgust and head over to the dumber but working competition.

Friday, November 16, 2007

Don't forget to lock your Computer

So Amit pointed me to this post on Coding Horror (I didn't get time to read any of the feeds for the last 2 days!!). It's about colleagues playing pranks with folks who leave their computer un-locked. I myself have done couple of these stupid but amazingly successful ones like taking screen shot of the desktop and then making it the wallpaper. Then you hide all visible things on the desktop so that the user on retuning goes on clicking on them without any result.

However, these days at Microsoft the prank has changed. On returning you just get to see an email typed out, addressed to Bill Gates. I don't even want to get into the topic of what is typed. The effect is amazing and permanent. Win+L keys become etched in your reflexes.

Monday, April 23, 2007

I just heard from a friend that my ex-colleague Sachin Gaur has passed away. He comitted suicide unable to cope with the pressure of our profession. He used to work with me in Adobe. He left behind his wife and son.

Sachin was a very kind person. When I bought my car, he drove it back from the car showroom as I was a bit unsure of driving it. I still remember him advising me to driving slowly and safely on the way back.

This is me with Sachin sitting beside me at a office lunch at the Noida Radission. May his soul rest in peace.