This is the more-or-less complete history of my blog over the past decade. There are a few articles I still haven’t ported over – if there’s something missing that you’re looking for, please do drop me a note to mathie@woss.name and I’ll see if I can resurrect it!

Convincing Vim to accept ? and ! as part of keyword
Published in Programming .

Last night I learned how to convince vim that ! and ? are part of a keyword. This is awesome, because both those characters are valid characters for method names in Ruby. In particular, it now means that when I hit ctrl-] with my cursor in a method name containing a !, it will take me to the correct method definition. Let’s see how.


There and back again: A packet's tale
Published in Internet .

I’ve got a new goal in life, and a new series of projects to achieve that goal. I’m planning to focus my free time to produce articles, screen casts and, hopefully, eventually, a book. They’re all around answering my favourite interview question: “When I pull up my Internet Browser, type ‘bbc.co.uk’ into the address bar, and press return, what happens?”

In this article, I explore why I like it as an interview question, and some of the topics I’ll be talking about in the coming months.


Keybase: A Web 2.0 of Trust
Published in Ops .

A short introduction to public key cryptography, how the web of trust is formed, and what Keybase brings to the key signing party.


Starting a new Rails project
Published in Programming .

Since Ruby on Rails 4.2 has just been released, perhaps how is a good time to review creating a shiny new Rails project. In this post we’ll go through setting up a new Rails app with RSpec and Guard for testing, and with Twitter Bootstrap for UI styling.


The Retrospective Prime Directive
Published in Writing .

The Retrospective Prime Directive states: “Regardless of what we discover, we understand and truly believe that everyone did the best job they could, given what they knew at the time, their skills and abilities, the resources available, and the situation at hand.” I muse a little on what this means.


Scotland's Depression
Published in Writing .

Everyone has their own take on Scottish independence. Most people I’ve read, and understood, have had a very personal, often emotionally charged, perspective on independence, based on their own experiences. This is my attempt to relate the issues to my personal experiences of the past year.


Two-Factor Authentication
Published in Ops .

The Internet is full of Bad People Who Want To Steal Your Stuff. Well, no, not really. The Internet is full of good people (so long as you don’t read the comments), but it does give the bad people access to an unprecedented amount of computing power, and a large audience with which to play. When you’ve got enough computing power, and enough bandwidth, it’s no big deal to guess somebody’s password by just trying out every possible combination (called a “brute force” attack).


Marking up an Article Supplying metadata to keep the robots happy
Published in Programming .

Let’s have a bit of a dive into the metadata associated with blog posts, and figure out how to produce the right information that all our social media tools (Google, Facebook, Twitter, etc) can consume.


Front-end Development 101 Part 2 (of 3): Using Grunt to automate CSS compilation
Published in Programming .

In the second part of this series, I’m taking a look at using Grunt to automate repetitive tasks and to automatically build artefacts when a source file changes. And we’ll use Grunt to compile our stylesheets, from our own Less CSS source, and Twitter Bootstrap.


A Personal Timeline Recording a personal history
Published in Programming .

I built a simple web app to enter details of a personal historical timeline, and use TimelineJS to display the resulting timeline. Mostly, I’m sharing the code just in case it’s of use to somebody else.


AWESOME!!!1!
Published in Writing .

We need to reclaim the word awesome and use it to chase the Black Dog of Depression away.


HYPERPOWER! Putting the caps lock key to work
Published in Ops .

Today, we’ll figure out how to replace the caps lock key with the (far more useful) HYPER key on Mac OS X, and have a think about the different ways we can put it to use.


Counselling for Geeks An introduction to Transactional Analysis
Published in writing .

I recently read Counselling For Toads, an introduction to Transactional Analysis set in the world of Wind in the Willows. Toad (of Toad Hall) is depressed, and his friends are worried about him. They encourage him to seek help in the form of some counselling, to better understand his feelings, and to learn to cope with them. The story is of Toad’s adventures in counselling, learning about himself, and figuring out his relationships with his friends.


Dockerising a Rails App
Published in Ops .

Today we’re going to explore how to bundle up a sample Ruby on Rails application into Docker images, run containers locally in our development environment, and link the containers together so they can talk to each other. On the way, we’ll automate the build with Rake, and discover a little more about how container linking actually works.


Vagrant, Docker & VMWare Fusion: Oh my!
Published in Ops .

Today we figure out how to run Docker containers on Mac OS X with a little help from VMWare Fusion, and Vagrant.


Going Deep on Accounting Learning the problem domain through code
Published in Programming .

A bit of an archaeology dig in ancient home directories turned up a couple of Rails apps that I built while I was studying for a Diploma in Accounting. Let’s see if we can dust them off a little and learn something from them.


Representing Trees in PostgreSQL
Published in Programming .

Today we figure out a novel approach to the materialised path pattern for representing hierarchical data in SQL. It takes advantage of PostgreSQL’s native support for array types. But it also poses a question: can we make use of ActiveRecord’s preloading machinery for eager loading these trees?


Specifying Ruby on Rails Controllers with RSpec Part 2: Command actions
Published in Programming .

Back in part 1, we had a look at some of the new features of RSpec, and we used those features to create a query-style controller action. In particular, it listed out all the widgets in our inventory management system. This time around, we’re going to look at a command-style action: creating a new widget.


Specifying Ruby on Rails Controllers with RSpec Part 1: Query-style actions
Published in Programming .

RSpec has come a long way since I last used it in anger. Today, I’m starting through a worked example on test-driving a Ruby on Rails controller with RSpec, Capybara feature specs, and plenty of mocking. Along the way, we’ll see some neat new features of RSpec in action.


Front End Development 101 Part 1: Goals, Go, Node and Bower
Published in Programming .

I could easily be labelled as a “[Ruby on] Rails Developer” and I’m quite content with the asset pipeline for managing various front-end web development assets (Javascript, CSS, client side templates, images, fonts, etc). But since I’m playing around with Go for back end development on my current project, I thought I’d investigate current practices for managing assets on the front end. This is a rambling log of what I learned while I was playing around.


tmux: New Windows in the Current Working Directory
Published in Ops .

I could have sworn that tmux used to launch new shells in the current working directory of my active shell when it spawned new windows/panes. In this post, I discover that it wasn’t my imagination, that it no longer happens by default, and how I can get the behaviour back again.


Markdown Cheat Sheet
Published in Writing .

While I remember most of the Markdown syntax that’s commonly available (after all, it’s “just” like writing plain text email), there are some bits and pieces – usually extensions to the language – that I forget. This is my attempt to document them so I’ll remember in future.


Personal Code Review
Published in Programming .

I have a micro work flow I use when I working with git, usually – but not always – while I’m developing software. Most git work flows talk about a larger scale, so I thought I’d share my own, personal, micro work flow.


National Novel Writing Month
Published in Writing .

I did it! I successfully validated 50,340 written words for NaNoWriMo by the end of the month. I am inordinately pleased about that, even if it pushed me off my regular blog/morning pages schedule a little. This is a little retrospective on the month.


Death of a Gruffalo
Published in Writing .

It all began with a mouse strolling through the deep, dark, wood. How could the Gruffalo live with the shame?


Walking
Published in Writing .

I love walking. The world is full of beauty, and the best way to find it is to wander through it. It’s good for your physical health, and it’s good for your mental health. It can be an opportunity to relax, to learn, or to socialise. Really, you shouldn’t read this; you should go for a walk instead!


The inner game of pool
Published in Writing .

It’s a funny old game, pool. But how do you learn to play it? Malcolm and I experiment a little with it, and have some insight on how to learn/teach along the way.


Planning
Published in Writing .

How did I ever talk myself into getting involved in NanoWriMo? Well, I’d been thinking about it for a while, to be honest. I’ve really been enjoying writing lately. It’s been theraputic. But then a conversation happened on Twitter, and a handful of friends all said they were going to give it a shot and, well, in some fit of craziness, I said “yeah, count me in!”.


A new hope
Published in Writing .

I get back on the horse - start blogging again - by talking about some of the ways in which I’ve encouraged myself to write again, and some of the Gremlins that have been stopping me from doing so in the first place.


MySQL and time zones
Published in Programming .

It turns out that MySQL has support for time zones, but doesn’t have the necessary information to support named time zones out of the box. Once we have that sorted, there are some new and exciting ways we can query local times while storing them as UTC in MySQL.


Pulling an Espresso
Published in Kitchen .

Has Bean, my goto place for beans and guides to brewing coffee, doesn’t have a guide for pulling espresso (which is fair enough, I suppose, seeing as they’re brew guides!). So here’s what I do. I wrote this note in EverNote a few weeks back, and was showing it to Annabel this morning (in the hopes of getting a coffee in bed!). She suggested I publish it here.


All late projects are the same
Published in Writing .

This is the first in a series of posts where I actually digest and write about articles I’ve read elsewhere. What better way to understand something you’ve read than try to write about it? Of course, with this blog’s track record, it may well be a series of one. :)


Shower Power
Published in Programming .

A few weeks ago, I watched a talk from CUSEC 2012 by Bret Victor called Inventing on Principle where he described the principle by which he lives his life. You should go watch the talk now, it’s awesome. I’ll wait.


Retrieving BigDecimals from a database with Anorm & Scala
Published in Programming .

In which I take a long, long time just to retrieve a couple of numbers from a DB and display them on a web page. Ah, the joys of learning a new programming language, framework and ecosystem, all at once!


Today I Learned: Vim command line fu
Published in Ops .

In which I learn some useful shortcuts to make life faster with the Vim command line.


Symlink corruption on Mac OS X
Published in Ops .

Mac OS X on my desktop computer (a newish 27” iMac, using a Promise Thunderbolt disk array for the root filesystem) seems to be having filesystem troubles. I notice it through symlinks going awry, though I’m sure they’re not the only victim. I tidied all the errant symlinks up two weeks ago, hoping it was a temporary glitch, but they’re back again today. Here’s an example:


How to install a working set of compilers on Mac OS X 10.7 (Lion)
Published in Ops .

Xcode 4.2 removed GCC, which seems to be causing a bit of confusion. Here’s a bit of background and a workaround ‘til the dust settles.


Running tmux in Mac OS X Terminal
First published in Ops . Last revised .

I’ve been a fan of screen for … a while now. But since I like being one of the cool kids, I’ve been using tmux for the past year or so. Last week, I noticed that every time I launch a new terminal, I wind up typing tmux attach-session. Let’s streamline, a little bit.


Give me back my # key!
Published in Ops .

Since I switched on “Use option as meta” in my Terminal app, I’ve lost my hash key. Can I have it back, please? Plus a bonus tip for quickly commenting out commands at the command line.


Understanding the Rails Logger
Published in Programming .

I’ve lost track of why now, but I’ve spent a bit of time this afternoon trying to understand how the Rails logger works in production. For years we’ve been using a Hodel 3000 Compliant Logger, which is dead straightforward. Recently, though, we switched back to using the built in logger with Rails, which is a little more subtle.


Ruby Timeout Woes, Part 2
Published in Programming .

in which I discover how Ruby’s Timeout implementation actually works, and discover why some of our code inside a timeout block never really times out.


Ruby Timeout Woes, Part 1
Published in Programming .

in which I discover that the behaviour of Ruby’s built in timeout mechanism has changed slightly between Ruby 1.8.x and Ruby 1.9.


Pimpin' TextMate (aka Top 5 TextMate Plugins, 2011 Edition)
Published in Ops .

I’ve put together a list of the indispensable TextMate plugins that take a great editor and make it awesome, including enhanced file finding, project search and Lion full screen support.


Using tcpflow
First published in Ops . Last revised .

Sometimes, when you’re writing applications that use a library to talk over the wire to a remote service, it’s difficult to see how the high level API the library exposes translates into the on-the-wire protocol. Funnily enough, I was having that very problem yesterday, so I dug tcpflow out my toolbox to better understand what was happening.


Installing on my Mac at home
Published in Ops .

This is a short tutorial on connecting back to your home Mac via SSH, through the magic of MobileMe, then downloading some software, mounting the disk image and installing it, all without the need of the Mac OS X GUI. I use VirtualBox as an example, but it should work for any standard Mac OS X installer.


Using SagePay in your Ruby Projects
Published in Programming .

Once upon a time, in a galaxy far, far away … Ok, I’ll stop now. A few years back, I was working on a client project and they needed to integrate with a billing platform. They’d already picked Protx (now SagePay) as their platform of choice, and in particular, the Server variant. Wait, I’ll backtrack. SagePay has three variants:


Converging your Home Directory with Chef
Published in Ops .

In this tutorial, I’ll take you through using Chef and Homebrew to manage your home directory in Mac OS X. I’ve also included a neat cookbook which will allow you to use Homebrew as your native packaging system in Chef.


Equality, Comparison and Uniqueness in Ruby
Published in Programming .

Ruby has the Comparable module, which, if you implement the spaceship operator <=> (winner of “Best Named Operator” 10 years running!) then it will give you a bunch of comparator operators for free (<, <=, ==, >= and >). Win. Enumerable’s #sort method uses the spaceship operator to do sorting too, so implementing the spaceship gives you a whole bunch of interesting behaviour pretty much for free.


Updating the path everywhere on Ubuntu 09.10
Published in Ops .

Ubuntu is my Linux of choice. It has been for a long time. I’ve been a huge fan of Debian since the late ’90s – I was a Debian Developer stuck in the NM queue for a few years – but the release cycle was way too long for my tastes (which invariably meant I kept most of my systems running testing or unstable). So I switched to Ubuntu pretty early on.


Why Ruby (and Rails) is Awesome
Published in Programming .

I was invited to give a short introduction to Ruby on Rails at Tech Meetup in Edinburgh a couple of days ago. I’d been racking my brain for days on what to talk about – 15 minutes is too short for me to give a meaningful introduction to Rails – and eventually settled on telling a few stories.


Using git submodules to track vendor/rails
Published in Programming .

In a previous post, Using git submodules to track plugins I introduced the idea of using git submodules as part of your workflow in developing Rails applications. At the time, Rails itself wasn’t using git, but that has finally happened. You can find the official Ruby on Rails source code repository at http://github.com/rails/rails. So, how to we track Rails with git submodules?


Read-only clones and committing changes to submodules
Published in Programming .

Hopefully this will be a shorter article, but I thought I’d get the tip into Google before I forget it and have to Google for the answer. :-)


Using git submodules to track plugins
Published in Programming .

Since the core Ruby on Rails team is finally actually moving to git, and a whole slew of other projects are following in their wake, now seems like a good time to write up my experiences with using git sub-modules to track external dependencies. Back in the world of Subversion, I had been using Piston to track external dependencies. This allowed me to import third party dependencies from their subversion repository into my own application’s repository, keep track of specific versions and even make my own local changes.


Convention for RESTful search in Rails?
Published in Programming .

Back in RailsConf Europe last year, at David’s Keynote, it was said that:


Capistrano 2 Rocks My World
Published in Programming .

Last night I gave a wee presentation to the Scottish Ruby User Group about Capistrano 2, and some of the ways I’ve been working with it over the last couple of weeks, since for some reason I seem to have been immersed in it for a couple of different projects. It’s nothing particularly groundbreaking, but I figured it was useful to demonstrate some of the things it’s capable of, and how much easier it makes my life on a daily basis. You can find a copy of the slides here, complete with my speaker notes:


Integrating capistrano with SMF
Published in Ops .

I’ve got a new application I’m in the process of deploying in order to demo for a client (no, it’s not ready for everybody else to have a nosy at just yet!) and figured I’d take the opportunity to learn two things:


Best Practice with sudo
Published in Ops .

I just found this lecture in some documentation I’d been writing for a client. Clearly I was running through an install, documenting it as I go along, and was filling in time while something happened. Anyway, I thought I’d share it here:


Solaris: Bonding network interfaces
Published in Ops .

I’ve managed to find a new home for the Thumper. The noise it’s making is driving me absolutely batty, and I have to switch it off at night. I’m also worried about it overheating as the weather starts to improve. So I’ve managed to secure a deal with Below Zero, an ISP based in Edinburgh with an amazing world-class network. We’re going to shift it into the new place tomorrow, so I’m preparing by changing IP addresses before it moves.


Thumper: Debugging and not jumping to conclusions
Published in Ops .

In a previous post, Thumper: Putting Blastwave on ZFS, I quickly saw some information and jumped to completely the wrong conclusion. In the comments, Boyd kindly pointed out that I should probably investigate it a little more thoroughly. So I have. Just to recap, effectively I am trying to install software, with pkgadd onto a ZFS filesystem. The full filesystem is 17 terabytes, and still has 17TB available. The steps I followed were:


Thumper: Putting Blastwave on ZFS
Published in Ops .

Since the root file system is a meagre 11GB, I figured I’d try and use my ZFS pool for installing Blastwave which is a system built on top of Solaris’ own packaging mechanism with access to lots of extra software that I can’t live without. Like sudo for example, at least until I figure out how the Solaris native RBAC mechanism works! So, I did something along the lines of:


OMG! EXTREME CRITICAL EMERGENCY!! EVERYTHING'S BROKEN! People are DYING!
Published in Ops .

So my email isn’t working this morning. Somehow the MX record for woss.name has, well, disappeared. Maybe DreamHost got offended that I switched to GMail and decided to get their revenge. Maybe I buggered something up (I was doing stuff in the DH control panel yesterday afternoon, but I don’t think I touched woss.name). Or maybe the gremlins got to it.


Howto: Using Mail.app to archive your GMail email
Published in Ops .

I’ll write this while I have the chance, since my mail inbox will be strangely quiet for the next few hours…


Setting up a local name server on Mac OS X
Published in Ops .

I’ve been using account_location for a couple of applications recently. It’s a really nice way to give individual ‘clients’ of an application their own domain and when we come to scaling up, it’s a really easy way of splitting customers across several hosts. So, yeah, very nice. And it’s dead easy to deploy in the first instance – a couple of DNS records along the lines of:


Migrating your Rails application to Unicode
Published in Programming .

Update Make sure you read the comments on this post before considering it. In particular, Pete brings up some concerns about applications having data which is already UTF-8, but marked as Latin1 in the database, may cause problems.


Switching to Gmail from DreamHost
Published in Ops .

I’ve been using DreamHost for a number of things over the past couple of years – web sites (including this one), email, subversion hosting, that kind of thing. But really, things have been going wrong too often, particularly with email:


Getting Started with a Sun T2000
Published in Ops .

This is the first part in hopefully what will become a series on the trials and tribulations I have with a Sun Fire T2000 over the coming weeks while I have it on trial. This is going to be an interesting experience; I have used Sun kit extensively in the past – I was one of the sysadmins for the Tardis project while at University, and since then I’ve run a variety of Internet services on Sun hardware, ranging from a SparcStation 5 (homer.mathie.cx, who used to be in the Usenet top 1000 peers, something I consider impressive for that calibre machine sitting behind a 512kb/s leased line) to a Sparc Ultra 30 (initially my desktop machine, eventually drusilla.wossname.org.uk, a replacement for homer). So I’m reasonably familiar, if a little rusty, with Sun hardware and Solaris. OK, OK, homer ran Linux, but at least all the Tardis kit was a mixture of Solaris 7 & 8 (with one machine, brigadier still running SunOS 4.1.4!).


Using launchd on Mac OS X
Published in Ops .

launchd is Mac OS X 10.4’s replacement for init, cron, (x)inetd and all the various startup bits like /etc/init.d or /Library/StartupItems (as was the preferred way in Mac OS X up to 10.3.x). It’s all replaced with one supervisor daemon which controls the startup (and restart upon failure) of daemons, schedules regular running of tasks and other hoopy things. I’ve been reading a little about it at Introduction to Tiger Terminal part 5 and Getting started with launchd trying to figure out how to make it work for me. And I came up with settings, that will launch the Darwin Ports copies of both MySQL and PostgreSQL on demand, which you can download here: mysql4.plist and postgresql.plist. Place those files in /Library/LaunchDaemons and, to get launchd to notice them, run the following:


Ejecting CDs
Published in Ops .

It would appear that, somehow, I am the killer of Apple Powerbook G4 CD/DVD drives. It’s not that they stop working, it’s just that they refuse to relinquish their media. I had always thought it was a problem peculiar to my previous Powerbook, a 12” G4. It would often take days of attempt to get it to cough up the CD I’d inserted. So that I basically stopped using the drive wherever possible, particularly since having a CD inserted – even unused – whilst on batteries does unnecessarily drain power.


Subversion and NFS file locking
Published in Ops .

I should prefix this with a warning: I know next to nothing about file locking and the implications of what I’ve just done. However, it now appears to work, and I’m not too worried about simultaneous access to my subversion repository since I’m the only one that uses it. (Even the web interface is currently running from a read-only mirror of the repository.)


Using ssh-agent and screen together
Published in Ops .

I’ve been meaning to ‘fix’ this for ages. I use public-key authentication for my ssh connections wherever possible. I also use screen all the time. (If you use ssh regularly and haven’t discovered it already, go look now! There’s a bit of a learning curve, but it’s well worth it!) But the SSH_AUTH_SOCK isn’t always set correctly inside a screen session, so you can’t then use the ssh key on the client computer to authenticate against other hosts. (Oh, I also have a reasonably strict policy of only ever create SSH keys for hosts that I am actually, physically, at the console of, not for hosts I merely ssh into now and then. There are, of course, exceptions to this rule!)