Wednesday, 30 December 2009

Two cool Christmas presents

Christmas has always been a special time for me, and now it's also special for the kids too.
This year my sister generously bought me a new car…
Super Grover in his convertible car
Pretty neat huh?
Carson got given this electronic robot.
Electronic robot
It came as a kit, which meant I had to pull out my trusty old soldering iron and solder all the components onto the PCB then assembly all the gearbox bits. I seem to recall my success rate for soldering electronic kits wasn't very good, but I'm pleased to report I managed to get this one working first time. Probably a good thing as I would have no idea how to fix it if it hadn't worked!
When you turn it on, it runs around the floor, and changes direction when the IR sensors detect an object in the way.
Merry Christmas and a Happy New Year to everyone.

Thursday, 17 December 2009

Watching the .NET Garbage Collector

Here's an interesting use of SciTech's .NET Memory Profiler – watching how objects are handled by the .NET CLR garbage collector.

The sample code create 4 objects – a simple class "Simple", a class that implements IDisposable "Disposable", and a class that also implements a destructor "Destructable".

.NET Memory Profiler can generate a real-time graph of memory allocations. I've instrumented the sample code using SciTech's API to add comments to the graph so you can match the code execution path against the X axis (time). The object instance count is mapped to the Y axis.


See how 2 instances of the "Destructable" class existed around the 10 second mark – then one was released at the first GC, then the 2nd (which has the destructor) is only released after the 2nd GC.

using System;
using System.Diagnostics;
using SciTech.NetMemProfiler;

namespace MemoryTesting
    internal class Program
        private static void Main(string[] args)












        private static void CreateSimple()
            MemProfiler.AddRealTimeComment("Create Simple");

            var a = new Simple();
            a.Something += OnEventHandler;
            a.Data = "hey";

            a.Something -= OnEventHandler;


        private static void CreateDisposable()
            MemProfiler.AddRealTimeComment("Create Disposable");

            var a = new Disposable();
            a.Something += OnEventHandler;
            a.Data = "ho";
            a.Something -= OnEventHandler;


        private static void CreateDestructableAndDispose()
            MemProfiler.AddRealTimeComment("Create Destructable and Dispose");

            var a = new Destructable();
            a.Something += OnEventHandler;
            a.Data = "haha";
            a.Something -= OnEventHandler;


        private static void CreateDestructable()
            MemProfiler.AddRealTimeComment("Create Destructable");

            var a = new Destructable();
            a.Something += OnEventHandler;
            a.Data = "haha";
            a.Something -= OnEventHandler;

        private static void OnEventHandler(object sender, EventArgs e)
            Debug.WriteLine("Something Fired");

    public class Simple
        private string _data;

        public string Data
            get { return _data; }
                _data = value;

        public event EventHandler Something;

        protected virtual void OnSomething(EventArgs e)
            EventHandler handler = Something;
            if (handler != null) handler(this, e);

    public class Disposable : Simple, IDisposable
        #region IDisposable Members

        public void Dispose()




        protected virtual void Dispose(bool disposing)

    public class Destructable : Disposable



Tuesday, 8 December 2009


The Byrds were spot on when they sang "To everything… there is a season… and a time to every purpose under heaven". Spot on, because the lyrics (whilst put to music by Pete Seeger according to Wikipedia) are actually adapted directly from Ecclesiastes 3.

Particularly appropriate for me at the moment is the line the following line:

"A right time to plant and another to reap" Ecc 3:2b (The Message)

r160170_602465[1]Right now in country areas of South Australia, harvest is in full swing. In the past that wouldn't have meant so much to me, but having worked for the last 18 months at a certain AustralianCanadian agribusiness, the change of seasons and especially the impact of weather on crop production has become much more relevant.

These are interesting, but exciting times. I'm sure a number of the other verses from Ecclesiastes 3 are also applicable at the moment, but I'll write more about that later!

Monday, 7 December 2009


I've been a long-time hay fever sufferer. I also had a fair bit of allergic conjuctivitis in my younger years which I seem to be growing out of (finally!), though for the last 6 or so years dermographism has been a challenge too. You can just call me "Mr Healthy" :-)

Because of this, I have developed a more than average interest in antihistamines, and done a bit of research on the various "non-drowsy" over-the-counter products available in Australia.

The products are grouped by active ingredient, and then ordered by the most familiar brand name with that ingredient. As a rule, the best known brand is usually the most expensive – presumably you're paying extra for all the marketing and colourful packaging.

Brand Active Ingredient Size Dose Price Cost per tablet
Zyrtec Cetirizine 30 10mg 21.95 $ 0.73
Zodac Cetirizine 30 10mg 9.95 $ 0.33
Alzene Cetirizine 30 10mg 17.95 $ 0.60
Telfast Fexofenadine 30 180mg 22.95 $ 0.77
Xergic Fexofenadine 30 180mg 21.95 $ 0.73
Fexotabs Fexofenadine 50 180mg 26.45 $ 0.53
Fexal Fexofenadine 30 180mg 15.95 $ 0.53
Xyzal Levocetirizine 30 5mg 22.95 $ 0.77
Clarityne Loratadine 50 10mg 36.95 $ 0.74
Lorastyne Loratadine 50 10mg 21.95 $ 0.44
AllerEze Loratadine 50 10mg 27.95 $ 0.56
Chemists' Own Loratadine Loratadine 50 10mg 32.95 $ 0.66
Aerius Desloratadine 28 5mg 24.35 $ 0.87

Note also, the prices I've quoted here are from online pharmacies based in Australia, such as Pharmacy Direct and Pharmacy Online (don't forget to allow for postage). Buying the same identical product from a non-discount pharmacy may cost up to a 1/3 more.

I've tried all the main kinds, with varying degrees of success. I do think it is a good idea to swap products every few months as in my experience extended use of one specific antihistamine reduced its effectiveness (as though the body became desensitised to it).

Tuesday, 1 December 2009

A Sydney Wedding

Katie and Gabriel OsorioNarelle's cousin Katie was getting married in Sydney, so we bundled the family into a plane and headed over for the festivities.

I'd booked seats on Tiger Airways earlier in the year (taking advantage of particularly cheap tickets). One thing with Tiger is that everything besides a seat on the plane costs you extra. I paid for extra baggage allowance but decided not to shell out for the privilege of choosing allocated seats. There was a risk that Tiger's seat booking system might be so stupid that it could put the kids and the adults in completely separate seats, but I'm pleased to report that we ended up with decent seats all in the same row on both flights.

A few quibbles with Tiger – the PDF attachments they emailed me were blank. Fortunately I figured out that the attachment file name happened to be the confirmation number so you could still review the details by going to their Review Itinerary page. Their website also fails to mention the fact that they will carry prams for free (thanks to Margaret for finding that out).

I'm not sure if it's a measure of how trustworthy visitors to Sydney airport are, but you have to pay $4 to use a luggage cart – contrasted with Adelaide airport where the carts are free (and I'd suggest a better design too – 3 bags fit side-by-side which we couldn't do with the interstate model).

Not a Toyota Camry! I organised a hire car through, who seemed to have the best price compared to some of the more familiar hire car companies. One thing I didn't find out until after submitting a hire request through their website was that they require a "CREDIT" credit card (ie. not a debit card) for security. So began a mad panic to try and obtain such a card in less that 2 weeks. Despite trying to ensure my credit union had all the paperwork required up front, it took a few days for them to ask me for a pay slip and then a group certificate. The Thursday of our departure arrived, but sadly the card did not (it was delivered the day before we got back home!) Thankfully Narelle's parents were also travelling on the same flight and were kind enough to use their card for the security (the actual payment could still be done on a debit card). Also in Sydney this company's office is actually within reasonable walking distance from the terminal. In peak hour if you don't have much luggage, walking may actually be faster than the free pickup they offer.

The car (a Toyota Camry Altise) was perfect for our needs, and we were able to just cram the kids into the back seat (with various booster/baby seats). Our own car is also a Camry (though a slightly older 1995 model) and by comparison I found the modern Altise quite responsive, a bit gruntier and with more headroom (something I tend to notice). Imagine my surprise to learn learn that the current model still has only a 4 cylinder engine. (And no, that picture is not a Camry!)

P1020144 P1020164We took the opportunity to do a bit of sight seeing, and visited Ocean World at Manly. We all enjoyed looking at all the various exhibits – especially walking through the tunnel through the aquarium. Boy those teeth look sharp!

Having grown up in Adelaide, driving in a big city like Sydney is not my idea of fun. The traffic just seems crazy, and it all feels like there are just way too many cars trying to squeeze along lots of too-narrow roads (even though the roads are usually multi-lane). At least this visit we did pretty well finding our way around – Narelle's old NSW navigation skills came through with flying colours.

It was a nice holiday but it is good to be home again.

Wednesday, 18 November 2009

Office Communicator and the tel: protocol

I was wondering today whether Office Communicator offered any integration with web pages to enable calling a phone number on a web page. It turns out it does (as the Communicator team explains on their blog) via the tel: protocol.

I confirmed this by inspecting the registry on a computer with the Office Communicator 2007 client installed. Sure enough, it is registered for tel: (and also callto:).

If your page is just for your intranet, you can probably get away with the local number, but the RFC strongly recommends you use full "international form" – that way the number should be callable from anywhere. eg.

Telephone: <a href="tel:+3585551234567">+358-555-1234567</a>

I don't have Communicator installed on my home PC, but I do have Skype. A quick check of the registry confirmed that Skype has registered as a handler for callto: but there is no tel:.

Tuesday, 3 November 2009

Getting podcasts onto my new phone

add01_3301[1]I recently replaced my dead iPod Shuffle with a Samsung C3050 phone that amongst other things has music playing as a feature. I bought an 8Gb micro-SD card to go in the phone to store podcasts on.

When I unpacked the phone from its packaging, I discovered that this phone uses a slightly annoying custom socket to connect to a PC, headphones or power jack. It also didn't come with a USB cable in the box (so when the box said "supported USB" it didn't mean "easily"). I ended up making my very first e-bay purchase and bought a $10 cable which did the trick.

Now to get podcasts syncing…

I had been using WinAmp with the Shuffle, but I found that its support for a basic USB drive (which is how the phone's SD card appears when connected to the PC) was not perfect. After scrounging the net to find a decent podcatching application. Some of the problems I encountered along the way included MP3 files getting filenames that the C3050 didn't like, MP3 files ending up in the wrong location on the SD card, and some software that just plain didn't like the feed – the "." in ".NET Rocks" seems to be a common cause of that.

I finally found Mediafly. This site offers feed aggregation as well as software for syncing podcasts to various devices.

I'd already started using to aggregate my feeds, so I just added my aggregated RSS feed URL - – to Mediafly. It then started downloading the latest files, and I was able to sync them over to the SD card.

So far it looks like this is working pretty well.

The C3050 is a pretty basic phone (what do you expect for less that $100 from the local Vodafone shop), and the music player has a few annoying quirks – in particular it too easily forgets if it is part-way through playing a track, and there's no way to determine (from the PC) what tracks have already been listened to. But in spite of that it does the job, which is the main thing.

Sunday, 11 October 2009

Upgrading the Media Center to Windows 7

After my success with upgrading my not-so-modern PC to Windows 7, I thought I'd take another plunge and do an upgrade of my Vista Media Center machine. This is the family TV so any problems would not go down too well!

The Windows 7 Upgrade Advisor didn't flag any major showstoppers, but it did suggest uninstalling the ATI Control Center (which I did). It also warned that I may need to upgrade the drivers for the iMON device (this is the front-panel display on the Antec Fusion 430 Silver case and IR receiver for the remote control). Conveniently, just before I installed Win7, iMON reported that there was a new update available so I allowed that to go through, hoping it would help avoid some of the problem some people have had.

I inserted the Windows 7 Ultimate x86 DVD, ran setup and selected 'Upgrade'. Probably about an hour later (and 2-3 reboots) it was all done.

A quick check confirmed that yes, live TV still worked (phew!) – and so did the remote control.

Going to the Guide showed the new layout, but oh dear – there were no listings for any of the ABC or SBS channels – hmm that could be a problem. But that was enough for one night, so I left it there.

The next morning, I woke up to discover that the kids had already figured out how to watch the previous night's recording of Ice Age – which was a good sign that nothing had changed too dramatically!

I recall seeing mention in the Australian Media Center Community forums that Windows 7 would finally allow use of the FM radio tuner included in the Hauppauge HVR-2200. I went to the FM Radio menu but it said I needed to add a tuner, even though the upgrade had found the 2 digital tuners ok, so I followed these steps:

First, choose Analogue antenna 

Confirm 2 analogue tuners are available

Now choose to set up the digital tuners

Confirm 2 digital tuners

2 analogue and 2 digital tuners will be configured

Scanning begins

Analogue as well as digital channels are found

TV Signal is now finished

Then I was able to go to the Radio menu item, choose FM Radio, then enter the frequency for a local radio station!

Enter 107.9 to get Life-FM in Adelaide

I was intrigued about what to do about the missing TV guide information for the ABC channels in the guide. Mike Hayton (from Microsoft) posted this explanation of how the guide gets updated, so I configured the Automatic Download setting to ensure the guide gets a chance to grab the latest listings..

Windows 7 TV Guide

So, thus far everything has gone very well. The upgrade went without a hitch and everything appears to be working at least as well as before. One problem I did have with Vista MCE was for some reason I was never able to upgrade the ATI video drivers beyond around version 8.4. Every time I tried a newer version, the machine would BSOD. So far the upgraded machine seems stable with the latest video drivers from Windows Update (8.632.1.2000 17-Oct-2009).

I see from New Magic's drivers page that there's an updated driver for the HVR-2200 for Windows 7. I'll have to check whether that got installed through Windows Update, otherwise I'll install that just to keep current.

Monday, 5 October 2009

From WinXP to Windows 7

My home machine used to be pretty state of the art, but that was a few years ago now. It has an Intel D865PERL motherboard. When I first got the machine, I used the built-in RAID to strip the two SATA disks together to get better I/O performance. This has proved quite stable, but unfortunately Windows 7 does not natively support the Intel 82801ER SATA RAID controller (the Windows 7 Upgrade advisor will warn you about this).

So armed with this knowledge, I bought a brand new 1Tb SATA disk (a Hitachi HDT721010SLA360) and then attached it to a spare SATA card that was leftover from rebuilding Dad’s computer.

All looked good until I started up the computer, and was greeted by a message from the SATA card that had found the Hitachi disk, but then did not proceed any further.

This card identified itself as a Silicon Image SiI 3112 SATARaid Controller, with firmware version 4.1.34. I obtained the BIOS update utility and latest BIOS 4.2.84, upgraded the firmware and rebooted.

This solved that problem, and the machine was able to complete startup and boot Windows XP successfully.

I then tried to install Windows 7 from DVD onto the new Hitachi drive. First problem was that Windows 7 didn’t see the drive at all. Eventually I figured out that copying the "SiI3x12 32-bit Windows SATARAID Driver" to a USB flash drive, so then it could be loaded by the Windows 7 installer (don't make the mistake of trying the 'BASE' drivers – they're intended for motherboards, not cards).

Now Windows 7 could see the drive, but it refused to install on the drive. Next stop was to change the motherboard BIOS to make the Hitachi drive the first drive (instead of the original RAID drive)

That did it – Windows 7 was now able to install.

One final thing to try out was whether Windows 7 could actually use the old driver for the Intel RAID controller. I located the 'drivers' folder (Program Files\Intel\Intel Matrix Storage Manager\Driver) and copied those files to somewhere that the Windows 7 installation could see them. Fearing a possible BSOD, I located the 'Intel 82801ER SATA RAID controller' entry in Device Manager, and upgraded the driver to this driver.. and it worked!

So I was then able to backup files from the old RAID disks onto the new Hitachi (which I'd also split into two partitions).

The good news is Windows 7 runs pretty well. I've still got a fair bit of migrating of applications but so far so good.

Tuesday, 29 September 2009

Hotmail accounts hacked for sending iPhone spam

I've had a few family and friends now who have apparently had their hotmail email accounts hacked for the purpose of sending spam to all the people in their contacts (including me!)

The spam (who's grammar should make it obviously not from the original sender) takes the form of

how are you?
recently, I got a nice site:
I brought some items from them. Wow, it is very nice.
low price and good quality (iphone new model 3GS 16 GB only 385 euro)
they also sell Wii, DJ, TV, laptop,camera and so on.
how do you think? login and have a look at it!
yours truly,

As best I can tell, they've done this either via guessing passwords or maybe via some kind of phishing attack. One reason for this belief is that for one incident I saw, the spam was saved in the sender's "Sent Items" folder, just like other regular email that they had sent.

If you have a hotmail account, I'd strongly recommend you ensure your password is long enough to be extremely difficult to guess. A passphrase instead of just a password is probably the best way to do this.

Tuesday, 22 September 2009

Why Websense is stupid (and I told them so)

One of the vendors who happened to be exhibiting at TechEd Australia this year was a company called Websense.

They were giving away T-shirts, so it was only after I had received my free shirt from them that I then proceeded to tell them how stupid and horrible their software was.

This seem to take the Websense staff a bit by surprise and they tried to defend their product assuring me with words to the effect that their software was wonderful and couldn't possibly be faulty and had the "largest database". Well let me assure you "quantity" definitely does not equate to "quality", and it may be no coincidence that their company name rhymes with "nonsense" :-)

Don't believe me? Well take a look at this example:

Try and browse through Websense and you are greeted with this response:


The Websense category "Entertainment" is filtered.



Presumably the legal department must have a fair bit of influence at Websense, Inc. as I don't think anyone else would consider reading software licenses 'Entertainment'.

It just goes to reinforce the enhancement Mitch Denny made in his Software Development Pitfalls talk to point 5 of Jeff Attwood's Programmer's Bill of Rights :

Every programmer shall have a fast, unfiltered internet connection

Ah, we can but dream.

Thursday, 17 September 2009

BinScope and MiniFuzz

Following on from seeing Michael Howard at TechEd last week, here's a couple of new tools to help with analysing your applications for security issues.

"BinScope is a verification tool that analyzes binaries on a project-wide level to ensure that they have been built in compliance with Microsoft’s Security Development Lifecycle (SDL) requirements and recommendations"

"MiniFuzz is a basic testing tool designed to help detect code flaws that may expose security vulnerabilities in file-handling code. This tool creates multiple random variations of file content and feeds it to the application to exercise the code in an attempt to expose unexpected and potentially insecure application behaviours"

Sunday, 13 September 2009

Tech-Ed 2009 – Friday


  • Talking to Virtual PC Guy (Ben Armstrong) about his home HyperV machine that also runs Windows Home Server
  • Watch Pete Calvert compete in one of the crazy competitions in the Mobile Smackdown

2008 R2 Virtualisation with Ben Armstrong

  • Live migration – 1-1.5 seconds
    • Copies config, then up to 5 passes copying memory, then finally state (CPU etc)
  • Cluster shared volumes – allows direct access to NTFS
  • Intel i7 – Hyperthreading is ok (not bad and may be good)
  • VMQ – networking optimisation (feature of NIC)
  • VM Memory Management
    • Uses shadow page tables to emulate page tables for each VM (avoids software emulation)
    • For i7, AMD gen3 Quad
    • Huge positive impact for 75
    • Solves performance issue with 3D video support
  • Deferred procedure calls (used by device drivers) now run on local core instead of core 0.
  • Power efficiency
    • Core parking (really processor parking)
  • Timer coalescing
    • align Windows timer ticks
    • Allows processor to deep sleep/save power
  • Native VHD
    • Don't need to use passthru for performance anymore
  • VHD Boot
    • WIM2VHD (Codeplex)
    • Create VHD through Disk Management

.NET 4 Parallel Extensions with Corneliu Tusnea

  • Need to watch out for locking
  • Parallel extensions now part of .NET Framework
  • Parallel.For/Parallel.ForEach
  • New concurrent collections
  • Automatically allocate work to to each core
  • Task, Task<>
  • PLinq
    • Need to partition data to cores
    • Depends on underlying type – eg. List or IEnumerable
    • AsParallel()
    • AsSequential() – to revert to single core
  • Debugging
    • Parallel tasks window

Big Algorithms in F# with Joel Pobar

  • Functional Programming avoids state and mutable data
  • Increase modularity and composability
  • F# interactive
  • Search
  • Recommendation engine (Netflix)
    • Nearest Neighbour algorithm

Mobile Smackdown

This was bizarre and quite crazy in a mostly good way. Because I'd won a token from the WCF talk, I got get a front-row (well second to front) seat and got a pile of goodies on my seat.

The basic rule of the smackdown was that anytime a demo failed assorted pieces of "swag" would be thrown into the audience.. Hence the audience were keen to see things fail!

Quite a few new Windows Mobile phones, headsets, mice and other nice prizes were given way.

I was also pleased to see that this year, no cat food was involved in any of the competitions (unlike the session from last year)

Final thoughts

So did I get my money's worth? Yes, I think so. I felt I learned or was exposed to new things in almost every session I attended. It was also great to catch up with lots of friends and familiar faces.

While the Gold Coast isn't the most convenient venue to get to from Adelaide, I do think the convention centre does an excellent job looking after and catering for everyone. No complaints about the food!

The HP Mini 2140 netbook is really nice. I think it was quite innovative to allow all delegates to be able to participate in the conference in an online fashion. Wireless network access at the convention centre worked pretty well considering how many concurrent users it had to cope with. Depending on which way the wind blew, I could sometime connect even when I returned to my motel room (which was just across the road). I've given my netbook to Narelle and I think she's pretty impressed already.

Maybe I missed them in the crowd, but I wonder if the days of UniSA sending >10 delegates are over as I didn't bump into any old colleagues this year. It did feel different not having Gary, Dat, Mark around or bumping into familiar faces from IT.

Finally I do especially appreciate the sacrifice my family made (both in my time away from home and financially) to allow me to attend.

Tech-Ed 2009 – Thursday

I woke up Thursday morning feeling pretty good, until I sneezed.

Unfortunately the sneeze triggered another back spasm, so by the time I got over to the conference centre, I was not feeling super-comfortable. I felt a little better as the day progressed but it meant I did end up having to stand for most of the sessions to avoid aggravating things even more.


  • Discovering Michael Howard also has a "Mr Happy" T-shirt – just like the one I was wearing during his session.
  • Mitch has great clip-art in his presentations
  • Winning a token to the Mobile Smackdown by answering a question in the WCF talk (don't call WCF proxies in a 'using' block as the Close() method can raise exceptions)

Software Development Pitfalls with Mitch Denny

  • Reality – software development is hard
  • 68% of projects still fail (2004)
  • Failure #1 - "Customers must understand all requirements"
  • Failure #2 - "Fixed price solutions"
  • Define the vision
  • Roles
  • SketchFlow
  • "It's about value, not frameworks"
  • Minimise waste
  • Villan #1 – Scope Creep
  • Villan #2 – Big "A" architect (doesn't have Visual Studio installed)
    • Planning Poker
    • Keep team stable
    • Pick team members for how they relate to the rest of the team
    • Resourcing not just about people
  • Villan #3 - "Pony-tail network admins"
    • Developers are different
    • Need a good PC
    • Developers' Bill of Rights
    • Rent servers by the hour

What's new in .NET 4 and VS 2010 with Adam Cogan

Visual Studio 2010

  • Add references improved performance (kind of)
  • Multi-line editing
  • Code navigation
  • Call hierarchy
  • SharePoint support


  • Optional parameters
  • Named parameters


  • Less requirements for line continuation character "_"


  • SEO (Routing), RedirectPermanent
  • Live data-binding – two-way binding
  • MVC
  • Query extensions
  • Deployment

SDL with Michael Howard

SDL Goals:

  • Reduce vulnerabilities
  • Reduce severity of missed vulnerabilities


  • Identify primary security/privacy contact
  • Security training
  • Track security bugs
  1. Strong signing and ACPTA
  2. Secure Crypto
    1. configurable algorithms (use a factory class)
    2. Use standard libraries
    3. Use appropriate algorithms
  3. Firewall
  4. Threat models
  5. Support UAC
  6. Granular feature control
  7. Grant minimal privileges (drop privileges on service startup)
  8. Use minimum code gen suite (eg. latest compiler)
  9. Use /GS
  10. Use Safe Exception Handling
  11. MIDL
  12. Use ASLR
  13. Use DEP
  14. Defect heap corruption
  15. No writable PE segments
  16. Don't use banned APIs
  17. Encode long-lived pointers
  18. Use FxCop
  19. Use /analyze
  20. Use SAL
  21. Use /W4
  22. Native code XML Parsers
  23. XSS
  24. Safe tags without attributes
  25. Use ViewStateUserKey
  26. Don't use JavaScript eval()
  27. Safe redirects
  28. SQL execute only
  29. Use parameterised queries
  30. Use stored procedures
  31. Don't depend on NTLM
  32. Don't swallow all exceptions (rethrowing is ok though)
  33. Safe error messages
  34. Fuzz testing
  35. Application Verifier
  36. Device drivers

Security for Developers with Michael Howard

  • How do I sell security to management?
    • Sell privacy and reliability
  • #1 skill developer should have
    • All data is evil unless proven otherwise
  • #1 skill testers should have
    • fuzz testing
    • !exploitable (WinDBG)
  • #1 skill designers/architects should have
    • threat modelling
  • What does the bad guy control?
  • The Turkish "I" problem
  • Why should I not use RC4
  • Don't use ECB mode

WCF Scaling with Chris Hewitt

  • Instance management (PerCall)
  • Service throttling 3.5/4.0
  • Threading IIS6/7
  • Cache the channel factory and channel
  • Proxies can explode
    • Use proxy wrapper
  • Don't really need wrapper for basicHttp binding as there are no sessions
  • Large data – stream mode
  • Binary encoding – even over HTTP
  • PerSession with durable services
  • SSL load balancing behaviour
  • "Dublin" – WAS extensions

Thursday night a whole stack of coaches drove all 2,500 delegates to Dreamworld. I'm not big on rides, but it was nice to have a look around, grab some tea, and catch up with Nigel, then bump into Jason and a couple of the guys from GraysOnline (Australia's biggest online retailer, which I'd never heard of until a few months ago).

Tech-Ed 2009 – Wednesday

Wednesday morning's keynote started the conference off at 8.15am. Highlights of some of the new features of Windows 7, Server 2008 R2 and Visual Studio 2010 were demoed.

They also took some photos of the attendees which have ended up as a deep-zoom photo. See if you can spot that guy near the front in the orange (actually bright red) shirt :-)

I attended the following sessions. Bullet points are transcripts of the notes I wrote for each session, so they may or may not make much sense sometimes!

SQL 2008 R2 with Mark Souza

  • Base engine is basically unchanged
  • "Gemini" add-in for Excel can efficiently process millions of rows of data in memory
  • Data-tier Application Component
    • unit of deployment
    • virtualise connection strings
    • can be moved between servers
    • supports updating and running custom scripts
  • Complex event processing

The DAC stuff looked interesting, and appears as though it will be a useful way to deploy and update database schemas.

ASP.NET MVC with Damien Edwards

  • Sample site
  • Model-binding instead of data-binding
  • Unit testing
    • arrange-act-assert
  • Includes AJAX javascript library and JQuery
  • Mobile
    • restrictions on cache size
    • – mobile device compatibility
    • mobile-aware view engine
  • Optimistion
    • Reduce HTTP requests
    • PowerShell post-build script to strip/compress/optimise javascript and CSS files
    • Switch to condensed javascript file (single file instead of multiple includes) in release mode

The optimisation stuff was interesting – concatenating multiple js files into one to reduce the number of HTTP requests.

WCF and WF in .NET 4.0 with Graham Elliot

  • Simplified configuration
    • Able to figure out default endpoints from bindings
    • Set default behaviours by omitting names in configuration
  • Service discovery
    • Dynamic endpoints
      • ad-hoc – good within a subnet
      • managed – uses a discovery proxy
    • Routing
  • Improved REST support
  • WF 4
    • XAML-only
    • Activity library
    • No state machine support

IIS 7.5 New Features with Jorke Odolphi

  • Support for Server Core on R2 – 64bit only
  • Use DISM to install ASP.NET on Core
  • FTP
  • WebDAV
  • Media Services (more integrated into IIS now)
    • smooth streaming
    • demo of HyperV live migration whilst streaming video
  • Web deployment tool

Live migration of virtual machine whilst streaming video was impressive.

SQL High Availability with Nicholas Dritsas

  • 2008 SP1 can finally uninstall updates and service packs
  • Support for HyperV – 1-2% impact if using newer hardware
  • Mirroring enhancements
    • recover from I/O errors by copying from mirror
    • log stream compression
  • ServiceU case study
    • Cluster at primary and DR sites
    • Log shipping and async mirroring
  • Connection string
    • use "Failover Partner=servername;"
  • Clustering new features
    • rolling node upgrade/patching
  • Can use replication to migrate to a new server and have the ability to roll back to the original server should the upgrade fail.

SQL Certification 70-432 Cram Session with Greg Low

  • Installing and configuring
    • Don't need Browser service running if using fixed port numbers
    • Database mail depends on Service Broker
  • Maintain SQL Server instances
    • Transparent database encryption – need to backup the certificate and private keys too
  • Performing data migration tasks
    • Filtered INDEX can include a WHERE clause
  • Monitoring and troubleshooting
  • Optimise SQL Performance
  • Implementing High Availability
    • Log shipping can be a good way to upgrade to a new server

Not sure if I'll do this exam, but Greg did a nice job giving an overview of the required knowledge, and we got tea as well.

Tuesday, 8 September 2009

Tech-Ed 2009 Arrival

The day almost didn’t happen when I realised I'd left my wallet in the car after being dropped off at the airport. Some frantic phone calls managed to catch Narelle before she'd driven too far! Boy did I feel silly!

The flights to Melbourne and then to Brisbane were uneventful, and made a bit more comfortable by being upgraded to exit seats (my legs appreciate the extra room). I'd had some of my Melbourne flights automatically upgraded when I was flying over to see Nanna before she died and for her funeral, and I also discovered that often you can ask to be moved to an exit seat – if you don't ask, you won't get.

Next the AirTrain down to the Gold Coast. I took advantage of booking the taxi when I collected my tickets at Brisbane airport, so they were there to pick me up from the train station and drive me directly to my motel.

The motel is directly opposite the convention centre, so you can't get a more convenient location. My priorities were to get something as cheap as possible, and it probably is a case of getting what you pay for. The room is very simple – bed, TV, bar fridge and bathroom. No, it isn't the Sydney Hilton by any means, but as I'm paying for it out of my own pocket, I'm quite content.

After dropping of my bags in my room, I wandered across the road and met up with Rob. Wearing our shirts we looked like the Lobsterpot Solutions Twins :-)

There was a nice dinner on offer as part of the welcome party (I do have good memories of conference catering at the Gold Coast!) and a chance to be introduced to many of Rob's contacts, survey the expo stalls and grab a few freebies for the kids.

One interesting thing I learned while chatting to one of the guys (I think it was Vaughan Knight) was that he had to change the topic of his talk because Microsoft were dropping the Live Services Framework – including Live Mesh. I've been using Live Mesh a bit (including as a way for the band-members of sevenfold to collaborate and share lyrics, recordings and other documents), but apparently it will shortly be no more, which is a real shame.

Monday, 7 September 2009

Catching up

It's been a little while between posts, and there's been a couple of reasons for that..

  • That back injury has been persisting a lot longer that I'd hoped
  • My Grandma (Nanna) Jean was hospitalised and then passed away recently

Nanna was 96, and had pretty much been living independently in her house right up until she suffered a massive stroke. She hung on long enough for the family to travel interstate to Geelong Hospital to spend time with her before she died.

I flew over to say goodbye to her (she wasn't able to speak but was alert and had limited movement), and then returned to Geelong a week later to attend the funeral service. Then last week her body was brought back over to Adelaide where she was buried.

My back injury seemed to be healing well initially but a work field trip (spent largely sitting in a car) was not helpful and things seemed to plateau for too long. I've taken to avoiding sitting as much as possible – including standing on the bus to/from work and even standing in some meetings.

Some more "enthusiastic" (aka painful but effective!) treatment from my Chiro and a follow-up remedial massage session seem to be helping. I'm sure my work colleagues would prefer to see me being able to sit down for most of the day rather than doing yoyo impersonations :-)

Ironically my iPod Shuffle appears to have succumbed to the dreaded "flashing LEDs of death" – annoyingly on the flight home from the Geelong funeral service, so all those podcasts will have to wait until I come up with a replacement plan.

And to top it all off, tomorrow I'm heading off to the Microsoft TechEd Conference 2009 at the Gold Coast Convention Centre. I well may be the conference delegate who stands up in the sessions rather than taking a seat.

Oh, and additional congratulations to LobsterPot Solutions, as they are now a Gold Certified Partner. Was it that long ago they were just plain Certified?! I'll be proudly wearing a LobsterPot shirt at TechEd and lending my support to raise the profile of Rob's company.

No doubt I'll be posting more about TechEd in the next few days..

Wednesday, 19 August 2009

Media Browser for Vista Media Center

I came across this useful Media Center plugin recently. As well as providing an alternate interface to browse media files it also includes an RSS reader which I've successfully configured to watch some interesting video podcasts:

  • dnrTV - .NET Rocks TV
  • 10-4 – New features of Visual Studio 2010 and .NET Framework 4.0
  • TED – Talks from the annual Technology, Entertainment, Design conferences
  • Scrap Time – A Scrapbooking video podcast for Narelle

It is free, and is being actively developed on Google Code.

Podcasts I'm listening to

For a long time now I've been listening to podcasts – first on on the iPAQ rw6828, then a HTC TyTN II, and more recently my iPod Shuffle.

My original subscriptions were:

At the suggestion of Ben and Nigel I added:

And I've also added:

  • Radio TFS – Team Foundation Server
  • SQL Down Under – Greg Low's interviews with SQL experts
  • SQL Snapshots (coming soon) – Also from Greg Low, I found out about this via Rob after mentioning to him the idea of a podcast for a "Talking Books" version of the SQL Books Online.

The best way I've found so far to get the podcasts onto the Shuffle is to use WinAmp and the ml_ipod plugin. WinAmp does come with an built-in iPod plugin, but I've found ml_ipod provides superior support, including synchronising podcasts – something iTunes won't do for a Shuffle at all.

Sunday, 9 August 2009

Ouch again

I'm a sorry and sore case again. My back gave out a few minutes into the first half of a game of Basketball on Saturday. Despite initial cries of "foul" from my teammates I quickly realised that the only reason I'd fallen to the floor in pain was an all too familiar but dreaded feeling in my lower back. One I'd hoped I'd never have to endure again.
It's so annoying as I'd been trying really hard to keep up the stretching and strengthening exercises given to me since the last incident. I realise this also doesn't just impact me - it messed up the rest of the weekend for my whole family, which is extremely frustrating.
Maybe it's an indicator that I need to think about other forms of exercise, and my body isn't as young and flexible as it once might have been? Or maybe the timing is appropriate for me to make the transition from player to supportive parent. We'll see.

Tuesday, 4 August 2009

Tracing the Sync Framework

Using the Sync Framework (aka Sync Services for ADO.NET) can feel a bit like a black box. You implement some classes, override some methods, call Synchronize() and it all just magically happens..

Except when it doesn't. Sometime strange things can happen, and it would be nice to know a bit more about what Sync is doing under the hood. Unfortunately this is one product that Microsoft haven't release source code for, so you can't step into it with your debugger.

That was where I thought the story ended until I stumbled upon this topic on MSDN – How to trace the Synchronization Process.

So add some stuff to your app.config file and you should get a little more information about what is really going on.

Monday, 3 August 2009

Congratulations LobsterPot Solutions

I see that Adelaide's own SQL Server-specialist consulting company – LobsterPot Solutions – are now a Microsoft Certified Partner (Data Management Solutions, Business Intelligence).

Well done Rob!

Saturday, 1 August 2009

Registered for Microsoft Tech-Ed 2009

The life of a contract programmer can be a lonely one. Well I guess it would be if you never spoke to anyone and live on a island all by yourself, but I didn't mean it quite like that. One of the things about being a "regular" employee of a company is that most places have some kind of professional development programme. Our old team at UniSA was no different, and we were always encouraged to attend conferences and training opportunities that would enhance our skills and benefit both us and the institution.

But now it's been over 12 months since I left the the safe and familiar confines of the Flexible Learning Centre building at the old Underdale campus. I spent a short time at DECS and the remainder has been at ABB Grain Ltd. A side-effect of that was I wasn't able to attend Tech-Ed last year, though not for lack of trying!

This year I was thinking I'd miss out again, but after mentioning the group discount and free netbook with my wife, she encouraged me not to dismiss going altogether. I ran through the figures including likely travel and accommodation costs, and while it isn't cheap we can manage it. At least the cost can be claimed on tax which is better than nothing.

So to cut a long story short(er), I've now registered and will be heading off to the Gold Coast in about 6 weeks time. I am also very appreciative of my wife, as I'm aware it will be a lot of work managing the kids while I'm away. She did say if I go again next year, she wants to come too (Not to the conference, but just for the holiday!) Sounds good to me :-)

Thursday, 30 July 2009

.NET Framework source code

I knew that Microsoft were making it possible to Step Into .NET source code when you are debugging (if you configured Visual Studio to use the correct symbol and source server), but I didn't know that you can download the entire source by itself as well.

They currently have various bits of .NET 3.5, ASP.NET MVC and WCF. Hopefully more will follow.

More details are on the Reference Source Code Center Team Blog, and there's a forum too.

Monday, 27 July 2009

P2P online backup

Very rarely you see an online ad that is interesting.. Today I noticed one for CrashPlan.

They offer both a free and paid online backup solution. The interesting thing about the free version is that you back up your data on your friends' or family's computers (rather than a central remote server). Quite a novel approach. About the only downside is that the free version apparently is ad-supported. Not sure how annoying they would be.

I think all the computers would need to be online at the same time for backups to work properly. Presumably the same would apply if you needed to do a restore too. Something to take into consideration.

There is also a paid offering too (for orphans or people without any friends?)

Thursday, 23 July 2009

Updating assembly versions in Visual Studio project files

Sometimes you need to update all the references to a particular assembly so that they use a newer version than the original one that was added to the project.

One option is to manually edit the references for each project, removing and re-adding the assembly.

Option two, which is a bit nicer, is to use something like this PowerShell script:

Get-ChildItem -recurse -filter "*.*proj" | Foreach-Object { (Get-Content $_.FullName) | Foreach-Object { $_ -replace "", "" } | Set-Content $_.FullName }

In this example, we are replacing instances of "" with "" – handy if you just happened to be upgrading to the latest version of Castle.

Note the use of the parentheses () around the Get-Content - without those you'll end up with an Access Denied error as it will be trying to write to the same file it is reading from.

Sunday, 19 July 2009

CodeCampSA 2009 – Day 2

Presentation notes

Nigel Spencer – WPF in 2010

  • Easing functions – affect animation velocity
  • Behaviours
  • Demo of customising Visual Studio home page – XAML-based
  • Model View ViewModel – templates

Greg Low – Spatial SQL

  • sys.spatial_reference_systems

Dave Glover – Windows 7 APIs

  • Windows 7 Training Kit

Omar Besiso

  • Sync Framework (seemed strangely familiar!)

Jason Stangroome – PowerShell and build automation

Jason Schluter – Silverlighter

  • XHTML to Silverlight converter

James Chapman-Smith – Model View ViewModel and Unit Testing

  • ViewModel handles
    • UI logic
    • input validation
  • Thought while observing Jame's code – could you have INotifyPropertyChanged take a lamba expression instead of a string? – Apparently yes!

Peter Cornish – AdWords

CodeCampSA 2009 – Day 1

Presentation notes

David Gardiner – Generating Unit Tests with Pex

  • Fantastic
  • Inspirational
  • I wish I could present like this guy
  • :-)

Anthony Borten – TFS 2010

  • Always try to install TFS, SharePoint and Build on separate servers if possible
  • Make sure you launch config tool immediately from the installer
  • Note the 'test' buttons to check your server names
  • Team Foundation Administration Console
  • Branching – better in 2010
  • Team Build
    • Build controller
    • Build agent
    • Gated checkins

Allan Baird – UniSA

  • Industry partnerships – opportunities to have students work for 6 or 12 month placements.

Rob Farley – The problem with BEGIN and END in T-SQL functions

  • Useful tool - "fences" – hides desktop icons
  • Generally modularisation in T-SQL is good
  • Funny joke about COUNT(dracula)
  • Compare two queries – one using a user-defined function, the other just has SQL
    • function query appears to run faster according to query plans
    • BUT, using SQL Profiler, it is actually much less efficient
    • SQL sees BEGIN/END and can't inline the function

Liam McLennan – MVC is better than WebForms

  • WebForms is to imperial as MVC is to metric

Tatham Oddie – WebForms are better than MVC

  • Used WebForms for graysonline
  • Used application/xml mimetype to validate XHTML content with Firefox during testing
  • XHTML 1.1 templates for Visual Studio
  • Tool to convert bad HTML to valid XHTML
  • .NET 4.0 – Can disable page-level ViewState, but enable it on specific controls

Scott Barnes – Silverlight

  • Was a Flash developer before joining Microsoft
  • 400 million downloads of Silverlight
  • Biggest competitor - HTML+JS!

Anthony Borton – VSTS 2010

  • Eliminating no-repro bugs
  • Virtual Lab Management
  • Test Case Management
    • Record against real application
    • Fast forward through test steps
  • Microsoft Test and Lab Manager
  • Replay – re-run test including launching application under test
  • Coded UI Test
    • Test builder – records UI actions

Paul Turner – SharePoint branding tips and tricks

  • Start with minimal master page
  • Enable debugging
  • Position tool pane
  • Standard delegates (My Site etc)
  • Site actions
  • Digest (MAC)
  • Understand CSS
    • Add custom CSS with CssRegistration
  • Don't put JS in master page
  • Async JS with defer

Wednesday, 15 July 2009

Bringing Developers and Designers closer together (eventually, sort of)

When Microsoft released their Expression suite of products, the marketing claim was that they could be used to edit the very same source files that the developers were working on.

BUT, while Visual Studio 2005 included TFS, the obvious integration with any of the Expression products was missing. So the marketing claim was a bit hollow. Yes, you technically "could" work on the same files, but it was going to be a clunky experience.

So it is ironic that yet again, a version 3 product finally appears to get it right. Note this announcement refers to Expression Blend, and it isn't clear whether Expression Web has similar capabilities.

Tuesday, 14 July 2009

The art of Unit Testing with Examples in .NET

I recently bought a copy of The Art of Unit Testing: with Examples in .NET by Roy Osherove, taking advantage of a discount being offered by Manning.

Already owning xUnit Test Patterns: Refactoring Test Code (Addison-Wesley Signature Series) by Gerard Meszaros and Working Effectively with Legacy Code (Robert C. Martin Series) by Michael Feathers, I was interested to see what new insights Osherove would bring, especially as he would be focussing purely on the .NET platform (code samples are in C#).

The book is divided into 4 sections.

Part 1 (which I skimmed through) was an introduction to unit testing. Osherove uses NUnit for his examples which is reasonable considering it is probably the most popular unit testing framework for .NET at the moment.

His preferred naming convention for test methods is interesting – "[MethodUnderTest]_[Scenario]_[ExpectedBehaviour]". It contrasts with the "natural sentence" style I currently favour (which I'd trace back to Jean-Paul Boodhoo's unit testing episodes on dnrTV).

He also recommends naming test classes with a "Tests" suffix. I've always used the singular "Test", but I take his point that each test class does contain multiple tests so plural may be more accurate.

Part 2 introduces stubs, mock objects and isolation frameworks (aka mock object frameworks). Following a poll held on Osherove's blog, Rhino Mocks was chosen to demonstrate how a framework can simplify creating mock objects. I could be wrong, but you almost get a sense that this was done somewhat grudgingly considering Osherove himself works for TypeMock (who sell a commercial mocking framework). Curiously whilst including a link to the Rhino Mocks download site, he doesn't even mention Ayende's name at all.

Osherove makes the following recommendations about stubs and mocks:

  • Use nonstrict mocks when you can
  • Use stubs instead of mocks when you can
  • Avoid using stubs as mocks

I found this interesting, as we've been writing a lot of unit tests lately, and one of the things we're coming to realise is that brittle tests can be annoying. Tests that still test your code, but are more flexible about exactly how the code under test works (rather than setting strict expectations for each and every method call) are going to be more useful and less effort to maintain.

Part 3 looks at various strategies for organising tests and a number of patterns and anti-patterns to follow when creating tests.

Part 4 covers how to make unit testing the norm in an organisation, and how to work with legacy code.

Having some experience writing unit tests, I did find this book a bit light on. Osherove references Meszaros and Feather's books regularly. I would also consider both of these works cover the topic in a more detailed and thorough manner. However they are probably not necessarily as good a starting point for someone new to unit testing, especially someone who's main experience lies in developing for the .NET platform.

I finished the book surprisingly quickly – pleased that I'd learned a few new things, but left feeling that it would have been nice to learn a few more.

Wednesday, 1 July 2009

Firefox 3.5

Today is "Upgrade to Firefox 3.5" day :-)

My upgrade went very smoothly, and one nice feature was it warned me beforehand which extensions wouldn't work with the new version.

Post-upgrade, it found a compatible version of Firebug, but I'm still waiting for updates of

  • Bookmark Duplicate Detector
  • Google Notebook
  • Live Writerfox
  • Microsoft .NET Framework Assistant 1.0

The following extensions work ok:

  • DownThemAll
  • English (Australian) Dictionary
  • IE Tab
  • Xmarks

They reckon 3.5 is about twice as fast as 3.0. It certainly does seem snappier.

As a side note, I just noticed that Google Notebook is no longer being developed. Might be time to finally make the transition to Evernote.

Saturday, 27 June 2009


(or two things I remember from this month's SQL Server user group meeting)

This month, Rob presented on "SQL in the cloud". It was an interesting talk, if nothing else for the interesting direction(s) that Microsoft have taken trying to get this whole "cloud database" concept up and running.

Rob's joke turned out to be quite good (considering the context of a SQL Server User Group - "A man walks into a bar, sees two TABLEs and says 'Can I JOIN you?"

The other thing which he mentioned as part of a discussion on cloud computing was Saasu – an online accounting site. Think MYOB or Quicken but entirely online. This attracted my interest as I've been using MYOB Business Basics to track Narelle's scrapbooking business for a few years, and I've come to discover that particular product isn't really suited to a reseller type business.

Saasu is free to join and if you keep below 15 transactions a month it is free to use. Following the familiar service model, once you start using it more often than that you need to pay a small amount each month. That cost would probably be less than having to buy an upgrade for MYOB each year, so it is quite competitive. Even though it's a global site, they have facilities for handling Australian accounting and tax requirements (eg. GST and BAS).

So far, I'm quite impressed, especially considering they support handling inventory (something Business Basics couldn't even do).

Monday, 22 June 2009

Tracing and logging WPF

Whilst researching unit testing WPF applications I came across Bob King's answer to this question on StackOverflow.

WPF DataBinding can appear to be a bit of a mysterious black box, but I now know that you can enable diagnostic trace sources to see what's happening under the covers. Mike Hillberg shows some examples in this post.

Saturday, 20 June 2009

42% discount from Manning

I saw today on Jeffery Palermo's blog that Manning are offering a limited time discount on "Alt.Net" books if you use the discount code "alt42" before June 25th. I've taken up the offer and ordered the following:

Some good reading, and just in time to claim for a tax deduction too.

Wednesday, 17 June 2009

Error message of the day – "Something has went wrong"

And I think I was probably the one who was responsible – a bit said for someone who normally does take the time to correct grammar and spelling errors :-)

Thankfully not something end-users get to see, but it does seem quite appropriate for an error (in an ironic kind of way).

Sunday, 14 June 2009

David and Fiona Meier

It’s not every day that your sister gets married, but it was yesterday!

My sister Fiona married her fiancé David Meier at The Corner Uniting Church.

The service was lovely and it was great to see lot of family and friends there. Following an afternoon tea at the church, we joined the bridal party for photos, then after leaving the kids with a babysitter headed off to the reception at Belair Park Country Club (situated in the grounds of Belair National Park).

The reception was very enjoyable, with musical entertainment provided by Heidy De Ruyter. Some really good speeches were given by the best man, bridesmaids and both fathers of the groom and bride.

My mum (the mother of the bride) came out of retirement to make possibly her last wedding cake, and she did a fantastic job.

Sometime you hear of weddings that don’t go to plan, have awkward moments or end up with the bride (and others) distressed and embarrassed. Maybe you’ve even attended one? I’m pleased to report that yesterday it was nothing like that! Everyone (especially the bride and groom) had a great time, enjoyed themselves immensely and went home knowing that David and Fiona are going to be very happy together.

Fiona and David chose Meg Hansen as their professional photographer (I took the ones you see here!) and Pete Dobré as videographer (who when he’s not videoing wedding can be found taking spectacular photos of Australian landscapes)

Monday, 8 June 2009

CodeCampSA website

I could keep dropping hints waiting for CodeCampSA to get its own site – or I could just go ahead and create it myself!

So, I’m please to announce – the new home of Adelaide’s own .NET Code Camp.

So let’s get the word out amongst Adelaide’s .NET community. Pass the word to your colleagues and developer friends. Tell any higher education or training organisations – what a great way for students to network and make contacts in the industry!

If the name “CodeCamp” puts people off, feel free to call it a “.NET Conference”! In fact call it what ever you like to get people to come along, because once they’re in the door I’m confident they’ll be glad they came.

Friday, 5 June 2009

CodeCampSA 2009

According to an email from ADNUG’s Peter Griffith, Adelaide’s CodeCampSA 2009 will be held on July 18-19th. As in previous years, it will be at UniSA.

I’ve offered to do a talk about Pex. I wouldn’t be surprised to see WPF guru Nigel popping up on the speaker list, and I’ve encouraged Ben and Timothy to think about whether they’d be interested in speaking too.

I still think having a CodeCampSA website would be a great help for promoting the event too.

Wednesday, 3 June 2009

When PreRelease really means Release

Once upon a time, I’d installed the 180-day trial version of SQL Server 2008, and prior to that I’d been running the last CTP.

The expiry time was fast approaching, and I also needed to install the Integration Services components so I figured it might be time to uninstall the trial version and install the proper licensed one instead. The main reason I’d been putting this off was I knew it was going to take a few hours of uninstall/reinstall.

So I uninstalled everything in Add/Remove Programs that looked vaguely related to SQL Server, rebooted, then installed a fresh version….

Only to see “10.0.1600.22 ((SQL_PreRelease).080709-1414 )” in the About box of SQL Server Management Studio.

Hmm.. In desperation I then uninstalled everything vaguely related to Visual Studio 2008, and then tried again…

Same result!

It was only then that I found this post in which I discovered that no, SQL_PreRelease really means RTM!

Oh well, I guess it means my Visual Studio and SQL installs are fresher, but a bit of a pain nonetheless.

Monday, 1 June 2009

"Parameter count mismatch" calling Resolve<T>()

I was seeing this exception being thrown in some code recently:

System.Reflection.TargetParameterCountException: Parameter count mismatch.
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
   at Castle.Core.ReflectionBasedDictionaryAdapter..ctor(Object target)
   at Castle.MicroKernel.DefaultKernel.Resolve[T](Object argumentsAsAnonymousType)

The original source line was something like this:

IDictionary<string, object> args = new Dictionary<string, object>();
args.Add( "paramName", "value" );

_kernel.Resolve<ISomething>( args );

That all looks fine, and let’s assume the Something class has indeed a constructor with a string parameter named ‘paramName’. So why isn’t it working?

I should have noticed the clue[1] in the stack trace, but was sure I had identical code elsewhere that was working correctly, so it had me stumped. It was only after taking a break from the code, then playing around with a very simple test project that I realised that while there is a method Resolve<T>(IDictionary), that’s not the one that was being called here. Why? Because instead of using var, I’d declared the variable to be an IDictionary<string, object> – and surprisingly that interface does not imply you implement IDictionary (the non-generic version).

When I went back and checked other instances of the code that were working, sure enough I was using var and because Dictionary<> does implement both IDictionary<> and IDictionary it was working as expected.

[1] The clue was the type and parameter name for Resolve - “Object argumentsAsAnonymousType” is obviously not the same as IDictionary!