Tuesday, July 31, 2007

Random Thoughts....

Justice at last...

I often fail to understand the Indian audience. There is this guy who's accused of holding a 'kaleshnikov' goes around the world teaching 'गांधीगिरी' and guess what he's a big hit. It seems no one gave our 'मुन्ना' a toy gun when he was a kid, so when he became 'भाई' he got ihim self a kaleshnikov instead. You know those unfulfilled dreams of childhood. Finally there is justice though. I know this is going to be symbolic and doesn't mean much, but it still a blow in the face of crazy audience... There is going to be a supreme court appeal and if in the worst case Mr. Dutt goes to jail, it's going to be nothing beyond change in address.


Good Job Mr. Y V Reddy

Reserve Bank yesterday increased the CRR by 50 basis points, almost "unexpectedly", squeezing away 150bn rupees in liquidity. This was a great job by Mr. Y V Reddy, who walks his talk. This shows Mr. Y V Reddy is more "concerned about economy than stockmarkets". Great job sir!!


Smiles on the face....

It would have taken a heart to go short yesterday evening. Something told me I should and guess what I did.. The logic (ok it is easier to explain stuff when it proves right.) but here's the logic. Yesterdays rally towards the end resembled something. (see the chart below, taken from icharts.in ). It told me, if there was a chance of going short it was today and if I was wrong, doesn't matter, cover it up with a stop loss at 4550. They say in minyanville , if you are disciplined, you can pretty much do anything. Discipline is the key.. that is the lesson that I have learnt in my short and 'not so much to write home about' trading history.

Oh well and while I finish this markets might have rallied past the dip, but thats market for you!!



Anyone interested in reading charts about Indian stocck markets, icharts.in is your answer. it is really really very neat. It's not yet my dream charting software, but closest to being useful..


Disclaimer: The stuff discussed here about the stocks is a personal opinion and should not be treated as an investment advise in any way. Investments should be done solely on the personal opinion and risk appetite.

Sunday, July 29, 2007

wordsilearnt.com is up now

A bit of an announcement. I was working part time on an application called "wordsilearnt.com". It is finally up and in a usable state now.

It's basically a simple application, which allows one to save and share the words they learn. I used to come across several new words and didn't do anything about them. Thought this would be a nice useful application and in hindsight I was not wrong! ;-). Or to give it a web 2.0ish name, it is a "social vocabulary building" application. Sounds sexy right? ;-)

I am planning to add a few features in the coming days.

For those who are on facebook, if you like the app, please add this application, so that I can get 5 users and then can submit it to Facebook directory. Here is the application URL on facebook if one wants to add it.

http://www.facebook.com/apps/application.php?id=2397064823

Enjoy!!

Monday, July 23, 2007

website screen capture in ruby - HowTo

For one of the projects that I am working on, I needed a website capture utility, that will dump output into a png file. I couldn't find any one-stop-shop for getting it done. There are many websites that have this service (see references towards the end in the post), however I needed something where I have access to the source code, so that I could tweak it to my needs Also something in ruby was prefereable, so that I can integrate it with other stuff I am working on. Google, google and google and finally I hit upon an implementation in ruby called moz-snapshooter.rb, which has got a good screen capture facility that uses 'gtkmozembed' , which is an embeddable Gecko rendering widget that GTK applications can embed. This was pretty much it. All that was needed was the ruby binding for gnome2 libraries etc. They can be found here.

So here is the final deal (on ubuntu Dapper) -

1. Get the ruby-gnome2-all package from here

2. Get the firefox-dev package using apt-get. (Note this is required for building the gtkmozembed.)

3. Get the moz-snapshooter.rb

4. Edit it to your needs

5. Fire ruby moz-snapshooter.rb

Most of the things just work out of the box.

Now comes a little tricky part. All of this requires an X server running. So what if one wants to run it on a headless X server? The answer is Xvfb (which is a virtual frame buffer based X server.) Continuing further.

6. Install Xvfb using apt-get.

7. Finally run the 'ruby moz-snapshooter.rb' inside 'xvfb-run' as follows
xvfb-run -s "-screen 800x600x16" ruby moz-snapshooter.rb

Note to pass -s "-screen 800x600x16" option, since most of the websites work well in that resolution.

Caveats:

1. The libgtk-mozembed-ruby package that comes for 'ubuntu' uses the gtkembed.so library provided by mozilla 1.7.X (which is not compiled with pango renderer. It is better to use firefox-dev library and hence build by hand the ruby-gnome2-all package.)

2. The final output resolution image should be of smaller resolution than the one passed to xvfb-run.

3. This is not 'perfect' yet, but a good starting point.

Here are some samples.

1. Google in 150x100 resolution -



2. paahijen.com in 320x200 resolution -



3. Marathi wikipedia in 640x480 resolution -




References :

1. A pygtk implementation by Andrew McCall
2. moz-snapshooter.rb by Mirko Maischberger
3. Ideum screenshot capture prototype

Friday, July 20, 2007

Best sumanism Ever

Suman has got talent for almost everything. He's one of the smartest coder I have seen. He's a very good singer, a good artist, can cycle for 50kms. I don't know of a thing, which suman can't do, I mean can't do well. But I guess his best talent, is for writing. I'd definitely make a blog dedicated to sumanisms. but this is the best sumanism ever.

"Wikipedia is google in O(1)"

Just too good. !!!

Thursday, July 19, 2007

just can't seem to get it?

Anybody following the stockmarkets for the past couple of weeks should get puzzled and have shorted it (like me), should get frustrated!! The things just aren't falling in place, but it doesn't matter, the markets are rallying and thats it.

- starting July 2 Indian stock market has rallied by 5 and a half percent.
- In this rally there have been all but two days of decline (which had a 0.25 and 0.43 percent decline.
- If we go back a little, in last month the markets have rallied by almost 10 percent (common is this Shanghai or something?)
- Not a single day of more than half a percent decline in 20 trading sessions, the highest decline is 0.46 percent.)

And all of this comes when
- most of the global markets have shown some intermediate corrections, but bulls at the Dalal street seem to be unfazed by that. Only possible exception is wall-street, which did have a hiccup or two but thats it nothing beyond that. Yeah all of this when a little over billion dollar gotten wiped out in the Bear Sterns Hedge fund, which is just the tip of the subprime iceberg. The dollar is at its weakest against Euro and pound.

- When the crude price is hovering around $75 per barrel

- When we have two successive weeks of increase in inflations. (up by almost .25 percent from its low.)

- When during the days for which I have observed, FIIs though buying in cash segments, have been in net short positions in Stocks futures and Index futures to the tune of 2000 Cr. rupees (not to mention tons of 4400 and 4300 nifty puts, which are going to go down the drain, I suppose)

- When none of the quarterly earnings being spectacular per say. (Infy disappointing, TCS goodish, HDFC okayish, Wipro poor. Only real surprise came from L&T (The stock has appreciated little over 30% already) and Ranbaxy.

- Now all of this is fairly risky, but no one knows where to find a top? The rally resembles almost a panick rally (I agree it is oxymoronic) Usually such situations arise while finding a bottom.

This looks like "someone is printing free cash" to go ahead and buy stock, the question is who? Carry Trade?

The answer just isn't there, or I can't seem to get it...... :-((

Tuesday, July 17, 2007

Context Sensitive Ads?

Let me start with a question -

How is Bra Selection in India is related to developing PHP apps with UML and which in turn is related to brass hardware and all of this is related to Pushposters? Confused, check the following....





The best one is the one at the top! I guess they figure out sex of the email viewer from the email address (or possibly its registered somewhere!)

PS: The image is edited a bit.

Saturday, July 14, 2007

A date with XUL

While working on a firefox extension for a feature on paahijen, I had a loong date with XUL. XUL (pronounced as zool, is an XML based User Interface Language). More stuff about xul can be found at XUL - MDC or XUL planet

Basically, I needed a form where I could copy something to clipboard from a document loaded from a HTTP URL. The problem was, I couldn't use the simple Javascript based methods, as access to clipboard is restricted inside mozilla. So I had to have a XUL window with a XUL button and contents loaded from the URL.

One option is to do all the UI in XUL and use XHR for talking HTTP. So I started with XUL UI. If you thought CSS is a bitch, try XUL and you'd almost fall in love with CSS. In short, for someone short on patience, looking for a quick solution, laying out a XUL UI is not an option. Looking for alternatives, I found an interesting alternative in the tutorial on xulplanet, which uses iframes instead. In my opinion, this is a better approach, unless there is a specific need for Client only UI. First, it is simple, and second you don't need to learn a lot of XULgiri.

So the final solution was a XUL window having a XUL button (on which oncommand was implemented to do clipboard copy) and the HTML document rendered in iframe.

One last issue is - to get contents inside an iframe. The solution is mentioned here.

Guess, thats it, rest of the stuff is quie straight forward.

Monday, July 09, 2007

Stay Hungry Stay Foolish

Steve Jobs Stanford Commencement Speech 2005.

Sunday, July 08, 2007

Scores Do Lie

There are days in your life when you thank God for being born as a human being, being gifted with eyes that can watch and being able to feel emotions. I remember one such day when India beat Australia in a test win at Adelaide and today was yet another day when I watched the two Champions play at the Centre court at Wimbledon. One of the champions have to win and it was the lucky one who won it eventually, but my champion for today is Rafael Nadal, the prince of Clay, nay, the prince of Tennis.

The match started with swiss holding the serve on love and looked like, O No!! we are here for yet another boring three setter, when mr. casual is going to sail through eventually and it just looked far more imminent when Nadal lost his serve on the second game and the Champion was up 3-0 and then we were presented with a quality of tennis that I have not seen in my life. Every challenge Mr. Federer had, Rafa had an answer and soon we were 6-6 Set number one. Tie breakers is Fedex's forte and looked like so when Nadal down from 6-3 was looking ominous to level 6-6, but the lucky fed managed to squirm throught the first set 7-6 (9-7).

Set number two started with Nadal serving first and from the trend I have seen, if you don't break Nadal in first nine games, you are going to loose the set and that is exactly what happened when Federer was broken in the tenth game. 6-4 second set Nadal. Match score 1-1.

Third set was like a boxing match when each player delivered their punches and it went to tie breaker, this time the swiss winning comfortably 7-3. Federer leads 2-1.

Thank God Federer started service in the fourth set and unless he lost the set with odd number of games in the set, he'd be the first to serve in the final, which gives a slight edge. Looks like Federer was in no mood to win the fourth set when a controversial "Hawk Eye" ruled a point in favour of Nadal and Federer was visibly peeved. To the 'naked eye' the ball really looked "OUT". Nadal completed the formalities of the fourth set with a double break and 6-2. Match state 2-2.

Federer serving in the final set. I couldn't hold my nerves and went away just to take a break from the tennis for a few minutes and when I returned I expected the scorelines to be 4-3 Nadal serving. To a kind of pleasant surprise, it was 2-5 Nadal serving. I knew the match was over. and it lasted a little less than five minutes after that when FedEx clinched his fifth title in a row.

The final scores (7-6, 4-6, 7-6, 2-6, 6-2). And these scores do lie, todays champion was Nadal. Federer has lost to Nadal a couple of times before, but it was his horrible play back then. Today Federer was not going to loose, he didn't seem interested in loosing today and played like he _had_ to win this match, but the darling of the crowd was 21 year old spaniard, whose agile court coverage, brilliant passing shots, made federer look like a
"normal" player. Nadal made federer run everywhere and made him win every single point that he had to, to win the championships... Ultimately Federer won, but my champion for today is Rafael Nadal and they say his style of play does not suit the grass courts, guess no one would dare say that after today.

The story of the match was captured in a couple of sentences in the post match interview when Roger said - "I said to Nadal at the nets 'You deserved to win today, I was just lucky one to win this!!'"

Well played both of you and thank you for such a marvellous display of high quality tennis.

मर्फ्यै तस्मै नमः

This post is dedicated to omnipresent Mr. Murphy.

Many of us are aware of Murhpy's law. For the uninitiated ones a bit of Wikipediagiri about murphy's law to start with. According to wikipedia, Murphy's law is formed with eight laws explain on the article. There is more about this over there..

Originally, I intended to write this blog in marathi, but some of the folks wont be able to understand it so writing it in english..

There is a proverb in संस्कृत (sanskrit), which says " कालाय तस्मै नमः ||" ("O times, I bow before thee!") . I think Mr Murphy deserves, nay, demands a similar reverence. Hence the saying "मर्फ्यै तस्मै नमः||" . A little bit of sanskrit grammer before we mover further. मर्फी is a "ईकारांत पुल्लिंगी" word like ॠषी, and we need a "चतुर्थी एकवचन" ( ज्याला नमन करायचे त्याची चतुर्थी). Hence the word मर्फ्यै!!

So how does Mr. Murphy proves that he exist? Answer - "In every possible way!". If you are going to give a presentation and the LCD does not like your Ubuntu laptop, it's Mr. Murphy in action. If you are standing at a signal when there is no chance of a shelter and it suddenly starts pouring, it's Mr. Murphy again. I will bet all my wealth (which isn't a lot), if I find a single soul who's not been affected by Mr. Murphy in one way or the other. Thank you Mr. Murphy..

Now a closer look at how much of a celebrity Mr. murphy was in our office. We had coined a special term for "getting murphied" called "मर्फी लागला" and Mr. murphy comes in a couple of sizes S (छोटा मर्फी) and L (मोठा मर्फी). The type of murhpy's explained above belong to the catagory of so called "छोटा मर्फी" (It might remind some of us about a brand of radio called Murphy and some of us might think of the small baby as छोटा मर्फी), where as मोठा मर्फी is when you move to bangalore and your home loan check bounces. Ask aditya about it.

Then there are some murphy people as well. Typically they exist in Cricket teams or all sort of team events, whose presence in a team makes the team vulnerable to Mr. Murphy's infection.

So what are your defences against Mr. Murphy? According to Aditya there are none. But there are chances of lesser harms, if you suffer from a couple of छोटा मर्फी's in a day, then probability of मोठा मर्फी affecting you is substantially (sorry somewhat) reduced. So pray for छोटा मर्फी.

To conclude, in due respect for such a great person "मर्फ्यै तस्मै नमः||" Long Live Mr. Murphy!

Saturday, July 07, 2007

Roger Puhlease

(photo taken from wimbledon.org original copyright ProSport/T. Hindley)

Play like you want to win this match and not like you just had a fight with your girlfriend and had nothing better to do and thought of playing tennis better than staying at home.... I know you'd win, still.

Just watched the match concluded bet Roger Federer and Richard Gasquet the Frenchman. The frenchman was a bit crippled in the third set, when Federer was 2 sets to 0 up, so it was a matter of time, till Mr. Federer the prudent swiss businessman, concluded his business on the Centre Court.

I am a great fan of Roger, but when you watch him play, it looks like he plays with a kind of laid back attitude and the worst part is he manages to win most of those matches. I often wonder what make him such a special player. Is it the odd Squash shot he plays, is it the back hand down the line return or is it is ability to win points at will? I just can't find the answers. Unfortunately to the misfortune of other players Roger has improved his serve so much and he serves almost Sampras like which make him much more formidable. In a couple of matches that I saw, I haven't seen him loosing more than 10 points in toto on his serve and when it goes to tie break, it lasts a few minutes.

The trouble with the way he plays is - With this kind of attitude, he's almost never going to win in Roland Garros, where the prince Rafael Nadal rules. It takes special skills, temperament and what the commentator at the end of the final this year said - "Federer needs to be a bit more like warrier to win against Nadal here".

I'd personally have loved to see Djokowic coming to final and every set going to a tie-break, unfortunately he had to drop out, thanks to the injury that's troubling him.

So the stage is set for the Federer - Nadal final at the wimbledon tomorrow, and I would really like Nadal to tease n test Roger, so that he's to raise his game a lot more.

Just out of curiosity, I'd really like to know the stats "How many five setters Roger has played in his career? And how many has he won?" May be I should write to Vijay and Alan (who are wonderful hosts for the tournament).

BarCamping at BarCampPune3

I had a wonderful day at BarCampPune3 today. Infact to be honest, I was a bit skeptical about whether most of the people who said they are coming will show up? And when we reached there, I thought my skepticism was just right, there were something like 23 and a quarter campers out there. But eventually people started joining and soon we were close to 100ish.. Well a lot of us showed up well after 10am the official starting point but eventually I guess, we were a couple of 100 or so, not bad. Barcamping to me was certainly new, but I kind of liked the geekish atmosphere there... (Did he mean 'Geeks', when he said 'Meeks shall inherit the earth?' hahan:-) ).

Something most interesting that I learnt by doing it.. Talking to an audience of 40-50 odd people with sort of diverse backgrounds. There were a few obvious pitfalls, which pilot pointed out. I had talked in front of 20 odd people before, and to be honest I felt pretty confident that I'd do a fine job, but from pilot's remarks, it appears it was kind of a mess. Neverthless important lessons learnt. So let me go over them one by one.

0. DO YOUR HOMEWORK. : What it includes? Atleast give a mock presentation to 2-3 people, plan your talk, your slides and DO NOT DO this at 1AM @ the midnight day before. Very very important.

0.5 Know your Audience: The best way to do this is by asking a couple of quick questions and checking out how much people know about the stuff you are going to talk. This is going to come in handy subsequently.

1. Set the expectations Right: It is very important to do so, when there is a sufficient amount of diversity, and it is obvious that you are not goint to please everyone, but still set their expectations right. Some ways to do this is go over an Overview of your presentations and mention briefly what you are going to cover.

2. Take a brief pause and plan for improvisations: Depending upon responses in 0.5 and 1.0 above, you've to plan a few improvisations. Of course the homework must be done for that. In general the improvisations will include, which topics to stress upon and pay attention to and which topics (slides) to skip. This also implies that you have the flow of slides well in your time.

4. Start presenting: Entertain questions but only at Logical milestones (and not after every slide..)

5. Whenever someone ask questions - Make it a point to "REPEAT the QUESTION", so that the audience knows what the question was and what your answer was refering to.. And answer to question should not look like a conversation bet you and the person from the audience who asked the question.

6. Whenever you've code snippets to explain stuff. They should be Pasted in the presentations. Doing (ALT-TAB) looks Ugly. Often relevant comments should also be included.

7. If you have a demo or something, plan it at the end or at the beginning, No ALT-TABs PLEASE.

One would obviously notice that I had missed on almost all the points above. Also, do not simply look at contents, while watching some interesting Google Videos, but look at How much the person is in Control of situation while presenting. The great skills of presentations lie in "Being in control"

Besides that, Mr Murphy was in control of procedeeings when needed and almost at will, when the Sleek Flat Screen Samsung Monitor Din't like my ubuntu desktop. ("मर्फ्यै तस्मै नमः||", a new phrase which I have coined. Will write in details about it subsquently) So much for the presentation. Coming back to the event... There were a couple of interesting talks that I attended, one of specific mention was about "Pros and cons of setting up your company in India vis-a-vis other options like US, UK or Singapore." This is not the exact title. But a very important point that came out of that, it probably makes sense to register a company in US than in India, if you are doing a startup.

We did a bit of advertising for paahijen as well. :-) It seems that a lot of people had actually seen what we were doing and thankfully none of them said "You Suck!" or were just being nice :-) ... (There was a bit of a goofup in the T we prepared on the 11th hour, which Akshay, noticed but guess not others! :-)

In all certainly a very enjoyable, eventful day! Look forward to more such things in the coming times....

Just before I conclude, a final reminder for me. "Do not assume people know the language you speak". eg. There was this journalist from the mint, namitha, who asked me... Where were you guys working before.. I told we were working at PANTA systems.. A High Performence Computing company.. To me "High Performance Computing" is as much a common word as say a "car", but she was like what does that mean? And I have seen this expressions a few times from others as well. The best answer I find for this is our company makes "Supercomputers like CDAC." Actually that sounds a bit sexy as well :-)

Tuesday, July 03, 2007

Wimbledon times...

I remember my school days when we used to almost religiously watch the men's and ladies' singles finals (those were the only matches telecast then on the good old DD). Those were the days when we saw the rise of Steffi Graf, beating Martina in 1988 final. 1988 was a kind of a dream year for a tennis fan like me when both my favorite players, Stefen Edberg and Stffi Graf won the championships.

After the Edberg-Becker era, there was a looong Sampras era and while it came to an end, I'd almost lost interest in the game, till I watched the 2004 final that saw the emergence of new era in Tennis, the Roger Federer era. I distinctly remember a small anecdot about it.. After the final Andy Roddick was asked "Andy you see to be enjoying this rivalry between yourself and Roger?" Andy - "To call this a rivalry, I'd have to start winning a few of those!".

This year though, wimbledon is cursed by the whimsical british summer, almost every single match is interrupted by rain and still we've managed to get to the fourth rounds well almost.. Unfortunately, I haven't watched a single Federer match. Hope I get to watch tomorrow against Perreira.

All the Grand slams are gruelling for the players, and each surface has a peculiarity of its own, but Wimbledon stands different. The meticulously maintained lush green courts, players wearing all white T's, the british idiocyncracies and the unforgettable "Thank you. Quiet please!". It's' all so very different... so very unique and so much enjoyable......

It's my dream to watch a Wimbledon final on the centre court one day and I hope to do so while Roger still rules the court!!!