For my birthday this year I was the lucky recipient of an iPad Pro. Primarily I wanted it for drawing but I was also curious as to how it might be useful at work. 2 weeks in, here are some of the things I've experimented with so far. Coding I always figured coding on a tablet was a bit of a non-starter. Most of the apps I work on can be hard work to set up on a laptop let alone a tablet. I vaguely…

Creating a cluster of Raspberry Pis undoubtably looks cool. If you are looking for an excuse to create a cluster but aren't quite sure what you could actually do with it, here is a quick run down of some of the reasons you might want to create a cluster of Pis. Performance This is probably what most people think of first. However whether or not you will get any performance benefit from a cluster…

Following on from my previous post about improving motion sensor behaviour, this is another little automation that I enjoyed making work. The background We have a downstairs toilet near our front door. I wanted to add a contact sensor to the door but there are 2 different scenarios to consider. Scenario 1 - Just popping in The first is the "normal" contact sensor behaviour where the light turns on…

This is a useful pattern I use in a few rooms around the house for turning lights on and off. I have motion sensors in a few places. When I first got them, I naively just hooked them up so that when they detect motion in a particular room, the light turns on. Then when the sensor deactivates, the light turns off again. Unsurprisingly this wasn't great and led to a number of farcical situations…

I've been spending some time updating my home automation set up. I have a SmartThings hub with a few contact sensors and smart bulbs attached. It all worked fine but there were a few things I wanted to change and couldn't. Firstly I'd tried writing a SmartThings app to integrate with Slack. Receiving updates was pretty straight-forward but issuing ad-hoc commands looked to be more fiddly. Secondly…

MQTT is a lightweight message protocol often used in IoT and home automation applications. It is very easy to get up and running. However once you have a larger number of devices communicating, it's easy to get in a pickle if you don't have a plan for how they will all communicate. Here's the strategy I'm using at the moment. Basic principles Topics should be all lower case and contain only…

Ever struggle to remember which branch is which? Here's a pimped out version of that might help. It lists the branches with most recent commit date first and includes a bunch of useful info to help identify which branch is which. Here's a screenshot (using source from the Ruby on Rails repo) Fancy list of git branches There are more examples of variations on the same theme on this Stack Overflow…

I've decided to take VS code for a test drive. Naturally the first priority is to get my colour scheme in order. Boss screenshot I've ported my Boss Atom theme over to a new Boss VS code theme. This turned out to be somewhat more of a heavyweight process than I anticipated. Whilst you can customise colours through the settings file, this doesn't work so well if you want to flick through different…

One of the great features of ECMAScript 2015 (previously known as ES6) is built in module loading. In some respects this is nothing new. CommonJS and AMD have been around for a while both of which fill the same role. The key difference is that it is now built into the language spec though it has been designed to work with existing CommonJS and AMD modules. Here are some examples of how to write…

Here's a quick and simple pattern that comes in handy when building simple service objects in Ruby applications. They can be used anywhere in the system to model a command but are commonly found at the boundary between the application domain and the UI layer. In the Rails world, this generally means the "in the controller". You may also know them as interactors. The premise The easiest way to…

Enabling :active on iOS We have a number of 'more info' icons that are used to display extra help text for thing like form fields. In desktop browsers, the help text appears when a user hovers over the icon using the css :hover pseudo-selector. There are obvious problems with this on mobile devices so we also apply the same styles using the :active pseudo-selector as well. This works great on…

I needed to add a summing column to a Google Spreadsheet. The spreadsheet contained monthly traffic breakdowns exported automagically from Google Analytics using the awesome Supermetrics and looked something like the sheet below. I wanted to add in the column at the end showing the year total for each page (highlighted yellow). Example spreadsheet Pretty easy right? Just a case of putting in the…

I finally managed to get round to doing something constructive with the Arduino I bought a few months back. For a long time I'd wanted a foot controller I could use with Ableton Live. I also fancied having a go at using MainStage for live performances. In my shed I had an old Vox Tonelab LE multi-effects pedal that I used to use for the Clarendon Jam night. After many nights of getting trodden on…

I am a big fan of hiding the sausage making with git. This is the practice of updating and editing commits to make them look as if they sprang into existence perfectly formed. It involves going back and rewriting git history to ensure that each entry is complete and coherent. Here is a quick run through of how I work in order to make it easy to juggle and rework my commits. Start on a new branch…

Stumbled across a great tip on Stack Overflow showing how you can get Github pull request information into your local repository. First you need to tell git to include the pull request data in a fetch. Note that if you have a different remote name for Github you will need to change references to origin to match your remote name. Then each time you do a the pull request information will be fetched…

Every change should be made on a branch You're probably already doing this but Github pull requests make this a necessity. Branching is cheap and easy so there is no reason not too. It's also worth noting that you can create a branch with a dirty working tree so if you make some changes and then realise you have forgotten to create a new branch it's not too late. Finally, if you do add…

We use Apache Solr to handle search queries. If you haven't used Solr before, the principle is that Solr maintains a index of all of our searchable data. We can then retrieve a list of records matching a search query by requesting a url from the Solr server. In its most basic form, the url looks something like Solr then returns a list of all the records in the index that match the query. Pretty…