Lachlan B's Blog

Automated build with Gitlab and Jenkins

With open source tools Jenkins and Gitlab you can automate your builds, track bugs, do code reviews and work in feature branches for .NET development. Here's how to get it all working.

  1. Your first step is to download and install the (free) community edition of Gitlab. If you don't have a linux server available, you can always run one within Virtual Box on your windows server.

    After installation, you should be able to log in and see the home page: For this example we are going to assume that Gitlab is available at the following address:
  2. On your windows server, you need to install the following:

I suck, you suck, we all suck at coding

Programming is hard, but us programmers never like to admit it. Except for the wonderful Scott Hansleman who wrote this fantastic article. And on a similar note. And a good explanation on why we are all so grumpy.

Oh and did you know that programming sucks?

And here's a better explanation why.

Oh and the code for Toyota 2005 Camry is TERRIBLE.

I write this post to assure fellow devs that you are a REAL programmer. Don't stress about not knowing everything or not knowing enough. There's too much to learn. The time it takes to get good at a language or framework is the time it takes for it to become obsolete! Programming sucks but is great fun. Just don't let it get you down :)


Midi patch changer schematic

Here's the schematic for my MIDI patch changer.


Speaking at NDC Sydney

In a couple of months I'll be speaking at NDC Sydney - my topic is "How to change things at your company" - a lightning talk on how to enact change. This is a non technical talk, which is fantastic, because I don't fancy having to answer technical questions from such a tough audience!!

This will be my first "big" conference, and I have to thank Lars Klint for his fantastic support in choosing me to speak at the DDD conference last year, which really gave me the confidence to submit a few talks to NDC. I should also link to a great article by Troy Hunt titled Speaker Style Bingo which is a killer article that helped me a lot in preparing my talks. Thanks guys!


Arduino based midi patch changer

I thought it would be fun to build a MIDI patch changer, something like this one.

So I bought a simple arduino kit and started knocking it together. Fortunately I've done a bit of electronics beforehand so I found it quite easy. The prototype has been built:

The next step will be mounting it in a box. Good fun!


Using NuGet to manage shared code

Within your organisation you probably have shared code that is common across multiple projects? You know, code that does boring stuff like sending an email, error message logging or generating a nice bit of HTML.

So the question is, How do you manage that code? Do you:

  1. Copy around code files to multiple projects
  2. Factor out your common code to a new project and include that project in many solutions
  3. Compile down your common project into a DLL and copy that around
  4. Use revision control to import particular versions of common libraries

All of these solutions work, but when it comes to keeping your common code up to date, and knowing which versions are used by which applications, you're going to start running into problems.

Enter, NuGet!

But isn't NuGet what Visual Studio uses for managing external, public packages? Yes it is. But did you know you can host your own private NuGet repository, create your own...

ASP.NET Two Factor Auth with Google's Authenticator App part 2

This is part two in a series of posts. For the introduction post on how to do it all with a NuGet package, see two factor auth with google authenticator app. This article is about how to implement it manually and how it works behind the scenes. A lot of this code is based on an article by Jerrie Pelser titled Using google authenticator with identity.

If you already have an application that is utilising ASP.NET's identity service, you can made a few modifictions to include the Two Factor authentication code.

To show how this can be done, first off create a new ASP.NET application, choose "MVC", and set authentication to "Individual User Accounts". In this example we are creating a new application for managing our own movie DVD collection, so we will name it MovieManager.


ASP.NET Two Factor Auth with Google's Authenticator App part 1

So you want to add two factor authentication to your site?

auth 1 screenshot

I have created a NuGet package that will get it running in 10 minutes. Alternatively, I have also written an article on how you can implement it manually without using the NuGet package.

This method is using ASP.NET’s Identity and Google’s “Authenticator” app. The authenticator app is simple, very widely used (GitHub and Slack, to name two) and works very well.

If you are adding two-factor authentication to an existing site or codebase, I would suggest that you start by creating a brand new project and adding the already-prepared NuGet package that I have prepared. This will ...

Fixing oWasps CSS

This week I heard about the .NET Security Cheat Sheet written by the owasp guys. So I opened it up on my mobile and saw this:

Eish. The text is tiny and you need to scroll around the screen to be able to read a sentence. Someone needs a mobile friendly CSS! So I tweeted them and got this response:

Fair enough.

So I fixed it... how's this?

The "main" culprit was the TABLE tag inside the HTML:

Removing that got us 50% of the way there... then we just needed a bit more CSS to clean it up:


Update for android app for East Timor

The last couple of months we have made some nice progress on our app. It's got a cool name, "Local Linguist", and it's had a facelift and a workover by some UI guys:

Each screen is much simplier and it will also include a section for listening to audio and providing a translation in your own language.

There's also a great interview with Katrina Langford, the "change maker" (eg, product owner) for the application. I could point out that so far we've won the Rhok Hackathon ahem *twice* but there's not a lot of point other than boasting, the value is in the results, not the kudos awarded on the way - though that definitely helps keep the motivation going, we're all human after all.

Plus here is a photo of the LocalLinguist team at the recent hackathon winning the trophy!! I'm not in the photo, I wasn't there on the day, but I've somewhat contributed to the project! But even still, great job guys.

While I'm here I might as well briefly mention that I recently gave a talk on "How to change things at your company" at DDD night, which was great fun. Here's a blurry photo of me doing my thing: