Monthly Archives: August, 2016

Ask your doctor about…

One of the things that strikes many of us visiting the US is the number of advertisements for prescription drugs, even on prime-time TV. This is not allowed in most other countries.

Vox has become rather good at producing short informative videos on a wide variety of topics; here’s their take on this subject…

In praise of integration?

Janet Daley, writing in The Telegraph about being an immigrant to the UK:

What does choosing to live in another country mean in today’s world? To my mind then (and now) there is no question that I had decided to become, for almost all intents and purposes, British. The whole point of my decision was that I admired the values and attitudes of this country. Why else choose to live here?

Residing in a country did not seem to me to be simply a matter of adopting a flag of convenience under which it would be possible to live any way one liked so long as the local circumstances facilitated it. In fact, the old countries of Europe were attractive precisely because they had established cultural histories and an inherited stability that the US – with its constant social churn and neurotic insecurity – lacked. You came to live in Britain because you wanted to be part of what Britain was.

The European Union’s “free movement of people” rule and its obtuse confusion over the assimilation of migrants seem deliberately designed to undermine any such notion of cohesive national identity.

What will preserve the integrity of a nation’s institutions if the collective memory of its history is lost?
You need not choose anymore. Your habits and social assumptions need not change. You can have it all: any number of nationalities; a whole wallet file of identity documents; a peripatetic working life that drifts in and out of what would once have been communities but are now simply transit stops in a migratory existence.

Maybe you think this is progress. I can understand the argument which says that it is liberating: a new form of personal freedom. For the young and unattached, this may be – temporarily – true. What bliss to come and go across defunct borders, working and living without encumbrance wherever you please, as if life were a permanent gap-year adventure.

But what happens after that? When the responsibilities of grown-up life cause people to long for rootedness and a real sense of hereditary belonging – what then?

And then there is the more urgent political issue: what will preserve the integrity of a nation’s institutions if the collective memory of its history is lost?

All characters portrayed are entirely fictional…

You know that strange disclaimer that appears at the end of every film? The earliest movies, of course, don’t have it. Have you ever wondered how it started?

Well, there lived a certain man in Russia long ago

The fens are alive with the sound of moosic

Yesterday we attended a rehearsal of the famous Grantchester Bovine Acapella Trio.

20160820-07570304-900

Actually, they were trying to reach this particularly tasty tree which was growing just a bit too far out over the river.

No trouble at mill

No trouble at t'mill

We paddled from home, through Grantchester, past Byron’s Pool and out towards Hauxton before breakfast this morning. Most enjoyable. This is the mill at Grantchester, taken from just beside Jeffrey Archer’s garden.

Saw kingfishers, ducklings, a comorant… Enjoyed a cup of coffee up a little tributary before turning for home.

20160820-08535712-900

Power pricing

Here’s a very rough rule of thumb which I find exceedingly useful:

If something uses 1W of electricity, and it’s switched on all the time (24 x 7), it will cost about £1/year in electricity.

So, for example, I have an elderly Mac Mini next to my television which used to be on all the time because it was my ‘media centre’ – it recorded things from the TV onto disk, etc. It takes about 80-100W, so it costs me roughly that many pounds per year, which means that if I turn it off I can get my Netflix subscription for free!

All sorts of calculations become pretty straightforward.

  • I have a second display for my iMac, which uses about 60W. (I’ve just measured it.) So that would be £60/year, but it’s only on for about 8hrs/day, so £20/year.

  • If a salesman tells you a new fridge will save you an average of 40W compared to your current fridge, but costs £400, you can work out easily that it’ll pay for itself in about 10 years.

In case you’re curious, this rule assumes you pay about 11.5p/kWh for your electricity, which is close enough for most UK residents. I forget who first pointed the convenient annual multiplication out to me, but I find myself using it all the time, so I thought I’d pass it on!

Framlingham

Framlingham Castle

Lend me your ears

Most of my ‘reading’ these days is in audiobook form. I have more time, and I’m more alert, when I’m driving or walking the dog than when I’m sleepily in bed after a long day and a glass or two of wine (though I do read in bed as well). I’ve written before about this — have a look at this post for some recommendations. The main advantage of listening over reading, of course, is that you can do it while leaving your eyes free for other tasks.

Listening to a book is different from reading it, of course – better in some ways, inferior in others – but some people also feel it’s cheating. Melissa Dahl, writing in New York magazine, suggests it isn’t.

Excerpt:

Researchers have studied the question of comprehension for decades, and “what you find is very high correlations of reading comprehension and listening comprehension,” Willingham said. As science writer Olga Khazan noted in 2011, a “1985 study found listening comprehension correlated strongly with reading comprehension — suggesting that those who read books well would listen to them well. In a 1977 study, college students who listened to a short story were able to summarize it with equal accuracy as those who read it.” Listeners and readers retain about equal understanding of the passages they’ve consumed, in other words.

Decoding, by contrast, is specific to reading, Willingham said; this is indeed one more step your mind has to take when reading a print book as compared to listening to the audiobook version. But by about late elementary school, decoding becomes so second-nature that it isn’t any additional “work” for your brain. It happens automatically.

According to the simple model of reading, then, you really can’t consider listening to a book to be easier than reading it.

For the record, though, I’d like people to know that I always listen to unabridged versions…

Thought for the day: talking to aliens

More great stuff from Neil deGrasse Tyson. Lots of good stuff in this collection of clips, but I like the 6-min section beginning at 9:53…

Freedom

20160806-13155527-Edit-900

Scene spotted at Aldeburgh last weekend. I have a feeling I should try selling this to a biking magazine…

Simply messing about…

Believe me, my young friend, there is nothing – absolutely nothing – half so much worth doing as simply messing about in boats.

Actually, I would recommend messing about in boats at breakfast time with a flask of freshly-brewed coffee and a bag of freshly-baked croissants.

20160814-09461904-900

Lovely clear water this morning on the Little Ouse between Brandon and Thetford.

20160814-10010909-900

The neighbours seemed friendly:

20160814-11465125-900

And even the Ship’s Dog had a good time.

20160814-09340502-900

Many thanks to CanoeDaysOut for suggesting the location.

Tips for using a private Docker registry

This is a geeky post for those Googling for relevant phrases. Sometimes a Docker Registry is referred to as a ‘Docker repository’; technically, they’re different things, but the terms are often used interchangeably.

It can be useful to have a private Docker repository for sharing images within your organisation, and from which to deploy the definitive versions of your containers to production.

At Telemarq, we do this by running:

  • a standard registry:2 container on one of our DigitalOcean servers
  • an nginx container in front of it, with basic HTTP auth enabled
  • a letsencrypt system to provide HTTPS certificates for nginx, so the communications are secure.

The registry container can, itself, handle both authentication and the certificates, but it’s easier for us to deploy it this way as part of our standard infrastructure. It all works very nicely, and we’re just starting to incorporate it into some of our more serious workflows.

So how do you make sure that the right images end up in your repository?

One practice we adopt for any deployment system, with or without Docker, is to require that things pushed to the servers should come directly from the git repository, so that they aren’t influenced by what just happens to be in the directory on some arbitrary machine at some time. Typically we might have a script that creates a temporary directory, checks out a known version of the code, builds and deploys it to the server, and then tidies up after itself. (If you use a continuous delivery system, this may happen automatically on a regular basis.)

In the Docker world, you can take advantage of the fact that the docker command itself understands git repositories. So you can build a container from the current master branch of your github project using something like:

docker build -t myproject git@github.com:quentinsf/myproject.git

and docker will do the necessary bits behind the scenes, assuming there’s a Dockerfile in the source. (More details here).

So, suppose you want to build version 1.6 of ‘myapp’ and upload it, appropriately tagged, to your Docker registry, you can do so with a couple of simple commands:

docker build -t dockerregistry.example.com/myapp:1.6 \
             gitrepository.example.com/myapp.git#1.6
docker push dockerregistry.example.com/myapp:1.6

I can run this on my Mac, a Windows machine, or any Linux box, and get a consistent result. Very nice. You could also tag it with the SHA1 fingerprint of the git commit, if wanted.

Listing the containers on your Docker registry

At present, there isn’t a convenient command-line interface for examining what’s actually stored on your registry. If I’m wondering whether one of my colleagues has already created and uploaded a container for one of our services, how would I know? There is, however, an HTTP API which will return the information as JSON, and you can then use the excellent jq utility to extract the bits you need:

curl -s -u user:password https://dockerregistry.example.com/v2/_catalog | jq .repositories[]

If you want to see the version tags available for mycontainer, you can use:

curl -s -u user:password https://dockerregistry.example.com/v2/mycontainer/tags/list | jq .tags[]

And you can of course wrap these in scripts or shell aliases if you use them often.

Hope that’s useful for someone!

© Copyright Quentin Stafford-Fraser