Been There, Done That, Blogged The Badge

Nearly four years ago now I started a project to blog each of my badges that I’d collected. With nearly three hundred badges to blog, I set myself the target of blogging two badges each week. As I have done that though, the collection has grown to over four hundred badges to date (due, a little more than I’d like, to some mischievous people who think that buying me badges whenever they can is a fun thing to do).

Now, I am finally up to date. And, although I’ll still be blogging new badges as I acquire them, the end to weekly ‘badge homework’ hopefully means I’ll have more time to devote to this blog and all the things that get me badges in the first place.

Do however take a look at my life in badges – so far.

Advertisements

How Large Is Your Latte

So Waitrose have caused a stir by announcing that they’re going to stop supplying disposable cups with their free coffee. Now, these days they are most often my takeaway coffee of choice, so clearly I’m going to have to jump on the bandwagon and start carrying a reusable cup. And that of course is where it starts to get complicated.

Now technically I already own one reusable cup; it’s a Starbucks one, used for peppermint lattes on long journeys, but it gets too hot to hold without the little cardboard sleeve so it’s less useful outside of a Starbucks. So perhaps an everyday cup is in order, ideally one that will also seal in the dregs when I put it back in my bag.

Now in the last few months there have been myriad reusable coffee cup reviews and comparisons so it didn’t take me long to narrow my preference down to either the KeepCup or the Ecoffee cup. In the process however I became aware that I would have to make another decision – how big a cup to buy.

Waitrose had only said “bring your own cup” and that it needed to fit in their machine*. So I contacted them to ask both the size of the regular latte from the machine but also the size of the large, which they sell in their cafe. After talking to them via customer services and Twitter I finally established that a regular coffee is apparently 8 fl oz and a large one is 10 fl oz (although the disposable cups they use are much bigger).

But by now I was considering the bigger picture. My main alternative coffee supplier is Costa, but I’m not hugely fussy, I’ll buy a coffee wherever is convenient, so I started comparing coffee sizes and prices.

Naturally I made a little spreadsheet so here are the highlights. Coffee sizes vary widely but in general a regular coffee is 12 fl oz. Caffe Nero and Greggs also do a large at 14 fl oz whereas Starbucks and Costa will super size you at either 16 or 20 fl oz (I rarely need a pint of coffee).

Obviously, the cheapest coffee is free from Waitrose but astonishingly the most expensive would be a large coffee from Waitrose if you have to pay for it.

After free Waitrose coffee, Greggs and Costa are cheapest. Allowing for the discount for bringing your own cup doesn’t change much except that Pret is now cheaper than Costa (that’s because Pret gives you 50 pence off as opposed to Costa’s 25 pence). Caffe Nero give you ‘bonus stamps’ on their loyalty card, I only allowed for the one extra coffee that gets you when calculating the discount (so not including the ordinary loyalty stamps).

If you want value for money in volume then large coffees are generally better than regular ones and again, obviously, don’t pay for coffee in Waitrose!

Where does that leave me? Well, despite the lure of the ‘value for money’ argument of a larger coffee, I think a 12 fl oz cup would be big enough for an everyday coffee cup. Now I just have to choose the design I want.

*Waitrose reckon 15cm is the maximum cup height that fits in their machines.

Flex 2 vs Vivosmart 3 – An Unlikely Comparison

So at the moment I’m walking around with two fitness devices on my wrist. Why? Because having just bought a Garmin Vivosmart 3 it seemed like a good opportunity to compare it with the Fitbit Flex 2 I’ve been using for the last year or more.

Now these aren’t devices that usually get rated against each other but my primary criteria puts them both in the same category; they monitor steps and sleep, have a silent alarm, receive call and text notifications, are waterproof and importantly both are small enough not to be bulky on a small wrist (and are moderately priced).
The Garmin also provides a screen and some more sensors which I’ll mention later.
Continue reading

From Telephones To Tudors

I recently discovered that there’s a national collection of telephone kiosks. I was far too excited by this news and was determined to go and see them.
They live at Avoncroft as part of a collection of historic buildings.
On arriving I was even more excited to find that the telephones actually worked and we could call between them. They were connected via a small exchange which, of course, we could also see working.
Having played there we set off to explore the rest of the museum, finding such gems as a prefab house, a corrugated chapel and a fibreglass spire. We also encountered some re-enactors, some of whom were doing Elizabethan dancing to a surprisingly recognisable tune.

Manchester Has Awesome People And Trams

I’d never been to Manchester but I was invited to go on what was a rather geeky day out, which involved lots of statistics and pretty graphs presented in Manchester Town Hall. The town hall is a most beautiful building and well worth a look in its own right. After a fascinating day we wandered out into the city and ended up in Piccadilly Gardens which was a hive of activity as they were preparing for the start of the Manchester International Festival; in particular for an event called “What Is The City But Its People?” which involved a giant catwalk and two massive screens. Well, as we were there anyway we decided to hang around and watch and we were very glad we did.

As people came along the catwalk, the screens showed us some beautiful portraits of them and told us a little about their life. From Stefan, who sells the Big Issue every day at Victoria station, to a Syrian refugee, a mother and her new baby, school children with dreams, lovers, bakers, an array of very well-behaved dogs and many, many more. A diverse community of people living their lives in a big city. Wow!

The next day we managed to find some time to explore the tram network, ostensibly to look for Eccles cakes in Eccles (be warned, there are none). However despite that, Manchester was an amazing city, and one I hope to see again.

Manchester

From Depart To Arrive Route
Exchange Square 14:47 St Peter’s Square 14:52 G/H
St Peter’s Square 15:01 Eccles 15:28 E
Eccles 16:50 St Peter’s Square 17:19 E
Piccadilly Gardens 18:52 Deansgate-Castlefield 19:03 E

 

Come and Sing – The Creation

It’s been a while since I did any ‘proper’ singing, so I was both delighted at the thought of another “Come and Sing” day and nervous as to whether I’d be up to the task. This was yet again with The Bach Choir but the time the piece was The Creation by Haydn.

Before the day I did my usual preparation, making sure that I had the score and working through it. I was pleased to discover that there was no splitting the choir into eight (as those parts are always tricky) but less pleased with Haydn’s definition of an alto. Really, there are some notes that should be left to the sopranos, did he not read the memo? He also throws in some fairly tricky fugal sections with several different variants of the same phrase.

On the day I put my worries aside determined to just do my best. I picked a good seat with a clear view of the conductor (once again the wonderful David Hill) and a Bach Chorister next to me (arrive early for these things, it pays off). The vocal warm up was fun and a real work out for the brain as well as the voice in places.

Then we settled down to work through the piece. We rehearsed chorus by chorus. David picking apart things into tiny details in places, simple things like breathing early (so you don’t come in late) or working to get the sound smooth and flowing. It was wonderful to work on making it sound beautiful. I felt an incredible sense of focus, with no other thoughts than the music (a musical ‘deep hack mode’ if you like).

And then rehearsals over, we were ready to perform for our select audience who, sitting at the front, were the centre of attention. They even got a round of applause. Once we started singing though, I was focused on the music, the conductor and not fluffing too many bits. Without soloists, so doing only the choruses, the time rushed by. So much so that we were treated to an impromptu duet of the opening with Philip Scriven on the organ and David Hill on the piano. Then it was time for us to sing the last chorus and our day was over.

Well, almost over, as it turned out there was a chorus of ‘Happy Birthday’ to sing to David in celebration of his upcoming ‘big’ birthday. Then it really was time to go home.

Yet again, an amazing, enjoyable, educational day.

 

Wrapping Text With ImageMagick

I’ve already explained that I wanted to create an image slide for a slideshow from some information in a spreadsheet. I decided to use ImageMagick and, in particular, the Wand library for python to help me.

As with all theatre projects this one is collaborative. The original concept for this was James’ and he’d created some examples by hand*. Each slide has some fixed elements and then information specific to the event. Using those he’s created some template images that contain the fixed elements, there are a number of templates depending on the type of event.

Basic SlideEach one has basically the same layout and the same (wavy) line which delineates where I can draw the event elements onto the slide. Then I add the date and time and the title of the event and who is presenting it. All of that is straightforward with either a Caption, or a Text element.

Image AreaThe more challenging part is the lower half of the slide. The spreadsheet contains a link to an event specific image in Google Drive, so I download the image data directly. I want the image to fit into, at most, roughly half of the remaining area, so I resize it keeping the aspect ratio but capping the height and width.

with Image(blob=image_data) as img:
    size = "{}x{}".format(max_width, max_height)
    img.transform(resize=size)
    img_height = img.height # save height
    img_width = img.width # save width
    main_img.composite(img, left=left, top=top)

Slide With Image

Now I want to display the description wrapped around the slide. ImageMagick will easily draw all sorts of amazing text effects (on one line) but text wrapping is more of a challenge. You can use a Caption to wrap text inside a rectangle, but my rectangle now has a corner taken out of it. Also I was asked to truncate the text at a sensible point (e.g. the end of a sentence) if it was too big to fit.

This is the point for some funky arithmetic. Firstly create a Drawing and set the Font you want to use on it. Now text is either going to be next to the picture (a narrow line) or underneath it (a wide one), so using the font size and the height available, and of course the actual image height and width, calculate how many lines you can fit of each width. Now we just need to split the text into that many lines each of the right length.

The simplest way to split the text is to use the python textwrap module but that requires you to specify a fixed maximum number of characters and my font isn’t monospaced. Instead I use the Draw module’s get_font_metrics to do the same job. It requires a dummy image for some reason.

words = para.split(" ")
lines = []
with Image(height=10, width=10) as img:
  line = words.pop(0)
  for word in words:
    line_width = draw.get_font_metrics(img, 
      line + " " + word).text_width
    if line_width < max_width:
      line = line + " " + word
    else:
      lines.append(line)
      line = word
  if line != "":
    lines.append(line)
return lines

Using this I can build up a list of lines of text. Firstly the narrow ones and then the wide ones, discarding any text that won’t fit. Then I can draw them onto the image line by line. Giving me a finished slide.Complete Slide

 

*James is also responsible for the spreadsheet that holds all this data. You should ask him about it, it’s awesomely clever.

From Spreadsheet to Slideshow with a Raspberry Pi

As well as actually spending time playing in the theatre I also occasionally get involved in various computer related projects for one. This particular project was to help set up a rolling slideshow of “coming soon” events that we can display in the foyer of the theatre.

Of course this project lends itself to a raspberry pi so I got mine out and started work. Everybody (it seems) creates a slideshow on their raspberry pi, so there are many solutions to choose from. In this case (you’ll see why in a minute) I wanted a slideshow that looped through pictures in a directory and automatically coped with pictures being added and deleted. For now I’m using Eye of Gnome which does this admirably but this can easily be replaced in future.

So where are the pictures coming from? Well that’s where this gets interesting. The list of upcoming events is kept and managed in a Google Spreadsheet so I needed to take this information and turn it into a set of images for the slideshow. As the information in the spreadsheet is regularly updated I wanted to write a python script that could be run regularly by a cron job to pick up changes and create the new slideshow images.

Google provide an API to Google Drive that allows access to files and file information and they provide a python library to access this.
I followed the instructions here to configure a developers account and then grant access to the APIs you need (in this case Drive and Sheets). I decided to use the OAuth for Server to Server authentication to avoid the need for human interaction, so the other thing I needed to do was to make sure that the service account has access to the files it needs. I did this by sharing the relevant files and directories in Drive with the service account’s email address. I only needed to grant view access to the files as we’re only ever reading the data.

Then on the pi I needed to install a few libraries, the Google API of course, a date parsing module and Image Magick to help create the images.

sudo apt-get install python-pip
sudo pip install --upgrade google-api-python-client
sudo apt-get install python-dev
sudo pip install ciso8601
sudo apt-get install libmagickwand-dev
sudo pip install Wand

Once that’s done I could write the script to download the data. The Google API documentation is full of example code so it’s easy to get this working.
Firstly I retrieve the modified time of the spreadsheet, using the Drive API, to see if it’s changed since we last ran. If it has then I download the data from the spreadsheet and check each row to see if it’s been updated (each row has a unique identifier and a last updated time-stamp). For each updated row I delete any existing image and generate a new one.
Finally I record locally the most recently updated time of the rows so I know when to start from next time.

Note (because it surprised me) that the latest updated time of a row might actually be later than the modified time of the file as there’s sometimes a couple of minutes delay before the file modified time is updated.

That really was all there was to it. Well, okay, there’s actually a few other things going on too, but that’s for another post perhaps.