Func<T> vs. Action<T>


Although I’ve been using Func<T> and Action<T> for years, I’m embarrassed to say I hadn’t really thought about the differences between them – or more importantly, how they are in fact two sides of the same coin.

Most of the time their use has been a natural reflex action to a coding problem, and the consideration of the other method hasn’t even entered my mind. It’s time I also start using their proper names, which also belies their use:






Today’s Problem

I needed a way of enumerating a directory of files and executing a bit of arbitrary code against each one. The code that was to be executed needed the contents of the file. Continue Reading “Func<T> vs. Action<T>”

Introducing…. Meteoric

This has nothing to do with JavaScript. Sorry.

Meteoric (source:, documentation: is a JavaScript framework that allows UIs to be built on-the-fly driven by JSON metadata. The JSON metadata is parsed by “writers“, very focussed JavaScript functions which understand the specific requirements of that metadata and spit out HTML to the DOM. Styling is done through CSS.

The idea is that you can build web applications very quickly simply by breaking down your applications into [data] and [renderers for the data].



Consider the following JSON object representing a customer:

var customer = {
    "type": "customer",
    "id": "1234",
    "name": "John Smith Ltd.",
    "email": ""

Continue Reading “Introducing…. Meteoric”

An ASP.NET MVC4 Razor2 Bug? (Updated)

Let’s Get Geeky!! This week I have been updating a project I’m working on from ASP.NET MVC3 to ASP.NET MVC4 (Beta). MVC4 ships with an improved version of the Razor view engine. But “updated” apparently also means “broken”… That is, if you’re using jQuery UI Widgets. Which I am. So it is.

Let’s build a simple MVC app and show you what I mean. The steps are the same for MVC 3 and MVC 4, but the MVC 3 one works while MVC 4 doesn’t. (If you’re lazy, I applaud you. I provide both code samples at the bottom of the page).

Continue Reading “An ASP.NET MVC4 Razor2 Bug? (Updated)”

8 Things Windows 8 Needs to do to Be a Success

Window 8 Metro. Nothing to do with Rome's underground train network...

1. Stop Stealing My Focus!!!

I can’t stress this enough. The single greatest threat to the economic recovery, continuation of the species and integrity of my sanity is the way Windows is completely dense about giving applications focus.

I simply can’t count the number of times I’ve been typing away merrily and Windows switched applications under me. This is a huge security threat!! I have seen people typing passwords into password boxes during demonstrations only to find that just as they typed the first keystroke of their ultratopsecret, high-entropy¬†passphrase Windows switches to an open Word document and the million people in the stadium, and the forty billion people watching the webcast see you’re a fan of obscene passwords. (And immediately, empty your bank accounts).

That’s slightly exaggerated but I have seen my parents suffer this while helping them set up internet banking. While entering a password into IE, Firefox finally loaded after an update, immediately took focus, and Dad ended up putting his password into the address bar and got a list of Google results for the password. This means that now not only do I know the key to my inheritance fund, but so do Larry and Sergey. Continue Reading “8 Things Windows 8 Needs to do to Be a Success”