Friday, August 29, 2008

Hug a developer today

Sometimes, every developer hurts; sometimes, every developer cries. And your client changing the requirements on you for the third time in a week is bound to do it to you every time...

Blogger's layout will probably mess the video up a bit, so here's the original.

Wednesday, August 27, 2008

When True does not equal True

One of my colleagues came across an interesting bug today. He was running this test:

   1:  [Test]
   2:  public void DoMXLookupWithValidDomainName()
   3:  {
   4:      MXLookupHelper mxHelper = new MXLookupHelper();
   5:      mxHelper.DomainName = "";
   6:      bool validDomain = mxHelper.hasMxRecord();
   7:      Assert.IsTrue(validDomain);
   8:  }

The test was failing with the rather unhelpful message:

Expected True, but was True.

It's not everyday that you see a boolean value of True not equalling True, so he called me over to have a look, we must have had half the office trying to figure that one out.

Our immediate solution was simple enough - modify the method hasMxRecord() so that the last line reads:

return foundRecord ? true : false;

which is something that sets afire every refactoring nerve in my body, so I had to add a huge comment to that line, to the effect that, "Yes I know it looks pointless, but you'll just have to trust me, it is there for a reason".

We were able to reproduce the effect on another colleague's machine, but of course when I tried it on my machine, the test worked as expected. The only difference that we could tell was the version of the .NET Framework that we were running, mine reporting 2.0.50727.3053, while theirs were reporting 2.0.50727.1433, so it may be a bug in the .NET Framework v2.0 which has been finally fixed with the release of .NET Framework v3.5 Service Pack 1, which I installed last week.

Of course, this incident just reminded of the frequent stories of people's flagrant abuse of simple boolean logic on The Daily WTF.

UPDATE: this appears to be part of a very old bug. Not bad, only taking three years to fix...

Thursday, August 14, 2008

Getting an iPhone in Australia with 3

Only a tribe of cave dwellers in the mountains of Papua New Guinea could have possibly missed the release of Apple's iPhone 3G last month, and even then only because they probably don't have 3G coverage in the vicinity.

Being a geek of the first order, you might expect that I would have got one by now, even if I didn't care to queue for 3-4 hours to get one on release day (the day after release, I was lucky enough to sit on the same aisle on a flight up to Brisbane as someone who had scored themselves one, so I got to play with it. What a great icebreaker an iPhone is. Just pity the poor woman who was stuck between the two of us!)

The reasons are:

  1. my network, 3, doesn't sell the iPhone. A bit obvious, but worth saying. The official reasons why are not widely known, but it's a bit strange, as 3's data plans are arguably the best available (and the less said about Telstra's data plans, the better);
  2. I'm less than a year into a new contract, so I would get hit with some pretty painful cancellation charges if I hopped to Optus or Vodaphone;
  3. most people that I'm likely to talk to on the phone are on 3 as well, and the free same-network calls would be much missed, on both ends of the conversation.

Fortunately, 3 are still working on the case. It is possible to get an iPhone on to the 3 network. The process is relatively simple:

  1. buy a pre-paid iPhone from Optus, and pay the $80 unlocking fee;
  2. go to 3, who will give you the appropriate SIM card and also refund you $300 of the purchase price of the phone.

The only downsides to the operation are:

  1. if you're outside 3's coverage, you'll be paying for Sol Trujilo's heavy mob at the rate of $1.65/Mb, which is enough to make your eyes water;
  2. the new contract will be for 24 months, but I guess if you're in my boat, then that shouldn't matter so much if everyone you also talk to is on the same network.

So now I only need spousal approval. Oh, and the timely arrival of my 35th birthday...

Tuesday, August 12, 2008

Caspar and the Jesus Paper

A fantastic title for a very eye-opening post by Bishop Hill, establishing just how corrupt science can be, especially in the field of climate study, where there is so much money to be made, usually provided by the government and environmental lobby concerns.

With this new, and pretty much entirely arbitrary hurdle in place, Wahl and Amman were able to reject several of the runs which stood between the hockey stick and what they saw as its rightful place as the gold standard for climate reconstructions. That the statistical foundations on which they had built this paleoclimate castle were a swamp of misrepresentation, deceit and malfeasance was, to Wahl and Amman, an irrelevance. For political and public consumption, the hockey stick still lived, ready to guide political decision-making for years to come.

Would you believe that Al Gore's woeful An Inconvenient Truth is being shown to school children in the UK as accepted fact, whereas nearly all its arguments have been shown to be junk science?

Something to think about next time the government tells you prices will have to shoot up in the next few years to pay for all those carbon trading schemes. I noticed the Sydney Morning Herald has been carrying a lot of articles about climate change, saying that it's all proven scientific fact, that the research has been meticulously peer-reviewed, that anyone who says anything contrary is in the pocket of the energy companies and going against the consensus. I think the above article should put paid to most of that.

What a shame that the mainstream press aren't interested in covering this sort of thing, preferring populist alarmism to "Sorry folks, it's all a sham".