Blog LogoBlog Logo

Blog

Browse by tag

Everyone has a test environment

...Some people are lucky enough to have a totally separate environment to run production in.

— 22 Aug 2026

Fixing out of sequence timestamps

I maintain a small open source project that helps test log message . Part of this is that each log message has a sequence number and timestamp attached to it....

— 25 Feb 2025

Speed up Visual Studio by turning off the Source Control Plug-in

I don't use the built in source control plug in Visual Studio as I use GitKraken instead, so Visual Studio's plug-in just sat in the background not doing much...

— 19 Apr 2023

Why is my app not responding? Oh... I've hit a breakpoint!

Have you ever run your app from Visual Studio to have it suddenly stop responding and you can't immediately see why, only to discover that you've hit a...

— 19 Nov 2022

We don't have the budget for that

Over 20 years ago, I was asked by the company I worked for to fly out and help a client with an issue. It seems that they had trouble printing in certain...

— 10 Feb 2022

How to Undelete a Branch in Git

About a month ago I deleted a branch that I thought I wasn't going to need. The ticket had been parked, then put back in the backlog and there were lots of...

— 10 Dec 2021

Why is there a difference between decimal 0 and 0.0?

const decimal ZeroA = 0M; const decimal ZeroB = 0.0M; They're the same thing, right? Well, almost. The equality operator says they're the same thing. bool...

— 03 Jul 2021

ReSharper test runner still going after tests complete

I've been writing some tests and I got this message: [RIDER LOGO] Unit Test Runner The process ReSharperTestRunner64:26252 has finished running tests assigned...

— 10 Oct 2020

How to: Tell if a PowerShell script is running as the Administrator

$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) if (-not...

— 10 Aug 2019

Ensure Controller actions/classes have authorisation

A couple of years ago I wrote a unit test to ensure that all our controller actions (or Controller classes) had appropriate authorisation set up. This ensures...

— 17 Aug 2018

Creating a Throttle with an ActionBlock - Addendum (Cancelling)

In my previous post I described how to create a throttle with an action block so you wouldn't have too many tasks running simultaneously. But what if you want...

— 17 Jul 2018

Creating a Throttle with ActionBlock

We have an application that needs to perform a repetitive task on many external services and record then aggregate the results. As the system has grown the...

— 16 Jul 2018

Comparing logically adjacent rows in a database table

If you have database table that stores something such as when an action occurred, it might be useful to work out how far apart these events are. It is easy to...

— 13 Jul 2018

Paramore Brighter: The Russian Doll Model

I've mentioned a bit about the attributing the handler and the step and timing parameters, but I've not explained them properly in previous posts (" Retrying...

— 31 Mar 2018

Paramore Brighter: DRY with Custom Decorated Command Handlers

You may wish to add similar functionality to many (or all) command handlers. The typical example is logging. You can decorate a command handler in a similar...

— 18 Mar 2018

Paramore Brighter with Quality of Service: Retrying Commands

Paramore Brighter supports Policies to maintain quality of service. This is useful when your command makes calls to external services, whether they are...

— 02 Mar 2018

Setting file permissions on a remote machine with PowerShell

Recently I needed to set some file permissions on a remote machine. Previously I'd done this relatively easily through a share as the user account I was using...

— 28 Feb 2018

IIS Administration file access

If you are using the IIS Administration ReST API to manage IIS, one thing that is not immediately obvious is that if you put your websites outside of...

— 23 Feb 2018

Taking ownership of a file

I'm currently looking at using IIS Administration as a way to automate some deployment tasks. However, the way it got installed, it's appsettings.json file...

— 20 Feb 2018

Paramore Brighter: Implementing a fallback exception handler

So far in this series, we have a basic command processor set up and able to dispose of resources . But what happens when things go wrong? The command processor...

— 16 Feb 2018

Paramore Brighter: Ensuring Dependencies are Disposed.

In my previous post , I showed how to set up Paramore Brighter with the built in Dependency Injection provided with .NET Core 2. However, it wasn't the full...

— 05 Feb 2018

Paramore Brighter: Using .NET Core's Dependency Injection

This is the first in a series of posts on Paramore.Brighter . I'm writing this as a series of recipes, with the aim of you picking up a point quickly and...

— 02 Feb 2018

Imposter Syndrome

This is a quick write-up of my near-impromtu grok talk on Imposter Syndrome I did at DDD East Anglia. Impostor syndrome (also known as impostor phenomenon or...

— 16 Sep 2017

Join Null Check with Assignment

I recently wrote some code and asked ReSharper to add a null check for me, which it did. Then it suggested that I could simplify the null check by joining it...

— 16 Jul 2017

Aggregate of columns, not rows

In SQL Server it is very easy to aggregate a value across many rows. You simply just write something like this: SELECT MAX(SomeColumn) FROM SomeTable This will...

— 11 Jul 2017

Round Robin class

We recently had need of a round robin functionality and since there is no round robin class built into .NET I needed to build my own class. It is a fairly...

— 24 Sep 2016

But why is the iterator operating in multiple-threads

Background Recently, I had a bit of a problem with NHibernate when I was converting some code into parallel tasks. (If you have no interest in NHibernate, then...

— 12 Sep 2016

Overusing the Null-Conditional Operator

The null-conditional operator is the ?. between object and field/property/method. It simply says that if the thing on the left hand side is null then the thing...

— 10 Sep 2016

Application Configuration in .NET Core - Part 2

In the first part we got started by pulling in configuration data from multiple source in .NET Core, in this part we'll look at mapping the configuration onto...

— 09 Sep 2016

Application configuration in .NET Core - Part 1

.NET Core has a new way of working with configuration that is much more flexible than the way that previous versions of .NET have. It allows you to: Pull...

— 03 Jul 2016

Setting up Ubuntu for .NET Development

First up, at the time of writing only Ubuntu 14.04LTS is supported. I've read that it will work on 15.04, but I know it won't work on 15.10 because of a binary...

— 06 Apr 2016

Tip of the Day: Calculating durations with Moment

Moment has quite a nice fluent interface for some operations, others just need a little more thought. For example, I wanted the duration of something and I had...

— 27 Feb 2016

Estimates are not deadlines

This is another one of those cautionary tales of what not to do. A number of years ago I worked for a digital agency. For most of my time there I worked on...

— 05 Feb 2016

Debugging a process that cannot be invoked through Visual Studio.

Sometimes it is rather difficult to debug through Visual Studio directly even although the project is right there in front of you. In my case I have an...

— 31 Aug 2015

How not to interview a candidate

I recently started a new job. I interviewed for a few companies and got a few offers on the table. However, one interview stuck out for me because, well, let...

— 13 Jul 2015

Tip of the day: Default project location in Visual Studio

When rebuilding a machine I always end up hunting this setting down just after installing Visual Studio because I keep forgetting where it is. I never put my...

— 13 Jul 2015

Custom routing to support multi-tenancy applications

The company I currently work for has many brands so they are looking for a website that can be restyled for each brand. They also want the styling information...

— 10 Jul 2015

Changing the default Assembly/Namespace on an MVC appliction

TL;DR When getting an error message like this: Compiler Error Message: CS0246: The type or namespace name 'UI' could not be found (are you missing a using...

— 08 Jul 2015

The difference between & and && operators

Here is a bit of code that was failing: if (product!=null & !string.IsNullOrEmpty(product.ProductNotes)) If you look closely you can see it uses just the...

— 11 Jun 2015

Let's hack it now and fix it later

“Let's hack it now and fix it later”. I've heard that before! 3 years later looking at some old source code, “WTF was I thinking?!” Then I remember. The...

— 10 Jun 2015

Setting up Code Coverage in Team City

The project that I'm working on has a rather spotted history for unit tests until now. There would be periods of people actually writing them, but then come...

— 16 May 2015

Code Review: Making a drop down list out of an enum

I’ve come across code like this a couple of times and it is rather odd: IEnumerable<CalendarViewEnum> _calendarViewEnums =...

— 20 Apr 2015

Code Review: FirstOrDefault()

I regularly review the code that I maintain. Recently, I've come across code like this fairly often: someCollection.FirstOrDefault().Id I cannot rightly...

— 09 Apr 2015

Previewing Config Transforms

Curiously, I didn't know about this until recently and it is such a useful thing too. You can preview the results of your configuration transformation from...

— 27 Mar 2015

Deploying a Node.js with Express application on Azure

By the end of the last post , there was enough of an application to deploy it, so let’s deploy it. Prerequisites An FTP client to get at the files on Azure. A...

— 23 Nov 2014

Node.js with Express – Come to the dark side. We have cookies!

So far, so good. At the point the application displays a list of languages and will display the language that the user picked. However, for the flashcards to...

— 18 Nov 2014

Node.js with Express - Getting form data

Now that view engines are wired up and working on this application, the next area to look at is getting data back from the browser. By default Express doesn’t...

— 17 Nov 2014

Express for node.js – View Engines

In the last post, Express Hello World , I talked about getting started with an Express application in Node.js. In it, the output was rendered by writing HTML...

— 16 Nov 2014

Express for node.js walk through – Hello World

While both Visual Studio and WebStorm have templates for node.js Express applications in this post (and and subsequent few posts) I’m going to walk through...

— 15 Nov 2014

Node Package Manager – npm

The Node Package Manager is a bit like NuGet for node. It is a way to get additional functionality into node for frameworks that were not bundled with node...

— 15 Nov 2014

Working with Modules in node.js

In my last post on node.js I showed how to set up a development environment to work with node. Now, I’m going to introduce some bits and pieces to get going a...

— 13 Nov 2014

Node.js – Setting up a basic development environment

Node.js is a platform for executing JavaScript outside of the browser. It runs on the Google V8 engine which effectively means it is cross platform as it can...

— 14 Oct 2014

A better tracing routine

In .NET 4.5 three new attributes were introduced. They can be used to pass into a method the details of the caller and this can be used to create better trace...

— 20 May 2014

Using Contracts to discover Liskov Substitution Principle Violations in C#

In his book Agile Principles, Patterns, and Practices in C# , Bob Martin talks about using pre- and post-conditions in Eiffel to detect Liskov Substitution...

— 20 Apr 2014

Tip of the day: Quickly finding commented out code in C-like languages

This is a quick rough-and-ready way of finding commented out code in languages like C#, C++, javaScript and Java. It won't find all instances, but it will...

— 17 Oct 2013

DROP/CREATE vs ALTER on SQL Server Stored Procedures

We have a number of migration scripts that modify the database as our applications progress. As a result we have occasion to alter stored procedures, but...

— 15 Oct 2013

Tip of the day: Forcing a file in to your Git repository

Normally, you'll have a .gitignore file that defines what should not go into a git repository. If you find that there is a file or two that is ignored that you...

— 29 Aug 2013

Recruitment Agents take note

A few times a week I get emails from recruitment agencies, they are are pretty much all along the same lines. The email seems to be a standard template that...

— 10 Aug 2013

Injecting a Dependency into an IHttpModule with Unity

We’re starting a new project, and as part of that we want to get better at certain things. One is unit testing the things we didn’t last time around that were...

— 06 Aug 2013

Tip of the day: How to tell why your app couldn’t log on to SQL Server

When you get a log in failure on SQL Server the message you get back from SQL Server Management Studio, or in a .NET Exception is vague for security. They...

— 26 Jul 2013

Linking Perforce Merge to Git

Git's built in Merge conflict resolution is awful. Although all the information is there it is difficult to use for all but the simplest of conflicts. Luckily,...

— 23 Jul 2013

Getting Tortoise Git to work with GitHub repositories

In this post I’ll walk you through installing Tortoise Git in a way that allows it to interact easily with GitHub repositories. Download msysgit First off...

— 21 Jul 2013

Tip of the day: Going quickly to an item in the Entity Model Diagram

After a conversation recently about how difficult it was to find stuff in the EDMX diagram because it can often be a right pigs breakfast, I stumbled across...

— 03 Apr 2013

Quick guide to Geolocation in Javascript

In some modern browsers, such as Chrome and Firefox you can access the geolocation of the device. That is, where the device is physically located. The main...

— 06 Jan 2013

Getting Entity Framework to Pick up on the Auto-generated Part of the Composite Primary Key

In my previous post, I wrote about how to get SQL Server to automatically generate a composite primary key for a table when part of that key is also a foreign...

— 30 Dec 2012

Composite Primary Keys Including Identity Like Column

I’ve been thinking of a way to organise some data for a multi-tenanted system. As such the database that would be used would have to mark pretty much every...

— 29 Dec 2012

IDisposable objects with StructureMap and ASP.NET MVC 4

I’ve recently discovered a bit of an issue with running an IoC container with ASP.NET MVC’s IDependencyResolver . If you have a controller that has...

— 21 Dec 2012

Git cheat sheet

Here is my little cheat sheet for working with git at the command line. Check the status of the current repository: git status This will return details of...

— 11 Sep 2012

Tip of the day: When other things populate elements on web pages

I work in a web team of 6 developers and we have a diverse range of skills. Some are more skilled dealing with the front end, the UI, and working with HTML,...

— 28 Aug 2012

Getting umbraco up and running in with MVC 4

In this post, I'll look at getting Umbraco and MVC to play nice with each other in the same project. Installing Umbraco 4.8 First off create a Web Application...

— 10 Aug 2012

Optimising clustered indexes in SQL Server 2008

I've just found a script on another blog to go through all the clustered indexes in a SQL Server database and rebuild them in order to reduce fragmentation and...

— 06 Aug 2012

HTML5 text boxs for numbers and email addresses

In HTML5 there are a few new types of text box available that can help with mobile development. For example, on mobile devices it can be useful to have the...

— 02 Aug 2012

Creating a data dictionary with SQL Server and MediaWiki – Part three: inbound references

In my previous posts (parts one and two ), I showed how to generate mediawiki markup to generate lists of tables and columns that can be used as the starting...

— 16 Jun 2012

Creating a data dictionary with SQL Server and MediaWiki - Part two: a list of columns

In my previous post , I showed how to create a SQL Script that generates Mediawiki mark-up to create a list of tables (or views) in your database. In this...

— 15 Jun 2012

Creating a data dictionary with SQL Server and MediaWiki - Part one: a list of tables

Background We've just installed MediaWiki as a documentation tool where I work. To get things up and running as quickly as possible, I created a few SQL...

— 14 Jun 2012

LINQ: FirstOrDefault without the null check afterwards.

So, I was considering a problem I had that called for a LINQ statement that contains a FirstOrDefault() call. If there was an object returned I wanted a string...

— 28 May 2012

Tip-of-the-day: Columns in CSS

The CSS Multi-column layout module is a Candidate Recommendation that allows CSS to specify various aspects of column layout for page flow. It has some...

— 17 Jan 2012

Checking for NULL using Entity Framework

Here is a curious gotcha using the Entity Framework: If you are filtering on a value that may be null then you may not be getting back the results you expect....

— 22 Nov 2011

Handling bounces on Amazon SES

If you send to an email that does not exist, Amazon SES will perform some handling of the bounce before passing the details on to you. When you send email...

— 18 Nov 2011

Verifying Senders with Amazon SES

I’ve already written a couple of pieces about Amazon Simple Email Service (SES) on sending Email and sending emails with attachments . Why do you have to...

— 13 Nov 2011

Sending more than a basic email with Amazon SES

Previously, I wrote about getting started with Amazon’s Simple Email Service , and I included details of how to send a basic email. The SendEmail method is...

— 10 Nov 2011

Getting started with Amazon SES in .NET

Amazon SES (Simple Email Service) is a cloud based email service for sending bulk or transactional emails. It has a web based API and Amazon also provide a...

— 09 Nov 2011

First(OrDefault) Vs. Single(OrDefault)

There are two mechanisms (each with an …OrDefault variant) in LINQ for getting one item out of an enumeration. They are First and Single . There is a...

— 07 Oct 2011

Singular Vs Plural table names

A while ago I blogged about whether to make table names singular or plural . The subject raised itself again recently in the office after Microsoft's Entity...

— 23 Sep 2011

Tip of the day: Expire a cookie, don’t remove it

I recently found a bug in my code that I couldn’t fathom initially until I walked through the HTTP headers in firebug. In short, you cannot simply remove a...

— 20 Sep 2011

Getting just the columns you want from Entity Framework

I’ve been looking at trying to optimise the data access in the project I’m working on, and the major stuff (like getting a piece of code that generated 6000...

— 31 Jul 2011

Entity Framework query that never brings back data

I was recently optimising some data access code using the Entity Framework (EF) and I saw in the SQL Server Profiler this following emanating from the...

— 30 Jul 2011

Tip of the day: Using the null-coalescing operator over the conditional operator

I’ve recently been refactoring a lot of code that used the conditional operator and looked something like this: int someValue =...

— 25 Jul 2011

Entity Framework: Unable to load the specified metadata resource.

Recently, I was refactoring some code and I moved the location of the .edmx file into a different folder (and new namespace). I updated the code to use the new...

— 23 Jul 2011

Why should you be returning an IEnumerable

I've seen in many places where a method returns a List<T> (or IList<T> ) when it appears that it may not actually really be required, or even desirable when...

— 19 Jul 2011

Tip of the day: IE Quirks Mode Vs. Standards Mode

If you are setting the DOCTYPE declaration in an HTML page to define the standard your page complies with ensure that you don't put anything before that...

— 24 Jun 2011

Parallelisation Talk examples - Cancelling Tasks

This example showed what happens when tasks are cancelled. In this example, some tasks will be able to run to completion, others will be cancelled and other...

— 11 Jun 2011

Tip of the day: Splitting a string when encountering whitespace

In .NET the string class has a Split method that splits the string at the separator character(s) that you specify. However, if you want to split the string at...

— 08 Jun 2011

Parallel Loop Anti-pattern

Here’s a quick parallel loop anti-pattern. In other words, don’t do this, it will only make you miserable. If you want to start tasks in a loop watch out for...

— 06 Jun 2011

Task status state changes

Over the course of the last couple of months I’ve blogged a lot about the Task Parallel Library and mentioned a number of statuses that a task can have, but...

— 03 Jun 2011

Cancelling parallel tasks

UPDATE (7-June-2011): The post as it originally appeared had a bug in the code, the catch block in the task caught the wrong exception type. See the Gotcha...

— 02 Jun 2011

Building messages in parallel

I recently saw some code where the developer was attempting to build up messages inside tasks that were being reported outside of the task. In a sequential...

— 25 May 2011

Parallel Tasks and the HttpContext

A few days ago I spotted a question on StackOverflow by someone trying to use a parallel loop in an ASP.NET application. It may have been an ASP.NET MVC...

— 24 May 2011

Handling AggregateExceptions

I’ve written a couple of posts ( see also ) about how the AggregateException plays its part in exception handling in parallel systems. However, it has another...

— 17 May 2011

Tasks that throw exceptions

I’ve blogged before about the AggregateException in .NET 4, but I missed out something that may be important. If you are using Parallel.Invoke or Parallel.For...

— 16 May 2011

ASP.NET MVC – Pretty URLs

As the little Harris Benedict Calculator application stands , the only way to get some sort of answer out of it is to fill in the form. What if you wanted to...

— 15 May 2011

ASP.NET MVC 3 – Introduction to validation

In my previous post on MVC 3 I started a project to calculate a calorific intake required to maintain a stable weight. In this post I’ll extent that to add...

— 14 May 2011

ASP.NET MVC – Server Side Validation

So far, we’ve built up a basic application and got some client side validation working. However, client side validation only goes so far. While it can prevent...

— 14 May 2011

Starting an ASP.NET MVC 3 application

In this post, I’m going to show the basics of starting an application with ASP.NET MVC 3. The demo application will be a simple calorie counter that takes in a...

— 13 May 2011

Feedback from my DDD Scotland Talk on Parallisation

I got my feedback from my DDD Scotland 2011 talk on Parallelisation . I was actually pleasantly surprised. I guess I was being a little too self critical and...

— 10 May 2011

Background tasks and application exit

During my talk on Parallelisation at DDD Scotland 2011 I was asked what happens if the application finishes while there were still tasks running. At the time,...

— 08 May 2011

Custom error pages and error handling in ASP.NET MVC 3

In ASP.NET MVC 3 a new bit of code appeared in the global.asax.cs file: public static void RegisterGlobalFilters(GlobalFilterCollection filters) {...

— 02 May 2011

Tip of the day: Obtaining all subdirectories recursively

This is an example of how to obtain a list of all subdirectories using a recursive method with the .NET Framework. public static List<DirectoryInfo>...

— 22 Apr 2011

Parallelisation Talk Example - Aggregate Exceptions

The two code examples here show what happens when exceptions are thrown within tasks that are not handled within the task. In each case the task that has the...

— 21 Apr 2011

Parallelisation Talk Example – ConcurrentBag

This example shows a ConcurrentBag being populated and it being accessed while another task is still populating the bag. The ConcurrentBag class can be found...

— 21 Apr 2011

Parallelisation talk example – Independent Object Graphs

Parallelised code works best when data is not shared. This example shows a simple piece of parallel code where each task operates independently on its own...

— 21 Apr 2011

Parallelisation Talk Example – Parallel.Invoke

Parallel.Invoke is the most basic way to start many tasks as the same time. The method takes as many Action<…> based delegates as needed. The Task Parallel...

— 21 Apr 2011

Parallelisation Talk Examples – Basic PLINQ

These are some code examples from my introductory talk on Parallelisation showing the difference between a standard sequential LINQ query and its parallel...

— 21 Apr 2011

Parallelisation Talk Examples – ConcurrentDictionary

The example used in the talk was one I had already blogged about. The original blog entry the example was based upon is here: Parallelisation in .NET 4.0 – The...

— 21 Apr 2011

Parallelisation Talk examples - Parallel.For

This is some example code from my introductory talk on Parallelisation. Showing the difference between a standard sequential for loop and its parallel...

— 21 Apr 2011

Parallelisation Talk Examples – Parallel.ForEach

These are some code examples from my introductory talk on Parallelisation. Showing the difference between a standard sequential foreach loop and its parallel...

— 21 Apr 2011

Prallelisation Talk Example – Tasks within Tasks

In this example I’m showing the launching of further tasks within an existing task. The Main method launches a single task (of course, it would likely be many...

— 21 Apr 2011

Building a tag cloud with LINQ

I have a set of blog posts that I’m representing as a List of BlogPost objects. A BlogPost is class I created that represents everything to do with a blog...

— 02 Apr 2011

Tasks that create more work

I’m creating a program that parses a web page then follows the links and then parses the next set of web pages to eventually build a picture of an entire site....

— 01 Apr 2011

Using semaphores to restrict access to resources

I’m in the process of building a small data extraction application. It uses the new Parallel Extensions in .NET 4 in order to more efficiently extract data...

— 30 Mar 2011

Parallelisation in .NET 4.0 - The concurrent dictionary

One thing that I was always conscious of when developing concurrent code was that shared state is very difficult to deal with. It still is difficult to deal...

— 24 Mar 2011

A quick intro to the HTML Agility Pack

I want a way to extract all the post data out of my blog. To do that I’m building a little application to do that, mostly as an exercise to try out some new...

— 22 Mar 2011

Table names - Singular or Plural

Earlier this morning I tweeted asking for a quick idea of whether to go with singular table names or plural table names. i.e. the difference between having a...

— 02 Mar 2011

Parallelisation in .NET 4.0 - Part 2 Throwing Exceptions

With more threads running simultaneously in an application there is increasing complexity when it comes to debugging. When exceptions are thrown you usually...

— 14 Feb 2011

Parallelisation in .NET 4.0 - Part 1 looping

In an upcoming project we have a need for using some parallelisation features. There are two aspects to this, one is that we have to make multiple calls out to...

— 08 Feb 2011

Dealing with data rounding issues

If you have data coming in from a database, web service or other source external to your application and it contains, say for example, price information then...

— 01 Sep 2010

Dime/Daim Bar Cake

This is not so much a cake as a shortbread base with a sweet dairy topping. It serves many people and ideal as a party food. This recipe produces 20 servings....

— 30 Aug 2010

DDD Scotland: The feedback

I’ll be standing down as chairman of Scottish Developers shortly. I’m not leaving, I’m just looking for a different role within the user group. But as I’m...

— 20 May 2010

Type Inference

Type Inference is a neat feature where the C# compiler can work out itself what type a reference to an object is. While this can be used for the developer to...

— 19 Mar 2010

Lambda cheat sheet

A while ago I wrote about all the new language features of C# 3.0 and it occurred to me that I'd left out a chunk about Lambdas. With LINQ being such an...

— 17 Mar 2010

Updated chart of .NET version numbers

Way back when, I published a table detailing the version numbers of the various parts that make up a .NET application: The Tools, the C# language, the...

— 17 Mar 2010

Tip of the Day: Duplicate input fields

Don't allow duplicate input fields into your form. The other day I was trying to debug a bug in an application that I maintain. The code created a set of...

— 06 Feb 2010

NMA - Top interactive agencies

This years New Media Age top interactive agencies list is out. I’m quite please to see that I work for a company that is doing very well in the list.

— 10 Oct 2009

If you really must do dynamic SQL...

I may have mentioned in previous posts and articles about SQL Injection Attacks that dynamic SQL (building SQL commands by concatenating strings together) is a...

— 21 Sep 2009

Tip of the Day: NaN (Not a Number)

The Issue If you want to detect if a double (System.Double) or float (System.Single) is 'not a number' or NaN you cannot use something like this: if (myDouble...

— 12 Sep 2009

Tip of the day - String Equality

When comparing two strings in a case insensitive manner, use: myFirstString.Equals(mySecondString, StringComparison.InvariantCultureIgnoreCase) or, if cultural...

— 12 Jul 2009

Granny's Shortbread

By request from Betsy Weber, I’m revealing my granny’s shortbread recipe (with permission). Ingredients 200g plain flour 100g Butter 50g Castor Sugar (called...

— 07 Jun 2009

Method hiding or overriding - or the difference between new and virtual

When developing applications it is very important to understand the difference between method hiding and method overriding. By default C# methods are...

— 10 Oct 2008

Microsoft Surface

Last weekend I was in Reading for the UK and Ireland MVP Open Day. And one of the highlights of the day was being invited to the Microsoft Technology Center at...

— 10 Oct 2008

The try-catch-return-false-throw-catch-return-false-throw-fail anti-pattern

I recently came across a wonderful anti-pattern. Well, anti-patterns are not wonderful, but the mind just boggles at the sheer bloody lunacy of this particular...

— 29 Aug 2008

Mixins in .NET (again)

A while ago I wrote about Mixins in C# 3.0 , at the time I was saying that you can get some of the functionality, but not all, from some of the new language...

— 10 Aug 2008

Crazy Extension Methods Redux (with Oxygene)

Back in April I blogged about a crazy thing you can do with extension methods in C#3.0 . At the time I was adamant that it was a bad idea. I still think it is...

— 07 Aug 2008

Tip of the Day - String Performance

Concatenating strings in .NET can be very easy. There is the overloaded + operator that makes stringA + stringB + stringC statements very easy to write. But,...

— 04 Aug 2008

How I got started in Software Development?

There is a meme going around at the moment and I thought I'd join in even although I've not been specifically tagged by it, it looks good fun. I spotted it on...

— 26 Jul 2008

Tip of the Day #5 (SQL Server memory usage)

You can limit the amount of memory that SQL Server uses by using the sp_configure stored procedure. By limiting the amount of memory that SQL Server is...

— 20 Jul 2008

Monitoring change in XML data (LINQ to XML series - Part 5)

This is the 5th part in a series on LINQ to XML. In this instalment we will look at monitoring changes in XML data in the XML classes added to .NET 3.5. The...

— 19 Jul 2008

Tip of the Day #4 (Connection Strings in Config files)

From .NET 2.0 onwards a new and improved configuration management system has been put in place. You can now add a <connectionString> element to the config file...

— 19 Jul 2008

Event Organisation - The Feedback

This is the first post in a series of random thoughts on community events that I'm writing based on my experience running a user group and the Developer Day...

— 23 Jun 2008

Navigating XML (LINQ to XML series - part 4)

In my last few posts on LINQ to XML ( part 1 , part 2 and part 3 ) I've shown you a starter on navigating around XML data. In this post I'll continue to show...

— 22 Jun 2008

Feedback on Developer Day Scotland

I was recently one of the organisers for Developer Day Scotland (aka DDD Scotland) in Glasgow. It was on on the 10th of May and was the first of its kind in...

— 20 May 2008

Navigating XML (LINQ to XML series - Part 3)

In my last two posts I've been introducing you to the the new XML classes in .NET 3.5. In this post I'll continue that and show you some...

— 18 May 2008

Developer Day Scotland - The scores on the doors

Developer Day Scotland was last weekend and went very well. I've just finished collating all the speaker feedback and I've sent each speaker their feedback...

— 12 May 2008

Crazy Extension Method

Here is an example of a crazy extension method that alters the semantics of method calling. First the extension method: public static class MyExtensions {...

— 16 Apr 2008

Fizz-Buzz in LINQ

This just occurred to me. It is somewhat pointless, but I thought it was interesting: static void Main( string [] args) { var result = from say in Enumerable...

— 16 Apr 2008

Getting values out of XML in .NET 3.5 (LINQ to XML series part 2)

In my last post I gave a brief introduction to some of the new XML classes available in .NET 3.5. In this post I'll continue that introduction by explaining...

— 12 Apr 2008

Introduction to LINQ to XML

Last year I wrote about the new languages features available in C# 3.0 ( Anonymous Types , Extension Methods , Automatic Properties , A start on LINQ , Object...

— 08 Apr 2008

Mixins in C# 3.0

This is something I've been mulling around in my head for a few days now. "Out of the box" C# 3.0 does not support mixins, but I think you can get some of the...

— 24 Feb 2008

Different ways to add point data in SQL Server 2008

The spatial data can be added to a table by specifying the column type of geometry or geography. The exact detail of what is in the column can be varied as a...

— 07 Feb 2008

Spatial References in SQL Server 2008

In SQL Server 2008, each piece of spatial data must be tagged with an SRID (Spatial Reference Identifier). Geometry types can have a SRID of 0 (which means...

— 05 Feb 2008

Creating Many-to-Many joins

A topic that comes up from time to time in forums is how to join two tables together when there is a many-to-many relationship. Typical examples include...

— 21 Jan 2008

DDD6 Feedback

Well, I've received the feedback from my session at DDD6 and here it is: Overall: 3.73 Knowledge: 4.13 Presentation: 3.93 Content: 3.4 By the looks of it, the...

— 10 Jan 2008

The value of smaller methods

A while ago on a forum I advised someone that their method was too long and difficult to read and maintain. I suggested that they break the code into smaller...

— 30 Dec 2007

Spatial Operations in SQL Server 2008 (Katmai) - Union and Convex Hull

CODE EXAMPLES IN THIS POST WORK WITH THE NOVEMBER 2007 CTP (CTP 5) OF SQL SERVER 2008. Say you would like to create a polygon out of a group of points. One way...

— 15 Dec 2007

Contradictory messages

While attempting to create a database project in Visual Studio 2008 against a SQL Server 2008 database I got a rather odd error message. The dialog used to...

— 08 Dec 2007

Inserting geometry through a .NET Application

THIS POST REFERS TO THE NOVEMBER 2007 CTP (CTP 5) OF SQL SERVER 2008 Following from my previous posts ( Getting started with Spatial Data in SQL Server 2008 ,...

— 06 Dec 2007

Parsing OS Grid References

If you have ever been to an agile coding session you may have come across the concept of the coding kata . It is an exercise designed to improve coding skill...

— 04 Dec 2007

Spatial Data in a .NET application

THIS POST REFERS TO THE NOVEMBER 2007 CTP (CTP 5) OF SQL SERVER 2008 Following from my last post about Getting Started with Spatial Data in SQL Server 2008 in...

— 02 Dec 2007

Getting started with Spatial Data in SQL Server 2008

THIS POST REFERS TO THE NOVEMBER 2007 CTP (CTP 5) OF SQL SERVER 2008 This post is probably going to be a wee bit random. After the running around over the last...

— 01 Dec 2007

DALs and the DAAB

I've been pondering something that was raised in passing earlier this week and that is the relationship between a DAL (Data Abstraction Layer) and the DAAB (...

— 03 Nov 2007

MVP Open Day

That was a great couple of days. Lots of good information was exchanged. Lots of interesting people were met. What was most interesting was that the audience,...

— 28 Oct 2007

What is a DAL (Part 4)

As has been mentioned previously, one of the purposes of the DAL is to shield that application from the database. That said, what happens if a DAL throws an...

— 15 Oct 2007

What is a DAL (Part 3)

In this continuation of my series on the DAL I'm going to show the ability to create several DALs and have a Factory class instantiate the correct DAL based on...

— 14 Oct 2007

A fantastic cartoon on SQL Injection Attacks

Just in time for the SQL Injection Attack micro presentation that I'm doing. From: xkcd.org Technorati Tags: SQL Injection Attack , cartoon , xkcd

— 11 Oct 2007

Life Imitating Art

It looks like life imitates art. A few weeks ago the following comic was published on xkcd: And then shortly afterwards the following appeared on eBay:...

— 11 Oct 2007

What is a DAL? (Part 2)

In my last post about the DAL I presented a very basic DAL based on a static class. This is fine for small applications, but for larger applications the...

— 05 Sep 2007

Pedes vallis viridis (The Glasgow Pedestrian)

The Glasgow pedestrian (pedes vallis viridis) is a very odd beast. Its actions go against Darwinian evolution. Its behaviour so at odds with its environment...

— 31 Aug 2007

What is a DAL?

I occasionally see posts on forums asking for help with some database problem. Then I see they've been using the the wizards in Visual Studio (which is okay...

— 28 Aug 2007

Chocolate Crunch Cake

One of my favourite sweet foods: Chocolate Crunch Cake I used to make this as a child and I only just rediscovered the recipe Basic Ingredients: 400ml sweetend...

— 04 Aug 2007

Code Reviews

I’ve been meaning to blog about code reviews for a while, but I’ve never seemed to sit down and organise my thoughts on the matter. Well, I’ve got some time...

— 31 Jul 2007

Photos of my talk

John Thomson was kind enough to send me a couple of photos from my presentation on An Introduction to Unit Testing with Mock Objects . I'm told that the head...

— 02 Jul 2007

Lean Software Development: An Agile Toolkit

Lean Software Development: An Agile Toolkit by Mary Poppendieck and Tom Poppendieck with Forewords by Jim Highsmith and Ken Schwaber A review of sorts The book...

— 24 Jun 2007

Please please please learn about SQL Injection Attacks

Here are two more great blog entries about preventing SQL Injection Attacks First, Bertrand Le Roy gives some excellent advice about how to spot potential...

— 24 Jun 2007

What could I do? What could I read? Who could I ask?

Earlier today I was listening to an audio book by Jim Rohn. He is a business author but he has one bit of advice that I find is extremely useful in software...

— 24 Jun 2007

What's on your bookshelf?

A few moments ago I got reminded of a book that I read many years ago. Looking at my bookshelves there are various software development books, some new, some...

— 24 Jun 2007

Creating an informative workspace

Earlier this evening Agile Scotland ran a presentation by Rachel Davies called Creating an Informative Workspace which I found really interesting. The basic...

— 23 Jun 2007

eXtreme Programming in .NET

This is a summary of a presentation by Dr. Neil Roodyn for the Scottish Developers that took place in Microsoft's offices in Edinburgh on the 21 st of July,...

— 23 Jun 2007

Normalising the data model

Sometimes I see on forums someone who is trying to get some SQL statement to wield data in a particular way but the data model is just thwarting their...

— 23 Jun 2007

SQL Exception because of a timeout

You think it would be easy to find information on exactly what error number a SqlException has when the command timed out. But, it isn't. MSDN , for all that...

— 23 Jun 2007

The new Model View Controller

I've always had an inkling that there was something not quite right about Model-View-Controller pattern. Something didn't sit right with me that (1) the View...

— 23 Jun 2007

The Normal Forms of Database Normalization

I'm doing a clear out at the moment as I'm getting the house ready to sell - I'm planning to move to West Lothian - and I came across some old notes about...

— 23 Jun 2007

Things I keep forgetting about FileInfo

This is going to sound like a real newbie post. But I keep forgetting this particular bit of information and I keep having to write little throw away...

— 23 Jun 2007

To be scammed, or not to be scammed

A little while ago I wrote about the poor security procedures that some banks had in place . The BBC have an article on today's edition of their news website...

— 23 Jun 2007

Types of join

Occasionally there is a post on a forum asking what a certain type of join is all about, so I thought it would probably be good to have a stock explanation to...

— 23 Jun 2007

What's new in Visual Source Safe 2005?

I've been looking at the new version of Visual Source Safe as the company I work for is desperately looking for something that isn't VSS6.0 and isn't going to...

— 23 Jun 2007

Banks need to get more serious about security

There was a 'security incident' with an agent of my bank. The transaction completed last week, so now I feel free to blog about it, and then something similar happened with my credit card company...

— 22 Jun 2007

Oh No! More on SQL Injection Attacks

I've not written about this in a while becuase it seemed that people were getting the message. But today I was asked, on Code Project , "I am wondering why...

— 22 Jun 2007

SQL Injection Attacks and executing dynamically created SQL

There is a very important difference between EXEC[UTE] and sp_executesql that anyone who executes dynamically generated SQL statements ought to know. Typically...

— 22 Jun 2007

The simplicity of nullable types

I just discovered nullable types. Wow! They are really simple and such a powerful feature. Just see for yourself.... If you have an int or a DateTime or any...

— 22 Jun 2007

Delete the row, or set a deleted flag?

For auditing purposes some database system run without deleting rows from the database - they just flag the row as being deleted and ensure that queries that...

— 21 Jun 2007

Internal Error 2755 caused by folder encryption

I was attempting to install some software recently (a few hours ago, actually) and I kept getting a message saying "The installer has encountered an unexpected...

— 21 Jun 2007

Spam Scams

Today I received an email apparently purporting to be from the "The UK. Natioal Lottery" (I think they meant "National"). However, I didn't pick up that it was...

— 20 Jun 2007

The Conditional attribute in .NET

One of the odd thoughts that shoot across my brain today was how does Debug.Assert() work? I mean there are not separate debug and release builds of the .NET...

— 20 Jun 2007

A start on LINQ

I was at the Microsoft MSDN Roadshow today and I got to see some of the latest technologies being demonstrated for the first time and I'm impressed. Daniel...

— 18 Jun 2007

Anonymous Types

Anonymous Types are another new feature to the C# 3.0 compiler. To create one, just supply the new keyword without a class name, followed by the, also new,...

— 18 Jun 2007

Automatic Properties

Continuing my look at the new features found in the C# 3.0 compiler I will look at Automatic Properties. public class Employee{ public string FirstName { get;...

— 18 Jun 2007

Extensions Methods

There have been many times a class has needed to be extended, but the additional code just doesn't sit right on the class itself, or I don't have access to the class...

— 18 Jun 2007

Object Initialisers (1)

Continuing with the language enhancements in C#3.0. This post presents the concept of object initailisation. Say you have a class with a default constructor...

— 18 Jun 2007

Object Initialisers (2)

Following on from a comment left on my previous post on Object Initialisers, I decided to take a screenshot of Orcas displaying the tooltips. I...

— 18 Jun 2007

Object Initialisers (3)

It seems that now I've got Lutz Roeder's Reflector on the case with Orcas the way object initialisers work slightly different to how I expected. As it was...

— 18 Jun 2007

How do you return error conditions?

A recent poll on Code Project asked: How do you return error conditions? I was disappointed to find that in the event of a "critical error that leaves the app...

— 17 Jun 2007

How to ask a question

You may have noticed the odd rant now and again when I get frustrated at people on forums who need help but seem incapable of doing even the tiniest thing to...

— 17 Jun 2007

Incoming!

As you know, I help out on forums from time-to-time... Well, a lot actually. But sometimes people just don't seem to want to give up...

— 16 Jun 2007

Unit Testing a Static Class

I've been trying to find a way to unit test a static class. That is, a class that has no instances. The problem has been that at the end of one test the...

— 16 Jun 2007

Test Driven Development By Example

Introduction A lot has been written on the subject of test driven development, and especially on the idea that tests ought to be written first. This is an...

— 28 Mar 2007

An introduction to mock objects

Sometimes when you are unit testing you might get to a point where you say “That's too difficult to unit test so I'm just going to leave it”. This is where...

— 02 Dec 2006

How to get a list of all subdirectories

This is an example of how to obtain a list of all subdirectories using a recursive method with the .NET Framework. public static List...

— 04 Jul 2006

Why Do I Do It?

...'

— 23 June 2006

The Public Fields debate again

Back in November last year I wrote about why you should make fields in a class private. Some people still make fields public. I did concede on one argument though...

— 17 Jun 2006

Wading Through Someone Else's Source Code

If I see a question on a forum with a "small sample project" attached I'd ignore it. It is difficult enough to help people as it is without wading through tonnes of source code...'

— 17 May 2006

Help me to help you! Help me to help you! Help me to help you!

I'm a fan of the comedy-drama show Scrubs and Dr. Cox repeatedly tells young Dr. Dorian 'Help me to help you!...'

— 4 May 2006

Why Does No One Reply to My Question?

If people cannot help then they tend not to reply. This is not because they are not listening, but because they don't know the answer...'

— 10 Apr 2006

A Bad Workman Blames Their Tools

I wish that some people, when asking questions on a forum, would look inwards for a moment and reflect whether they really understand before making unfounded bold statments...'

— 5 Apr 2006

Why make fields in a class private, why not just make them public?

Encapsulation is sometimes also known as information hiding. The idea is that an object hides the details of how it works from the outside world. However, some definitions of encapsulation suggest...

— 28 Nov 2005

SQL Injection Attacks and Some Tips on How to Prevent Them

Introduction Security in software applications is an ever more important topic. In this article, I discuss various aspects of SQL Injection attacks, what to...

— 23 Apr 2005

Passing Values Between Forms in .NET

Introduction I wrote this article in response to an almost overwhelming number of requests on forums on how to pass a variable from a one Windows Form to...

— 22 Apr 2005

The Stored Procedure Now Runs How Fast?

On our test server the stored procedure ran acceptably in a few seconds so it came as somewhat as a shock when trying the application out on the client's test server that the same code was timing out after 20 minutes...'

— 31 Oct 2004

Backroom Boys - The Secret Return of the British Boffin

The book I am currently reading is **Backroom Boys - The Secret Return of the British Boffin** by Francis Spufford. It is a fascinating read, and it reads so much better than I ever imagined it would....'

— 12 Oct 2004

Speed Kills

As you know, I help out on forums from time-to-time... Well, a lot actually. But sometimes people just don't seem to want to give up...

— 6 Oct 2004

The benefits of Stored Procedures

There are lots of books that discuss getting data in and out of databases and the best ways to do that. Many advocate the use of stored procedures to ensure the safety of the data...

— 1 Oct 2004

SQL Injection Attacks

There is also a proportion of people responding to these questions that give advice that opens up gaping security holes...'

— 25 Sep 2004

The Lazy NotSupportedException

I am currently building a class library that makes extensive use of abstract classes and interfaces, and like all good TDD (Test Driven Development) I am writing the tests up front...

— 19 Sep 2004