Friday, October 24, 2014

Diwali lessons on money

Over the years I have tried to learn as much about capital markets as possible. It's a fascinating industry that lubricates the wheels of industry and economy. Without the modern capital markets quite a few of our beloved innovations would have been challenged. I maintain that our capital markets, as they are, are necessary (but maybe a little lopsided with respect to rewards to those employed - that's for another post)

Lesson one (or maybe Lesson Zero) - Asset Vs. Liability

Every investor has to first learn the hard factual difference between an asset and a liability. I have very painfully over the years understood this and got to a stage where the incremental liabilities have been reduced. Well, I never had loans or credit card debts but I was engaged in activities that cost me money instead of creating wealth. One such is the bike I own - a Royal Enfield Thunderbird 500. No doubt its a great machine and lots of fun to drive, but its maintenance is akin to owning an elephant as a pet - impressive when you ride, but otherwise keeps draining your resources. The last time I had a flat tyre, my laziness took over and I got it repaired only after 3 weeks - 3 weeks of no expenses. Otherwise every other month, the bike goes to the service center and costs me money in repairs - small trickle but endless nevertheless. As with all liabilities, it brings no tangible value to me. And the intangible joy element - I should have stuck to my old Pulsar, since I am more of a traveler than a motorcyle enthusiast - so long as the two wheels move my soul, I am at bliss.

Lesson two - See things for what they really are. 

Investing is not rocket science. If you have common sense, you can become a very good investor yourself. As your investments grow, your knowledge grows and you become even better. But for this to happen, one must first accept and overcome one's blind spots. As a layman, one must begin to see everything in front of them for what it truly represents. Coming back to my acquisition, the TB 500, I massively failed to realize of what it truly portends. I understand bikes. I understand the passion that a "Bullet"/ "Royal Enfield" invokes in millions in India. I have been meaning to own one since ages. Back in 2012 when I test drove the new Thunderbird 500, I fell in love with the modern machine - the ease of handling, the power of the engine, the stability of the ride. This was beginning of a new era for Eicher Motors. With that one machine they unlocked the potential of the brand. As an enthusiast myself, I instinctively understood the thousands of dreams it was going to fulfill. What I completely missed is what it would do to the balance sheet and profit & loss number of the company. As Peter Lynch says in his book "One Up On Wall Street", I need not be brilliant to launch my portfolio into an orbit. I simply need to keep my mind open. With the launch of the modern bike, the only way for the revenue numbers of the Eicher Motor Company to go was up.

The magnitude of the mistake

So the mistake I committed - The stock price of Eicher Motors rose from Rs. 2258 (Oct 1, 2012 when TB 500 was launched) to Rs. 11890 (today) - that's 5.26 times. Rs. 35,000 invested in the company stock at that time would have allowed me to buy the motorcycle today without any additional expense, a mere two years later. And if I had been wise enough to have actually invested the whole amount I spent in actually buying the bike at Rs. 178,000, I today would have had a cool Rs. 936,000 and could have bought the new 'Cafe Racer' with money to spare. Instead all I have now is a liability that sucks money out of my poor incomes.


There are several mistakes I have made with money, but this one rankles quite a lot. Happy Deepavali folks!

Tuesday, May 01, 2012

Retrieve Amazon EC2 windows password

I recently was given to work with an existing Amazon EC2 AMI without having the benefit of the previous key-pair. Additionally when the AMI was created the Set Password was not enabled. This led to the problem that even though the AMI could be used to launch a Windows EC2 instance, we could not login.

To surmount this, we need to make use of an Ubuntu linux instance launched on Amazon EC2. Following steps help in recovering the password.


  1. Launch a Windows instance from the given AMI. Use your own or newly created Key-Pair.
  2. Stop the instance and detach the volume which contains the root partition. This is usually /dev/sda1. The root partition contains the setting for Set Password. (C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml)
  3. Launch a micro Ubuntu server instance. We do not need a larger instance since it is a simple operation.
  4. Attach the volume detached in step 2 to the Ubuntu instance under /dev/xvdf.
  5. Login into the Ubuntu instance via ssh or whichever way you do.
  6. Create a mount point  sudo mkdir /opt/tempm/
  7. Use fdisk to check the correct volume to mount sudo fdisk -l This will list two volumes - /dev/xvdf1 and /dev/xvdf2. Of these xvdf1 is the boot partition, and xvdf2 is the one containing the requisite file.
  8. Mount the Windows NTFS volume onto this directory using: sudo mount -t ntfs-3g /dev/xvdf2 /opt/tempm/ Take care to include the "2" in xvdf2 otherwise you will get errors.
  9. Once mounted, navigate to the configuration windows directory. cd /opt/tempm/Program\ Files/Amazon/Ec2ConfigService/Settings/
  10. Use your favorite editor to launch the config.xml file using sudo sudo vi config.xml
  11. In this file, change the tag from "Disabled" to "Enabled". Save and exit.
  12. Unmount the volume sudo umount /opt/tempm/
  13. Detach the volume from the ubuntu instance and reattach to the Windows instance. When attaching to the Windows instance take care to use the right mount point - "/dev/sda1". Otherwise the disk will not be treated as a boot partition.
  14. Start your windows instance and use "Get Windows Admin Password" to recover the password using your new key-pair.

Note: Obviously if the "Set Password" had been set correctly while creating the AMI, this problem should not have arisen. Please let me know otherwise in the comments section.

Thursday, March 29, 2012

Cassandra with Hector - Eclipse project

I have been mucking around with Cassandra to see how big data works. I am mainly a Java programmer and needed a client to use in Eclipse to connect to Cassandra. In comes Hector. There is the Cassandra tutorial. I am essentially still on the Ant system (will learn Maven someday for sure). Now it requires that I have the correct libraries in the classpath to run the examples.


List of libraries required to run the examples using Cassandra 1.0.8 and Hector 1.0.6:

  • apache-cassandra-thrift-1.0.8
  • commons-lang-2.4
  • guava-r09
  • hector-core-1.0.3
  • libthrift-0.6
  • slf4j-api-1.6.1
  • uuid-3.2.0

This isn't exhaustive. One could possibly include all the libraries in the Hector-core. Some of the jars can be found under cassandra/lib folder. Additionally, the Hector project now tracks the Cassandra versioning system. So look for an upgrade to 1.0.8 sometime soon.

This post is intended more as a collection of sources than a tutorial. Hopefully will update this into a full blown "how to" guide.

Monday, August 23, 2010

The Millenium Trilogy (Book Review)

It had been a long time since I had read fiction at any length having being busy with work and myriad such excuses. So when I had made up my mind that enough is enough, I went around, asked and looked for a good read. Given the history of my reading habits, I knew nothing short of great would get me interested. And then I found Stieg Larsson of The Millenium Trilogy fame and his lead protagonist Lisbeth Salander.

At the very outset I will admit that I have been bowled over completely by the contemporary and adult storyline, that involves themes like hacking, espionage, secret service, sex, activist journalism, and a potpourri of themes without losing the actual thread of the story.

Lisbeth Salander is one awe-inspiring woman, inherently moral and very much the sociopath in the everyday sense of the word. But she's much like John Nash, in that they share the common belief that if I can think, I can do pretty much everything. Remember that John Nash defeated schizophrenia by thinking and analyzing. Lisbeth Salander destroys the secret behind the all powerful sapo, the most clandestine of operations in the Swedish secret service. While some reviewers frown upon the use of violence by her as illegal, I like the fact that an individual is able to defend her own space when the system has not only ditched her, but also has systematically exploited her for its own needs and ends. Her individualism stands out almost in  an Ayn Rand way - remorseless and unrelenting. And it is probably the same when she bonds with people she likes and respects - complete and without inhibition.

The other main character is that of Mikael Blomkvist, an investigative journalist who lives to make that next expose that will bring down the most corrupt, whether it be humongous corporations or secret within sapo. He also lives to make love to strong women. And he does both with nuance and flair, treating them like the art that they really are.

The book left me flipping pages as fast as I my eyes could travel and my brain could process. Besides the storyline of murder, mystery and intrigue, the book trio also paints such beautiful colors and bleak shades of gray of the Swedish people, culture and countryside, that by the end you feel that you know it all. And did I add that all topics are dealt in such detail so as to leave the layman spellbound and the connoisseur impressed.

My recommendation: If you haven't read the trilogy, your should. Period. 

I am also eagerly waiting the Hollywood version of the trilogy - hopefully they pick a good team and do justice.

Saturday, August 21, 2010

Purchasing Power Parity

We have on varied and multiple occasions breathed long and vocal sighs when we hear the large dollar/pound/euro salaries and benefits that our very close and dear friends earn when they work in developed countries like USA, UK, Netherlands, Australia, etc (at least I do this purposefully on every occassion :)) What we tend to dismiss with the wave of our hand or the flick of our finger is their living expenses based on a certain minimum lifestyle in such countries. Obviously this applies to people who have stayed back for some duration like for say 4-5 years and not the other set of friends who were there on a short stay (how they behave is beyond of the scope of discussion in a blog post!) And this is where we should think of Purchasing Power Parity or more commonly known as PPP.

PPP: In simple terms it is difference in cost of a Big Mac at McDonalds in your native country vs. in the foreign country you are comparing to. Or you could say it is the cost of a meal/ movie/ party/ car/ house/ etc. in the countries you are putting in the comparison bucket. Again always look at averages across items, and across geographical regions within each country. So the coffee your NRI friend buys for $4 you can very well buy for ₹25 here - its like saying that the value of $4 is the same as the value of ₹25.

Are there any standard measures: Not really. Over the years various economists and organizations have tried to do something in this direction without much success or recognition. Although the Big Mac Index has some popularity in this matter - it was first popularized by The Economist. It essentially tracks the price of a Big Mac produced and sold across 120 countries that have a McDonald's outlet. Since this burger is a standardized product it is very loosely indicative of PPP or currency under/over valuation. Again, it is not a serious economic indicator, as in no country would probably base its economic policy on this. But it comes in handy when you want to write a post like this !

Why should I be bothered: Well, we probably wouldn't even use it in our day-to-day life unless you are economic policy advisor to the Government of India. But it helps to look at things in perspective, and realize errors in leading media articles like this on TOI today. I usually am wary of our media - half the time their content and the journalistic quality is such crap such that I cringe to pick up the morning newspaper. Some have gone so bad that their editorials come out as incoherent jingoistic babble in favor of the babus and netas. But this particular piece takes the cake pretty near the bottom. Aren't newspapers supposed to raise awareness about issues that people are concerned with ?? And not mislead the junta ??

Oh, by the way, my favorite newspaper is "Bangalore Mirror" - flawless and entertaining in their coverage of storm drains, petty theft, celebrity sightings, and your sex problems! What more can you ask for ??