Category Archives: Uncategorized

I have moved my blog

It’s now at https://willj.net/. Check there for new posts.

Fixing errors installing the charlock_holmes ruby gem

This gem can be a PITA to install on a mac, this is what worked for me. If you get this error:


charlock_holmes -v '0.7.6'
Building native extensions. This could take a while…
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.
current directory: /Users/will/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/charlock_holmes-0.7.6/ext/charlock_holmes
/Users/will/.rbenv/versions/2.6.1/bin/ruby -I /Users/will/.rbenv/versions/2.6.1/lib/ruby/2.6.0 -r ./siteconf20190213-34122-e636v8.rb extconf.rb
checking for -licui18n… yes
checking for -licui18n… yes
checking for unicode/ucnv.h… no
***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/Users/will/.rbenv/versions/2.6.1/bin/$(RUBY_BASE_NAME)
–with-icu-dir
–without-icu-dir
–with-icu-include
–without-icu-include=${icu-dir}/include
–with-icu-lib
–without-icu-lib=${icu-dir}/lib
–with-icui18nlib
–without-icui18nlib
–with-icui18nlib
–without-icui18nlib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/will/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/charlock_holmes-0.7.6/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/will/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/charlock_holmes-0.7.6 for inspection.
Results logged to /Users/will/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/charlock_holmes-0.7.6/gem_make.out

view raw

gistfile1.txt

hosted with ❤ by GitHub

First, make sure you have installed the required dependencies:

brew install xz icu4c

Now, install charlock_holmes:

gem install charlock_holmes -v=0.7.6 -- --with-opt-dir=/usr/local/opt --with-opt-include=/usr/local/opt/icu4c/include --with-opt-lib=/usr/local/opt/icu4c/lib --with-cxxflags=-std=c++11

Why I returned my Macbook Pro

Recently I posted on Twitter that I’d returned my new Macbook Pro. Some people were interested in why, and what my experience was, so here is is.

Caveat: This is all my opinion. There are some people who like the new keyboard, USB-C, and the touch bar, but then there are people who like the music of the Beautiful South, so I wouldn’t draw too many conclusions from that.

Background

Back in 2014 I bought a new Macbook Pro, I got the mid 2014 model maxed out with 16GB memory, the 1TB SSD and the processor upgrade. It’s the machine I do all my work on, and spend a lot of my leisure time using, so for me the upgrades are worth the extra cost.

Screen Shot 2017-08-14 at 19.08.51.png

It was a real upgrade from my (I think) 2010 Macbook Pro. Faster, lighter, more capable. I don’t think I had a single gripe about it at all, it was a great machine.

Why upgrade?

This machine has served me well for three years, but for a while now has been suffering from the screen delamination issue that affected Macbook Pro screens at the time, and the trackpad has stopped clicking reliably. Neither of these are major problems, I use external monitors, keyboard and mouse.

MacBook-Pro-anti-reflective-wearing-off

It’s been hard to find the time to take it into the Apple store however as having it out of action for any period of time would be pretty hard to live with.

I finally decided that what I would do would be to get a new Macbook Pro, restore from a backup so I could continue working while my 2014 model was being repaired. I would then hand down the older computer to someone in my family. Three years should be time enough to feel like I was getting an upgrade, right?

About three weeks ago I received my new Apple Macbook Pro. Including two adapters the whole lot cost me £3,317.

The new machine

Before I start on my list of whinges about the new Macbook Pro, there are a few good points.

  • It looks good. Space grey is a pretty nice colour. I was unsure how I’d like it, but out of the box it is a really good looking machine.
  • It’s thinner. Though really not that much.
  • It’s lighter. Again, nice, but it’s not a huge difference, at least not to me.
  • The screen seems nice.
  • The new trackpad is gigantic.

That’s pretty much all the positive stuff I can think of, so on to the issues!

Short power cable

The first surprise was that there is a shorter (I think) power cable in the box. Previous macs shipped with a power brick that had a Magsafe connector on one side, and a power cable going to the plug on the other:

duckhead

Apparently £3,249 is too tight a budget to include a section of mains cable and a plug.

The new mac doesn’t have what Apple have dubbed the “extension lead” or as I prefer to think of it, the “long enough power lead”. I haven’t measured the old cable, or the new one, but the new one didn’t feel long enough. I get that a lot of people probably didn’t use the “extension”, but I did all the time, and in my experience more than half of the people I see also used it. There aren’t many chairs in my house that are an extension-less power cable distance from a plug socket leaving room to shift about, and no, all my furniture isn’t in the middle of the room.

This was honestly pretty surprising, so much so that I spent a couple of minutes wondering wether I was just being stupid and the extension cable was hidden in the box, but no, though I was still stupid there was no hidden “extension” lead. I cannibalised one from the 2014 power cable because the new cable wasn’t long enough to reach my machine on my laptop stand.

Apple sell this “extension” cable for £19. 19. UK pounds. Not some sort of Venezuelan bat pound or something that converts to £3.50 sterling. Nineteen. Fucking. Pounds.

12LpGu1.gif

No MagSafe

Magsafe was brilliant. It’s saved my laptop on several occasions. It seems Apple have totally forgotten, or are hoping we forget, the reason why Magsafe was so revolutionary.

Yeah bitch, magnets, ooooh indeed. A week into using my new Macbook Pro I had an incident where Magsafe would have helped. I switched my sit/stand desk to standing mode, as I do several times a dayweekmonthyear. The power cable had got caught on something and I only realised there was a problem when my laptop stand started to bend. The USB-C power cable was under incredible tension and I had to lower my desk to free it. Magsafe would have just popped out. With this new machine if I’d not noticed I could have broken my USB-C port or power plug.

landscape-1477587655-merg

Yes, I can buy a third-party adaptor, but I shouldn’t have to. Maybe you missed the £3,317 figure earlier, or didn’t watch that video where Steve Jobs explained how much of a PITA it is to have your laptop yanked onto the floor.

No magsafe adaptor

One of the great things about having had a few macs over the years is that I’ve got a decent number of power cables. If I head to my living room I can pretty much guarantee there’s a power cable I can use. If I go and work in the garden I don’t have to unplug the power cable at my desk. I can keep a power supply in my bag all the time.

These are all Magsafe 2 power supplies. Apple doesn’t sell a magsafe to USB-C adaptor, so these power supplies are all basically useless to me. The magsafe power cable that comes out of my Apple lightning monitor? Can’t use it.

B_xz4KIU0AAD-iy

Dongle hell

The dongle situation on the new Mac is pretty crap. Just to get the same functionality that was completely built-in to my 2014 Mac I had to buy three:

– USB-C to Lightning
– USB-C to regular USB
– USB-C to mini display port (third party)

comparison

Yes I know that’s not a 2014 MBP, but that 2017 photo is legit.

And that was just to get it all working as it was day to day before (and ignores the magsafe power cable coming from the monitor issue). If I want to plug an HDMI monitor in, or an SD card I need more adapters. To make matters worse, the USB-C to mini display port adaptor I had to buy from a third party because Apple doesn’t make one. Maybe the USB-C to Lightning one works for this, maybe it doesn’t, I don’t know. Nothing I read on the Apple site suggests it does.

I get that USB-C might be the future, but having to buy, carry, and juggle multiple adaptors is a crappy experience, and are SD cards really so anachronistic that they don’t deserve a port of their own?

That keyboard

The new keyboard is loud. The sort of loud that I’d feel self-conscious and a bit selfish using in an open plan office, coffee shop, or train. I don’t quite get how Apple thought that the noise of typing on the new keyboard was OK.

thorhammer-ft

Typing on the 2017 Macbook Pro.

The keys are much bigger, closer together, and lower profile. Though I think could have got used to the keyboard, it was annoying. Lower profile and closer together meant that my fingers couldn’t “reset” their understanding of their position on the edges of the keys so well. This meant I made more mistakes and found it harder to type fast. I was put in mind of the feeling of typing on an iPad with it’s lack of tactile feedback. Put in mind of the feeling of typing on an iPad with a rubber mallet.

I much preferred the 2014 model. I’m not sure if the drive for thinner laptops is worth the decrease in comfort and the *THUD* *THUD* *THUD*.

Touch bar

The touch bar feels like a gimmick, and one that ultimately detracts from the usability of the machine.

Screen-Shot-2016-03-29-at-12.49.14-PM

Juicero will surely go bust when someone launches an “Uber for juice”

When looking at the screen it required a context switch to use. Instead of having a predictable set of buttons I now need to look away from the screen, look to see what functions are available on the touch bar and where, use them, then get back to what I was doing. Every operation that I made on the touch bar was slower and more interrupting than the same operation using either a static set of buttons, or the mouse.

The most annoying change though was the lack of physical escape key. I knew I rested my finger on the escape key a lot (no, I don’t use Vim as my primary editor) and was curious how it would fare. Ultimately it was annoying.

Touch ID

I’m pretty uninterested in this. I used it to unlock my laptop and 1Password, but it wasn’t really much faster than the keyboard, if at all. I didn’t use Apple pay (though I do on my phone). Fingerprint recognition on the iPhone feels like a step up, if this is an advancement then it doesn’t feel like a large one.

E-T-phone-home-424505

It doesn’t feel revolutionary in the way I think face recognition might do.

Performance

I know the laptop was faster than my 2014 model, but there really didn’t seem to be much in it. I’m not sure what I was hoping for here, but I guess what I discovered is that my 2014 laptop was fast enough.

The new model still had 16GB RAM and a 1TB SSD, so there was no change there.

Conclusion

If Apple had made a laptop with the same keyboard from 2014, the same set of ports, magsafe and no touch bar I would have kept it even though it really doesn’t feel that much different performance wise than my 2014 machine. If I was switching from a 2010 mac this would have been an upgrade, but I’m not.

Individually these issues I could probably have lived with and got used to. Just ponied up £19 for a stretch of mains cord, or taken the risk of not having magsafe, but taken together they were more than I was willing to put up with.

If you like touch bars and bad keyboards, already carry a separate bag for adapters for your computer, or have no chair in your house further than 50cm from a plug socket you’re going to love this machine. If you’re upgrading from a crappy Air from 2010 it’s going to be an amazing speed upgrade with some irritating dongle shenanigans, but for me it was just disappointing.

Don’t take my word for it though, go ahead and get some more opinions, some people really like the keyboard, some people like the touch bar. These niggles are just the things that irritate me personally. Perhaps try one out. Apple make it really easy to return a laptop you decided you didn’t want.

Returning the machine

Some people asked me about this, so here are the details. You can return most stuff to Apple really easily, even if you’ve used it, for up to two weeks. They even pick it up via UPS. Just make sure you return it within the time limit.

If you want to give the 2017 Macbook Pro a go you can order one and as long as you’ve not yanked it onto the floor by the power cable and bent the lid then you can return it to Apple for a full refund.

Basic pasta sauce

Someone asked on Twitter how I made my pasta sauce, so here it is!

z

The base of my Pasta sauce is largely this recipe, except I mostly don’t add mozzarella:

At it’s simplest I can make the whole thing for one person in 19 minutes, so it’s great for lunch.

Ingredients

85g dried pasta per person (50g per child). You can use whatever you want, I prefer spaghetti.
1 punnet of good tomatoes, about 225/250g (small ones, eg. baby plum, sunstream etc.)
Small bunch of basil or parsely.
Salt & Pepper
1 clove of garlic
1 chilli, I don’t de-seed
Olive oil

Method

To start, boil some water in a medium pan. Add a decent amount of salt. While the water is coming up to the boil prepare the other ingredients.

First, chop the tomatoes, you can leave the skins on. I chop mine in half, I prefer the texture. It is also quicker. Finely chop the garlic and chilli. Roughly chop the basil or parsley.

As soon as the water comes to the boil, add your pasta. Now heat some oil over a medium heat in a small frying pan. Add in the chilli and garlic. Make *really* sure not to burn the garlic. Before the garlic browns add in the tomatoes then a good pinch of salt. Stir around for a few seconds. Now add in some water. It’s really easy to add in too much, you want just enough to cover the base of the pan, any more and you’ll end up with soup. You can always add more if you need to.

Next, add the basil or parsley. Stir through. When the pasta is al dente drain it retaining some of the cooking water and add to the sauce, stir around. Add pasta water if needed. You should still be able to work out what each of the individual parts of your sauce are made of. If you can’t you cooked it too long and/or added too much water.

At this point you can stir in mozzarella, I mostly don’t.

Slap it on a plate, grate parmesan over it and eat it.

Notes

With practice I’ve got this down to 19 minutes for the simple version, you might be faster if you can boil water faster than me. Adding more stuff makes it slower obviously.

Only get good tomatoes. They have to taste of something, if they don’t taste of anything your sauce will be crap. If you can’t get good fresh ones (or they have a gazillion air miles on them) use a *good* tin. It’s not as good and doesn’t work as well with the parsley or mozzarella versions, but it’s better than the alternative.

This sauce is great by itself, but you can add to it as you want. Some black pitted olives from a jar are great. If I’ve got other veg lying around, or more than one person eating I will add that too, depending on the density of the vegetable and how finely it is chopped depends when I add it. Chop it finer to cook it quicker. A good addition to bulk it up is a sweet pointed pepper & celery soffritto. One pointed pepper and 2 celery sticks is about the right balance with one punnet of tomatoes. Fennel and black olive are great too. Just be careful not to overdo it. There’s enough sauce with just the tomatoes for one person, less is more when adding extra ingredients.

If you do add more veg, try to keep the tomatoes per person ratio the same IMO.

In the photo above I went a bit mad and added:

– sweet pointed pepper & celery soffritto
– 1 small bulb of fennel, thinly sliced.
– Bacon*

It was really a bit too much.

*Bacnon! Chop some aubergine into ~1cm cubes or strips, one handful should be enough, think proportional to the other ingredients. Put on some foil, sprinkle salt on, create a parcel (crimp the edges to keep the water in) and oven cook at ~180°C (?, experiment) until just soft. Aubergine is great for adding some a bulky umami flavour in-place of meat.

I think that’s it! Nail the basic sauce then experiment on top of that and you’ve got a handy and versatile base!

Tagged , ,

The security of a system is as strong as it’s weakest component

The pad lock that had seized shut on my back gate was proving hard to remove, the hardened steel U was not yielding to my hacksaw. I noticed some rivets underneath that turned out to be soft steel. 10 minutes of sawing and I was in.

IMG_8951

Hardened steel U

IMG_8950

Soft steel rivets on the bottom

IMG_8953

After removing the rivets, hammering off the bottom plate

IMG_8955

Bottom plate revealed, lock mechanism removed

IMG_8956

Lock open!

Random graph

Random graph, from playing around with RGL in Ruby.
Random graph

Tagged ,

Testing Github commit hook one liners

A couple of ruby one-liners for dumping out the content of a github commit hook payload:

For hooks that use type application/json:

$ ruby -rpp -rjson -rsinatra -e 'set :port, 8000; post "/*" do; pp JSON(request.body.read); end'

For hooks that use type application/x-www-form-urlencoded:

$ ruby -rpp -rjson -rsinatra -e 'set :port, 8000; post "/*" do; pp JSON(params[:payload]); end'
Tagged ,

New Pi mount, and testing the power requirements

Testing the robot power requirements

Before I pick a battery I need to know what power requirements my robot is going to have so I took it into the hackspace to test. I hooked it up to one of the power supplies then ran all the systems, so Streaming video off the Raspberry Pi over wireless whilst running the motors. I weight it down with a large motor (the big black thing) and then provided resistance, it peaks at about 1.6 amps.

In the video you can also see the new side mounted Raspberry Pi and the base of the ping-pong ball hopper.

Detail view of the side mounted Raspberry Pi and the base of the ping-pong ball hopper:

Raspberry Pi mount and ping-pong ball hopper base

Tagged ,

Creating animated gifs with imagemagick

In my last post I linked to some animated gifs I made on my mac. It’s pretty easy if you have imagemagick installed.

Simply get a bunch of images together and use the convert command:

convert -resize 900x -loop 0 -delay 10 DSC_8264.JPG DSC_8265.JPG DSC_8266.JPG DSC_8267.JPG DSC_8268.JPG DSC_8269.JPG DSC_8270.JPG jon_walk.gif

The last argument is the output filename. The options should be self explanatory, but you can check them up in the man page if you want to tweak the values.

Paula Deen riding things

I made some Paula Deen riding… pictures. Because I can. Find more here.