Thursday, 4 November 2010

Take 2 Cygwin a day and call me in the morning


For developers who have never ventured out of their Windows environments and in to the world of UNIX based operating systems (like Linux and Mac OSX), the command line is an often under-utilised tool.

This is quite understandable in the case of the Windows command line that lets you relive your early DOS days. With all the lack of power of DOS, the command line was long ago abandoned for many mouse clicks and maybe once in a while a RUN command that is copied straight off the Internet and into the START->RUN control.

For the uninitiated, who have never dropped back to a command line or shell or who never even started there like us oldies, the commands look like line noise. Amusingly enough, those who were not Bourne from a shell probably do not even know what line noise is. Ahh, the days of whistling along to our high speed 9600 baud modems are long and lost along with bulletin boards and green on black screens. Those days are lost because the world has progressed to the point that you need not listen to the squealing down the phone line or force your eyes to work in a Matrix like world.

The good things haven't gone. The powerful languages that let their engineers create low level code like C and C++ are still around. Even if more and more amazing higher level languages appear, there will always be a place for the land of hardcore programming. They are needed. They are powerful tools. Weapons even. When wielded by good software engineers, great things happen. Of course, you do need the high level languages because who really wants to spend all their time perfecting memory management and automation of the reinvention of the wheel.

The other thing that will never leave us is UNIX land. The beauty and capacity of the UNIX tools will never become obsolete. They have been ported to every new environment to follow UNIX and implemented as APIs wherever possible. To live without these tools is for some developers, like cutting off a limb at the neck. It's a horrid disabled world.

Windows is one of these worlds that lacks the default access to UNIX tools. The DOS command line is not a poor substitute because it's not even in the same league. It's like comparing Java as a programming language to pig latin. It's simply a silly and meaningless comparison.

For those of us (usually .NET devs) who must play in an exclusively Windows world, we have a few ways around it. We either have a non-Windows machine at hand or we use Cygwin. Cygwin is a library that provides POSIX functionality in the Windows environment. You install it on any Windows machine (an install that takes at least four coffees) and it gives a UNIX like environment for Windows. The Cygwin commands look like UNIX commands but are actually wrapping Windows system calls that do a similar thing or have been extended to do so.

There are of course limitations to the scope of Cygwin that are based in the fundamental differences between the Windows and UNIX based operating systems. Pretty much, the foundations aren't the same so only so much can be faked. Often that much is enough to provide a developer with these much needed tools.

Now Cygwin on it's own is a nice little tool and a lovely idea but the serenity comes from all the tools that are built on this basic foundation. There are shells that let you believe you could be using bash; text tools like grep; and much more.

The zealots will kick me and say this is a poor replacement in a bad environment. I tend to agree but it's the best thing out there for us .NET devs. How any developer can live without it, is beyond my understanding.

You'll find Cygwin here.

Have fun.

Tuesday, 26 October 2010

Stop Being Such Bitches


There have been a lot of discussions on this blog about what it feels like for a geek girl in this IT world. I've even covered the topic of what a geek girl is and isn't. This time, I want to tell you one of the worst things about being a geek woman.

It is other women.

You would think that the sisterhood would encourage women to support each other through tough times in a workplace. Women always refer to the "boys network" in a company. We talk about how they look after their crew and make a lot of deals over a beer. Women work at getting in to these circles of blokes to play the game too. Some are successful. Some aren't.

Over and over again, I see women pushing each other down for what seems to be no other reason than to be mean. Women can be more cruel to each other than any man can be to us.

If you'd help out a guy then a woman should be no different. Women should be building a support network in their careers made up of men and other women.

What happened to innate female empathy?

I refuse to push down or even push back at another woman at work. I don't go to work to fight. I go to work to get stuff done. Help me do this or don't. I simply will not play the games of 15 year old school girls. We are passed that.

Sunday, 17 October 2010

Australians Buying Software Online


It may be obvious to all around but I only just worked it out. When you are buying software to be downloaded from the Internet, choose to pay in US dollars. It is legal to pay in any currency you want but with our almost parity in Australia, US$ end up being a lot cheaper.

Last night, I saved $14 on software by choosing to buy via Paypal and opting for US dollar prices over Australian prices.

This goes for anything you buy online, I guess. Software is just famous for being priced at different levels depending on your currency. Let Paypal do your conversion. They are fairer.

Saturday, 16 October 2010

When do you not generalise your code?


At the moment, I'm working on a Silverlight project. The best way to learn a technology is to build something in it. Reading books and blogs and the rest will give you a vibe for what the technology is but only getting your hands dirty will make it real. Real is when you understand the beast and all its tides and moods. You also get to know the elegance of it and where the shine in its soul radiates from. Yes, I'm still talking about Silverlight.

One of the simple tasks in this current project requires me to parse a CSV file. That's easy enough to write on your own but anyone who has written a parser knows that if someone else has built one that does what you want then you should consume theirs. They would have handled all the exceptions and possible gotch-yas. This means I don't have to worry about that and I can get the task done quickly.

In this case, Fast CSV is a common choice in the .NET world. I've used it in the past on and it does what it promises. With the MIT license, the price is right too.

Sounds easy right? Well not totally. For my Silverlight application to consume this library, it must be a compiled as a SIlverlight library. Easy enough - I'll port it. Thing is, this code extensively uses the System.Data namespace and as I found out quickyly, there will be no talking directly to a database from a Silverlight application. That makes complete sense.

After looking in to it, the main use of System.Data is in the use of the IDataReader to stream the CSV file. There is also some DataTable usage. Nothing that couldn't be wrangled to use another stream reader and a generalised Linq table, in it's place.

But then I stopped...

When is porting the library more trouble than it is worth? My task is such a small simple one that I might as well write a custom parser that takes each line of the CSV file that I'm reading via normal file IO and push it straight to my view models for display.

Robustness of the code is an issue but I'll test drive it and keep it simple and neat. It doesn't have to be so general that it caters for every possible situation. It is just for my situation.

In this case, I have decided that a quick CSV parser that exists as a helper class in my project is good enough for this task. It is not just good enough but it's the right choice. Get the job done in a thorough way but don't over engineer the solution because it is the funnest way.

This has been a good learning experience and has solidified my resolve that sometimes you can write code that isn't so gold-plated and generalised and that's ok.

Thursday, 14 October 2010

Unable to start asp.net development server because port [port number] is in use

After a debugging session was stopped abruptly in VS.NET 2010, the error "Unable to start asp.net development server because port [port number] is in use" would appear every time I tried to debug or run the web application.

Restarting Cassini and killing all instances, restarting VS.NET and ultimately kicking Windows did not release the port. When I checked manually, the port was not in use but Visual Studio insisted it was. Changing the port used or auto generating the port to be used did not work around this issue.

This is a Silverlight application but the issue does not seem to be Silverlight specific.

The fastest way to fix this problem was to Remove the web application project from the solution and re-Add it.

Tuesday, 28 September 2010

Start by reading this documentation


There is no bigger buzz kill when starting a new job than that moment when a tree load of written documentation is set before you and you are told to start there.

"Read this to give you an idea of how we work."

That is a ridiculous idea. Reading documentation to find out how people work is about as useful as reciting them a haiku in Japanese, when they first cross the workplace threshold. Actually, the haiku is much less boring.

When I started at Buzz Numbers last week, I was given a computer and a set of short videos to watch. These walked me through the main code solution and discussed different areas in details. They are not only introduction documentation but good refresher resources when you go in to an unknown section of the code.

I was happily coding within an hour of starting work, on my first day. The video docs gave a good push start and an easy reference point for when I asked myself where that thing was again.

Since Buzz Numbers has me sign an NDA on my first day, I won't be sharing any of their video documentation with you. It's not a new idea so there are many examples online of how this can be achieved. Thing is that it's usually big companies with big budgets that are doing this. I work for a start up and they did it without any major cost.

Simple. Inexpensive. Effective.

What more could you ask for? Try this at your workplace if you understand the pain a new starter feels.

Here is an example of Yahoo's YUI video documentation...

Friday, 13 August 2010

Geek Girl - For Better or Worse


Hey Geek Girl, you know your marriage is in trouble when...

0. You look to xkcd for relationship advice;

1. Waiting for a green build sends your heart racing more than seeing your husband;

2. You get more excited in bed at night when you hear emails arrive on your smart phone than when anything else pops up;

3. Comments on your latest blog post elicit more emotion than the man you married;

4. You have defined the majority of your conversation with your spouse as a regular expression punctuated with "uh huh" and "yep, I'm listening";

5. You stop reading his tweet stream and scroll past most of what he says. Before seeing him at home after work, you read the latest tweets so you can fake interest in his day;

6. He gets emoticons more than he get cuddles;

7. You "like" his facebook status without reading what it is and often have to explain that liking a negative one was in fact showing support. Oops;

8. The thought crosses your mind that selling your engagement ring diamond would easily cover a new MacBook Pro, iPad and phone;

9. His handwriting seems to look like line noise.

Acknowledge Me

Apple started a user experience trend many iOSes ago when it accepted Settings changes and did not ask for confirmation. Once the chang...