Tuesday, December 11, 2012

Who is Wayne Gretzky.

"I skate to where the puck is going to be, now where it has been". I got this quote while I was reading the book Presentation Secrets of Steve Jobs. I was intrigued but I could guess that he must be an ice hockey player since the term puck is used in that context. A little search in Wikipedia confirmed my guess that he is an ice hockey player. Now He is not just any ice hockey player but rather that greatest ice hockey player.

You can read more about Wayne Gretzky @ Wikipedia. Ice Hockey as I know is fun for the part where players can officially hit other players. Wayne is of the view that fighting in hockey is not good. That's great for the sport but for people with weak association skills it takes away a great crown from the same.

Tuesday, November 22, 2011

Code that generates code

One satisfying exercise that I carried out today was to automate a seemingly mundane task :-) Using Velocity templates and some reflection in Java I was able to create a bunch of Transfer Objects from Java classes to Objective C source code. No verbose xmls were required but just the jar containing the classes and voila. 234 Objective C classes generated in under 10 secs.

With the prevalence of patterns in programming and seemingly routine stuff that we write one way to make things interesting would be to not write the code itself but write code generators that produces the required code. This would be especially valuable in code bases where multiple modules all have similar code but differ only due to the attributes of the source classes.

Thinking in terms of meta programming would also mean that LOC's of generated code does not matter. If you can do it for 1 class then you can do it for any number of classes.

Some things I see as a potential problem
1) Version history of the generated classes would be meaning less. They would be a by product of code generators version history
2) Exceptions in logic individual modules would lead to lot of branching in code generators.

I feel that the typical service calls, data mapping from layer to layer etc. are excellent candidates for Code generation. This also would be much much more interesting than simply churning out routine code.

Tuesday, November 15, 2011

Dichotomy of Fame

Since the music of Rockstar has released I have must listened to the entire album atleast 50 times. The album is incredibly deep and Mr. Rahman never ceases to surpass himself. While enough has been written about the popular numbers sung by Mohit Chauhan , there are few other hidden gems too. The two instrumental tunes that are equally brilliant are the Tango for Taj and Dichotomy of fame.

Dichotomy of Fame is a beautiful layered song with a classical guitar and nadaswaram. The subdued plucks of the nylon string adds a wonderful life to the soulful sound of nadaswaram. The way these two instruments alternate as lead instrument is seamless. You can almost visualize a spanish beauty swaying to the music. The melody of nadaswaram seems heard before but the guitar's backing sound gives the song a unique feel. And as it is with many songs of Mr. Rahman the diverging melodies resonate into a brialliant finale as sound progresses. You just think that this is how its meant to be.

All you guitarists/keyboardist's this is a wonder song to transcribe

Monday, November 14, 2011

TSP and TDD


One of the goals I had started this year was to model the Travelling Salesman Problem as a Coding Kata exercise. The benefit of the same would be three fold
1) Get an exposure in trying to solve the problem
2) Get a hang of modelling the problem using OOPS
3) Using TDD to develop the solution

While I have not solved the problem fully the solution developed till date is satisfying. The classes that have been created seem to be apt for the job that they are doing. They are not too verbose and following TDD has resulted in beautiful abstractions. The solution developed till date has flexibility to use multiple algorithms to solve the problem and at the same time can visualize the solution

While reading about TSP came across a lot of other interesting facts namely
a) Seven bridges of Konigsberg
b) Hamilton path

Rather than doing old age CRUD problems liked Library Management and others we should have folks practice algorithms and solve them using computer programs. I think that's a more involved exercise and keeps everybody interested. It's especially fun to pair up with and try solving the problem

Project available on github @

Saturday, November 12, 2011

Setting up a Mac machine

For quite some time I was thinking about getting a Mac based machine. My interest was primarily for learning the Mac and the iOS platform. I had made quite a lot of investment on Win and Linux based platforms so wanted to keep the cost to as minimum as possible


There are quite a few devices available for Mac

1) iMac : All in one desktop costing around Rs 70-90k

2) Macbook Pro: Sturdy and sleek laptops. If you have the cash for the same go for it. It starts from Rs 70k and goes till Rs 125k

3) Macbook Air : Sleek and stylish. I found it too fragile for my use

4) Macbook: It’s basically one notch below the pro and costed close to Rs 60k. Not worth it.

5) Mac Mini. Just the core of a Mac machine with no display/keyboards/tracking device. Incredibly small box. Costs around Rs 34k


After spending close to 2 hours at the shop I finally decided to go with Mac Mini. I persuaded myself by promising that with the extra Rs 40k I saved ( by not going for a Macbook pro) I can gift myself a iPad2 J


While a simple USB keyboards and mouse will do I will recommend an apple keyboard and magic trackpad.


The experience on Mac so far has been satisfying. I was able to setup the internet connection connect to a monitor using the bundled HDM to DVI adaptor. I was also able to hook up the internet connection using photon+. I had to get the dashboard software from Huawei site.


Xcode is a huge software ( almost 3 gigs). However my primary objective in getting a mac was to get the hang of Objective C and iOS platform so I did not have a choice.


I have a Viewsonic monitor ( VA2226w) and it has both DVI and VGA pins. So I have hooked my mac and win based machine to the same display and can swich from one to other at a click of a button.


Win7 is not all that bad but there is no clean option to try out iOS development and entire java setup with all app servers db’s ide’s are in Win environment. Additionally I have a host of virtual machines within windows ( Solaris, Slackware, Ubuntu etc.) which are handy

Sunday, January 23, 2011

Arthur and Zach

There was a great bang. Nobody heard it. Arthur heard it. Zach reacted. Nobody was sure whether it's real or not . I liked it. A bang at the start makes me feel like the narrator with booming voice.

"It's a dream. I am going to wake up any minute now" thought Arthur.
It was not a dream. I did not wish my characters to think that my imagination is their dream. Arthur woke up. He rubbed his eyes and slapped himself hard. I was happy

Well getting back to the bang let me proceed with the story. It's not everyday that the characters you make up have a say in how the story proceeds. What's the fun in being a writer then.

" You are going to miss the bus , Zoe. Move it now !!!" yelled Arthur. Zach scratched a bit.
" Who the hell is Zoe?" I wondered.

Zoe was Arthur's 8 year old daughter. I was surprised and angry. Surprised because this was my story and no character got created without me creating it. Angry as Arthur seemed to have found a will of his own.

"It's all good!!" I calmed myself. Arthur looked me in the eye. I wished to make peace. I could have bought Mount Everest on top of him but was not sure where to take my story from there. Zoe was pretty like any 8 year old. She was all set up in her little checkered uniform complete with bag, lunch bag and water bottle.

"Bye Daddy" chimed Zoe as she boarded the bus. Maybe the bang must be the loud honking of big yellow bus.

It was a nice day. Warm and sunny. A nice breeze flowing over the garden nearby bought the fresh whiff of air. Arthur stayed there for a moment. " I am going to enjoy this day. I am going to enjoy this day come what may!".

I cleared my throat. I expected a reaction from him. I am your creator. I did not sense a tone of request or prayer in what Arthur said. Arthur went back in.

"Did you actually go till the school to drop Zoe off??" inquired Holly, rather sternly. I smiled. Arthur snapped as if he head heard a ghost. " Who the hell are you?? " Arthur stammered.

" Meet your wife, son" I whispered.

"Take Zach out before he pees all over the house" came another round of orders.

Pretty soon both master and dog were out. There was nothing better any one of them could have done at that moment. I felt content.

What I was feeling after doing this was well in the spectral range between benevolence and ruthlessness. Another day another way.

Friday, December 24, 2010

The last week of the year

The thing with getting old is that you that like to look back. The more you old you get the more you like to look back because the more there is to see. Well, let me get to the point. the last week of the year generally tends to unfold the same way every where. The anticipation of the new and the reality of the past often puts people in decisive mode.

It's been 3 score years on this planet and I still feel sometimes that I have not drafted a course that I can look back at and figure out where this will lead to. Life it seems has its own course that we are following. It's not destiny but I am sure there is some amount of control that we are not aware of. Is it God or is it chance?

Well I am more philosophical than I used to be (Another definite sign of getting old) but I can't help wonder. Solomon the wise king of the old testament lamented " Everything is vanity, vanity of all vanities". I feel the same (Of course that does not put me in the same league ;-)). It definitely helps to see what have we done for the year that is not vanity. What should we do to control the controllable outcome of our actions. Perhaps its time to to submit ourselves to the higher power within us to discern what truly will hold and create a course.