Monthly Archives: April 2012

The Best OS? All and None



Non-computer savvy People often ask me, “What is the best operating system?”. The thing that annoys me about how many people answer this question, is that they give a one-size fits all answer. Usually based on their fanboydom.
“Oh definitely Apple. It’s miles ahead.” “Windows for sure. It’s awesome”.

Rather than propagate their favoured brand, they should be seeking more information. There IS NO best operating system! It all depends on intended usage. I wouldn’t want to rely on Windows for NASA-related stuff (Mars Rovers etc.) and I certainly wouldn’t recommend Linux for a commercial role where the use of a powerful office suite is required (sorry guys, but MS Office craps of Libre Office/Open Office or whatever that java-based rubbish is called these days).

Each OS will suit a particular user more, depending on what they want to achieve.

For someone who does not need to know where their photos live, and just wants a photo app to automatically pull them in from a device and display them, Apple is the way forward. Whether it is music, photos, documents, the where and the how do not matter. Many people like that straightforward, automatic user experience. There are minimal calories burned to make things happen. My Mother runs a MacMini and she loves it. She also loves the design, so there’s also a certain interior designer appeal with Apple. And that’s cool too. It’s the right product for people requiring that as a feature.

Personally, I like to have lots of control over my OS. I like freedom. I like to be able to put it on a variety of devices, not tied to any manufacturer. I like to extend my computing skills using it. So, for me, Linux meets that criteria the best. But I also need to do heaps of .NET development, so Windows fits that bill. Hence, those are the 2 I need. For me, I personally have little use for Apple.

So people, lets consider the user first, before evangelising our favourite brand. And for those who hate Bill Gates, I can assure you that Linus Torvalds and Steve Jobs (RIP) equally scaled the heights of tosserdom. So they’re all square there.

Path.Combine

I recently learnt something interesting about the Path.Combine method (in System.IO). If the second parameter is effectively a complete UNC, then the first parameter will be ignored and only the 2nd will be returned. That’s good to know, as the 1st parameter will almost always be a complete and valid UNC in and of itself.

I discovered this in a bug in some existing code which I have taken over the maintenance of. Stuff was going wrong, and we discovered a call to Path.Combine which was something like:

Path.Combine("F:\\logs", "\\bff\\incidents\\filename.ext");

That was, of course, returning \\bff\\incidents\\filename.ext (a valid UNC for a network share), instead of what was intended – F:\\logs\\bff\\incidents\\filename.ext

So make sure you know exactly what you are passing to the 2nd parameter. The API makes perfect sense. We, as developers, need to make sure we know how to use it.

NLog Copy always

Another one I keep forgetting. With NLog, you need to set the Copy to Output Directory property to Copy always (or at least Copy if newer):

Just lost 2 hours of my Saturday on that. Time to go watch some Frasier.