Debugging legacy C++ in Visual Studio’s output window

Sometimes you are knees deep in legacy code and need to know what is going on. Sensibly you try to debug and step through. However, seconds later Visual Studio has started to crawl and it looks like you are stepping over at one line per minute. At this point, consider logging to console instead of continuing to debug. In many cases this can be a vanilla printf but sometimes a printf is dropped by the application and nothing is logged. [Read More]

.NET MVC routing on legacy ASP pages

When working on legacy ASP websites often you have to work with a directory full of .aspx files: about.aspx login.aspx logout.aspx shopping.aspx … With some architectures, the code behind calls into a front controller as follows: Protected Overrides Sub OnLoad(ByVal eventArgs As System.EventArgs) MyBase.OnLoad(eventArgs) Dim frontController As New LegacyFrontController frontController.LoadPage("shopping.aspx") End Sub Thanks to MVC route controllers, we can refactor such websites and reduce the amount of .aspx files. [Read More]

Single return versus multiple return

Imagine the maitre d’ at a restaurant. When a diner enters the restaurant the maitre d’ has to perform a number of checks to determine whether the diner is allowed a table. When we take this real world scenario and convert it into code, we end up writing a validation function. If the rules are: Check the diner is old enough Check the booking exists Check the booking has not expired Check there is a table available Then we can write the code as follows: [Read More]

Feature picks from C# 6

These are my feature picks from the upcoming C# 6: New nameof operator The nameof operator provides the name of the target variable. We can use it to prevent debugging messages becoming inconsistent after refactoring variable names. if (!_Validate(name)) { throw new ArgumentException(nameof name + " is not valid"); // throws "name is not valid" } Primary constructors Primary constructors allow us to initialise fields and properties without a constructor. [Read More]

Minimal Google Chrome browser extension


    "name": "Extension Name",
    "version": "0.1",
    "manifest_version": 2,
    "browser_action": { },
    "permissions": [],
    "background": { "page": "background.html" }


<script src="background.js"></script>


chrome.browserAction.onClicked.addListener(function (tab) {
    alert('Hello World!');

Cooking for Geeks - Real Science, Great Hacks, and Good Food

Cooking Learn through curious experimenting and have fun while cooking. Do not be afraid to make mistakes. Take time to taste things, both to adjust seasoning and taste changes during the cooking process. Resist the urge to stir and poke, let the food cook. Recipes Read the whole recipe before starting and understand each step. The order of ingredients in a recipe indicates the order they are added to the dish. [Read More]

Successful NLP

Principles for success Know what you want from an activity before you start and use the present tense “I can bench 140kg”. Take feedback on your progress and make changes to reach the target. State goals in the positive and have a goal beyond the goal. Consider and plan for consequences in advance, if you have to work long hours, discuss and agree this with your spouse. There is no such thing as failure, just feedback. [Read More]

Why I Never Hire Brilliant Men

Technology companies dedicate most interview time to technical questions. However that may not be the best approach for producing a successful company. In the 1924 article “Why I Never Hire Brilliant Men” the author provides an interesting rebuttal of hiring superstars at the expense of the team. He provided five criteria for the identification of good employees: Has he got good health? Has he saved some money? Does he talk and write effectively? [Read More]