Be Paranoid. Be Very Paranoid.

Do you maintain an application with a backend database? Does that application ever write to the database? Be afraid. The worst situation to be in with respect to the above is when a customer mails you and says: “Why is my data gone?” 99% of the time, it’s because they clicked on the “Delete” button;…


WPF: Allow your users to define their own styles using XAML

An application I’ve been working on has the vague property of “displaying items on the screen”, and a fairly unusual requirement which specifies that users be able to completely define how the items look. Our items are displayed on a timeline and can represent pretty much anything (up to the user), hence the flexibility required…


WPF: Supporting command line arguments and file extensions

Traditionally, handling command-line args in an app has been a simple case of reading arguments from the “int main()” function (or equivalent). In WPF this changes somewhat. The usual setup is that you have your App.xaml.cs, which loads your initial window. While it’s the former that  has access to the arguments, it’s the latter that…


You’re asking for the wrong thing.

Just stumbled upon this article by John Dvorak titled “My Windows 7 Wish List”, and I see the same pattern as many of the other fruitless wish list articles. Maybe IHBT… As a user, the user experience (UX) is the only thing that ever matters to you – the implementation is never the issue. Take…


Trivial but useful extension method

Don’t know why I didn’t write this before; it makes code very readable. Often when you write anything graphics related, you want to constrain coordinates to window edges (for example). So a simple method: 1: /// <summary> 2: /// Ensure that the given number falls within the 3: /// given min/max constraints. 4: /// </summary>…


On using Arrays

Eric Lippert has a great article on arrays:   I think this is especially useful to consider if you’re writing an API. Consider not just arrays, but any time you’re returning any collection: Are you returning values or a variables? Did you mean to?   Avi


Microsoft Bacon Home Edition, RC0

Totally unrelated to programming, but I deem this worthy of a blog post. A few weeks ago I decided to make my own bacon.   Why? Don’t ask stupid questions; bacon is an axiom. How? turns out that it’s actually not so complex: Buy some pork belly. Any butcher (even the one inside the supermarket)…


Computer Programming isn’t Art

(Sorry, Mr Knuth) My uncle’s hobby is building beautiful furniture from wood. I noticed something last time I spoke with him about it: He doesn’t talk about a table, or a book case, or a dresser; at least, that’s not what he talks about with emotion. You only get a sense for what he loves…


Back in Seattle

I recently came back from visiting Seattle (where I’d lived and worked for 7 years before returning to Sydney). My wife was presenting at TechReady, so I figured I’d hitch a ride and make a vacation of it. It was also a good opportunity to meet up with my team and try to remember what…


Getting Code Coverage to Work in Visual Studio

Are you sick of seeing this error?: “Code coverage is not enabled for this test run” I was working on a project where my COV results were always giving the above error, and it took some figuring out. Basically, it came down to two things: I had the following setting switched off, so I wasn’t…