• Assuming culture

    I’ve just had an interesting bug report for Aussie Toilets. The stack trace starts with this:

    System.Reflection.TargetInvocationException: TargetInvocationException —> System.FormatException: FormatException à System.Decimal.Parse(String s, NumberStyles style, IFormatProvider provider) à Gardiner.PublicToilets.Services.DataService.b\_\_3(XElement x)

    There’s a small clue there, but the other big hint was the user’s regional setting:

    Culture: fr-FR

    It turns out in a number of places I’d been assuming the default number format, particularly instances of Decimal.Parse(), Convert.ToDouble(), and the popular String.Format().

    So if you’re in France, you’d be used to seeing “123.49” written as “123,49”. The bug in the application was that the data being read was originally formatted in the former, but with the user’s regional settings set to ‘French (France)’ the parsing methods were assuming it would be formatted as the latter.

    I’ve resolved the problem in this instance by explicitly specifying the InvariantCulture, as the data isn’t displayed to the user. If it were intended for user display, then allowing the user’s regional settings to influence the display would be quite appropriate.

    FxCop (aka Visual Studio Code Analysis) will warn you about these kinds of issues, specifically CA1305 – Specify IFormatProvider. I’ve changed this warning (and a few others) to an error to ensure I don’t get caught by it again.

    Visual Studio Code Analysis Settings - changing warnings to errors

    Expect Aussie Toilets v1.4 soon!

    Sidenote

    When I first started working on Aussie Toilets, I was doing it from the perspective of a parent who has had first-hand experience trying to find a public toilet for a young child. I hadn’t really considered another market for the app might be the overseas visitor. Maybe I should consider providing translations for some of the labels for these users too.

  • Aussie Toilets app v1.2

    ‘Aussie Toilets’ version 1.2 is now available in the Windows Phone marketplace. This is my Windows Phone 7 app that shows the nearest public toilets to your current location. wp7_278x92_blue The latest release includes the April 2011 dataset, and significant performance improvements. Specifically, toilet locations should load almost instantly. So now if you’re in a hurry to find the nearest public toilet, you’ll be relieved (ha ha) to know you won’t be kept waiting any longer than necessary. I’m quite chuffed that ‘Aussie Toilets’ is currently sitting at no. 3 in the top selling apps of the ‘Navigation’ category in Zune. Not sure if this is just for Australia or global. So far I’ve had over 1,200 downloads, which isn’t too bad at all. PS. I have received a bug report from an Austrian user of Aussie Toilets – turns out I hadn’t tested the app outside Australia! This may explain an issue I had with getting 1.2 passing the Marketplace requirements (as I assume the testing would be taking place in North America). So expect v1.3 very soon!

    Update 24th April, 3.30pm Version 1.3 is now available in the marketplace

  • The big Four Zero

    Today I am 40 years old!

    I know this because as you can see the in the photo below, I’m wearing a badge (made by my daughter) that says “40 years old” 😀

    Photo of David wearing a '40 years old' badge

    Yesterday I celebrated the occasion with family and friends at a picnic lunch in Belair National Park. The weather couldn’t have been better and I think everyone really enjoyed themselves (I know I did).

    Extra special thanks to my lovely wife Narelle who worked very hard to make it a fantastic day, Narelle’s Mum & Dad for decorations, barbecue knowledge and other help, my Mum and Dad for having me in the first place 😀, my sister Fiona for putting together a wonderful birthday scrapbook, and my kids for helping with the games.