Who is talking?


Integrating OpenShift and Splunk for Docker Container Logging

about 1 month ago | Dave Kerr: dwmkerr.com

In this article I'm going to show you how to set up OpenShift to integrate with Splunk for logging in a Docker container orchestration environment. These techniques could easily be adapted for a standard Kubernetes installation as well! Screenshot: Counter service splunk The techniques used in this article are based on the Kubernetes Logging

Effective Shell Part 2 - Become a Clipboard Gymnast

2 months ago | Dave Kerr: dwmkerr.com

In this article I'll show you how you can use the shell as an efficient tool to compliment how you use the clipboard.

Effective Shell Part 1: Navigating the Command Line

6 months ago | Dave Kerr: dwmkerr.com

Text in the command line can quickly get unwieldy. Here are some simple tricks you can use to navigate in the command line.

A utility to help you wait for ports to open

7 months ago | Dave Kerr: dwmkerr.com

There are occasions where you might need to have scripts or commands which wait for TCP/IP ports to open before you continue. I've come across this need again and again when working with microservices, to make my life easier I've created a little utility called wait-port which will wait

Tips and Tricks for Beautifully Simple Mobile App CI

8 months ago | Dave Kerr: dwmkerr.com

In this article I'm going to demonstrate some simple tips and tricks which will help you build and maintain beautifully simple mobile build pipelines. These techniques can be applied to different mobile app technologies and integrated into almost any build system: Sample App Index Each tip is demonstrated in the sample apps in

Get up and running with OpenShift on AWS

10 months ago | Dave Kerr: dwmkerr.com

Setting up your own OpenShift cluster can be a little complex, but in this article I'll show you how to make it fairly painless.

Creating a Resilient Consul Cluster for Docker Microservice Discovery with Terraform and AWS

11 months ago | Dave Kerr: dwmkerr.com

In this article I'm going to show you how to create a resilient Consul cluster, using Terraform and AWS. We can use this cluster for microservice discovery and management. No prior knowledge of the technologies or patterns is required! The final code is at github.com/dwmkerr/terraform-consul-cluster. Note that

Using Slack for Server Development

about 1 year ago | Dave Kerr: dwmkerr.com

I recently found a surprisingly helpful approach for server-side development which uses Slack in a creative way.

Simple Continuous Integration for Docker Images

about 1 year ago | Dave Kerr: dwmkerr.com

In this article I'm going to demonstrate a few tips and tricks which can make your life easier when you are building or maintaining Dockerfiles. The need for a Build Pipeline Do we really need any kind of continuous integration or build pipeline for Dockerfiles? There will be cases when

Run Amazon DynamoDB locally with Docker

about 1 year ago | Dave Kerr: dwmkerr.com

tl;dr: Run DynamoDB locally using Docker: docker run -d -p 8000:8000 dwmkerr/dynamodb Try it out by opening the shell, localhost:8000/shell: DynamoDB Shell That's all there is to it! DynamoDB Amazon DynamoDB is a NoSQL database-as-a-service, which provides a flexible and convenient repository for your services. Building applications

Effective Node.js Debugging

over 1 year ago | Dave Kerr: dwmkerr.com

If you are interested in improving your Node.js debugging skills, then check out my talk at the recent JSChannel 2016 conference in Bangalore: Comments and observations are always welcome!

Testing the Docker for Mac Beta

over 1 year ago | Dave Kerr: dwmkerr.com

I've finally had a chance to install the new Docker for Mac Beta and give it a whirl, here are my experience so far!

Is it worth persevering with Golang?

over 1 year ago | Dave Kerr: dwmkerr.com

After perhaps 10-20 hours of learning, coding and messing around, I'm wondering - is it worth persevering with Golang?

What's your Vim Name?

over 1 year ago | Dave Kerr: dwmkerr.com

I'm a few weeks into moving to Vim as my main editor, I've stopped crying and shaking mostly (at least about my editing ability). Now I'm wondering: what's your Vim name? And who's got the best one? As far as I can work out, my Vim name is: Replace everything

Quick Tip: Sending Newlines with cURL

over 1 year ago | Dave Kerr: dwmkerr.com

Yikes, this took far too long to figure out! I have a service which takes plain text multiline input and outputs an object for each line, something like this: Input Line 1 Line 2 Line 3 Output [ {line: "Line 1"}, {line: "Line 2"}, {line: "Line 3"} ] There's a bit more

Moving from React + Redux to Angular 2

over 1 year ago | Dave Kerr: dwmkerr.com

I'm going to share my experiences of experimenting in Angular 2, as someone who needs a pretty compelling reason to move away from React/Redux!

Learn Docker by building a Microservice

over 1 year ago | Dave Kerr: dwmkerr.com

If you are looking to get your hands dirty and learn all about Docker, then look no further!

Getting Started with React & ES6

over 2 years ago | Dave Kerr: dwmkerr.com

Feeling like having a go with Facebook's hugely popular React framework but not sure where to start? In this post I'm going to build a simple React application from scratch - using ECMAScript 6. We'll put together the bare minimum skeleton of a site and keep the folder structure free

Manipulating JSON Web Tokens (JWTs)

over 2 years ago | Dave Kerr: dwmkerr.com

I've been writing a couple of web services lately that use Auth0 for identity management. It's a great platform that makes working with different identity providers a breeze. One thing that I couldn't work out how to do at first was to quickly build a new JWT1 from an

The Best Module System for AngularJS Applications

over 2 years ago | Dave Kerr: dwmkerr.com

I was working on a small and simple application built with AngularJS the other day. As with most applications like this, I start with a single JavaScript file caled app.js and no module system. In the past I've used RequireJS with AngularJS. It's an awful mistake. It leads to

Failures Connecting from Elastic Beanstalk servers to MongoDB on EC?

over 2 years ago | Dave Kerr: dwmkerr.com

tl;dr? Check your mongodb.conf bind_ip settings to make sure that you're not allowing connections only from localhost. This may just end up being the first part of a wider troubleshooting guide, but this is one I've spent a few hours fixing, after assuming I was making terrible

Fixing Memory Leaks in AngularJS and other JavaScript Applications

almost 3 years ago | Dave Kerr: dwmkerr.com

Dealing with memory leaks in JavaScript applications can be a complex process. In this article I'm going to show you how to identify whether you have memory leaks, analyse them and ultimately resolve them. I'm using an AngularJS application to demonstrate the concepts and approaches, but much of this material

Free Continuous Integration for .NET Projects with TravisCI

about 3 years ago | Dave Kerr: dwmkerr.com

TravisCI offers free hosted continuous integration for Open Source projects. It's a great platform and I use it for some of my libraries, such as Angular Modal Service. Build Status If you are maintaining open source projects, CI is really useful. When people are creating pull requests, verifying that the code builds and the tests pass is critical, and having quick feedback on that is essential. TravisCI runs builds on Unix boxes, and it has no support out of the box for the .NET framework, Visual Studio and so on. But with the help of Mono we can use Travis to create a CI build. 2/12/2014: If you need more functionality and have an open source project, you can also try AppVeyor! Getting Started You'll need to be hosting your project on GitHub. Travis downloads your code from GitHub. Now sign up to Travis using your GitHub account, once you've done this follow the instructions on Travis to allow the two systems to communicate. The .travis.yml File Travis works by looking for a .travis.yml file in your repository and executing commands from it. All we need to do is set up our yml file to install mono and build the project. In this example, I want a CI build for my GlmNet project, which is an implementation of the GLM mathematics library for .NET. The details of the project aren't important, important is that it is a .NET class library with some tests. Here's how we might start with the yml file: language: c install: - sudo apt-get install mono-devel script: - xbuild source/GlmNet/GlmNet.sln We set the language to C (as Travis doesn't support C# it doesn't really matter!), install mono and build our solution. That's what we'd like to do, but nothing's ever that easy. It takes a little more than this to get it working, but in essence this is what we need. Installing Mono Installing mono is not as simple as apt-get install mono-devel, because the most Unix distros are using out of date versions of mono in their package sources. Here's a script that installs the latest version of mono - everything's commented so you can see what's going on: # Add the Mono Project GPG signing key. sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF # Add the Mono Package Repositories. echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list # Update the Package Cache. sudo apt-get update # Install Mono Complete. You might be able to get away with # mono-devel depending on which assembies you use from the # .NET framework, try it if you can, it'll make your # build quicker! sudo apt-get install mono-complete # sudo apt-get install mono-devel # Some tools like Nuget are going to make requests on # HTTPS resources. Mono doesn't trust SSL certificates # by default, so let's import Mozilla's list of trusted # certificates. mozroots --import --sync So this script basically adds a GPG key for the mono project, adds a new package source which has the latest mono versions, installs mono complete and updates the machines certificate store. This should be enough to install mono. If you have access to a Unix machine or VM, give the script a try. Now there are two ways to go from here - either we can save this script to a scripts directory in our repo and call it from the .travis.yml file, which keeps things clean, or we can just include what we need directly in the yml file. I'm going to include it directly in this article because it'll make it easier to follow, but for serious projects I'd suggest a scripts folder. That's because you can check out your repo to a test VM, and test each script in turn - it's harder to test the yml file. It also keeps the yml file clean as you build on it over time. So let's look at our yml file now: language: c install: - sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list - echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list - echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list - sudo apt-get install mono-devel - mozroots --import --sync script: - xbuild source/GlmNet/GlmNet.sln Notice that I'm not doing apt-get update. We're on a clean VM and I'm speeding the build up by assuming my packages are up to date. I'm also only installing mono-devel, which is lighter than mono-complete, it has less .NET assemblies but all the ones I need. If you can get away with mono-devel, do it, it's faster. If the build complains about missing assemblies, then try mono-complete. The script part of the yml file uses xbuild, mono's compiler, to build our solution. Easy! We now have a running build, we can add the badge to the README.md file for the project and our Open Source .NET project has CI! Build Status Adding Unit Tests to the Build My project has nunit tests. Can we run those as well? Actually, this is super easy. Just update the .travis.yml file: language: c install: - sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list - echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list - echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list - sudo apt-get install mono-devel nunit-console - mozroots --import --sync script: - xbuild source/GlmNet/GlmNet.sln - nunit-console ./source/GlmNet/Tests/bin/Debug/Tests.dll Notice the difference? We install nunit-console and run out tests assembly against it. Now the build will fail if the tests do not succeed! That's It I hope you found this useful, do let me know in the comments if you have any questions or suggestions. Troubleshooting Some issues you might run into are listed here. Error: Unmet Dependencies The following packages have unmet dependencies: mono-devel : Depends: libmono-system-runtime4.0-cil (>= 2.10.1) but it is not going to be installed I've have seen this happen if the correct repositories are not added, make sure you include the lines: # Add the Mono Package Repositories. echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list In your build. See Installing Mono on Linux for details. References Some resources that were useful: Installing Mono on Unix Donal Lafferty - Building your Microsoft Solution with Mono

The Only AngularJS Modal Service You'll Ever Need

over 3 years ago | Dave Kerr: dwmkerr.com

If you need modals in an AngularJS application, look no further. I'll show you how to use the Angular Modal Service to add Bootstrap Modals or your own custom modals to your application. See it in a fiddle or check out a full set of samples online. Contents Using the

AngularJS Promises - The Definitive Guide

over 3 years ago | Dave Kerr: dwmkerr.com

Promises are a core feature of AngularJS - whether you understand them or not, if you use AngularJS you've almost certainly been using them for a while. In this post I'm going to explain what promises are, how they work, where they're used and finally how to use them effectively.

Better Specifications

over 3 years ago | Dave Kerr: dwmkerr.com

Specifications are absolutely key to the success of a project. Unless you have a good definition of what your project is supposed to be, there's no way you can deliver it. A specification is the contract between you and the client, the basis for technical designs, quality assurance test plans,

Blogging with Ghost

over 3 years ago | Dave Kerr: dwmkerr.com

tl;dr Ghost is a blogging platform well worth considering if your blog is all about development. I've been having some gripes with WordPress as a platform for blogging lately. For development focused blogs like this one, there are some things about it that make writing posts just a little

Managing Vsix Deployments with Powershell

over 3 years ago | Dave Kerr: dwmkerr.com

tl;dr - vsix-tools fixes the 'Invalid Multiple Files in VSIX' issue on the Visual Studio Gallery and lets you set vsix version numbers with Powershell. I maintain a reasonably large project called SharpGL. This project contains two Vsix packages (Visual Studio Extensions), each of which contains project templates for

Practical AngularJS Part 2

almost 4 years ago | Dave Kerr: dwmkerr.com

I'm going to be working in F# almost exclusively for a short while, so before I throw myself into that I wanted to wind up my Practical AngularJS Part 2 article. It's ready to rock here: Practical AngularJS Part 2 - Components of an AngularJS Application In this article we

Langton's Ant in Javascript

almost 4 years ago | Dave Kerr: dwmkerr.com

Langton's Ant is a great simulation to write to play with a language. Just today I've completed my Langton's Ant write up and published it on the CodeProject, you can see the article at Learn JavaScript Part 3 - Angularjs and Langton's Ant. Langton's Ant There are some interesting things in the

A great read for JavaScript newcomers

about 4 years ago | Dave Kerr: dwmkerr.com

A superb article by Colin Eberhardt has just been published on the CodeProject, called 'Understanding JavaScript Object Creation Patterns'. This article should be on the reading list of anyone who's new to JavaScript or not familiar with how objects and prototypes work. It takes you step by step through the

Introducing Practical AngularJS

about 4 years ago | Dave Kerr: dwmkerr.com

I was recently at Devoxx in Antwerp, primarily because I wanted to get involved in some of the sessions that were being hosted by guys from the AngularJS team at Google. I've had a chance to work a little with Backbone and KnockoutJS and had been recently deliberately holding off

Space Invaders on the CodeProject

about 4 years ago | Dave Kerr: dwmkerr.com

I'm currently writing a series of articles on the CodeProject called 'Learn JavaScript' and am pleased to say that the latest article is available now! Learn JavaScript Part 2 - Space Invaders In this article we take a look at how to create the classic space invaders game with plain

SharpShell 2.0

about 4 years ago | Dave Kerr: dwmkerr.com

I have just released SharpShell 2.0  - you can get the release from sharpshell.codeplex.com or the new GitHub page at github.com/dwmkerr/sharpshell. This release has been primarily a bugfixing release, but there is one very useful new feature, the Server Registration Manager tool (srm.exe). This is a standalone application that can be used to install and uninstall SharpShell servers. srm install server.dll -codebase srm uninstall server.dll This tool makes it much easier to deploy SharpShell servers. You can call the tool as a Custom Action in a MSI project, either by using Visual Studio 2010's installer project type, or a WiX project. I'll be writing up an article on the CodeProject on how to use the tool soon, until then you can download the tool and try it out now!

ConsoleControl and Happy Coders

over 4 years ago | Dave Kerr: dwmkerr.com

Sometimes I write up an article and some code on the CodeProject and get a good response, other times it seems an article sinks beneath the waves without any notice. Looking over some emails the other day, I noticed that my ConsoleControl article had actually received a slow and steady response of extremely positive feedback - people are using it and suggesting improvements. screenshot This is great, it's one of the things I love about the community of developers that I'm part of. So I decided to try and put a bit more back with ConsoleControl. I've moved the source code to GitHub, so that anyone can fork it and work on it easily: https://github.com/dwmkerr/consolecontrol I've bulked out the readme.md file with some more information and am working in the documentation. I've also added ConsoleControl to Nuget - you can install it for WinForms or WPF with the commands below: PM> Install-Package ConsoleControl PM> Install-Package ConsoleControl.WPF Finally, I'm blogging about it here. It's great to see people using a project like this, it's rare for me to share comments like the ones below, but I must say I was touched by: This is just about borderline genius. - Gerben Rampaart Brilliant. So easy to use and works flawlessly. - Sukar I saw similar controls - but yours is outstanding - I love it! BTW: Very nice coding (style, comments) - 5ed! - johannesnestler To finish off this post, I'd like to say thanks to everyone who's commented, suggested improvements and shared their experiences with the code, it's a great feeling when you share something and it seems that people benefit from it. If you've used the code and want to share ideas for improvements or feedback, email, comment or hit the GitHub page or CodeProject article.

Space Invaders in JavaScript

over 4 years ago | Dave Kerr: dwmkerr.com

If you take a look at the Experiments Page you'll see that there's a new entry - Space Invaders. spaceinvaders Space Invaders is a great little game to code if you're learning a new language or technology (and JavaScript is still very much in that category for me). I'll be writing up how I made the game on the CodeProject soon enough (if you're interested you can see how I made the starfield background in JavaScript). You can check back periodically - the game is nearly done and more than ready to play with. The code is available as well, either just get it from the browser or check Space Invaders on GitHub. I'll post when it's done and the next experiment starts!

Introducing Experiments

over 4 years ago | Dave Kerr: dwmkerr.com

I'm staring a series of articles on learning Javascript (the first is available at http://www.codeproject.com/Articles/642499/Learn-JavaScript-Part-1-Create-a-Starfield). To help with this, I've created the Experiments page. This page will host each of the things I've been playing with in the process of learning JavaScript and coming up with good topics for tutorials. You can see the Experiments page here, there's also a link at the top of the site. If you like it, please feel free to comment on this post or get in touch.

Node.js and Express - Strange Http Status Codes

over 4 years ago | Dave Kerr: dwmkerr.com

In a Nutshell Sending a response in Express with a call like res.send(status, body) will send body as the status code if it is numeric - ignoring status. This is due to a fudge for backwards compatibility. The Details As part of a project I'm working on, I'm writing a service using node.js and Express. This service exposes some entities in a MongoDB database through a REST API. Typically I hit this API through client-side Javascript, but in some places I want to hit the same API from some C# code - and I don't want to have to create classes for everything. I've got a funky library for this which I'll be publishing soon, but it helped me find a problem. Testing the C# code showed me something that was a bit odd - GETs and POSTSs were working fine, but PUTs and DELETEs were showing an HTTP Status code of '1' (which isn't a valid code). Here's the what I was seeing: requests Checking the node server showed the same thing - DELETEs were returning status 1. console The server code is very lightweight so it's quick to see what's going on: [code lang="js"]exports.deleteUser = function(request, response) { // Get the id. var id = request.params.id; // Log the user id. console.log('Deleting user: ' + id); // Get the users collection, delete the object. db.collection(collectionName, function(err, collection) { collection.remove({'_id':new BSON.ObjectID(id)}, {safe:true}, function(err, result) { if (err) { console.log('Error deleting user: ' + err); response.send(400, {'error':'An error has occurred'}); } else { console.log('' + result + ' document(s) deleted'); response.send(result); } }); }); }[/code] The function is called successfully, so we hit 'response.send'. This looks like the problem - the result object is simply the number one, checking the Express Api Documentation for send shows some examples like this: res.send(new Buffer('whoop')); res.send({ some: 'json' }); res.send('some html'); res.send(404, 'Sorry, we cannot find that!'); res.send(500, { error: 'something blew up' }); res.send(200); So just like the final example, we're sending the code 1, which is not valid. What surprised me was what happened when I changed the send call to the below: [code lang="js"]response.send(200, result)[/code] I was still getting the code 1 returned. It turns out that this is a kind of undocumented oddity of Express - if you pass a numeric code and the second argument is also numeric it sends the second argument as the status. In response.js of Express we find: [code lang="js"]res.send = function(body){ var req = this.req; var head = 'HEAD' == req.method; var len; // allow status / body if (2 == arguments.length) { // res.send(body, status) backwards compat if ('number' != typeof body && 'number' == typeof arguments[1]) { this.statusCode = arguments[1]; } else { this.statusCode = body; body = arguments[1]; } }[/code] So it seems the Express used to support a call like res.send({body}, 200) - and checks for a numeric second argument for backwards compatibility. The workaround - don't send numbers as any part of the response, unless it's most definitely the status code - if you want to return the number of documents deleted, format it as json first, otherwise Express will get confused and mess with your status codes.