11–17 October, 2020

The Heb — Race on the Edge was due to run on 12–13 September 2020 but was postponed to May 2021 due to Coronavirus. So we went there on holiday to spend some time doing some of the sections at a more leisurely pace instead.

We got the boat from Uig on Skye to Lochmaddy on North Uist on Sunday morning. We spent four nights at Balranald, nipped over to Harris for two nights at Pairc Niseaboist, then back to Balranald for one more night.

Sunday 11 October — Eaval

Run: 9.6km, 1 hour

George and I decided to run the off-road…

That quick fix that you hate to do but can’t avoid. Usually it’s because there’s a problem in production that will take a few days to fix properly but waiting that long will cause problems. Or a workaround for a broken third party component while you wait for them to fix it. Whatever the reason, you’ve written some code and it’s temporary.

The trouble is, temporary code has a habit of lasting a long time. So when I do this, I think of a date by which it should be fixed by and build in a failure in my tests…

You know the pattern. I want to unsubscribe from your newsletter. But you don’t want me to go. You want to keep numbers up.

Making things bright and obvious and irresistible helps drive sales. The big, green “buy” button. Pretty pictures of your product. It’s common sense.

So if you don’t want someone to do something then you make it small and dull and hard to find. Right? Here’s an email I just got:

(not picking on this particular company — they’re typical of many)

Great. Nice picture. Nice “Buy Now” button. There’s a footer. The font is tiny and grey: I guess they don’t really want me to read that…

Read more if you use version control for software development…

Don’t Break the Build

It’s easy to do. I’ve done it (lots of times) but my intention is that all tests pass with each commit. For bonus points (and who doesn’t want bonus points?), any new tests that need to be written should also be included in the commit. The commit is a little, happy parcel of code.

If you find yourself writing a series of commit messages like this then I suggest you are committing too often:

  • Update widget method to cope with pears as well as apples.
  • Fix up call to widget…

It’s good practice for your automated testing not to require a network connection to an external service to run. At the very least, using an external service is going to slow down your tests (and it could have other consequences).

One solution is to stub out or mock calls to external services, but it’s easy to forget to do that. For instance, let’s say we using HTTParty to POST data to an external website.

class FooClient
def self.send_data(value)
HTTParty.post(url, body: { value: value })

And here’s a test for it (using Minitest Spec and Mocha but the principle…

This might be of interest if you use the AASM state machine gem and Ruby on Rails. If not, well, I warned you.

Let’s take the example, from the AASM documentation, of a Job. You can run it, sleep it or clean it. We want to have an UI that allows an operator to control the job with a series of buttons.

class Job
include AASM

aasm do
state :sleeping, initial: true
state :running, :cleaning

event :run do
transitions from: :sleeping, to: :running…

A story about deploying code to a production website. It’s not a disaster, and no customers got upset but I made our customers wait an extra second or two to load a page and that isn’t good.

Upgrading MySQL

I decided to upgrade MySQL on my Mac from 5.6 to 5.7 and that was my first mistake. The upgrade was smooth enough, but after I did it I realized that the production server was running 5.6 and it’s a nice idea to run the same version.

No matter, I’ll just install 5.6 again. I use Homebrew so I just uninstalled 5.7 and…

Bill Horsman

Internet person interested in useful and beautiful. I live at the feet of the Angus Glens, beside a loch. More at http://bill.lgc.li

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store