.NET Vs Java – The F5 puppets

This is more of a rant than a useful discussion, so if you’re expecting the later go write yourself a Hello World ;-)

In 2002, for a class project I had the option of working with either Microsoft Foundation Classes (MFC) or Java. After having worked with Windows SDK in the last semester, the decision was clear. Anything that didn’t come from Microsoft was going to be OK. So I started reading this book – The Java Programming Language and that is when it happened. I fell in love with James. James Gosling that is. How funny, how intelligent, how brilliant this man might be I thought. If it wasn’t for my employer who made me write Java Server Pages (JSP), I might still have been in love. I’m not quite sure, but I guess it had something to do with the fact that my job involved staring at the “Null Pointer Exception” in the Apache command window for four hours a day, that brought my love story to an end.

In 2003, I was forced to move from Java to .NET. I wasn’t ready for the separation, but the HR lady would hear nothing of it. What did I expect? Human Resources and Programmers are a match made in hell. So there I was, staring reluctantly at my first .NET program. I pressed F5. Everything worked, I didn’t see a “Null Pointer Exception”. Wait a minute I thought, what about the web server? I don’t remember starting it, or installing it, or reading the ten page documentation on how to configure it. I cried. My life as a programmer was over. I was reduced to a Visual Studio puppet – my only task henceforth would be to click F5. I starred enviously at my friends who after two days of debugging had discovered that their program was crashing because they were using JDK 1.3.2 instead of JDK 1.3.1. Oh how I missed being a programmer.

I’ve missed being a programmer for the last seven years now, but I seemed to have survived the million F5s and the zillion “Microsoft Programmer” jokes ;-) Last weekend I started a little hobby project with my husband and a friend – both loyal to the sun, who of course sold their souls to the oracle. The project was to be in Java, no discussion needed there.

So I installed Eclipse. A Java editor that looked professional and was free. Was I falling in love again? Maybe. I then needed to install some Google plugins for our project – what hobby project is complete without involving Google? Ok, it didn’t work, it couldn’t find java. Ummm… why? Well turns out because Eclipse uses its own java compiler or something (don’t ask me!), as javac clearly didn’t exist on my machine. Interesting. So after installing Eclipse I install the JDK! Fine. Subversion crashes. Ummm… Why? Don’t know again – some clash apparently with the java version and the class paths. I found myself digging through the Environment Variables and looking for issues with the “path”. I’d forgotten all about “Environment Variables” in windows, I was hoping they were dead by now. Yikes. Anyway, after it was all sorted out I created some beautiful java classes only to eventually discover that I had the wrong version of Eclipse to write JSP files!

As you can tell, I am not a good java developer. I couldn’t even install the right version of Eclipse. I gave up, someone would have to write the JSP for me. Neither my husband nor my friend seemed too keen on writing that JSP – not sure why. My husband got stuck with it as my friend had a genuine reason, he was a “server side programmer” so he couldn’t be expected to write front end stuff. As a Microsoft developer, you do not have the liberty of making such statements. If you did, it wouldn’t be long before you heard – “Geez man, my 5 year old son can create an ASP.NET website – all you have to do is click F5 !”

How has war affected your life?

WAR – is it good / bad / needed / not needed? I don’t know.

But one thing I do know is that if my country is at war, it is for ME. It is for the safety and freedom of me and my countrymen that we are at war.

Now, the least I can do when my country goes to war is be INTERESTED! Yes. I should know what the war is about, why we need to be at war and why peace negotiations failed. After all, millions of people from my and other countries will die, and one must not forget – it is all for ME.

If the war does bring about the change we wanted, I should be thankful and raise a toast. Cheers!

But what if it doesn’t? This is where things start going wrong.

If the war fails to do what it was meant to do, I am not directly affected. This does not make any sense. So the government officials spent hours at working out the details for me, millions of soldiers from my country died, millions of soldiers from other countries died and my life continues almost unaffected? Again, this does not make any sense.

What if there was a law that forced citizens of “countries at war” to give away 50% of their salaries to the families of soldiers (for as long as the war lasted)? Would I still be unaffected? Would I still be OK with my vacation money taken away? We do pay taxes, but they just don’t cut it. I speak of an action that has a direct consequence – War is on – action starts, war stops – action stops. It is immediate and it is direct.

Everyone should be affected when a country is at war, not necessarily in the same way, but definitely is some way. Not only is this fair to the millions of people who lose their lives, but it also demands more from a government that makes the decision. Because, if and when that decision goes wrong, they will have not a handful but the entire nation questioning them.

Chrome Extensions and Privacy – I’m Scared !

Recently Google introduced Chrome Extensions which are little applications that let you do more with your Chrome browser. Like take this Google Dictionary extension which can tell you the meaning of any word on a website. All you have to do is double-click the word.

Super cool, isn’t it? You just need to Install the Google Dictionary extension and double-click words and meanings will pop up! After you excitedly click “Install”, you get this lovely confirmation box, where things start getting interesting.

All it wants is for you to confirm that this extension will have access to your data on all websites and your browsing history. A little scared? Worried about privacy? Don’t be, Google already knows everything there is to know about you.

Google with its “open” culture allows everyone to create extensions. Developers around the world have already created tons of extensions and people around the world have dutifully downloaded them. See this one from Yoono. It claims to be the most popular extension on Firefox. I should be able to trust it right? But for some reason when the warning pops-up, demanding I allow Yoono to access ALL my web information, I freeze. I just can’t do it.

I decided I will have to be satisfied with extensions developed by Google. We all trust Google. Google’s the good guy. So I decide to Install Speed Tracer.

An even better confirmation message pops up this time. Google now requests access to all data on your computer. Thats right, all my local computer data. The message gives me the creeps! So Google will know everything I do online AND offline. Why don’t they just send me to prison and get over with it!

May be I am orthodox, but the privacy around chrome extensions frightens me, it really does. Until Google can come up with a better privacy policy, I’m definitely going to keep my hands off chrome extensions.

[There is a positive side to this; the extension code is public, so you could in theory review the code. Now, who doesn’t love code reviews?]

London Vs New York – an Indian perspective

A careless, opinionated and utterly pointless comparison of the two cities !

The Queen and Politeness

If you have a queen, you have got to learn to bow ;-) Londoners are generally very polite and well mannered. They can hate you and still manage to be polite. A New Yorker would have a hard time doing so. They (New Yorkers) sway between nice and friendly to loud and annoying with politeness lost somewhere in between.

Till today, Her Majesty, Queen Elizabeth II distributes honorific titles like Sir or Knight which the English would die for (quite literally). In America everyone is a Sir, and the only title of any importance are Millionaires and Billionaires which again most New Yorkers would die for – quite literally.

Power of the wheel

If you’re from India you know the law of the road. The more wheels on your vehicle the more powerful you are. Walking on streets / footpaths is completely at your own risk and isn’t recommended for the week hearted.

At heart, the New York traffic scene isn’t quite different from India except that the madness is toned down a bit. New Yorker’s have little patience for anyone obstructing their way and would prefer if walking on streets was illegal.

Now, Londoner’s love to walk and secretly envy cyclists. Disrespecting a person on foot would clearly indicate you are not a Londoner and a menace to the city.

Subways and Tubes

When compared against each other, the London Tube is a zillion times cleaner. It looks clean, it smells clean, and it IS clean. Except that they seem to spend so much time cleaning it, that its always under maintenance!

The New York Subway not only looks like a coal mine but also feels like one. On the bright side its always up, even past 1 o’clock at night, after the London Tube had decided to nap.

Supermarkets and cheese

Supermarkets in London are easy to find. Huge supermarket chains have mini versions of their store spread out across the heart of The City. Do not be fooled, real-estate in London is as outrageously priced as New York. Good food (a synonym which Europeans use for their cuisine) is cheap.

Manhattan has no supermarkets. Enough said. European food is either costly or badly made depending on where you ate it.

Indian Food

Indian Food is everywhere in London. In the supermarkets, in the restaurants, on the television BUT all of it is crap. How did Indian food go so wrong in a country that came to India for its spices !?

Indian food in New York is a dream. Its easily accessible, cheap and a land where “Indian” means “from India” and not the Indian Subcontinent ;)

GAP, Ted Baker & Skin

The dressing in London is smart. People quite rightly wear clothes that make them look attractive. The dressing in New York is casual. People quite rightly wear clothes that make them feel comfortable.

It is a common perception that women in the USA are fatter than their European counterparts, but the ones in Manhattan are definitely not. Women of both cities seem to be doing pretty well on the diet front. Sadly the same can’t be said of the men. Most men in London are athletic and dressed to impress, most men in New York.. oh well.

Also, women in London are a lot more conservative in their dressing showing a lot less skin than their New York counterparts. They even hide their toes with open footwear being quite uncommon. (Given the weather, what choice does one have?)

Which brings us to ….

The Weather Channel

Checking weather constantly in the hope that it will change is a obsessive compulsion you are born with in London. Sadly its contagious, and any newcomer will soon be infected. The sky in London is always overcast, the scene is always gloomy and rain is always around the corner. Some months the rain will be kind enough to drop by only on weekends, how convenient! It is not uncommon for a Londoner to memorize the weekly weather, scheduling each task carefully. No rain on Wednesday afternoon, great – pick up dry cleaning.

With all that rain, its no surprise that the sun decided to take his summer vacation in New York.

A Birds Eye View

When the seatbelt sign goes on and you being to descend into London, you see (weather permitting) pretty red houses, as pretty as you would have drawn them in school. The sight is quite different with New York where you will be overwhelmed by amazing twists and turns and butterfly patterns made by highways that meet the horizon.

I like New York. It makes me feel at home, it reminds me of Mumbai. That might seem like a strange statement to make. Maybe it is strange, but it is also true, at least for me.

Windows 7 and DNS Server woes

Problem !

When I moved into my apartment this weekend I was unable to connect to the internet which lead to emotions of utter disbelief followed by despair and finally by obsessive compulsion and irritability until fixed. Despite the best intentions of my operating system to automatically diagnose and correct the problem it couldn’t. Not holding any grudges, we all have our limitations. I was stuck with –

Windows can’t communicate with the device or resource (Primary DNS Server).

Solution !

I knew something was wrong with MY machine because by husband’s Macbook-Pro worked just fine. Damn. So here’s the deal, Windows 7 on Sony VAIO had set my DNS server to a static value. To make things work, I simply had to ask windows to obtain DNS server address automatically. Easy-peasy.

1. Select Start
2. Select Control Panel
3. Select Network and Internet
4. Select Network and Sharing Center
5. Select Change adapter settings (in the left corner)
6. Right-Click Local Area Connection and select Properties
7. Select Internet Protocol Version 4 (TCP/IPv4) and click Properties
8. Under General select Obtain DNS server address automatically and click OK

When and why does this problem occur?

Technically I don’t know (Now I do, see update below!). But generally, the problem seems common on a Sony VAIO running Windows 7, especially if you switch between networks.

Is this solution permanent?

Apparently not! The behavior seems a bit erratic with the DNS server being reset to its static value randomly between standbys and resets. If that happens you can repeat the steps above or even try resetting the TCP/IP stack. With Windows, you never quite know the mood its in ;-)

[Update – an hour later] Understanding why this happens (technically) ! See below an as-is explanation by my friend Amit.

Step 0: The n/w is down
Step 1: You see some wlans
Step 2: You select one
Step 3: Your NIC ( n/w interface card) and the router get familiar, they authenticate
Step 4: Now the connection is established @ the “PHYSICAL LAYER”
Step 5: You now need IP to talk TCP & UDP, so send DHCP request
Step 6: Get response back from the router. It should contain among other things your MAC ( for verification), your new IP, your gateway address ( same as the router’s IP ) and DNS settings ( DNS server IP, search strings etc)

Thats it … your n/w should now be up. In your case, if the setting is disabled (Obtain DNS through DHCP) your machine will continue to use the static DNS that you have set and ignore the one given by your router.

Thanks Amit :) Life makes sense again!

Conclusion:If you want to enable DHCP on a Windows 7 machine, simply select “Obtain DNS server address automatically” in the TCP/IP settings as show above. Happy surfing!

Microsoft WebMatrix – a tool for the lazy?

Microsoft realized it was unfair that children and wives were unable to experience the joy of creating web applications. So last week they introduced a brand new shinny toy in the market – WebMatrix. Sadly, they forgot about toy-safety which any toy manufacturer will tell you is a cardinal sin.

If you want to know what WebMatrix is, you can check Scott Guthrie’s blog post here that explains it in detail. To sum it up, in Scott Gu’s very own words…

WebMatrix is a task-focused tool that is designed to make it really easy to get started with web development. It minimizes the number of concepts someone needs to learn in order to get simple things done, and includes and integrates all of the pieces necessary to quickly build Web sites.

In 2003 when ASP.NET joined web development, it was great. There was nothing like it in the market that let you create web applications so easily. You didn’t exactly have to understand how the internet worked, you didn’t have to worry about POST or GET verbs, because when ViewState, Event Handlers and Page_Load got together all you had to do was party! Unfortunately, because the entry constraints were so low, some not-so-good developers joined the scene creating some not-so-good applications that resulted in not-so-good user experiences. But the party still went on, as there was a community of very good ASP.NET developers always ready to help. Not only did they provide answers to problems, but they also developed long term solutions and methodologies like TDD, SoC that would help you create beautiful and maintainable applications.

In Scott Gu’s post on WebMatrix, he lists an example where database, business logic and user interface code all sit hand in hand on the same page. Click here for a snapshot. A decade of web development has taught us one thing – not to write such code. Numerous tools and technologies, Microsoft’s very own ASP.NET MVC prevent us from doing so. Why then would we want to teach a failing technique to a bunch of fresh minds?

Just because a child cannot fully grasp the idea behind gravity does not mean we teach children the earth is flat.

I like the idea, to be able to create web applications without knowing everything there is to know. Visual Studio can be daunting and overwhelming and a simpler tool for the beginner is a great idea. However, since the users is naive, the onus lies on the product manufacturer (in this case Microsoft) to help you create a good product.

There should be no way to write the example code shown. A tool like WebMatrix should force constraints and restrict users from creating such a mess. Maybe a user might not understand why he is forced to write database code in one file and user interface code in another. He might even find it an inconvenience. But you the manufacturer know what is good for this child-developer. It is for the developers of WebMatrix and not its users to identify pitfalls and force constrains around them. This might reduce flexibility, but wan’t this tool meant for simple applications in the first place?

I’m still not sure who WebMatrix is for. Microsoft says it is not for professional web developers. So is it then for people who can write SQL queries, learn Razor (MS’s new MVC view engine), understand open source projects like BlogEngine.Net, purchase web domains and hosting, but simply cannot take the effort to create good applications, even if it was for their own good? The word that comes to mind is Lazy.

Version Control: Do you need both TortoiseSVN and Subversion?

Installing a version control system for my local machine left me confused. Did I need Subversion and TortoiseSVN? If TortoiseSVN is only a “client” can it work without Subversion? If it can’t, why does TortoiseSVN allow me to create repositories without me having installed Subversion yet?

After having wasted a day googling, good sense prevailed and I mustered the courage to go through the FAQ (which thankfully is very clear and to the point). And voila!

So what did I learn? If you want a version control system for your local files and folders you only have to install TortoiseSVN. It has everything you need for creating local repositories on your hard drive, which can be accessed via file:///C:/YourProject. In this case the working folder (the ones you check-out & check-in) and the local repository (where version control data resides) are on the same machine – your personal computer.

Version Control for Local files & folders for a single user => TortoiseSVN

If however you need a version control system that would be accessed by a small team (of 2 or more users) you also need Subversion. Subversion is a source control “server” which allow multiple users and machines over a network to access the central shared repository in a safe and consistent manner. Your repository is now on a server. When using Subversion, you access your files via svn://server-ip/YourProject (or svn://localhost/YourProject if the server is running on your local machine). Subversion can be used via the command line, however TortoiseSVN for Windows provides a wonderful GUI that integrates with Windows Explorer.

Version Control for shared data over Network (multiple users) => Subversion (source control server) + TortoiseSVN (on each client machine)

You can avoid installing Subversion (server) by placing your local repository on a network drive (accessed via file:///server/sharedfolder/YourProject). This is however not a recommended approach (read FAQ or see the Mind Map below for ‘why’).

Do you need both TortoiseSVN AND Subversion

Mind Map: Explains if you need both TortoiseSVN and Subversion
Personally, only after I had installed and setup Subversion did I realize I didn’t need it. Oh well, I’m going to use it anyway! Feels cool :-o

Which sun sign creates world class football players?

Well, I did some data analysis on the footballers of the 2010 FIFA World Cup and turns out its – Gemini! As for the Scorpions, sorry guys, the stars just ain’t in your favor!

2010 FIFA World Cup, Statistics – Footballer Sun Signs

2010 FIFA World Cup, Statistics – Footballer Sun Signs

I’ve also plotted the months in which maximum players were born. Going by this, a Gemini child born in May has a brilliant chance of making it ;-) Future moms might want to keep that in mind :-)

2010 FIFA World Cup, Statistics – Month footballers are born

2010 FIFA World Cup, Statistics – Month footballers are born

The English football fever left many casualties, lets hope Argentina – Germany results in a 4-0 win bringing us some much needed solace ;-)