Monday, May 21, 2007

To be (signed) or NOT To be (signed!)

A few days back, we observed an interesting behavior of signed and unsigned chars.
We had an array and were using a char variable with right shift operation as subscript in order to access a member in the array. (something like foo[foobar >> 4])

I was surprized to see that for some reason, after the shifting operation, the subscript value came out to be negative. wheras (unsigned char)fobar >> 4 was giving a positive value.

I just could not digest the behavior. My argument was that memory location allocated to hold the value of foobar will have some bit pattern. I don't care what it is. When I right shift this bit pattern, it should just shift and the resultant bit pattern should be THE SAME irrespective of whether foobar is signed or unsigned.

But then it hit me. In case of signed data, the MSB is the sign bit. It does not form part of data. So when I right shift a signed data, the MSB will not move. Whereas, in case of unsigned data, Thus, if I right shift a negative number, the resultant will also be negative. And that is indeed correct, as right shifting is equivalent to division by 2.

And the subscript on an array is always treated as signed value.

So, signed and unsigned makes difference! Recall the basics :-)

Saturday, May 19, 2007

Mahabaleshwar

With a lot of excitement and enthusiasm we started our journey to Mahabaleshwar. The plan was simple ... Go there ... Look for some decent accommodation ... If you get one, spend the weekend and return ... else just return home before its dark!
After a 3hrs of drive filled with thrill, excitement etc. we reached Mahabaleshwar. As we had already expected, there was a lot of rush. After all this is the peak season.

We first went to a resort "Ramsukh" ( a friend who had stayed here earlier referred this resort to us). We went to the reception to enquire about a room. I still cant believe what I heard ... "Sir, we have only one cottage available. The rest of the resort is full. For one night stay, the cottage will cost you Rs ..... 17,000/- ONLY!" My God! This is the highest price I have heard till date for one night accommodation. A similar accommodation with similar amenities 'in Singapore' will cost you some 7000/- (INR). I was further shocked to know that 3 out of such 4 cottages were already taken up. Meaning there are people on this planet who believe that the accommodation is worth the price!!! May god help them make sound decisions :-P. Well, we obviously decided to try other hotels/resorts. But before that we decided to check out a famous 'SPOT' in Mahabaleshwar ... Arthur's Seat. The route to Arthur's Seat is really nice ... its as good as a switchback ('Ghaat' as it is called in local language), with dense plantation on both the side and many many blind turns! The climate was good, cooler that Pune. (But the Sun on the top didn't spare us :-( ).

We had a GREAT time at 'Arthur's Seat' spot. We bought some 'Baraf ka gola', some local fruits (ever heard of a small black fruit called 'Tuti' ?). We found a person who would sell you your 'One minute photo' (Now we have one memorable photo of this trip!) The funny thing was that this fellow wont let you stand where YOU wish to stand. It is him to decide which is the best place for a 'Couple Snap' and which is the best place for a 'Family Snap' :-)

After spending time at Arthur's Seat, we returned back to the main Mahabaleshwar city. We didn't find a single hotel who would offer accommodation for some 2000/- All of the hotels had 'Exactly one room available' which would cost some 4000/- bucks. We had a look at the rooms, and concluded that it was definitely not worth the price. Secondly, we were not sure of what to do even if we get an accommodation. I mean, we didn't find anything special as such at Mahabaleshwar :-( So, the plan was SEALED. We were not staying at Mahabaleshwar. So, after lunch, we started back at around 3.15 in the afternoon.

On our way back, we spent almost an hour at Mapro Garden. This is a great place to hang around. Lot of trees, lot of flowers, great sandwich and ice-cream .... its just great.

We left Mapro Garden by 4.15, and reached home in less than 2.5 hours!

So ... here is the conclusive part ....
Except natural beauty, there is nothing in Mahabaleshwar. It is no more a hill station one would like to visit in Summer. Reason is simple ... its not cool anymore, and even if the air is cool, the sun on the top doesn't spare you :-(, the places is crowded, and the accommodation will cost almost 3 times the off season rate.
In my opinion, winter is the best time to visit this place. You will have a pleasant gift left behind by the rains ... greenery! the climate will be really cool and you will surely enjoy walking on the streets even in the afternoon. you will get good accommodation at very cheap price. Thirdly, it will not be crowded at all.

If you have a group of friends .... you can also plan a one day trip to Mapro Garden. I mean, JUST Mapro garden. No need at all to spend efforts,fuel,time going all the way to Mahabaleshwar. Just go to Mapro, spend time there, have food, ice-cream, juices ... and come back!

Planning for Mahabaleshwar

Finally, a plan that was on paper for quite some time, was executed today.
I and Swati were planning a trip to Mahabaleshwar for almost a month. But for some reason or the other, it would not materialize. But today, finally, we made it to Mahabaleshwar :-)

We returned to Pune from Nashik on 14th. We knew that we have one weekend in hand, before our next trip to Nashik. And then we decided to go to Mahabaleshwar on this weekend. Why mahabaleshwar? well, actually there is nothing special about this place (not atleast for us!). We just wanted to go to some place near (?) Pune, on bike! So the options were ...
1) Some Ganapati mandir (Astavinayak mandir).
2) Lonawala / Khandala
3) Matheran
4) Panchgani / Mahabaleshwar

Now Ashtavinayak were ruled out, as it would have been (strictly) a few hours trip. We wanted to spend the weekend at some place (at least one complete day). Now out of the remaining options, Matheran was ruled out, as one can not take vehicles up there. You have to park then somewhere (no idea where) and the walk to the main city. So 'I' canceled the idea. I have been to Lonawala, and I just cant think 'what a person can do in Lonawala in summer?'. I believe Lonawala/Khandala are places to be visited only during and immediately after monsoon. So we were left with only one option.

Panchgani / Mahabaleshwar was a considerable option.
The reasons ...
1) The place(s) is at a drivable distance from Pune. (120km - approx. 3 hrs drive)
2) The place(s) is known as a 'Hill station'. A perfect place to visit in Summer?

So ... the plan was fixed, the tank was filled full, the bags packed, alarm set and we went to bed dreaming about tomorrows drive.

To be frank, I was a little nervous. I have been doing long drives (Pune - Nashik ... 210km) pretty regularly. But in last 3 years, there was not even one drive when I took someone along. But this time, Swati would be with me! I was thinking about a lot of worst case scenarios ...
its a long drive. she has never done this before. would she be comfortable? what would happen if the tyre goes bust in the middle of nowhere? what would happen if we meet with some accident? etc. etc. etc. Actually I always think of such worst case scenarios when I start for Nashik. But then, I am always alone, and don't have to think about anyone else but myself. But things are different when someone ... your wife ... your love is going to be with you :-)

well ... in spite of all these negative thoughts, I decided to give it a try. and there we were ... at 6.30 in the morning ... on our way to Mahabaleshwar!

Sunday, August 20, 2006

CARS ....... A must watch

CARS …
One of very few movies that have thoroughly enjoyed … A fabulous creation. Disney and PIXAR promise, unlimited entertainment on PIXAR’s 20th birthday.

The dedication put by PIXAR in the making of this animation movie comes out live in the theater. Not a single thing in the movie disappoints you.

Apart from being an animated movie that would be loved by people of all ages, CARS has much more to offer. Animation, graphics, comedy, tragedy, happy moments, sad moments, excitement, seriousness …. you name it and you’ve got it 

The story is about a racing car, a rookie, who wants to make it big … a car that would ‘Eat losers for breakfast’ and come out a winner. The ‘Piston Cup’ is all that he (yeh … the car is he and not it, not anymore ) is looking forward to. This is, faster than fast, quicker than quick, Lightning McQueen. This chap would do anything to win that Piston Cup, and he does!

The story starts with a race … yeps … race for Piston Cup. And McQueen is challenging the champions … but what the heck … he doesn’t win the race …
The piston cup is still a race away and McQueen has another chance to win the cup.On his way to the race destination, McQueen gets lost on famous Route 66. He makes a loud entry in a small town on route 66, Radiator Springs. The small community in this town shows him what he has been missing till date.

Why McQueen fails to win the piston cup in the first race, how does he gets lost on route 66. Whom does he meet in Radiator Springs and how they treat him? what happens to McQueen and his dream to win the Piston Cup …. To know all this and moreover to have a wonderful day …. Watch CARS !!!

Wednesday, August 09, 2006

Frustrating rains :-(

There was a time when I used to love rains ... The climate would be nice ... Greenery all around you
having chance to enjoy the rains followed by hot tea and spicy 'Kanda Bhaji' ... It was all fun.

But since last year, things have changed. I have started to hate rains. Reason ... it just doesn't stop raining. Since last year, the climate in India seems to be changing. Its either very hot summer, or chilling winter and non stop rains otherwise ... I am just frustrated of drenching every time I step outside.

It hasnt stopped raining since Friday (except a few hours every day). Almost all the dams are full and almost every river in Maharashtra is flowing above danger mark. Thousands of people are 'shifted' to safe places. I am just happy (?) I don't happen to be one of them.

Hope situation will improve in a day or two

Monday, August 07, 2006

Fate !!!

Only 3 laps to go ... Alonso already out of the race ... Fisichella too ... Massa holding onto 9th position, fighting to come one place up, to gain some points ... GOD though not looking strong with his worn out intermediate tires, trying his best to defend his 3rd position ...

Wow ... what a situation that was! Ferrari having a chance to cover up the gap in constructions championship by some 6 odd points. GOD having a chance to cover up the gap in World championship by some 5 points ...

And it happened ... GOD started retarding ... other cars zooming past him ... and there he went into the pit ... just to retire !!!

3 laps remaining and GOD had a broken track rod! Millions of hearts broke with that rod :-(
I guess this is what we call FATE / DESTINY

And when I write this blog, with heavy heart, feeling really bad about what happened and especially 'when' it happened ... here is what GOD has to say ... http://formula1.com/race/news/4780/763.html


“Of course, I am very disappointed. We had a great opportunity but we did not take it. All weekend and especially the race was something of a rollercoaster and in the end, we found ourselves back where we started, although with one less race to go. The track rod broke as Heidfeld went past. We touched, partly because the track was still a bit slippery. These things happen. Did we take a risk staying out on track with intermediate tyres and in the fight with my rivals? That’s the way I am. I always want to fight for the top which is why I have won so often. There are still five races to go. Nothing is yet lost and I will give it my all in trying to win the title.”

Well ... that’s the way it is :-)

Friday, May 19, 2006

Here I come

After reading lot of blogs, felt this is time to start my own.
Hope this I will continue blogging for years to come ...

thats it for now.