Archive for July, 2006

Hey Visual studio! We need to talk.

// July 23rd, 2006 // No Comments » // Visual Studio.Net

There are some things you do for me automatically by default assuming that i am an idiot and that i have no clue what i am doing when i’m building an application. It’s like you are indirectly telling me that “Look! i’m smarter than you and i will do things for you that you don’t need and you can go change it if you don’t like it.”

Not cool, babe!

For example, yesterday i was building a custom control and everything seemed fine initially. When i wanted to use the control in another project, it just wouldn’t work. I checked whether i had copied the custom control’s dll to the bin folder of the project i was working with. It was there. I checked if i had in fact added it to the references. I did. Was i using the right syntax? Yes. Then what the hell was the problem? The error message was that you couldn’t find the control in the dll under the given namespace. But the namespace was right. I had specifically set it to “GG” in the control. Here’s how i tried to use it in the test project.

I had no freaking clue what was going on. I tried rebuilding the solution, rebuilding the control and copy-pasting a fresh copy of the dll into the bin folder everytime. Nope. Didn’t work. It was like you were teasing me and i certainly did not appreciate it.

And then finally i remembered what Russ told me about what you do when someone adds a new project to the solution. He said you set the rootnamespace by default to the name of the project and that needs to be removed if i plan to have my own namespace for the project

So i right click on the project in the solution explorer and click on “Properties” as shown below.

Project properties

And this is what i see

Root namespace

You had in fact set the root namespace to the name of the project by default. Sigh!

Now why would you do that, honey? Please don’t be like that. I love you and i’ll do anything for you and you know that. But please don’t act oversmart. Show some respect here. I know you are smart and i totally dig that. In fact, it turns me on sometimes. But please don’t think i’m an idiot when i’m using you. I know how you are structured and how you work. I know almost all of the features you were built with. I also know how to use most of them to unleash your full potential, babe. Trust me! I can do wonders with you.

Now that we are on the topic, i have a couple of other things to discuss with you. Let’s just get it over with. The other day when i was trying to bind you to the solution in visual source safe (VSS – Your cousin), something pissed you off. I don’t what happened and what triggered your madness. But you just went nuts and used 100% of my CPU and 1.4GB of my memory. And then after 15 minutes, you gave me this message.

Catastrophic failure

I mean…seriously! Is that all you got for me? Catastrophic failure? What am i supposed to do with that? Could you be more specific next time, hon? I know sometimes you have your moments. But i wonder what the guy that actually wrote that piece of code when building you, was thinking when he/she was in fact writing that? “Yeah…i’m just gonna tell them something bad happened. The measure of bad being in the magnitude of a catastrophy. The user can figure out what went wrong.”

Last but not least(cliche!), i still wonder how childish you can be sometimes even after growing up to be such a charming young lady. In fact these days, i think you are a super woman. That’s how i look at you. But you still let the kid in you come out and play once in a while especially when i’m in the middle of rebuilding the solution. I understand that it can be a royal pain the butt to rebuild 16 projects in the solution, one at a time. But c’mon now…that doesn’t call for a peek-a-boo game in the middle of the working hours. You just disappeared during the re-build! Right in front of my eyes…whoosh! Vanished into thin air! I quickly pulled up the task manager and there you were – devenv.exe eating up memory and cpu cycles. But nowhere to be found to the naked eye in Windows. Grow up, sweety! Not all guys think that’s cute.

And while i’m at it, let me clear up something. I’m NOT having an affair with nant. She’s just a friend that helps me out with the build, especially when you are playing your little games of hide and seek. I don’t think she can give me what you can(one word – intellisense) and i don’t have any feelings for her anyways. If you play nice with me, i’ll stop going to her for help..ok?

I know you have tons of complaints against me. Especially the way i write inefficient code that drives CLR crazy. But let’s talk about it another day.

A 9/11 for the US. A 7/11 for India.

// July 12th, 2006 // No Comments » // Miscellaneous

You know what i don’t understand? What exactly were these terrorists thinking when they hatched a deadly plan like this? Not just this one but every single attack on innocent people. 9/11, 7/7, Madrid blasts and all others that have killed scores of innocent people. I mean…what exactly are they planning to achieve here? Force the world to take a look at them, so that they can present their case with a now-that-i-have-your-attention clause?

In case, you are one of those Jihad a-holes reading this, let me explain something to you here. I’m not going to tell you that there are better alternatives to solve your problems because i know that you know them already and still have chosen to murder unsuspecting, unarmed human beings, foolishly hoping that it would advance your political desires. But what i will ask you is something that has been on my mind forever. If you don’t like a country’s international policies, why don’t you try to deal with the people that actually are responsible for them, for example the politicians who framed the policies, huh? That’s the most logical thing to do, don’t you think? They are the leaders and they make the decisions. The public doesn’t have too big of a say in it. If they did, the US would have never gone to the war in Iraq. You remember all those war protests, right? People here are still protesting, but the Bush government hasn’t withdrawn their troops yet and i don’t see that happening any time in the near future either.

So my point is, if X does something wrong (according to you), don’t kill Y for that. What did the civilians do? Why kill them? What’s your point?

“You people put those politicians in power. So you have to be punished for that. That’s why we are going to kill you and your family.” – Guess that’s the justification your single-cell brain can come up with.

No man. That doesn’t make sense at all. That’s not how it is supposed to work.

There’s a reason why there is so much security for all those powerful politicians because they are the ones that run the government, rule the country, do what’s best for the people and understandably face threat from terrorists inside and outside the country, who think that they are responsible for their own problems, which may be true. But don’t take it out on innocent people for heaven’s sake.

Now time for the million dollar question that’s been hovering over the Indian minds all over the world – What has Indian government done to avenge these kind of attacks? When the United States was attacked on 9/11, the whole world was shocked. This is not the diplomatic fake shock that international leaders express when there’s a huge tragedy in a 3rd world country, that i’m talking about here. This is the true shock in every sense of the word. How could someone do this to America? This is arguably the most powerful nation on the planet. How’s the American State going to respond? And boy, did Uncle Sam respond! They knew Osama Bin Laden was the mastermind of 9/11 and they also knew that he was the leader of Al-Qaeda that had its roots and headquarters in Afghanistan. They took out the whole country. Call it surgical strikes or clinical attacks. Call it hell! They ripped the country apart in 3 months and installed a puppet government and also “restored democracy” there. WOW!

They didn’t stop at that. They beefed up security measures within the US and increased CIA operations worldwide for better intelligence. “Random” checks(always the brown guys) at the airports increased and put people at discomfort. But the government didn’t care. They had learned their lesson and will not allow the mistake to happen again. Recently the FBI foiled the preparation for another attack on the American soil well ahead of time because they had the intelligence reports and caught these guys red-handed in Florida.

What a great nation! Forget Iraq for a second. And think about how much the rulers care about their people and how much they value their lives. Just look at the domestic governance. It’s unmatchable.

Now look at India. Since the Mumbai blasts in 1993 that left 257 dead, there has been multiple attacks in Mumbai alone and this is not taking into account all the other attacks in Kashmir, Srinagar, Varanasi and the notorious Parliament attacks in 2001 etc. What has India done to avenge the deaths of over a thousand people in these horrifying blasts? NADA!

Dawood Ibrahim – the SOB behind 1993 Mumbai blasts is in Pakistan and even though the Pak. government vehemently denied this, he just embarassed them by having a big wedding for his daughter in Pakistan, who married the son of Pakistan’s top level ex-cricketer Javed Miandad(this guy played in 6 world cups and is considered a hero on their soil).

India mobilized its troops on the border after the Parliament attacks in 2001 by Pakistani terrorists but stopped due to international pressure to avoid a nuclear war in Southeast Asia.
That’s the closest we have come to waging a war against terrorists in recent times. We can defend ourselves if attacked but we’ll never take the offensive. We’ll never say – “Enough of this bullshit. That’s it. We are taking you down.” You know why? Because Indian lives are not invaluable. Sure…some people die everyday in heinous attacks like this. So what? Who cares? We need peace and harmony. Waging a war is not a walk in the park. There are so many things to take into consideration. Blah..blah..blah.. Sure i buy it. You have your own reasons, sir. Until you are ready to stop this once and for all, we’ll keep losing our fellow men, women and children. No problem.

After all, we are a land of Ahimsa…right? Non-violence is our motto. Wonder what Mahatma Gandhi would have done if he were alive.

Overriding hyperlinks’ default behaviour in javascript

// July 6th, 2006 // No Comments » // JavaScript

No biggie, right? Write a javascript function that should do whatever is needed and just hook it up with the OnClick attribute of the hyperlink. Simple and easy.

Let’s say the function looks something like this.

<script type="text/javascript">function HandleClick() {
alert("Some message!");
}
</script>

Now let’s test it.

Click this link.

See what happened? The javascript function was executed but you still got redirected to the url set in the href attribute of the link.

This is due to the fact that we have overridden the default behaviour of the hyperlink but we still haven’t told Javascript to cancel the default behaviour.

How do we fix this? Just add return false; right after the function call, as shown below.

<a href="http://www.morethan2cents.com" onclick="HandleClick(); return false;">link</a>

By returning false, you are basically telling javascript that the link was not clicked and thus not to trigger the default behaviour.

Now try it again. Click this link.

Voila! No redirection. Alternatively, you could leave the href attribute blank (href=””). But that would basically refresh the page for obvious reasons.

The perks of turning older.

// July 4th, 2006 // No Comments » // Miscellaneous, Personal

For those reading this that are not in the United States, your car insurance rates drop quite a bit when you turn 25.

Here are some pics taken at the office. My colleagues threw me a lil’ party and to cut the cake, i had to wear the famous Birthday Hat. My friend says that i look like a school kid in these pics.

Hmm…Whatever!