Friday, December 23, 2005

Madness (and love)

Its the last day before vacations at office. I leave early reach home at 5. Mom is surprised to see me home so early. I open my laptop to sit down and write some code. There's a long pending project I had started way back in september - there's some nagging problem and I'm too frustrated to sit down and debug the darn issue. I opened the browser to write about the project and the problem that I'm stuck at...

"Dude, life does not run according to an algorithm - language does not mean C++. Please talk in human comprehendible manner!"

"Well I feel like they're talking in a language I don't speak..."

"DO NOT quote some dumb song you keep hearing all the time! Tell us what YOU think!! Its like you don't have any opinion or mind of your own!"

"You better start sniffing your own rank subjugation, Jack, 'cause it's just you against your tattered libido, the bank, and the mortician forever man and it wouldn't be luck if you could get out of life alive" - (THUD - that was someone spearing me down to the ground!)

Shit! This is going way too much off on various tangents!!!!

Shut the fuck up, Donny!

"It sure is no fun working all the time. What you must do is to try and see how to make big bucks, fast!"

"In a land of make believe, they don't believe in me"

"Okay, we're losing this guy here - get the incantation"

"Someday, somehow, I'm gonna make it alright - but not right now.... No one's wondering when..."

(Don't even bother to wonder what that was all about)

Sunday, December 18, 2005

Temp only!

Some people do extensive research to come up with something like this - but just goes to show that software engineers are indeed a rare breed :-)

Alternative Theories


Wednesday, December 14, 2005

Windows Blues

My computer has finally succumbed to my brash usage and Windows has crashed and it does not boot up anymore. Well, It was not me - it was the sudden power failure that did the damage. I tried booting with various options - safe mode, safe mode with command prompt, last good known configuration - none of them worked! I knew I had to spend a good one hour doing the repair installation. I got a bootable CD to start the repair installation - to my horror, the installer listed C: as an "Unknown" partition. Goddamn it - there was a very good NTFS partition there!

I decided to pursue this and booted to linux to see whether I could access the windows partitions. Viola - All the NTFS and FAT32 partitions are accessible from linux. I could copy documents and even edit files! If linux can read the partitions, why the hell windows can't?! I went about searching for an answer to this.

The answer most probably lies in the basic dual boot configuration. Having a dual boot machine with 2 operating systems is something like having 2 girlfriends! No - its not very pleasant if one of them gets to know about the other. Something very similar was the case here too. The windows installer probably looks for its signature in the MBR of the disk. It found that linux (the "other" girlfriend) had filled up the MBR with the bootloader - it just (grows jealous and) refuses to recognise the partition.

I'm just guessing that this might be the issue. I'll have to do some more experiments to confirm this.

Moral: Things always seem fine until something screws up! (Is'nt it always?! - DUH!)

Saturday, December 03, 2005


Don't talk
It might hurt
It might cause hatred
It might make people estranged
It might evoke sympathy
It might bring tears
Don't talk

Don't go
Don't go searching for light
It might be fire
Don't go

Saturday, November 26, 2005

Secret Seven!

7 things I plan to do before I die
  • Learn as much as I can in the computer science field
  • Learn to play a guitar fluently
  • Buy a large house in Rio de Janeiro (Dream on!)
  • Travel almost every corner of India
  • Ascend Mt.Everest (??)
  • Marry some French actress
  • (How many remaining?? As you can see, many of the above are unrealistic. Basically tells you that I'm not very ambitious)

7 things I can do

  • Think about design, write code and debug code all day
  • I can sing (At least I would say so - no one hears me sing on the way to office on my bike/car!!)
  • Do nothing but listen to my favorites playlist all day
  • Sleep all day long
  • Live in isolation for a week (I've done that twice)
  • Go on a long drive alone on my bike in the very early morning
  • Plan a trip within 30 mins

7 things I just cannot do

  • Stay without my gadgets - Computer, laptop, MP3 player!
  • Read newspaper for more than 5 mins
  • Live without coffee - Need coffee at least 3 times a day! (same as loonie)
  • Swim - I have not learnt to swim till date. History has it that I almost drowned in a river when I was 6 years old. Some say that I automatically float! (See next point for details)
  • Put on weight - How much ever I eat, I don't put on weight!!
  • Forget the past
  • Ignore people

7 things that attract me to the opposite sex

  • Intelligence (Knowledge of C++ preferable :D)
  • Level-headedness
  • Honesty in whatever they say
  • Understanding nature


7 things I say most

  • WHAT THE?!
  • Its like Lenin said...
  • That's undefined behavior
  • That's not portable!
  • So, ...
  • Nan magne (Local slang!)
  • Yeah, ok, but...

7 celebrity crushes

  • Jennifer Aniston
  • Debra Messing

Well, not much information there. But that's all I've got!

Wednesday, November 16, 2005

Lost for words

Pink Floyd - Lost for words

I was spending my time in the doldrums
I was caught in the cauldron of hate
I felt persecuted and paralyzed
I thought that everything else would just wait

While you are wasting your time on your enemies
Engulfed in a fever of spite
Beyond your tunnel vision reality fades
Like shadows into the night

To martyr yourself to caution
Is not going to help at all
Because there'll be no safety in numbers
When the right one walks out of the door

Can you see your eyes blighted by darkness?
Is it true you beat your fists on the floor?
Stuck in a world of isolation
While ivy grows over the door

So I open my door to my enemies
And I ask "could we wipe the slate clean?"
But they tell me to please go fuck myself
You know you just can't win

A "must-listen-come-what-may" classic!

Monday, November 07, 2005

Off to never-never land...

Well, not actually. Of the 4 days of the extended weekend (I'd applied leave on thursday), 3 days were spent travelling. Thursday and friday to Tirupati and saturday to Mysore. Tirupati visit was for religious purposes - we'd booked for a seva at the Tirumala temple. Get this - we'd booked for the seva on 4th Nov 2005, on 2nd Feb 2001!!!! Talk about advance planning and booking!! I must ask my parents if they've already booked the wedding hall sometime in 2010!!!! :)) (Err.. If so, I'd have inquire about how to get it cancelled!).

Tirumala is a wonderful place! I mean, the infrastructure there and the way they've maintained the whole place so clean in spite of the massive and constantly mobile crowd is indeed commendable! I somehow forgot to take my cam (someone blonk on my head for that!). The seva was at 3:30AM and I'd to get up at 2AM to get ready and reach the temple! And the following day journey in a bus back to Bangalore meant that I had absolutely NO sleep for 2 days!!!! That I slept like a slothful dog that night (almost 12 hours - 6PM to 5-30AM) is another matter altogether! :D

Saturday - a timepass trip to Mysore. The plan was made in a jiffy and just me and 2 of my friends started off at 8AM. The trip was made primarily for enjoying the long drive! On reaching Mysore, we visited Chamundi hills, had lunch and came back! That's it! People would probably think that we'd have been really crazy to do something like that - but then, hey, who cares! We enjoyed the day! :)

After 3 days of travelling, I was hoping to relax at home on sunday. But NO! I have to attend some social gathering! Man, how I hate these gatherings - Its utterly pointless to just go there and put on a smiling face for people you would'nt even have come across in your entire life! Listen to this - I am wearing a t-shirt bearing a bold logo saying "HP-invent". A lady (turned out to be my mom's friend - I found this out later) comes to me and asks "Are you working at Infosys?" - I had no words coming out of my mouth for a while and eventually I managed to get a decent answer out. Man, how I had to force myself not to make any smartass replies!

Anyway, its a new week and have to get back to work - My Inbox in showing 86 unread mails! Phew! Ok then - cya all around!

Sunday, October 23, 2005

Rainy saga

This incident happened quite sometime ago. Since so much rain is lashing the city nowadays, I was reminded of this.

It was one of those evenings when the skies were turning dark and the winds were carrying the moisture that howled into my ears - "Go home, Srinivas - Its gonna rain like crazy!". I looked at my watch - it was almost 6. I knew that if it started raining and I had to leave after the rains subsided, there would be major traffic snarls all over the place. So, I decided to leave office. No one in the office was surprised, 'cos 6 - 6:30 is my usually packing time anyway. Actually, they'd be surprised if I am seen at office anytime after 6:30!!!!

I was on the way, riding back home - I just about, had made it thru the Richmond circle traffic junction. But as fate would have it, the light turned from green to amber as I was about to cross the pedestrian line. SCRREEEEEECH! I bring kid to a halt just centimeters before the line. (For the uninitiated - "kid" is what I call my bike). I sighed in relief 'cos the policemen can be quirky sometimes, levying a fine for even the slightest of traffic offenses. Someone had also commended me as "a strict follower of traffic rules", so I wanted to keep that rep intact. Moreover, I did not have enough money to pay up the fine if I was caught and they don't accept credit cards - do they?! ;-)

The counter started counting down from 129 seconds. Damn - that's a lot of time. I turned off kid to save fuel and lend my minute contribution towards national economy and in saving the global non-renewable resource. I looked up to the skies and I could see a massive dark cloud trying to position itself exactly above my head! I realized that its not safe to have my mobile phone and wallet in my jacket, 'cos its not really water-proof. 75 seconds remaining. What to do?! I slip my hand into my pocket, get a pack of menthos out and roll one into my mouth - "Dimaag ki batti jala de!!". I thought it would give me some bright idea, just as that kid in the commercial got an idea to save his college books from the rains(Not to mention, he also managed to impress that girl in the nearby car - but no, there was no girl in any of the cars nearby!). I decided it would be safer to put them in my bag. 45 seconds remaining. There was not enough time to get the bag from my back and then transfer the stuff into it and then put it back. So, I tried to get the zipper of one of my bag's compartments open while it was still on my back. The people around me would have been wondering why menthos did not give this guy any other bright idea than what he's currently wrestling to accomplish! 25 seconds remaining. I managed to get it open, and put the mobile phone and the wallet into it. 20 seconds remaining. It starts pouring heavily. Within no time, I'm completely drenched. 15 seconds remaining. I realise that its no use to wait in shelter for the rain to subside. Since I'm already all wet, I might as well try to reach home as early as possible and dry up. 10 seconds remaining. Uh oh! I am not able to close the zipper of that open compartment! 8 seconds remaining. I try to yank it and force it my way! No, it won't budge! 7 seconds remaining. I still needed to get kid kick-started. I could hear horns honking loud behind me! One last try - I yank so hard, that the zipper handle is in my hand - Well done Srinivas! What a brave accomplishment! 5 seconds remaining. That's it - I cannot keep trying on this anymore. I started kid and then rode away. All this while, it was raining constantly and since the traffic did not allow me to check my bag anyway on the way back, I had to check it only when I eventually reached home.

The first thing I checked was my bag. I peered inside the compartment where I had put my mobile phone and wallet. Both of them were happily swimming in the little pool that had formed inside my bag!!!! All the notes in my wallet were soggy and the mobile phone was behaving weird. I had to keep it switched off for 3 days to get it completely dried and working properly again. So, nowadays, I put my phone and wallet in the bag before I leave and yeah, I also bought a new, reliable water-proof jacket! Someone please remind me to sue the menthos ad agency!!!!

Friday, October 21, 2005


I'm doing what I usually do when I have to keep my blog alive. This is a nice song I came across a few days ago. Thanks to Girish for pointing me to it :) It's got a sad touch to it - but in some eerie sense, it seems true.

Boulevard of broken dreams - Green Day

I walk a lonely road
The only one that I have ever known
Don't know where it goes
But it's home to me and I walk alone

I walk this empty street
On the Boulevard of Broken Dreams
Where the city sleeps
and I'm the only one and I walk alone

My shadow's the only one that walks beside me
My shallow heart's the only thing that's beating
Sometimes I wish someone out there will find me
'Til then I walk alone

I'm walking down the line
That divides me somewhere in my mind
On the border line
Of the edge and where I walk alone

Read between the lines
What's fucked up and everything's alright
Check my vital signs
To know I'm still alive and I walk alone

New post coming over the weekend. Have a nice weekend - everyone :)

Tuesday, October 18, 2005


I request all my readers to kindly grant me leave from the blogging world for one week from today. :D


Monday, October 10, 2005

Marriages - not made in heaven!

/* Changed the title - credits to Vaibhav Rajan */

A weekend full of social meetings! That's what it was. A wedding reception on saturday evening and my nephew's first birthday celebration on sunday. While sunday was a great experience, saturday was not as well planned and executed as sunday. The current way of wedding receptions is way too ineffective for people who go through the "routines" of the reception.

Just think about it - what do we usually do when we go to wedding receptions? Stand in a line, give the gift to the couple, wish them, pose for a photo and then go to the dining hall, have dinner and head back home. There might be a few social interactions here and there which is irrelevant for my post here.

Effective Marriage:
Have a drive through kinda thing with 3 counters on the way. People drive in,
  • Drop the gift(s) at the first counter
  • Have a photo taken at the second counter - which will then be digitally morphed with the couple's photo - just like it would be if you were to stand beside them!! There could even be a telephone in this counter using which people can talk to the couple and wish them all the best for their long life ahead!
  • Get food and eat it at the third counter. Based on some people's preferences, they could get the food packed too and eat it later!
More Effective Marriage:
Conduct the reception over a video netmeeting with audio conferencing. This way we could get as close as possible to the "real" reception atmosphere!! For the food, the hosts could allow people to eat whatever they want and get the bills reimbursed. This way people get to eat what they like most instead of some fixed food decided by the hosts. In order to have a control on food expenses, the hosts could decide to reimburse only upto a particular maximum amount.

How did I end up thinking of these junk stuff????
  • Wedding hall 35KMs from my home(That I did not have to travel the entire 35KMs is a different story altogether)
  • Heavy rain throughout the "journey"
  • Traffic jam inside the wedding hall premises
The titles "Effective Marriage" and "More Effective Marriage" inspired by Scott Meyers' books - "Effective C++" and "More Effective C++". :))

There's a time and place for every song ever written.
Hell with the time and place - just listen to the simply amazing songs anywhere, anytime!

Friday, October 07, 2005

A message

My song is love
Love to the loveless shore
And it goes on
You don't have to be alone

Your heavy heart
Is made of stone
And its so hard to see clearly
You don't have to be on your own
You don't have to be on your own

And I'm not gonna take it back
And I'm not gonna say I don't mean that
You're the target that I'm aiming at
And to get that message home

My song is love
My song is love, unknown
But I'm on fire for you, clearly
You don't have to be alone
You don't have to be on your own

And I'm not gonna take it back
And I'm not gonna say I don't mean that
Your the target that im aiming at
And I'm nothing on my own
Got to get that message home

And I'm not gonna stand and wait
Not gonna leave it until its much too late
On a platform I'm gonna stand and say
That I'm nothing on my own
And I love you, please come home

My song is love, is love unknown
And I've got to get that message home

Sunday, October 02, 2005

Tryst with... Barber??

Its time when its one of those saturdays that I've to go get a haircut. I hate to waste time during mornings since its the most productive time for me. Wasting such precious time for haircut?! I'm against it. But since I'd been successful for almost 4 months in evading this "duty", this time, my mom would have none of my excuses. Thinking - "Sigh - here goes a wonderful saturday morning, right out the door!", I slowly drag myself to a salon.

Its a salon that's pretty near to my home. I ask the guy to cut my hair short. He gave me a puzzled look:

Barber: You sure? You want it cut fully short?
Me: Yeah.
Barber: How many months since you had a haircut?
Me: (Taken aback!) 2 months I guess.
Barber: No way sir! It must've been 3-4 months!
Me: (Thinking - whatever man, you would know better!)

I honestly had no idea when was the last time I had got my hair cut. I mean, does it really matter?! For once I ws not wasting time on saturday mornings and I was sort of enjoying my flowing long hair :D. Anyway, he got on with his job and I drifted out in my reveries. I was suddenly brought back by this legendary line!

Barber: Sir, You must have got the hair cut by me the last time!
Me: WHAT?! How can you tell?
Barber: I just know its my work!
Me: (Again thinking - whatever man, you would know better!)

I did not know who cut my hair the last time. There are 3-4 barbers in that salon. Gee - talk about recognizing your work. Then he went on saying that I had strong hair and I must grow it longer and get it styled. I firmly said no and I paid him. While leaving, I just glanced back from the door and told him:

"I'll be back in 4 months!"

Saturday, October 01, 2005

< * >

Sing the Anthem Of The World

But will we ever learn
To control our hate and to forgive
We must learn to find the way
To just live another day
And be free like an eagle in the sky...

This is just a place holder - check out this song by Stratovarius over the weekend. Happy weekend. :)

PS: Observe the time of the post. Its a saturday morning and I'm at office!! :((

Monday, September 26, 2005

Sweet story - or is it?!

** BEGIN **

He is dressed in clean pressed spotless white shirt and a flawless navy blue pants. He has a fresh red rose in his hands. He's at a engagement party and is consciously looking every now and then towards the entrance. 30 uneasy minutes pass on and with every passing moment, the eagerness is more and more evident from his eyes. During this time, he's not accepted anything to eat or drink. Its pretty late for dinner and quite a few people have finished dinner. Some people do notice that he's got a rose in his hand and are wondering why he's not giving it to the bride-to-be. No, it was not his engagement and no one seemed to know how he was related to the people in the engagement.

His face suddenly lits up in enthusiasm. A fine young lady draped in crisp white dress gracefully walks in. He thinks everyone's eyes are on her. She walks straight to him. He now thinks that everyone is jealous of this fact!

She: Is the rose for me?
He: Of course sweety!
She: You're too sweet
He: Its getting pretty late for dinner and you must be hungry.
She: Oh no dear, I was late, 'cos I finished dinner before coming

(Background laughters if required!)

He: Yeah, even I don't feel like eating.
He: You look beautiful!
She: (Blushes) Thanks. You look pretty dashing too.
He: Well, I've to be my best when I'm with you.
He: Hey, there's a counter where we can get some chocolates to eat!
She: How wonderful!

(They reach the counter, but find only 1 piece remaining!!)

She: Aww, there's only one left.
He: You have it - I know how much you love chocolates
She: Yeah, but you should have it dear - you're such a darling
He: No problems, I could buy a chocolate on the way back
She: No, I'd feel bad if you did'nt have it.
He: And I'd feel bad if I ate it alone
She: Why not split it - we can both eat together!
He: How sweet and romantic?!

As they turn back to the counter, a third person has taken the last piece. He eats the whole piece at one go, tosses the wrapper skillfully to the dumpster a few feet away and walks away thinking - "Sheeesh! GET A LIFE!"

** END **

Friday, September 16, 2005

Fix you

I see a lot of unhappy souls around - this is dedicated to all of them...

When you try your best but you don't succeed
When you get what you want but not what you need
When you feel so tired but you can't sleep
Stuck in reverse

And the tears come streaming down your face
When you lose something you can't replace
When you love someone but it goes to waste
could it be worse?

Lights will guide you home
And ignite your bones
And I will try to fix you

And high up above or down below
When you're too in love to let it go
But if you never try you'll never know
Just what you're worth

Lights will guide you home
And ignite your bones
And I will try to fix you

Tears stream down your face
When you lose something you cannot replace
Tears stream down your face
And I

Tears stream down your face
I promise you I will learn from my mistakes
Tears stream down your face
And I

Lights will guide you home
And ignite your bones
And I will try to fix you.

A very soothing, slow song (for a change, eh?! - Yeah!)
[ Some of you might be thinking - why do I post song lyrics?? I am a guy of very few words - I used to talk a lot - but now I usually don't talk that much. I let songs do my talking :) ]

Tuesday, September 13, 2005

There's just so much going on at office - with a new product getting transitioned to us, there's always some or theother training session dialy. And I've also been studying documentation everyday to increase my understanding of the product. Life is progressing at a blinding pace - so much that I've not been able to clearly see things that've passed by. But every now and then there are things that come to one's mind, some things that happen during one's fast paced life, that makes one stop for a while and ponder a bit over it. Exactly something like that did happen today.

It dates back to my primary school days. I used to go to a school near to my home. I had so many friends, most ofwhom were living quite nearby. Today we all are seperated - not so much by distance, but by the lack of time! Most of us still live in the same locality but still don't meet often - actually, we seldom meet. Today I was reminded of a strange meeting with a very old school pal, almost 3 years ago. That just has made me take a break from a runaway life and think about him - wonder where he is and what he's doing today? I just hope that he's doing fineand is happy with life.

He's this very good chum of mine, and we knew each other since LKG! Even today, I clearly remember he used to come to my home as it was on the way to school for him. We used to go to school together. The last we saw each other wasat the end of the 7th standard. He continued with high school studies in the same school, while I switched schools. He was a very simple person - I mean, we were just kids then, not knowing too much about each other's qualities. But we got along very well - Its only now that I can see the difference that he was from a relatively poor family. In those days, we were just like brothers - no difference in anyway that we could point out in each other!

It so happened that 3 years earlier, on a lazy morning, as I was strolling around the terrace, I see the newspaper guy come with the dialy newspaper. I rush downstairs to get it. By the time I reach the gate, the guy was at the next door. It was someone familiar - very clear resemblance. I slowly walked up to him, still trying to figure out who it was. As he turned back, there was no doubt - it was indeed him! He recognised me instantly. I was a tad surprised to see him deliver newspapers. We chatted for a while and then I asked him as to what he's doing nowadays. He told me that he was doing B-COM and since he was having vacations, he was doing some part-time jobs to help his parents with some income. Now I was surprised that he never contacted me when he'd been delivering newspapers since a month! I asked him why he never called me out whenver he came to my home every morning. To this he bent his head down - for a moment I could not understand, but then I realized that it was probably that he felt a bit ashamed about it. I quickly changed the topic and asked him to take me to his house. They had changed their home - but it was still in the same area. I went to his home and talked to his mother too. Even his mother recognized me fairly quickly. I stayed there for a while and then left. I did meet him often from that day, for about 4 months. Then suddenly he disappeared again. After 3-4 months, I heard from another friend of mine that he's joined some night shift job and was living in a different locality. Till date I have not heard from him or anything about him.

I just wonder sometimes, people do not give any name to some relations - I mean, in this case, we were just kids studying in the same school for 8-9 years - at that age, we did not know these deep meanings of friendship, etc. But yet, there's always this thing in our head that brings us back memories from the past. Today, I remembered my very good pal who I knew from kindergarten. Even though I do not know his whereabouts or how he's doing, in myheart, I just hope that he's fine and happy in life. And yeah - hope he remembers about me too :)

Friday, September 09, 2005

Velvet Revolver - Contraband

Contraband - Velvet Revolver Posted by Picasa

Finally I got my hands on this album after roaming around from one store to another for almost 2 months now! Its a neat album - got all ingredients of a hard rock album. Fast, racy tracks and also some slow, rhythmic, melodious songs. Here's the complete list of tracks. Do keep an eye on the warning - (Strong language - it really is! Mind you!!)

Sucker train blues *
Do it for the kids
Big machine
Illegal I song
Spectacle *
Fall to pieces ***
Superhuman *
Set me free **
You got no right ***
Slither ***
Dirty little thing
Loving the alien ***

The starred songs are my personal picks. For the racy/heavy music buffs, Slither, Set me free are racy enough to get your pulse racing. For those who favor melody, I'd recommend - Loving the alien, You got no right and Fall to pieces.

Now something about the band itself - Its got 3 of Ex-GNR members. Scott Weiland on the vocals, Slash (Ex-GNR, Saul Hudson is his real name) on lead guitars, Dave Kushner on rhythm guitars, Duff McKagan (Ex-GNR) on Bass guitars, and Matt Sorum (Ex-GNR) on the drums.

To make the long story short: Certainly worth a buy - at least, get the songs and listen to them (AT LEAST the starred ones!)

Thursday, September 08, 2005

Stay tuned for an update tomorrow!

Been out of action for a while - reason: viral infection. I'm back at office tomorrow. Wait for a review of the album "Contraband" of Velvet Revolver!

PS: I missed you people!

Friday, September 02, 2005

Valuable interaction

A small doubt of mine - really, it was nothing - but I still wanted to pursue to find out the answer. Okay - I had this doubt when going through the GotW archives - for the un-initiated, GotW stands for "Guru Of The Week" and it has a collection of design puzzles that got discussed on comp.lang.c++.moderated. Herb Sutter maintains an archive of these at his website. In the item pertaining to "forwarding functions", this was what was mentioned. A code example -

class X { };

bool g(X x)
   // ...
   return true; // or false

bool f(X x)
   return g(x);

// user code
X xObj;
bool truth = f(xObj);

In cases like this, one would think that the compiler can optimize away the copy of xObj in function 'f'. BUT, the standard now prohibits the compiler from making such an optimization! The reason given was this -

This change was necessary to avoid the problems that can come up when compilers are permitted to wantonly elide copy construction, especially when copy construction has side effects. There are cases where reasonable code may rely on the number of copies actually made of an object.

The only places where a compiler can elide extra copies of objects is during Retrun Value Optimization and for temporaries. (Look into your favorite C++ book for more details on return value optimization). I was not really clear on why totally prohibit such optimizations and also make them standard. Only for types which cared about things such as number of copies made, etc would be affected by such optimization. But for other types, it can incur a performance penalty. Also, if number of copies made is an issue, even the return value optimization can affect code! I did post a query on a usenet group - but that did not generate much light on this issue. I mailed a well known C++ expert who's active on that usenet group - Alf P. Steinbach. He helped me get in touch with Herb Sutter through e-mail and a day later I had got a reply from Herb himself. This is what he had to say -

This was a compromise. Yes, it(RVO) can cause the same change to side effects. But the RVO has clear value that people didn't want to lose, and it's much more constrained so that programmers can learn that copies can be elided in this one place. But in the end it was a compromise.

Well - I was glad that my doubt was a valid one and thrilled to have interacted with gurus like Alf P. Steinbach and Herb Sutter!

Monday, August 29, 2005

Wild valley farm team outing!!

The best trip I've been on so far - and why not?? It was *completely* funded by HP. Serious - even booze was sponsored by someone - so I did not have to shell out even 50ps on the whole trip!!!! Howzzat??

Let me start off with the narration. We were 13 of us travelling and we had 2 vehicles - a Mahindra Scorpio and a Ford Endeavour - perfect vehicles for a journey like this!

Our Road-Beasts!  Posted by Picasa

Meeting place was Banashankari Temple on kanakapura road and everyone gathered there at 6-30AM, friday. I went into the Scorpio, 'cos it had a CD player and a LCD screen :D. On the way we watched the movies "Meet the Fockers" and "Bourne Supremacy". We had a breakfast stop at Kanakapura at 8-15AM. There's a hotel called "Vasu hotel" - make sure you go there to eat masala dosa - simply great!! The next destination was Shivanasamudra falls. We reached there at 9-30AM after 1-2 bio-breaks. There was absolutely no one at the falls. A few of us decended the rocks to reach the foot of the falls. There's nothing that can describe the tiny water droplets gently splashing against your face. We sat there for about half and hour and then we had the arduous task of climbing up the terrain! Man, all the breakfast was completely burnt up!!!!

Then we started to our final destination - Wild valley farm. The roads were pretty okay, mainly due to the kind of vehicles I must say - scorpio and endeavour are great beasts of the road! We had a jungle area check-post to go through and then it was just wild jungle roads for about 20KMs. Finally we reached there - it was 12-30PM, the tents were already in place and there were large lush green areas, surrounded by hills on one side and thick forest cover on the other. We had lunch and relaxed till 2-45PM. Then we set out for our TREK!

Our tents - forest behind the tents!  Posted by Picasa

On-going trek - in the wilderness!  Posted by Picasa

We had to walk through dense forest cover and then climb a hill. It was totally 20KMs to and fro! By the time we reached the top of the hill we were all dog tired and had finished up all the water!!!! But the sight from the top of the mountain made us forget all our weariness. We sat there looking at the vast valley for about half an hour. We ate some chocolate bars to give us energy for the return path. It really was a wild trek - we slipped in so many places and bruised our knees, had mud patches on our clothes, etc - but it was great fun and adventure! No one ever complained.

Yes! We conquered this hill!!!!  Posted by Picasa

We returned back by 5-45PM and everyone had a hot bath. The water was heated by burning wood. Its somewhat different from the electrically heated water and is more relaxing. As the sun went down and it started becoming dark, we lighted the bon-fire. Oh, did I tell you that there's no electricity anywhere except the toilets? Yeah - no lights anywhere. The only light was of the fire and fire-flies which were present in abundance! The night sky appeared so clear and we could see millions of stars so clearly. Its impossible to get such a view of the clear night sky from the city. Here, there's so much glare of lightings from the city! What happened for the next two hours is edited here :D - All I can say is that it was a long drinking session!

Place where we had camp fire Posted by Picasa

We had dinner at 9-30PM and went to bed at 10-30PM. Most of the people slept peacefully - somehow I could not sleep for a long time. It started raining at around 2AM. Avinash foolishly touched the inner tent fabric and it started dripping water in our tent!!!! I managed to get some 4 hours of sleep after 3AM. It had rained the whole night!!!!

We had plans to trek in the morning too - but was cancelled due to heavy rains overnight. We played volleyball and cricket instead. We all were so focussed on playing - it was not until the next morning that we felt the effects. I could have counted the number of bones in my body by counting the bones that were paining!! All I did on sunday was sleep and relax at home. We had lunch at 12-30PM and left the place at 1-30PM. We reached back at 6PM after some peak driving at 120KPH!!!!

A game of volleyball Posted by Picasa

Cricket pitch - Good campaign for the movie 'Iqbal'??  Posted by Picasa

Does'nt this look beautiful??  Posted by Picasa

All in all - a wonderful adventurous team outing, spending 2 days in the wilderness - was simply awesome!

Monday, August 22, 2005

Blogger meet - II

Sorry to disappoint everyone - but this is a lesson not to procrastinate something too long... I've learnt my lesson... Sorry again! :(

Saturday, August 20, 2005

You can go ahead and do a thing that you know is right, and later get blamed for doing the right thing...


You can ask 100 people, with most of them wanting you to do the wrong thing - you go ahead and do the wrong thing - and get appreciated for it!!

Neat life we're living here... I'll keep on digging...

Smells like teen spirit??

Tuesday, August 16, 2005

Paradise place

Take me down to the paradise city, where the grass is green and the girls are pretty...

I was talking about our trip to Shivanasamudra falls this past weekend. It was a paradise, there was greenery everywhere and the girls were pretty too ;-) Just the getaway we were looking for at the beginning of a long weekend. A trip is not just about the destination - but also about the journey. So, 4 of us started in early morning at 8-30AM in a fairly new santro. The main topic during most part of the trip was what music to play!! You all know the kind of music I like - but none of the others were keen on playing such music. One wanted FM all the way, 'cos he thinks the female RJs are chicks! PUHHLEEEAASE!! Someone must show him their pics!!!! Another one is an ardent telugu music listener, while the other wants *only* old kannada songs. So much for a mixed bag!! What do we do now? We had to time-slice between these 4 genres of music - Though I must say that I got an unfair share due to the (Ahem) brute force of others!!

Anyway, once we got there, it was a great sight - the falls is full of water and made for a spectacular sight. I'll stop writing now and let some pictures do the talking - I, of course, cannot describe it better than the pictures themselves. Take my advice - do visit it once sometime soon.

View of falls going down the stairway Posted by Picasa

Great force throwing up water droplets that appear like smoke Posted by Picasa

Can you see the mini streams of water caused by water droplets splashing against the adjacent rock?? Posted by Picasa

Friday, August 12, 2005

Happy weekend!

This has been quite an un-eventful week, except for a few tidbits here n there. I'm off to shivanasamudra falls tomorrow. And since my blog needed to be updated, I'm jus droppin a note to wish everyone a happy weekend. Oh yeah - the most interesting comment at office about my new hair style - "Before this you were looking like a decent fellow!". Thank you very much, that was the whole idea!! :)) Ooh - n also, leaving below a romantic song. This one's romantic alright - but not mushy. How I hate those ultra mushy ones - by those boy/girl/pop bands!!!! You know, its just a phase that you like them - quite at ages 12-16. But eventually you grow out of it. Something like - you never wear the pant you used to wear when you were 15, now that you're 22 - Right?? But some people do! Hard Rock fan Mr. Savage Garden for example - (Pun intended!)

Anyway, This is for My Lyla.

By Oasis (Liam Gallagher)

Calling all the stars to fall
And catch the silver sunlight in your hands
Call for me to set me free
Lift me up and take me where I stand

She believes in everything
And everyone and you and yours and mine
I waited for a thousand years
For you to come and blow me off my mind

The stars about to fall... So what'd you say
The world around us makes me feel so small
If you can't hear me call then I can't say
Heaven help you catch me if I fall...

She's the queen of all I've seen
And every song and city far and near
Heaven help me mademoiselle
She rings a bell for all the world to hear

Have a nice weekend everyone! See you all around :)

Monday, August 08, 2005

My condolences for yesterday!

Waking up on a sunday morning to find your cellphone showing "12 messages" is something surprising - considering that its my cellphone! Something that has not happened for a long long time! I scroll through the list of senders - 8 of them are from people who would'nt have messaged me in the last 3-4 months at least! What's the deal?? It was friendship day - how lame??

I'd like to take this opportunity to show the longest finger of my left hand to the concept of friendship day! I don't need my friends to wish me on a special day when they would remember me as their friend! Its as if they don't have time throughout of the year to call up and talk to friends - so, what do they do? Ear mark a day for "remembering" friends! Shoot - what's this coming to? Friendship day, mother's day, father's day - nothing but cheap marketing gimmicks to sell flowers, cards, "friendship bands" - what the hell does it mean?? I ain't got no bands on my hands! Does it mean I don't have friends?? Take a hike!

Don't get me wrong here - Just 'cos I did not send any friendship messages or buy friendship bands does not mean I don't care for my friends. And I'm pretty sure that my friends would know that. But people who would'nt have cared to say "Hi" for a long long time remembering someone on a friendship day is plain stupid! For those 8 messages, I never replied!

Yep - neat weekend!

*Totally irrelevant sidenote* - "Where there's a will" is a very good comedy play running at Rangashankara. Written by Mahesh Dattani. Go watch it sometime!

Wednesday, August 03, 2005

Before, After - which one's better?

Its that time of the week again where I have the itching to post some C++ funda. The topic this time is "Pre-increment Vs Post-increment - Which is more efficient?".

One would not worry about this much in C. But in C++, one must. Why? Because, we have the possibility of user defined types coming into the language type system. Let me start with a simple example.

++i; // increment and return the value

i++; // copy initial value. increment. return the copy

Just by looking at the steps involved, can we not tell that pre-increment is more efficient? Not convinced? Okay, the "copy initial value" step would actually be a call to the copy constructor in case of a user-defined type. For example, for a hypothetical Integer class, I'll write the initial versions pre-increment and post-increment operators and point out problems and their fixes as I go.

Integer operator++() // pre-increment
   return *this;

Integer operator++( int ) // post-increment
   Integer temp(*this);
   return temp;

With these implementations - the following problems exist.


Integer a = 10, b = 20;
++b = a;

The value of b would be 21 and not 10 as expected. To correct this, make the pre-increment operator++ return a reference to *this.


Integer c(30);

This works fine! But this is downright rubbish. To fix this, make post-increment operator++ return constant value.

3. This is a general guideline. Always implement post-increment in terms of pre-increment to be consistent.

Integer& operator++()  //point 1
   return *this;

const Integer operator++( int )  //point 2
   Integer temp(*this);
   ++(*this);   //point 3
   return temp;

Hope it made sense! :D

Monday, August 01, 2005

Latest aquisitions!

Oasis - Don't believe the truth Posted by Picasa

Another of typical Oasis album - satirical humor sometimes. The creative workforce behind Oasis - Noel Gallagher has written most of the songs. For starters, I would recommend "The importance of being idle"... VH1 is airing the video for this song nowadays... Set in the backdrop of 70s England, the music and the screenplay complement each other. Go listen to the song and watch the video.

Coldplay - X&Y Posted by Picasa

Coldplay have tried to create a new theme for this album. All songs in Side-A are labeled 'X' and those on Side-B are labeled 'Y'. (I'd have named this album I&J :D) The most popular song in this album is "Speed of sound" (Btw - speed of sound at sea level is 340 m/s :D) VH1 is airing the video of this one too. I don't want to comment on the video but the song sounds good. I have'nt yet listened to all the songs. Review of the album would be forthcoming. Meanwhile enjoy these songs and their videos.

PS: For those in my office, I have the mp3s on my comp. They're available on demand :D

Thursday, July 28, 2005

Today's song and gyan

Today's note: One of my photos on Dheepak's blog. Check it out! (29/07/2005 - 10:00AM)

Eagleheart - Stratovarius Posted by Picasa

All through the night he is lying awake
Wondering how much more can he take
Watching the walls where shadows dance
Drifting away into a trance.
And his eyes are blazing with fire

Dreams burnt to ashes so many times
Highest of mountains, still he climbs
Ready to fly because he just can't stay
Flame burning brighter with every day
And his eyes are blazing with fire
Longing for the deepest desire

Heart of an eagle
He flies through the rainbow
Into a new world and finds the sun
Spreading his wings above all the sorrows
The glory of Eagleheart

Fever is burning in his veins
Determined with courage breaking the chains
Back against the wall under blood red skies
Prepared to fight until he dies.

Gyan: (For guys only!) Single girlfriend is a SPOF(single point of failure). Always have an optimal number of girlfriends :)) (I hope Pooja does not read this!!)

Tuesday, July 26, 2005

A lot can happen over a coffee!

A lot can happen over a coffee! Posted by Picasa

The much talked and discussed about Blogger's meet - one which was seen being planned, planned, talked about, talked about more and more without anything to show forth! - IT FINALLY HAPPENED! It was the 24th of July, Sunday. All gods seemed to be against getting some like-minded people together! It was raining cats, dogs, may be even pigs!! Naren had an important covert mission to fulfil, Raju was peacefully asleep - may be a bit too peaceful! Keshav was stuck in the rain. This was looking bad. I just rang up everyone for one final time half hour before the scheduled meet. To my surprise, everyone said "Be there in 30 mins" - as if to defy all the odds of nature (remember the cats, dogs and pigs??)

Keshav lived up to his billing as the most punctual and was the first to arrive. I followed closely and to beat the rain, we went inside coffee day and helped ourselves to an irish coffee each. Naren was the next to arrive - he seemed distracted. Every now and then he'd look at his mobile phone with a "Why is'nt it ringing?!" look. Raju was the last heroic entry. Even after being offered a pick up and drop, he HAD to come on his war-horse completely drenched in rain! Kudos to Raju!! He even did a jig for the dull coffee day audience! Value for money - not only for us, but for the entire coffee day as well! "Btw - that was for drying my pants" he said! :))

There was no hesitation on anyone's part trying to think what to talk now that we've got together! That's the benefit of a few like-minded people - instantly gelling together and letting loose all the talk of the town. These were people who had known each other for a long time - known each other through blogs. Seriously, it makes sense to draw a mental picture of people by the way they write, by the topics they write about, etc. And it was great to know that (at least for me), I was correct in deducing about these people. Discussions, debates galore.

"Why is F1 such a craze?! Is it really worth the money invested?!"

"What about football or any other sport for that matter?!"

"I could say the same thing about metal music!" (BTW - This was Raju!)

Raju was not having anything. "I'm not hungry and I hate coffee. If I've to have anything, it'd be just for the sake of having something". Yes dude, we all are in the same boat. We don't meet at coffee day to eat and drink the whole day, that's unless someone's earning way too much!! And, abt the coffee - I LOVE COFFEE!! Reluctantly he ordered a strawberry frappy, frappee, frappe - "shit! How do you pronounce this thing?!" he blurted out! Discussion off to a tangent - Some of the items in the menu - how the hell to pronounce them "properly". How to say "Mocha" - mocha or moCha - jeez, this is'nt getting any easier to type!! :)) The waiter is standing amused + dazed! He sheepishly reminds us of his persistent existance near the table. We're all brought back to the context of ordering Raju's strawberry frappe! "Strawberry juice - this is just juice - and they call it some tongue twisting name" Raju says and we all have a hearty laugh!

I'd got 4 jukebox coupons hoping everyone of us could play a song of their own choice. Since, both Keshav and Raju were not so keen on playing music, I helped myself to some of my favorite music :D. Poor people they had not anticipated that they'd have to go thru the running commentary along with the playing songs, giving details about the song, artistes and the significance of the songs :D. Then the ace photographer (read Srini :D) set up his camera timer to take a picture of the illustrious 4 who made it to the first blogger meet! (That has not been published for copyright reasons!)

Time flew by so fast, and the rain also had stopped pouring. It was almost 3 hours! Making a wise decision to avoid getting stuck in the late evening rain, we called it a day at 6:30PM. It was a great experience and all of us were of the feeling that we must do this often. And also, get more people to come to these meets.

So, the next blogger meet will happen soon!

Friday, July 22, 2005

One lil' problem

I borrowed this idea from this friend of mine. Instead of me blurting out some C++ funda, this time I'll pose it as a question. Will post the solution on this very same post on monday.

How to simulate a 'final' class of Java in C++? A final class is one which cannot be extended by inheritance. There's no built-in language mechanism in C++ to disallow inheritance. So, the solution would involve using some other C++ constructs to make a class behave like a final class.

I have one solution for this. There might be other solutions too. If you arrive at a solution, please mail the solution to me at

My solution would follow here...

template < typename T >
class MakeFinal
    // declare/define all ctors & = op here

    // nothing needed actually

  // This is the line that makes this solution!
  friend T;

Now - for any class that you'd want to make final, just inherit from the above class virtually!

class MyClass : virtual public MakeFinal< MyClass >
  // ...

Inheritance from MyClass would not work, because MakeFinal has only private ctors. MyClass is a friend of MakeFinal, so it can call the private ctors of MakeFinal. But since the class inheriting from MyClass is not a friend of MakeFinal and since MyClass inherits virtually from MakeFinal, the inheriting class cannot call MakeFinal's ctors.

Hope this was a good solution... Do let me know if I missed anything.

Wednesday, July 20, 2005

Replay: Real forwards! - Part 2

Absolutely hilarious!! :))

I enter the class and sit down in the 4th bench. The teacher is talking something about how packets are routed when a network is congested. Of course, this does not concern us in any way. We have other, more important things to do. The gang is discussing euthanasia, or mercy killing.

Sunny: "If that patient is so ill that he cannot live, and wants to die, just let him die no. What is your problem?"
Sridhar: "But someone simply cannot die. He owes a debt to society."
Sunny: “But he will get his insurance money. He can pay off all his debt.”
Sridhar: “Not that kind of debt. See ... He owes society his life”
Sunny: “He did not buy it did he?”
Sridhar: “Buy what?”
Sunny: “Wait… Listen… Life is free”
Me: “Mine was probably bought in a half-price sale”
Saurav: “I bought Nike floaters yesterday… Half price…”
Krishna: “Really? Where? ”

… And the discussion goes off on a tangent … But it brought back by the forceful Abishek

Abishek: “This is just like suicide. I don’t want to live, so I die.”
Sunny: “Yeah, It’s like me asking you to suicide me. It’s simply a callback function”
Karunanidhi: "Some things are beyond the normal. We have to transcend our consciousness and touch the spirit within to understand the "maya" that the world around us is. Why does GK wear that red jacket all the time? It is simply inexplicable."
Me: "Hey look... Let's not talk about my jacket ok..."
Raghu: "Yeeno nidhi... Thames nalli T*** T****** bandya? yeenu english hoditaidiya?"
Linus: "I hope they use Linux on all the hardware. 'cause if they are using windoze, it might crash and the hardware might malfunction and the patient might....err.. survive!!! We don't want that to happen. We have to ensure that the patient dies..."

(Anup is in the back bench... He makes an obscure reference about Sunny, which is overheard.)
Sunny: "One of these days, I am going to euthenize Anup..."
Me: "But what about moral issues? What about ethics?"
Kris: "Chicks? Someone say chicks?"

… And again off on another tangent …

After talking about euthanasia in general and nothing in particular, we reach no conclusion.

In the meanwhile, the teacher has noticed the sound levels rising in class. To bring it under control, he shouts:

Teacher: “What happens when this link is down. How is the congestion controlled in the

I take some time to realize that the question was addressed to me.

Me: “Err… Sir… If the node A is down and it’s link to the flanking nodes is handled by the transport layer entity which is at the peer level in the corresponding layer at the remote host, the congestion will be rerouted through alternate paths as calculated by the distributed system
either by Dijkstra’s algorithm or ad-hoc routing through peer-mobile networks, whichever has shorter turnaround times as determined by the local host trying to communicate through the
communication channel.”
Teacher: “Sit down…”

Let’s take a re-look at the above conversation, only this time, with a computer’s perspective.
Algorithm used by GK to determine answer to the asked question (in C++):

Question * q = getQuestion();
delete q;
Dictionary dict = getDictionary(COMPUTER_TERMS);
while ( ! target.isDazed() ) {
  Word w = dict.getRandomWord();
  cout << w;
cout << endl;

The corresponding messages ( output of the STDERR stream ) of teacher :

brain@teacher : Input error… encoding of stream could not be determined!!
brain@teacher : Parse Error… Un-understood term:flanking
brain@teacher : Parse Error… Unrecognized tokens in input stream
brain@teacher : Parse Error…
brain@teacher : Page fault… Restarting listening daemon…
brain@teacher : Listening daemon… Could not bind to ear…Too much noise in class
brain@teacher : Retrying… Connection Established…
brain@teacher : Parse Error… Could not determine the question to which answer is been given…
brain@teacher : Warning!!! Flow control error… Some or all packets may be lost
brain@teacher : Error… Unknown error!!!
brain@teacher : Error… Too many errors…
brain@teacher : Confused by earlier errors… bailing out…
brain@teacher : Throwing exception “Sit Down”.
Expected to stop input stream. Raise error “DazedLook” to display_module

So now you know… The “sit down” command is really an exception thrown to make the student stop talking.

Friday, July 15, 2005

Fore-warned is fore-armed

Many of the networking or related applications have to marshal/unmarshal packets to/from structures. And its not uncommon to have more than one field within a byte of a packet. So, what's the best way to construct a packet before sending it over the wire? Say, a SCSI CDB (command descriptor block - similar to an SNMP packet) has to be sent to a device target. Lets simplify the whole thing and say that just 1 byte consisting of 8 1-bit flags is to be sent over the wire. What's the best way to represent such a byte? The first solution that comes to anyone's mind would be bitfields. So, let's go ahead with that.

typedef struct CDB_Byte {
  unsigned char a:1;
  unsigned char b:1;
  unsigned char c:1;
  unsigned char d:1;
  unsigned char e:1;
  unsigned char f:1;
  unsigned char g:1;
  unsigned char h:1;
} CDB_Byte;

Now I want to set only the LSB(least significant bit) and the one next to it. Okay, that's simple.

CDB_Byte byte;
byte.h = 1;
byte.g = 1;

But, I have a question. Is this the correct way to do it? The answer is NO. Let me illustrate why this is'nt the correct way with a simple example.

unsigned char c = 0x01;    // LSB set
CDB_Byte byte;
std::memcpy(&byte, &c, 1);    //copy the bits
// to change the value of 'c' to 0x03
byte.g = 1;    // set the bit next to the LSB
std::memcpy(&c, &byte, 1);     // copy the bits back
std::cout << (unsigned)c;

Will this print '3'? The answer is 'depends'. The language standard does not say anything about the allocation of bitfields. The compilers are free to implement them as they deem fit. On linux, the gcc compiler allocates the bitfields starting from the LSB. This can be verified - the above piece of code prints '65'.


However on HP-UX, the aCC compiler allocates bitfields starting from the MSB. The above piece of code prints '3' (as one might have expected in the first place).


Moral of the story is this: Never use bitfields to construct structures containing sub-byte fields. Always use a void * chunk of memory, extract a byte, and use masks and bitwise operators to set/extract sub-byte fields. At least, if you expect your application to be portable, don't use bitfields! I would say that bitfields should never be used anyway, 'cos there's no guarantee that the same application will run on the same platform if the compiler vendor rolls out a newer version.

Fore-warned is fore-armed!

Wednesday, July 13, 2005

Replay: Real forwards!

This is a part of the "Real forwards" series that was so rampant in our college days. Read on this marvellous "creation" :))


There is a project going on to write a poem for one of [X]'s RGFs (RGF = Remote Girl Friend as described in RFC 27342). These RGFs are all outside Bangalore. There is a lot to tell about [X]’s good luck. He seems to get all the RGFs he wants. Girls mysteriously call him and message him. He meets these girls “quite by accident” he says. Serendipity, he calls it. Bullshit I say. Anyway, here is the beta-1 release of the poem for RGF #1, who is sitting somewhere in Mumbai.

“The Fluttering candle”

Ooo my dear rosy
You make me all woozy
I am here, sitting in IP class
You are there, hope you don’t have SARS

What is life: Love and friendship?
Woe is me, with all my hardship
Our meeting, it cannot be incidental,
Nothing else rhymes, so I’ll say environmental

You came in my life like a tornado
And left my little soul like a tomato
My kidney, liver and heart, have formed a group
Swimming like a bread crumb, in tomato soup.

All of us look over our marvelous achievement in poetry. If poetry had a modern-art edition, it
would be along similar lines.


How was it?!

Tuesday, July 12, 2005

This ain't no movie!

A social gathering - party to be precise... A sea of people (well almost) - some known faces, some unknown, some enjoying, some pretending to be enjoying, some absolutely lost without a clue as to what's going on. Such variety of people around - he looked at the crowd once more, for the topology of people had changed. Everytime he looked around, he was almost amused to see people doing things they were doing. Presently he could see a lady walking towards him.

"Hello beta! Do you remember me?", she asked him
He pretended to concentrate hard and suddenly said "Ya! Yes, yes - I do remember..."
"So, I heard now you're earning since a year. Very good beta. I'm so proud of you" she continued.
"Ya, just completed a year. Thanks" He had to say this. Suddenly she turned away from him and called out to someone in the crowd.
"Pooja, come here..." - He could see a girl coming towards them.
"This is my daughter, Pooja" She introduced her to him.
"Hi!" she said.
"Hello". He somehow did not like this.
"You two be talking, I'll be back shortly" she said, and disappeared into the crowd.
"Just like in the movies eh?!" he asked
"Like what?" She asked
"You know, parents introduce a boy to a girl and conviniently leave the scene" he said
"Oh ya. Always happens na?" she chuckled.
"How lame I must say! By the way, I still don't know who she was and who you are - please pardon my ignorance" he said matter of factly.
"Oh that's alright. As long as you know my name, that's enough for a conversation. And yes, that's a very lame trick and I hate it!" she said.
Oh great, someone who seems to think similarly, he thought to himself.
"I don't know about you, but I'm hungry. How about having something to eat?" he asked her.
"I'm hungry too. Sure" she said.


Hey, hey - what were you ppl expecting?? This ain't no movie!!!! :))

Friday, July 08, 2005

Strange lookup rule

This post is purely technical and uninterested people can hit the back button immediately.

This is something I never knew and read about it recently in "Exceptional C++". Let me start with a code example...

namespace A {
  class S { };
  void foo(S& parm) { }

namespace B {
  void foo(A::S& parm) { }
  void bar(A::S& parm) {
    foo(parm); // Which "foo" does this call?

Try this out and to your surprise you'll find that this gives a "call to foo is ambiguous" error. But why?? The only foo visible at the place of call is in namespace B. Why should this result in an error? Okay, now try this out - comment out the "foo" definition in namespace B.

namespace A {
  class S { };
  void foo(S& parm) { }

namespace B {
  // void foo(A::S& parm) { }
  void bar(A::S& parm) {
    foo(parm); // Which "foo" does this call?

This compiles without errors! Surprised again? When you run the program, it'd have called A::foo. What happened here? Does this not appear to be a namespace violation. Apparently not! This strange behavior is explained by "Koenig lookup".

If you supply a function argument of class type (here parm, of type A::S), then to find the function name the compiler considers matching names in the namespace (here A) containing the argument's type.

But still, is'nt this a namespace violation?? NO. Just consider this piece of code...

std::string str("Hello");
std::cout << str ;

This works fine right? How? This works because of Koenig lookup. The function in question here is "operator <<" which is found in "namespace std". But we have'nt used any "using" declaration to bring that function into the current scope. Since std::string is going as an argument into that function, the compiler will automatically look into the std namespace and will find that function. Without this kind of lookup, the same function call would have to be written as...

std::operator <<( std::cout, str) ; // ugly! ain't it??

This is the great value that Koenig lookup gets us and we tend to use it every now and then without realising it. Interesting - is'nt it??

Wednesday, July 06, 2005

Phone hang!

Wow! I thought I could stress-test just my comp! Turns out that even my mobile phone is susceptible to my usage. I'd call this my newest stress-testing benchmark for mobile phones. Okay - what I have is a rather old nokia 3530. Yesterday while I was in the lab, busy doing something, I received a message which warranted a quick reply. I went on the replying path very rapidly. I've got delivery reports set to "on". So, while checking up and deleting the report, my cell phone "hung". YES, it hung bloody! And what more?? I've been able to "reproduce" the hang quite consistently - now I know the exact sequence of operations that leads to a hang.

Since I work on firmware, I can guess that even mobile phones have their own OS (what nokia calls as "nokia OS"). These wont be a full fledged OS but a minimal implementation of job scheduling and dispatch and may be some trivial memory management. And some sort of firmware that runs over this OS service is responsible for all the activities that the user expects. This hang could well be the result of some sort of deadlock within the phone firmware. Err - now can I report this somewhere?? :D

Friday, July 01, 2005

Song for the weekend

Posted by Picasa

Cold winter nights

Summers gone a while ago
The daylight dims away
I'm watching here
how the snow begins to fall

Yesterdays like a dream
A memory in my head
Like the lifes gone behind the winter wall

I'm lighting up the candles
and lock the door
Sitting by the fire
Its time to dream some more

I have to find a way how to survive
I am surrounded by the starlight
I have to find the path and to
escape from the Cold Winter Nights

And in the morning there's no trace of the sun
Just gray fog hanging above my head
All the birds are quiet hiding in the woods
Cant see no movement are they all dead?

From the new album of Stratovarius - "Destiny"
Happy weekend :)

Thursday, June 30, 2005

Today's gyan

What my great grandfather says...
Whenever you have a nightmare in the early hours of the morning, its likely to come true...

What I say...
Whenever you have nightmare in the early hours of the morning, you're likely to have a great day ahead, but with a minor skirmish... (<---- GYAN)

Lets take today, for instance. I'm woken up by a horrible nightmare at 4-30am. The moment I woke up, I don't remember exactly what the nightmare was... A friend of mine had given a crash course on - "How to remember your dreams/nightmares even after you get up from sleep - in 3 days"!!!! All that has long gone out to the dumpster! :)) (Hope she doesn't read this ;-P) Anyway, back to what I was saying - I got woken up at 4-30am... now what to do?? Wait a minute, remember me gyan?? I switch on my comp and start playing "Project-IGI". Yeah, yeah, I've finished that game some 32 times almost 3 years ago!!! But that game has sentimental value to me... Its the last game that ever ran or could be ran on my comp - see, my comp is also quite aged with old hardware!! Starting from the first mission, I kick every single gaurd's ass with a wide array of weapons like - Glock, Desert eagle, Mp5-Sd3, M16-A2, AK-47, Minimi, Spas-12, Jackhammer, Dragunov, Proximity mines, Flashbangs, etc, etc, etc. I finish 8 missions in 2 hours! All setting up for a great day ahead! Then I start my usual morning routine, setup my favorites' playlist on the media player and go to the bathroom for cleaning myself up... nice n slow, rhythm building, electrifying guitaring rushing the adrenalin on, and suddenly........
loud sounds of band-baaja, totally out-of-tune dholaks and many [what do they call that??]s... What the **** is happening?? Wait a minute, remember my gyan?? Minor skirmish... I peek out of the window to see what that's all abt... seemed to me like a baraat... DAMMIT. Okay - one more reason for me not to marry... have a baraat like this and spoil some dude's morning paradise???? NEVER!

And how do I know its likely to be a great day ahead?? Well, somehow I can just feel it... :)
Oh ya - I'm very pleased to see myself referenced in a very honorable way on the blog of my fellow liverpool fan! :)

Tuesday, June 28, 2005


Never, in the recent past, have I been so occupied with various stuff. (Observe no posts since friday!) Ummm - Well lets see where to start - Okay weekend.

Saturday morning I get up, I don't why/how, but I feel this sudden urge to go to a book shop and buy some books. So, I leave for book paradise right after a late breakfast. 3 hours later, I'm at home with 5 books!

1) Exceptional C++ - Herb Sutter
2) More exceptional C++ - Herb Sutter (This guy's the chief architect for the MS VC++ team)
3) Design Patterns - By the famous 'gang of 4'
4) C traps and pitfalls - Andrew Koenig
5) Excuses, excuses, excuses - [Don't remember the author - but really funny to read!]

I got so much engrossed into the books that I skipped some social function on sunday. Monday I come to office and viola, loads of work formed right in front of me - like manure from compost!! As I'm writing this, I see a mail pop-up... must be another escalation! Phew! Yesterday, there were many small discussions...

1) Avinash was of the opinion that the 'singleton' pattern does not need any special implementation in C++. According to him, a class with just static data and static members would be as good as a singleton.
Partly agreeable. 'Cos static members are class wide - so there would be only single instances of all the members. But there's nothing that's expressly disallowing users from instantiating multiple objects. Also, without careful class design, there's no way to control the construction and destruction of these static members. May be the members need a constructor-like initialization and not just static initialization. But something to think about anyway.

2) Goutham - One of the constant critiques of C++ questions that in the C++ singleton implementation, why is there a need for a private static handle to the same class - why can't the private handle be a normal member of the class?
Okay, had not really thought about this. What I feel is that such a construct is not safe. A pointer within an object (just 1 object - mind you, its a singleton) to self - No, that's not safe. What might happen if that object is to be serialized onto backing store? Object serialization usually uses deep-copy semantics. This means, that the object serialization would recurse endlessly. This was what I could think of. There might be other and more compelling reasons for it too.

3) Microsoft is drafting the new C++/CLI standard that's likely to get approved in 2006/2007. What the new standard is all about is bringing 'Concrete C++ language on the virtual platform' (As quoted by Herb Sutter in his keynote address at the OOPLSA). What is aims to do is to bring the best from the worlds of C++ and managed languages together.
Imagine -
'Destructors and finalizers' together! ( T::~T() and T::!T() - These are the new syntax)
'Templates and Generics' together!
Ability to create objects on system heap or the managed runtime heap!
(T* ptr = new T; and T^ gcPtr = gcnew T; - This is the new syntax)
The complete video of the keynote address is available here. Do have a look at it! Sounds exciting! (Herb Sutter is a great speaker)

Ah well, time for me to get out of my tech fantasy and attend to my work at hand... OnO.

Friday, June 24, 2005

Music tag!

Well, almost everyone in the blogosphere has been writing about the books they read, possess, books which has made a difference to their lives, etc, etc, etc. I'm not a book person at all. Even though I have read a few here n there. I'm very much a music person. One can always see me with my headphones on in office and with earphones/mp3 player during travel. My neighbours even have the privilege(read untold misery) of hearing me sing while I bathe!! So, I thought, why not list out the songs I listen to, possess, and some songs that've made a difference in my life. Well, here goes! And oh ya - ppl interested can take this up too... (This tagging is so rampant! Uff!)

Last album I bought
Iron Maiden - Dance of death

Next album(s) I want to buy
Oasis - Don't believe the truth
Velvet Revolver - Contraband

Last song I downloaded
Stratovarius - Venus in the morning

Last song I heard before this post
Cradle of filth - Hallowed be thy name

All time favorite bands
Pink Floyd
Guns 'N Roses(GNR)
Iron Maiden

All time favorite songs (Not in any particular order)
(Take a deep breath - long list! All of these have had an impact on the way I think)
(List updated: June 03, 2006)
Nothing else matters - Metallica
Fade to black - Metallica
One - Metallica
Master of puppets - Metallica
No leaf clover - Metallica
Turn the page - Metallica
Astronomy - Metallica
Wherever I may roam - Metallica
Unforgiven I/II - Metallica
My friend of misery - Metallica
Enter sandman - Metallica
Memory remains - Metallica
Hero of the day - Metallica
Die, die, die my darling - Metallica
The call of ktulu - Metallica
Blood Brothers - Maiden
Wicker Man - Iron Maiden
Afraid to shoot strangers - Iron Maiden
Clansman - Iron Maiden
Wasted years - Iron Maiden
Phantom of the opera - Iron Maiden
Rainmaker - Iron Maiden
The thin line between love and hate - Iron Maiden
Ghost of the navigator - Iron Maiden
Fallen angel - Iron Maiden
The mercenary - Iron Maiden
Fear of the dark - Iron Maiden
Judas be my guide - Iron Maiden
No prayer for the dying - Iron Maiden
Holy smoke - Iron Maiden
Only the good die young - Iron Maiden
The trooper - Iron Maiden
Alexander the great - Iron Maiden
Infinite dreams - Iron Maiden
The clairvoyant - Iron Maiden
Virus - Iron Maiden
The loneliness of a long distance runner - Iron Maiden
A tout le monde - Megadeth
Wanderlust - Megadeth
Secret place - Megadeth
She wolf - Megadeth
Thought I knew it all - Megadeth
Hangar 18 - Megadeth
Train of consequences - Megadeth
Die dead enough - Megadeth
Trust - Megadeth
This was my life - Megadeth
November rain - GNR
Sweet child 'o mine - GNR
Civil war - GNR
Don't cry - GNR
Yesterdays - GNR
So fine - GNR
Estranged - GNR
Live and let die - GNR
Coma - GNR
Used to love her - GNR
Ain't it fun - GNR
Patience - GNR
Paradise city - GNR
High hopes - Pink Floyd
Another brick in the wall II - Pink Floyd
Hey you - Pink Floyd
Comfortably numb - Pink Floyd
Wish you were here - Pink Floyd
Coming back to life - Pink Floyd
Lost for words - Pink Floyd
Shine on you crazy diamond - Pink Floyd
Time - Pink Floyd
Money - Pink Floyd
Little by little - Oasis
Wonderwall - Oasis
Champagne supernova - Oasis
Don't look back in anger - Oasis
Morning glory - Oasis
The importance of being idle - Oasis
Lyla - Oasis
All around the world - Oasis
Boulevard of broken dreams - Green Day
Wake me up when september ends - Green Day
One more time - Lynyrd Skynyrd
Am I losing? - Lynyrd Skynyrd
Jesus of suburbia - Green Day
Someday - Nickelback
Blurry - Puddle of mudd
Kiss from a rose - Seal
Losing my religion - REM
I'll be there for you - Rembrandts
Walk on - U2
Visions of paradise - Mick Jagger
Drops of jupiter - Train
No boundaries - Michael Angelo
A hamlet for a slothful vassal - Theater of tragedy
Mutter - Rammstein
Mama I'm coming home - Ozzy
Smells like teen spirit - Nirvana
Come as you are - Nirvana
Last kiss - Pearl Jam
Higher - Creed
One last breath - Creed
Stairway to heaven - Led Zeppelin
Stream of consciousness - Dream Theater
Take the time - Dream Theater
Learning to live - Dream Theater
Another day - Dream Theater
Pull me under - Dream Theater
Surrounded - Dream Theater
One last time - Dream Theater
Spirit carries on - Dream Theater
The ytse jam - Dream Theater
Believe in love - Scorpions
Still loving you - Scorpions
Wind of change - Scorpions
Send me an angel - Scorpions
Rock you like a hurricane - Scorpions
Rhythm of love - Scorpions
Holiday - Scorpions
Pour some sugar on me - Def Leppard
Love bites - Def Leppard
Animal - Def Leppard
Lets get rocked - Def Leppard
Two steps behind - Def Leppard
Fall to pieces - Velvet Revolver
Loving the alien - Velvet Revolver
Slither - Velvet Revolver
Set me free - Velvet Revelver
You got no right - Velvet Revolver
4000 rainy nights - Stratovarius
Venus in the morning - Stratovarius
Eagleheart - Stratovarius
Cold winter nights - Stratovarius
Black diamond - Stratovarius
Warning sign - Coldplay
Yellow - Coldplay
White shadows - Coldplay
Fix you - Coldplay
Speed of sound - Coldplay
A message - Coldplay
X&Y - Coldplay
Hardest part - Coldplay
Numb - Linkin Park
In the end - Linkin Park

All time favorite lead singers
Bruce Dickenson(Iron Maiden)
Dave Mustaine(Megadeth)
James HetField(Metallica)
Liam Gallagher(Oasis)
Axl Rose(GNR)

All time favorite lead guitarists
Kirk Hammett (Metallica)
Slash (GNR/Velvet Revolver)
Marty Friedman (Megadeth)

Total Songs(mp3s) I have on my office comp

Total songs(mp3s) I have on my home comp

Total Music CDs I've burned

People who have to take this up

Hmm... waiting to know your musical interests! Then I'll have more new songs to download :)