An Introduction to the LEDS Stack

Jun 10 17

Full blog post is coming soon.

For now, please see GitHub repository for demo project:

Talk slides at:

Azure function not receiving json messages using Topic Service Bus Trigger

May 25 17

While developing an Azure Function application, using this tutorial, I encountered a problem.

Ultimately, using func new generated my function (the run.csx file) which looked like this:

Side note: the mySbMsg is important – it’s defined in the function.json bindings, and must match.

However, there was a problem.
When sending messages to my topic, they weren’t being picked up by my function.

I was using some very simplistic code to send messages to my topic:

The messages were definitely being delievered to the topic – I could see that in the Azure portal.

However, the function wasn’t picking them up.

The issue was around the string mySbMsg parameter.
The scaffolding assumed that it would be a string – but it is in fact, a byte[] (due to me serializing the JSON)

Changing this parameter to be a byte[] – and my messages are now received by my locally running function.

Asserting multiple properties of argument with FakeItEasy

May 4 17

More often than not, I want to assert that my dependency has been called with a parameter that matches more than one condition.

Let’s say we have a method that calls ICustomerService.Add method.
We want to assert the Add method was called with a Customer that matches a few conditions.

The way we’d typically achieve this is by doing something like this:

This will work. And it will indeed assert that the AddCustomer method was called with a Customer object, with those properties set to the corresponding values.

The problem lies if one of those properties doesn’t match.
We get a failed test. But no idication of which property it’s failed on.

What I like to do instead, is follow this pattern:

So, here, we’re basically saying when Add is called, with any Customer object, Invoke the anonymous function, that takes the Customer argument, and stores it in addedCustomer.

We can then individually assert on each property.

I created an issue on GitHub which addresses this, with a view to finding a more ‘inline’ solution

Physical 419 Letter Received

Apr 25 17

Last night I opened an innocuous looking letter delivered to my home address.

It had a ‘commercial’ postage stamp on it (not one that you’d pick up in the post office) and it wasn’t addressed to anybody on the envelope.
The content of the letter was what I’d expect to get via email – a 419 scam!
It was, however, addressed to the previous occupier of the house. They even knew her husbands name.


Email address listed:

Microsoft SQL Server on a Ubuntu Linux VM

Apr 15 17

As part of a blog post on the LEDS stack (Linux Nginx Dotnet, SQL Server) I’m putting together, I wanted to see how easy it is to install SQL Server on a Ubuntu VM, running on Digital Ocean.
Turns out, very easy.

I went with a Ubuntu  16.04.2 x64 box, with 4GB of RAM
The docs state that you need at least 3.25GB of memory to run SQL Server on Linux.


Once my droplet had created, I SSH’d into it.

First, we need to import the public repository GPG keys, and register the Microsoft SQL Server Ubuntu repository

curl | sudo apt-key add -
curl | sudo tee /etc/apt/sources.list.d/mssql-server.list

Then, it’s a simple

sudo apt-get update
sudo apt-get install -y mssql-server

And SQL Server is installed in around 2-4 minutes.

Next up, it tells you the command you’ll need to run:


Which is

sudo/opt/mssql/bin/mssql-conf setup

for those copying and pasting.

Once you’ve accepted the license terms (you do accept them, don’t you?) and chosen a secure SA password, setup is complete.

You can verify the service is running with:

systemctl status mssql-server


Back in Windows…
To test out your new SQL Server install on Linux, you can connect to it using SSMS (Windows)
I’m currently using SQL Server Management Studio – Release Candidate (17.0 RC3)
(I tested it with 2014, and it worked fine.)

Port 1433 was open on my VM, but it may be blocked with your firewall!

Restoring the Northwind database backup.

Ok, next let’s get a database up and running on our Linux SQL Server.
I downloaded the Northwind database backup to my local machine.

I used SCP to copy the backup of the Northwind database:

scp root@:/var/opt/mssql

This copies my file into /var/opt/mssql on the remote server.

I’m using a mac, so SCP is installed already.
If you’re on Windows, you’ll need to use something like WinSCP

Since I uploaded a zipped backup file, I’ll need to unzip it.

If the unzip command isn’t already installed on your system, then run:

sudo apt-get install unzip

Then it’s just a simple


Next, with SSMS locate the backup file, and restore in the usual way:


Note: SSM puts “C:\” in front of your path in the location bar
This can be ignored, but for some reason it does need to be there.

And there we have it. The Northwind database, restored on to a SQL Server instance, running on Linux, on a non-Microsoft cloud.