Friday, November 28, 2008

The Month of changes... ;)

It’s been a long month and for sure this month has seen a lot of changes in me as to what I think and the way I think. Not saying that I absolutely adore the changes but I have to say that I might put up a fight before going down.

All the credit for my current situation goes to Mark and Mayank. Whether this turns out good or bad is yet to be seen but at the moment I can certainly say that one difference between me today and me a month ago is that I can see something more clearly and now I have a bit more idea of how this world works. Yay!!! Never stop collecting information; you never know when you might need it or where it might actually be a lifesaver.

On the other front thanks again to Mayank I think I’m going be in a better shape ;)

Monday, September 15, 2008

Finally found someone to match my thought process

Sunday was a day meant for sleeping and sleeping only... but no some of us had a (or rather two) films to catch. First up was "Wall.E" at 10:30 in the morning... yeah you read it right. we got up at 10 to go to the movies...

It actually was a “reado” (reading analogy of typo) by us. The website said 10:30 and we didn’t look any further. It actually was AM (those people should use military timings) no one would ever confuse 2030 with anything as 1030. Anyway “Wall.E” was a big disappointment, honestly I expected better from Pixar.

But cut to the next movie “The Wednesday” and I seriously admire the creator. This is exactly the way things should be. We catch the terrorists only to release them later when some AssHole (pardon the language) captures 189 people and demands their release (remember Kandahar and flight IC-814).

What did we learn from the whole goddamn drama… nothing I guess! We just moved on, what a pity!

We caught “Maulana Masood Azhar”, “Mushtaq Ahmed Zargar” and “Ahmed Omar Saeed Sheikh” and for what? Kept them in prison for lot of time and feeding them all this time on the tax paid by us (WTF, I want to kill all the politicians for this act only), then released them when the terrorists held passengers of IC 814 hostage. So in essence we released those three terrorists for protecting 189 hostages and a plane. Did no one realize that those three terrorists out in the open might kill few thousands and damage property worth more than an airplane?

Let’s weigh the pros and cons in the current version

  • Pros
    • Passengers safe
    • Plane safe
  • Cons
    • Three known terrorists at large
      • Will kill more than the 189 people in all probability
      • Will destroy property worth more than one “Airbus 300” in the aforementioned act
    • Loss of Spine for India

Maybe no one was able to prove that the aforementioned three people really were terrorists before the hijack but after the hijack was there any need for the proof?

The version I would have liked better:

  • Take all three to Kandahar and approach the plane
  • Execute them then and there
  • Storm the plane

Max losses

  • The passengers
  • The plane

Max benefits

  • Passengers
  • Plane
  • No threat from at least those three terrorists and the hijackers.
  • Strong message to the would-be hijackers.

But this is me, and I think different. But then I ask this simple question, why do we keep people in jail when they have been proven guilty? Why provide them with food and medical supplies when there are people in the country who can’t get enough to survive? Why build jails worth crores, each cell costing multiple millions to build and maintain when a bullet costs 50 odd bucks and cremation another 1000 bucks? Why even cremate them, kill them, chop them and feed to them to the dwindling lion population; after all they (lions) deserve more then what they usually get?

Naseeruddin Shah’s character does exactly this. Kill them off. Government will never do it; they lack the spine and the mental makeup that requires this. Kudos to “Neeraj Pandey” for making this movie. Thanks.

Saturday, September 06, 2008

Adding Icons to the Menus

This has been the worst struggle I've ever had to do with getting MFC to do what I want.

I had to add Icons to a Context menu and so far I have done it successfully for Vista. For XP its another ball-game altogether.

Tuesday, September 02, 2008

Of promising to give more than you have

For years that i have been programming i have taken pride in the fact that I check for all the newly allocated pointer against NULL and don't use it otherwise.

No imagine the following scenario

  1. You ask for a huge amount of memory and system returns you a pointer.
  2. You check it against NULL and are happy that its not NULL so you go ahead and try to use it.
  3. Out of the blue you get a Segmentation Fault error and boom... you app is dead ;(

Lets investigate as to what happened

  • There is a feature in Linux kernel called "Over Commit"
  • When you ask for memory it just returns you a pointer which actually is not yet allocated.
  • System assigns you pages as and when you use it (WTF)
  • So just in case when you decided it was time for you to use the memory you allocated and check the return value for NULL (just to be sure) the system might run out of all memory.

The result

Your app just "crashed and burned". Why? because although you checked for a NULL return from the allocating routines but you didn't use it and check for a "segmentation fault" following the access to the memory. a BIG WTF.

 

One solution I can think of is to follow this procedure

  1. Set up signal handler for "SIGSEGV"
  2. Allocate memory
  3. Set up a flag that you are going to use the newly allocated memory (the flag has to be thread specific of use a synchronization object for this thus making it thread safe)
  4. In the Signal handler for "SIGSEGV" see if signal was raised due to the memory access of the newly allocated memory.
  5. If yes set up another flag marking the memory bad and don't use it anywhere.
  6. Else use the memory and be merry.

Conclusion

  • A simple and efficient check against NULL now replaced with all the above crap.

My stand

I don't know who and why would think up this feature, let alone make it a system wide policy. if this would have been a process level settings wherein the developer would have to explicitly tell the compiler to enable "Over Commit" then i could have let that fancy dev do whatever he/she wanted, but making this default setting on every Linux box... WOW, no other words.

Yes i know there may be some advantages to this, but the risk far outweighs the advantages. Let the crazy ones make this choices of doing all the juggling for allocating valid memory, I just want the NULL back.

I found this on gnu.org

Memory overcommit is a Linux kernel feature that lets applications allocate more memory than is actually available. The idea behind this feature is that some applications allocate large amounts of memory "just in case", but never actually use it. Thus, memory overcommit allows you to run more applications than actually fit in your memory, provided the applications don't actually use the memory they've allocated. If they do, then the kernel terminates the application.

Wow, I got terminated because I asked for memory and then used the memory i got back. am I missing something here?

Tuesday, August 12, 2008

Just an update...

Went on a trip to Leh... although could not complete it.
Bike ride from Manali to leh is truly an experience (it has been described so much already on so many different places that I'm not even gonna start ;) )

Bought a lot of Kitchen utils and finally a TV set... woha..

Thursday, May 29, 2008

The Download Day...

This sure is an interesting way to create some hype and get people to download FireFox the day it releases and increase the presence...

Download Day 2008
Download Day 2008
Download Day 2008
Download Day 2008
Download Day 2008

Monday, May 19, 2008

Of Bike Servicing

It can be a pain to love your bike and not finding good enough service center for the bike.

Right now I have a Bajaj Pulsar 150 UG3 and believe me; here in Noida or back in Bangalore I am yet to find a Bajaj Service Center that meets the expectations.

It’s been almost a year since I shifted to Noida and since then I have been going to the same dealer (Suman Autos, Sector 2 Noida, near Nirula’s). After every service I see some things that were all right before and have gone bad since. These include simple things such as Indicator lights to complex parts as complete display system.

Before they take the bike in for servicing they ask you about all the problems you know of. They make a list of all the problems and then the guy receiving the bike takes a test ride and points out all the additional faults that you might have overlooked. So far so good.

Then they give you an estimate of the servicing costs and tentative delivery time. Brilliant.

But then the things start to get worse (at least for me). More often than not I have got the bike in almost the same condition, save for the parts that needed replacement. In one of the incidences I had had a skid and the front shock absorber forks were bent. The guy at the service station told me that they would need replacement and I agreed to it. At the end of the day the Forks got replaced but there was a slight alignment error and that error has still to be corrected. But then I have gotten used to the error and have stopped bothering them.

During the last to last servicing they somehow managed to make my digital display malfunction. The RPM needle was offset by about 250 RPMs. Although they replace the display unit free of cost (I had to haggle with the head about the lax attitude and the incompetency) but not everyone might be so lucky.

I have now decided to check Castrol Bike zone (have heard a lot of good things about them) and if possible ditch the Bajaj authorized service centers once and for all for good.

Sunday, May 04, 2008

Trips are phun! ;)

Oh, its been over 6 monts since my last post as well! ;)
I must say life has been good. attended a wedding, gonna attend another one, went on three trips all within one month.
We went to Rishikesh at the end of April. Being cut off the world for some time felt real good. It causes you to stop and think about the thing called life. It is so busy now a days people hardly get time to think about what they want from life.
for people living in the fast lane here isa warning "Try and see the Roadside, you might never see it again".
The next trip was to Sat Tal. This was the worst trip I could have asked for! The journey was marred by the lack of leg room in the bus and then after a gruelling journey the pedal boats just don't cut it.
I spent the entire camp Sleeping or chatting away. my legs were exausted from the onwards trip and I had the return trip to look forward to.
one thing I learnt from the trip was "Do not mess with someone who has problems getting a joke at the moment and may cost you your job".

The third trip was by far the the best. Bike ride for about 520+ km (lots of it in the mountains). We went to Dharmsala and McLoydganj. Three people, two bikes and mountains and night time driving. What more can you ask for? The people are good up there and they do have the essence of life ;)

Oh yeah, I changed my phone too. Now have a Windows environment on my phone as well! yeah!