• If you're not logging, you're doing it all wrong. (part 1) posted on 23 Apr 2014

    Part 1: If you're not logging, you're doing it all wrong.

    Really? Seriously?

    Synopsis: Simple way to start logging your .NET application.

    Maintaining some production software is most overlooked until a problem arises ... which by then it could be more costly to support and fix if some simple, basic procedures were not considered from day zero. In my opionion, adding the ability to get acess to the internal runnings of your system is crutial to seeing what is going on under the hood and helping you get some facts to help problem solve a production issue.

    Logging is one of these mechanisms and should be considered and planned before you even start any coding.


  • Fixing Github with Chrome Plugin - GitHub.Expandinizr posted on 07 Feb 2014

    So if you've ever visited Github, and thought 'Oh, I'll browser a repository and find a file', no doubt you've probably ended up in a suituation like so:

    OH Joy, this is so readable... I honestly have no idea who at Github approved this...


  • If you're going to use repositories, don't have generic or base repositories... posted on 31 Jan 2014

    Repositories are one of those patterns we hate to love or love to hate, but seems to be getting more hate lately than love.

    Personally I don't have any real problem with repositories themselves, I just have a problem with the way it is used.

    If you run the following search in Google:

    BaseRepository OR GenericRepository OR IRepository site:stackoverflow.com

    You will get about 10k results on Stack Overflow for questions that contain something related to a generic repository or base repository. You end up with code snippets such as:

    public interface IRepository<TEntity> : IDisposable where TEntity : class
        IUnitOfWork Session { get; }
        IList<TEntity> GetAll();
        IList<TEntity> GetAll(Expression<Func<TEntity, bool>> predicate);
        bool Add(TEntity entity);
        bool Delete(TEntity entity);
        bool Update(TEntity entity);
        bool IsValid(TEntity entity);


  • Snow's new server feature! Runs up a testing website for you. posted on 25 Dec 2013

    Just now I released Snow v1.4.0 :) with this we have two new features.

    1. New server=true argument on Snow to run up an Owin testing website.
    2. Merged assemblies

    New server argument

    When running Snow, you can now pass in an additional argument server=true which will start up a self-hosted website which will allow you to test your updates before pushing them.

    Given my blog for example, my config looks like so:

    .\Snow\_compiler\Snow.exe config=.\Snow\ debug=true server=true

    Now when I run this:


  • Unit testing Workflow Foundation Bookmarks... easily... posted on 18 Dec 2013

    I'm not a fan of Workflow Foundation, but you got to do what you got to do. Usually when using WF, unit testing an activity is rather easy. Invoke with some data, assert the out value, possibly watch some methods on some dependencies...

    But when it comes to testing Bookmarks, if the bookmark is created, and resuming it, it's not easy...

    Well that is unless you're using Microsoft.Activities.UnitTesting

    So creating some new projects, a workflow project and a class library for testing...


  • Git support in Visual Studio 2013... is actually quite cool! posted on 12 Dec 2013

    Lately I've found myself using the new Git support in Visual Studio 2013 more and more, it turns out once you get used to it, its quite handy! Initially my thoughts were its rubbish, mostly because I found it cumbersome, or maybe just that things weren't working the way I thought they were. I do fine some things strange, but it's still completely usable!

    How does it all work?

    Let's start by creating a new project:

    I ticked the Create new Git repository option in the bottom right hand corner, this just initializes the folder for you.

    Now that the project is created, we can open the Team Explorer, it should look something like this:

    I'm not entirely sure why it does this but when I create new projects, the solution file is never included by default?!?

    So the solution file is excluded, we can right click the file(s) and include them...


  • Snow gets Drafts! posted on 07 Nov 2013

    A special thanks goes out to @johanilsson for this new feature!

    Snow now ships with Drafts and Privates, this is a really cool feature since it allows you to create drafts, and a page to list all drafts (optional).

    What are the options

    There are three options for a published state:

    • draft
    • private
    • true

    Draft is basically a finished or rough cut blog post that you will publish soon, it will be compiled to /drafts URL and be publicly accessible (either via a known page or the direct URL)

    Private is a post that will not be compiled at all, this will stay as markdown, good for when you want to begin writing something but not have it show up online yet.


  • Making Nancy Modules easier to manage posted on 03 Nov 2013

    One problem I think a lot of developers have, is creating Controllers and Modules that are small and maintainable. Sometimes when you add some querying, bit of validation, pass it off to a repository or service, etc. It begins to become a little bit too big.

    Lets assume our we have an AccountModule it Gets a Login route to load the UI, and Posts to a Login route to authenticate the user, and do something.

    It also Gets a Register route to load the UI, and Posts to a Register route to register the new user.

    Without an actual implementation, something like this:

    public class AccountModule : NancyModule
        public AccountModule() : base("/account")
            Get["/login"] = _ => "login";
            Post["/login"] = _ => "login";
            Get["/register"] = _ => "register";
            Post["/register"] = _ => "register";

    To begin with, we only have 4 things to implement, its rather small, somewhat easy to manage, but what happens when we want to update an account?


  • Running JavaScript Unit Tests in Visual Studio with Jasmine & ReSharper posted on 24 Oct 2013

    • Running Basic Unit Tests in Visual Studio without a browser
    • Running Basic Unit Tests with a browser and separate projects

    There's so much information on the internet in terms of JavaScript Unit Testing and how to run tests etc, but when it comes to running tests in Visual Studio, without a browser, there's very little information. I had to piece information together to figure it out.

    So I'm going to do a small series on this.

    Things you will need!

    1. Jasmine
    2. PhantomJS

    Setup PhantomJS

    To run JavaScript tests without a browser, we need PhantomJS, and we need to wire it up into Resharper.


  • Semantic-UI & AngularJS - Basic Registration Form with Validation posted on 05 Oct 2013

    Last week I saw a tweet about Semantic-UI, which I had not heard about, I guess it's relatively new. I decided to take a look and to be honest. I love what I see.

    So to get rolling I decided to create a basic registration form for a personal project using it.

    What is Semantic UI

    Well, for starters, its a rather large library :| coming in total at a whopping 333kb for just the minified CSS an JavaScript.

    That's not including the Fonts (roughly 50kb, unless you like SVG which is 194kb, but who the hell uses that crap), Images which are about 3-10kb, though you probably only use 1 or 2 per app depending on what you're doing. These are all loading gifs, all other images are... well done using Font-Awesome. Which happens to be rolled into the library.

    But for what the library does, its pretty damn impressive.

    The idea is that Semantic is a more fluent and structured way to writing a web application, rather than naming stuff poorly like Bootstrap does with things like col-lg-4, Semantic opts for column. This is both good and bad. The examples on their homepage are more semantic, but at the cost of either writing less or more code in order to describe the UI elements in the markup.

    Reading the examples is awesome, in fact I wanted to right align a button, I started out with:

    ui blue submit button

    I thought "I want that floated right, it would look better...", and I ended up with

    ui blue submit button floated right

    You end up writing lots but instead of shifting around in CSS to figure out how to move it from left to right, I just described it. Sure enough, button sat on the right hand side!