Struggling for Competence


NUnit Assert.That examples
Common and not so common examples of the Assert.That syntax for NUnit 3.
Maximum Contiguous Sum
Discusses a problem from Jon Bentley's Programming Pearls, of finding the maximum contiguous sum of an input vector.
MsTest Original File Location
How to find the original location of the dll when using MsTest.
Lines of Code
Lines of code as a software metric is discussed.
Bargain Hunting
A heuristic for finding a reasonable bargain without looking too hard.
The differing assuptions about unemployment for Keynsian and New Classical Economics are discussed.
Why You're Wrong
Discusses TED video by Kathryn Schulz on being wrong.
Discussion of The Checklist Manifesto by Atul Gawande.
Mass Delete All Wordpress Comments
How to delete all existing WordPress comments.
Hot Numbers
A complaint to Ofcom about the misrepresentation of randomness.
Randomizing Output
Three essential things to take with you when you go out.
The Englishano
To avoid confusion, an Americano with milk should be called an Englishano.
Oxford - Cambridge Evidence Controversy
Leading universities in the UK disagree about the meaning of evidence.
Simple Recursion
Simple recursion is described, with examples in Scheme. The Little Schemers commandments for recursion on a list are described.
Backus Naur Form (BNF)
A brief discussion of Backus Naur Form, with examples of defining simple data structures like the binary tree.
Functions as First Class Objects
Describes the characteristics that make a function a first class object, with a simple example of a higher-order procedure in Scheme.
Prefix, Infix and Postfix
The difference between prefix, infix and postfix operator notation.
Learning Scheme
Resources for learning Scheme. Scheme is a dialect of LISP.
Hardy Littlewood Rules
The Hardy-Littlewood rules for mathematical collaboration.
The State of the Stack
I present my current understanding of how to best architect a testable web application using Asp.mvc.
Simple Logic
Two identical logic problems are presented, though the second is much easier to answer, since it is formulated in human terms.
This JavaScript
The behaviour of this in JavaScript is explained, with examples.
Javascript Objects
Shows the basic mechanics of creating objects in JavaScript.
Unit Test Logging on a Custom MsBuild Task
How to unit test a custom MsBuild task when you have logging.
Prime Numbers
A brief discussion of the main theorems about prime numbers.
Unit Test MsBuild Custom Task
Example code for calling an MsBuild project from a unit test. Can be used for testing custom MsBuild Tasks.
CSS Shorthand Properties
A brief summary of css shorthand properties.
Engine Efficiency
The equation for the maximum efficiency of an engine is presented. This explains why power stations have cooling towers.
Pimp my Visual Studio
My Pimps for Visual Studio: ReSharper, Tabs Studio, DiffMerge, Custom Menu.
Test Data Setup with Fluent Builder Pattern
Example of the fluent builder pattern, used for test data set-up.
Fluent NHibernate Unit Of Work Pattern
Example of the Unit of Work pattern, using Fluent NHibernate.
Optional Filtering in Stored Procedures
Optional filtering in a stored procedure.
First Steps with Fluent NHibernate
A super simple example of using Fluent NHibernate.
A guesstimate is an answer correct within a factor of 10. You may think such a rough answer is useless, but it's infinitely more valuable than no answer at all.
Chance of winning any prize on the national lottery
The probability of getting 0,1,2,3,4,5 or 6 numbers correct on the UK national lottery is calculated.
Browser Differences
Discusses techniques for dealing with cross browser rendering differences, including: browser reset, IE8 compatibility mode and IE conditional comments.
What's the chance of winning the national lottery?
The probability of winning the UK National Lottery is calculated. On the way the permutation and combination formulas are explained.
XHTML - What's that all about?
Examines the rules for making XHTML documents, focusing on the XHTML 1.0 Strict doctype.
CSS Simple Form
Example of a simple form layout using CSS, including a CSS button with a transparent background.
CSS Block verses Inline
This post summarises the differences between the inline and block display types in CSS.
Bayesian Probability of Success
Probability of Success Next Time= (k+1)/(n+2), where k is the number of successful events so far, and n is the total number of trials so far.
Extreme Quotes
Quotes from Extreme Programming Explained.
XP Engineering Practices
Describes extreme programming (XP) engineering practices, including a brief discussion of incremental design.
Sql Server Bits and Bats
Sql Server cheat sheet. How to do some common tasks in the query window and GUI. A few notes about connection strings.
The Dreyfus Model
Discusses Andy Hunt's Pragmatic Thinking and Learning, in particular the Dreyfus model.
How Safe is Flying?
The article compares the safety of air travel with the safety of the space shuttle.
Dependency Inversion and the Repository Pattern
The repository pattern creates an architecture which obeys the dependency inversion principal.
Castell de Montgri
Castell de Montgri is a small attractive castle in Catalonia, Spain.
The Evolving Definition of Unit Testing
To get testability - easy to write, easy to understand, fast automated tests - your architecture must allow you to replace external dependencies during test.
Unit Testing with Email
Unit testing email by faking the SmtpClient, with C# example code using System.Net.Mail.
Active Record verses Repository
Comparison of the Active Record and Repository patterns. Explanation of the inherent untestability of the Active Record pattern.
Unit Testing with the Repository Pattern
Example showing how the repository pattern lets you to unit test without hitting the database. Example implemented in C# and Linq to SQL.
Simple Repository Pattern
Simple example of Repository Pattern using C# and Linq to Sql. Repository encapsulates persistence logic in a separate class, outside the model object.
How to stop the bathroom mirror from fogging
To stop the bathroom mirror from fogging, simply smear the it with a small amount of detergent, say washing up liquid or liquid soap.
How far is the Horizon?
Formula for the distance to the horizon. Distance you can see is limited by light scattering from the air.
Sometimes it's just much harder than it should be
Test a custom MsBuild task using MsTest for UnitTesting. The MsBuild task works on the database, so the database is set-up from the test too.
Http Basics
The basics of http are explained, with request and response examples captured using fiddler.
How Many Bugs?
The Lincoln Index, E1xE2/S, could be used to estimate the number of bugs in a software system.
Kent Beck's Four Hats
The trick to controlling the size of you checkout is to only wear one of Kent Beck's four hats.
CSS Enlightenment
Descendent selectors are the key to good CSS design. They let you select the element you want, without explicitly adding a class to it.
CSS Selectors
The key to CSS is understanding how selectors work. A summary of CSS 2.1 selectors, with examples, is presented.
First Steps with JavaScript and jQuery
Getting started with JavaScript and jQuery. Simple example code to calculate time to double your money for a given interest rate.
C# Events
An event lets a publisher notify subscribers when something happens. The article examines event rules and convention, and presents a C# example.
C# IEnumerable and Yield
Example of IEnumerable and yield in C#. How to make a collection class enumerable so that it can be iterated over.
Code Kata - Atari
This Code Kata is to calculate whether a Go stone is Atari. It was set by Keith Braithwaite at Software Craftsmanship 2009 in his session TDD As If You Meant It.
Pick's Theorem
Pick's theorem is a remarkable formula for calculating the area of a polygon drawn on a grid. A = P/2 + I - 1.
ASP.NET Session State
Example of setting up ASP.NET session state in SQLServer mode, using web.config.
C# Custom Attributes
Example of C# custom attributes, using reflection to retrieve the attributes.
Create Table and Alter Table
Examples of Create Table and Alter Table in SQL Server.
Source Control, Build, Test
I believe that the three fundamental practices of Software Engineering are: source control, build and test.
Struggling for Competence
I find software development a struggle. Ignorance, inadequate testing and suboptimal design are the problems. My aim is to achieve competence.

Little Projects

Resharper Shortcuts
Selected Resharper and Visual Studio Keyboad Shortcuts (IntelliJ Keybindings).
Learn to touchtype
Online tool for learning to touch type.
Pomodoro Timer
Online timer for the Pomodoro technique.


Hosting by Github
Css Reset by sanitize.css
Syntax Highlighting by Prism
Maths by Katex
Mass edits by Html Agility Pack


Except where otherwise noted, the material on this site is licensed under the Creative Commons Attribution 4.0 International License.