Sunday, 31 December 2017

The year that was, 2017

Time to once again take stock of the last 12 months and that leads to an important question about 2017. Was it worse than 2016? For me, the answer is yes. Assorted burn-out issues have resulted in a significant decline in physical and mental health and a marked reduction in making things. That is something to fix for next year. Looking at the positives, I've survived a year in a new job and city and I've managed to catch up with a lot of friends from The Past. I've also managed to do Some Things, albeit Fewer Things than I'd have liked. Still, it hasn't all been Killing Floor 2 and Ultimate Chicken Horse.

  • 12 posts on this blog (13 including this one)
  • wrote a short story
  • another year of the Year in Pictures site, up to 15 photographers
  • over 385 contributions to various projects on github
  • completed GMing a 2 year 5th ed D&D game to great critical acclaim
  • got back in to playing D&D online
  • started planning a new regular game
  • created the university of bath RPG (post to follow on this)
  • went on a photography course to learn how to use my camera properly
  • 55+ pictures on my instagram account
  • loads of photos on my flickr stream
  • attended some cookery courses
  • updated my website and Gareth's website
  • lots of work with build pipelines and hosting
  • plenty of game recording, with sadly little to no video editing
  • a bit more voiceover work

I also hung up my abacus, finishing my time as a church treasurer and member of our church council with a financial presentation to the congregation. I've continued running the sound desk in the same church.

Resolution count: 3.5/10 - better than 2016. Still bad.

This coming year I'm going to try undoing the problems of this year - most notably fixing my health and writing more. I'm also starting a new role at work and I'm going to be spending more time going to see friends from university who have disappeared a bit. Here we go...

Thursday, 21 December 2017

Hosting a Rails App on Cloud Foundry - first impressions

From time to time I have been known to write a bit of code and whenever one writes a web application, there is always the question of hosting. I've done my time in Ops and I can certainly deploy an application to a VPS and run the surrounding infrastructure to make it work - however, that all sounds like more work than I'm willing to put in. This is the world of Cloud hosting and I'd like to spend my time writing applications, not deployment scripts. What I want is something I can throw code at and have it sort itself out but for my own projects the price needs to be low so I'm not spending a ton of money every month on my own games.

This is an interesting niche as I don't have the same requirements for my own stuff as I would for professional hosting. Initially my requirements were:

  • Very low monthly cost
  • Rails 5
  • Database (probably postgres)
  • Ability to hook it into some kind of CI (ideally Codeship, as I'm already using that)

For my own projects I'm not that bothered about high capacity, or extensive DR. These are great, but are also expensive.

I'm going to end up on Heroku, because the free tier appears to do everything I want and more. However along the way I tried out Cloud Foundry so I thought it worth writing up how I got started.

Easy stuff first

signed up for an account then created an org and a space on the dashboard. I also created a database within the space (no binding - it's better to do that with a manifest). This was all achievable via the web interface. The postgres service has the option of a free database, limited to 20mb storage.

Next, I installed the command line interface and logged in (cf l), choosing the space as the default.

Preparing the application

A Rails 5 application needs no additional configuration, beyond migrating it from sqlite to postgres. The easiest way to tie the application to the production database is via a manifest file. Mine looks like this:

- name: yip-helper
  random-route: true
  memory: 128M
  instances: 1
  path: .
  command: bundle exec rake db:migrate && bundle exec rails s -p $PORT
    - yip-postgres

The name becomes part of the subdomain on deployment. The memory is kept low to keep the costs down for a personal project. The service listed should match the name of the database created in the space, above. Stick this in the repository so it can be used with the CI later.

Now the application should be ready to deploy with a simple cf push.

Continuous integration

I use Codeship, and their docs worked fine for me with two modifications:

  • I dropped the CF_APPLICATION envar from the script as it's defined in the manifest file
  • My first deploy failed as it couldn't find the required gems - subsequent deploys worked fine, despite a warning about including the .bundle dir in my repo (which I didn't)


This all works with minimal fuss, however I'm going to end up going back to Heroku. I originally discounted it because it didn't play well with Docker (a requirement I've since abandoned). Also:

  • Heroku encrypts traffic for free on their own domain, whereas Cloud Foundry doesn't have this option. I can pay $20/month to use my own domain and cert but this breaks my first requirement. I can understand them charging for additional domain hosting but honestly, securing their own subdomains should be a given.
  • The Cloud Foundry free tier database is tiny. Paying for a database adds a lot to the monthly costs - this is true of all the hosting options I looked at - so a useful free tier offering is important.
  • Heroku is better supported. In Codeship, for example, there is a plugin to support it whereas Cloud Foundry requires a custom script. It's a simple one, to be fair, but it's symptomatic.
  • The Heroku tooling and web interface are nicer. Again, unsurprising given how much longer Heroku has been around. The Cloud Foundry tools are fine, but the doing the same things with Heroku is just easier.

So there it is. These are just my experiences, based on not a lot of time and with the intention of hosting for a personal project.

Thursday, 30 November 2017

Remember remember

Let's talk about fire.

I've always loved bonfires. They are primal and evocative - beautiful pillars of light and movement shining bright in darkness. So what does that mean for photography? Taking a picture of a bonfire is both an interesting technical challenge and an exercise in trying to capture the emotion of the moment.

Breaking down the requirements in photographic terms, what do we have? The fire is moving so you need a fast shutter speed to capture the tongues of flame. The scene is dark, but with a bright light source so you need to control white balance. A fast shutter means a higher ISO, to make the camera more responsive to the available light. A wider aperture allows more light in, but also restricts the telephoto options. So a first guess leads to something like:

  • High shutter speed
  • High ISO
  • Wide aperture

So something like this:

Minch fireworks

Nice and warm, but the body of the fire is over-exposed.

What happens if we drop close the aperture and rely on a crazy-high ISO to capture the available light?

Minch fireworks

Loses the warmth, but now we can see into the body of the fire.

I wonder how important the ISO is in practice? What is we keep a wide aperture and fast shutter and drop the ISO?

Minch fireworks

There is more definition on the tongues of flame here when we zoom right in. Pushing the ISO distorts the image so this is a good change.

I started taking these pictures trying to logically get to some decent manual settings. Out of interest I brought out my phone and took a photo then looked at the results:

Minch bonfire

Huh. Seems nice. Settings?

  • Medium shutter speed
  • Tiny ISO
  • Wide aperture

So the phone decided aperture was the key to sorting out the light capture, and didn't think the movement of the fire was too much of a big deal. Next step was to try this collection of settings on my big camera:

Minch fireworks

Different again. More warmth, losing definition on the tongues of flame.

And for a last hurrah, how about a different framing - adding some zoom (which narrows the aperture) and correcting a bit with ISO and shutter:

Minch fireworks

I have my favourites. It's very interesting seeing the same fire depicted so differently just by fiddling with some settings. I'm still calibrating my mind - looking at the subject and trying to imagine the different photos possible with different settings. The first few here I can say I thought through logically but I'm not sure I'd have got to the settings chosen by the automatic mode on my phone. I suppose I'll have to go to more bonfires and keep practising. Such a shame.

All the photographs taken that evening, including some different attempts at fireworks, are in this album:

Minch bonfire 2017

Saturday, 21 October 2017

Getting off auto

I take a decent number of photographs and as well as running a monthly photograph website I am taking it increasingly seriously as a hobby. Most of my photographs are taken using a camera phone thanks to the convenience of it always being in my pocket and, although I've dabbled with manual settings and know (very roughly) what they do I've never really been able to get consistently decent shots on manual mode. Never one to have a hobby and not get nerdy about the details, this month I got myself a proper camera and went with my Dad on a course to learn how to get off auto.

Buying a camera is hard. There are a load of nearly identical models and so much comes down to personal preference at a time when one doesn't know enough to have a preference. Given how expensive lenses can be, this is also a decision about which ecosystem to buy in to. It's a similar lock-in to the Apple / Windows or iOS / Android world in that it's reversible, but change can be tricky, unfamiliar and expensive. I may write about this in the future, but for the moment my key learning was the big choice if buying an SLR is Nikon / Canon. I ended up choosing a Nikon 5600.

Not all the way off auto

I've played around with manual photography before and have a (very) basic understanding of what the various settings do. When switching to manual mode on the phones I've used, the interface has encouraged taking full control - that is handling aperture, shutter speed, ISO and white balance all at once. This has always been too many interconnected, unfamiliar settings to learn and embrace at the same time. Possibly the single most useful tip from this course was to view it differently - take control of one of these aspects and let the camera do most of the rest automatically. This gives priority to a particular setting and therefore set of techniques (indeed, the modes on a proper camera are called aperture or shutter priority so ... yeah).


We focused on aperture, letting the camera adjust shutter speed automatically and making corrections for exposure with the ISO setting. A wider aperture (aka a smaller f stop setting) lets in more light, allowing a faster shutter speed. It also allows control of the depth of field, enabling the blurred background effect used to create useful negative space and draw attention to a specific area of a picture.

This is often seen in portraits. Some useful tips for portraits - the eyes are the most important bit and should therefore be in the sharpest focus. So far, fairly obvious. Less obvious is that the camera may well actually focus on the closest part of the face - the tip of the nose - so for a really good picture some manual adjustment is necessary.

Another counter-intuitive tip is that portrait pictures are best taken on maximum zoom or with a dedicated telephoto lens. This is because the longer focal length allows for a wider aperture and hence maximises the depth of field effect.


And lo, the results.

Or, for a particular example of the portrait stuff above:

We had a lot of fun walking around Lacock and practising the specific techniques that fell out of playing with this one setting and the day did a wonderful job of demystifying the bewildering array of buttons on a decent camera. I'm looking forward to learning more.

Saturday, 30 September 2017

Hanging up my abacus - part 2

It has been a while, but here is part two of my reflections on being a church treasurer. If you missed it, here is part one. Last time was mostly about vision and strategy. This is about people.

Back to the things I learned and experienced.

Lesson 5: It's dangerous to go alone...

Time is finite. An Earth-shattering discovery. However, the important point here is about setting expectations - both in others in yourself. This kind of role can easily be a full-time job, and this is one of the reasons it's often picked up by a retired person. Limiting factors like Having a Job and Wanting a Life will severely cut into the amount of time available and hence what can be delivered. It took me a long time to get this straight in my head and stop beating myself up for how long everything seemed to take - especially since business as usual work ate up a significant amount of the time I could otherwise have used for improving things.

It's impossible to create more time, so if you want to get more done you need other people to help. I set up a team to help and together we achieved things I had initially discarded as impossible for me alone. It astonished me that creating a Finance Team wasn't standard - I had several conversations with members of other churches who took this revolutionary thinking back with them. Another lesson for me was that just because something seemed obvious, that didn't mean it is. It is worth sharing your thinking.

Lesson 6: ... but choose your companions wisely

Forming a team in a charity is an art in itself. The obvious approach is to simply ask for volunteers, however if you do that you'll find you get the same faces who appear over and over in other teams. These people are going to be busy already, and are the people pre-disposed to volunteering - not necessarily the folk with the most useful skills.

Volunteers are nothing like paid staff. Our motivation is based on enthusiasm for the cause of the charity, supporting each other and our interest in the task at hand and it is all too easy to destroy any or all of these if the group isn't pulling in the same way. In my case, I was forming a group which was to act under my authority as a treasurer so I needed people I could trust to behave with integrity and who I could ask to do things and believe they would actually do them.

I avoided asking for volunteers. I think it misses the opportunity to encourage folk who wouldn't normally put themselves forward and it makes it very likely the resulting team will struggle to gel. Instead, after consulting as many people as I could looking for likely victims, I approached a handful of people who I thought would have the right combination of skills and perspectives. Most were people who did little to no volunteering in the church. I was fortunate that all but one agreed to join my merry band and they did so with the confidence that The Leader (me, gosh) believed in them.

There are definitely pitfalls to be avoided. Exclusively approaching people relies on your own knowledge of the people available, and triggers all of your biases, conscious or unconscious. There is a balance to be struck but it's too easy to just ask for volunteers and miss an opportunity to encourage people who otherwise wouldn't put themselves forward.

Lesson 7: A shared vision brings a team together

Next, I needed to turn the group into a team. Providing a constant stream of brightly-coloured cake definitely helped.

We had several sessions discussing the direction of finance in St Swithin's and prioritising out work. I outlined the problems as I saw them and let the conversation take its course and by the end we all owned the resulting plan. This bound the team together as the strategy came from the team, not from me. Not only did this do wonders for the motivation, we also ended up with a more ambitious programme than I had originally had in mind. When discussing the problems, we collectively decided that we couldn't do anything without a new computer system - something I had previously discarded as I didn't have time to do it. However, others in the group saw it was the most important thing we could do and volunteered to take it on.

Lesson 8: Learn to predict the future (and convince others of your mystic powers)

Accurate crystal balls are hard to come by, but there are ways to peer into the future with some accuracy. Looking at trends in income / expenditure give a clear indication as to what is going to happen - if the budget is any good it's quite easy to start thinking about what happens next year and the year after.

By asking ourselves several "what if" questions we got a picture of the problems hidden in the heart of our finance. Some were real (trends which predicted issues further down the line) and some were potential ("what if the top three donors all moved away this year?") and they let us set policies which helped mitigate these risks. For instance, following an analysis of the profile of our donations we diversified our income and changed the way we solicited giving.

In theory, spotting difficulties ahead of time should have let us do something about them before they became major problems. The hard part is convincing other people in the organisation when there are problems ahead. I presented year on year on the challenges hiding in the heart of our budget, however those problems were not immediate and so generating the right response (immediate action without panic) was extremely difficult. This is partly the nature of this role - as noted before, the ingrained culture was that finance was my problem so solving these problems was also my problem.

Regardless of the difficulties, all this helped me learn the value of investing the time in using the data available to make predictions, not just validate (or otherwise) the decisions of the past. Obvious, maybe, but this was the experience that cemented it in my mind. In the business of day to day life it's easy to forget it and drift further and further into being just reactive.

Lesson 9: Volunteers are not staff

I've already mentioned this above, but it's something to pick up on again. I was a volunteer in a professional organisation (the Church of England). There were things I had to do, legally, to perform my role. There was also an awful lot that I didn't have to do, but was very helpful to the wider organisation. As noted before, time is finite and whether I did any of these things depended on my motivation to spend that time assisting the wider organisation rather than (or in addition to) working to improve my local church.

Motivation is a tricky beast. With a volunteer, it's the only thing that is making them keep giving their time to you and not someone else. It is very easy for a large organisation to forget when it is relying on the goodwill of volunteers over whom they have very little actual control. However, if this does happen it doesn't take long for all those extra voluntary jobs to stop happening.

The short version is - if you're in a paid position, remember when you're dealing with volunteers or you will lose them. They owe you nothing.

Lesson 10: The importance of process

Volunteer groups are often held together by the links between people. Indeed, professional organisations usually have back-channels for getting things done because person X is friends with person Y in another team, which means they hear about stuff that is going on over there.

This is natural, and inevitable unless we want a world where we behave like automatons fitted to a job description. However, there needs to be a plan in place for the people who come next.

When I took on my role as a treasurer, it was on the back of all the previous finance people stepping down. I inherited very little, and while the former volunteers were very helpful it still meant I had to re-solve a lot of problems. Had there been clear processes in place I could have slipped into the role far more easily.

I'm cheating a little here as this was actually a lesson I learned back during my time as part of the team running a student radio station. Back then we worked very hard to ensure there was no clique (encouraging new people to join) and we had established processes (allowing others to keep the station going when we were gone). During my time as a treasurer, we brought in all kinds of new practices and we always did our best to make sure they didn't rely on the specific people in post. We documented, handed over knowledge as best we could and generally tried to make sure the next lot would have a far easier time.

I hope my successor has inherited a working system and is getting as much from the role as I did.

Thursday, 31 August 2017

Sitting atop a mountain

In all honesty, August hasn't been a great month. It started well with a week at New Wine but has gone steadily downhill since then. That means I don't really have much to write about, so instead I'll tell a short story.

Once upon a time, some friends decided to meet. They had known each other a long time so one decided to bring the ultimate accessory - Mario Kart. Thus proceeded several races in which everyone realised they were much better at videogames back in the olden times.

Again, not a Nintendo publicity shot

But at least they looked like they were in a Nintendo publicity shot.

Alas, the restaurant decided they wanted to sell some food to the gamers and they ended up eating their own bodyweight in chicken wings, because otherwise the "all you can eat" deal just wouldn't have been worth it. But chicken was eaten and there was much rejoicing. That is, until someone pointed out that that restaurant was chosen because of something called a Freakshake.

And thus it was ordered. Several times.

What had we done?

Look at it.



Behold the tower of magnificence

And there were no survivors.

Next month I'm going to do something.

Friday, 28 July 2017

Homebrew postgres

> Hi me. Remember when you used to do all your development on a Linux machine? Wasn't that nice and easy?

> Well, no, but at least tools were consistent with the server.

> Ok, good point. But you're using postgres installed through homebrew now aren't you?

> Yes...?

> So how do you create a database now?

> Oh, well you since it runs as your user you can just do:
bundle exec rake db:create

With this in your config/database.yml:
default: &default
  adapter: postgresql
  encoding: unicode
  # For details on connection pooling, see Rails configuration guide
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

  <<: *default
  database: mydb_development

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
  <<: *default
  database: mydb_test
> That's remarkably easy.

> Mac!

> Traitor...

Sunday, 25 June 2017

Hanging up my abacus - part 1

After three years as treasurer of St Swithin's church, Bath I have handed in my spreadsheets and passed the mantle to another. This also marks the end of six years as a member of the PCC - the council which oversees the church and acts as its trustees. It has been a very significant part of my life for more than half a decade, so I thought it worth looking back at the lessons I learned along the way.

I was made treasurer for two reasons. Firstly; people think I can do numbers. Secondly; there was nobody else. My first (and slightly flippant) question was "so how much money do we actually have?". As it turned out, attempting to rigorously answer that question in detail was the basis for the entire financial strategy for three years.

Lesson 1: Asking (then answering) the simple questions is a good thing

That first question was far too obvious to be useful, and yet proved to be absolutely key. Obviously it can be rephrased to something more sophisticated ("do we have a clear picture of the current financial position?") but honestly there's not much point. I spent a lot of time carving this question up in a variety of different ways in an attempt to understand the nuances and that was a great exercise to help map out the problem space.

The important lesson here was accepting that, despite this being a complicated role, asking simple questions was a valid way of approaching it - those simple questions had a lot of value.

And that leads to...

Lesson 2: Helping others understand the answers is a vital skill

As soon as I had to take a proper interest in the church's finance I had some basic questions. Of course, if I was asking those questions it was logical to assume that others would be asking them to me in my role as Guardian of All Money. And lo, they did.

Between frequent reports to the PCC and annual reports to the congregation at the general meeting I had to learn how to take a complex financial position and explain it in sufficient detail to a roomful of people who all wanted me to say "it's all fine" and then stop talking.

The key to this was in the narrative. If a talk is structured so it follows a logical, coherent thread then it is far easier to follow. There needs to be enough detail to engage people and back up the story, but not so much as to drown it. Given the nature of the subject (numbers - few people love numbers) then patterns need to be explained, and their significance highlighted.

I presented the financial position three times at annual general meetings and each year got extremely positive feedback along the lines of "at last I understand the finances!" so I think I did something right here.

There were a few lessons along the way. Accepting that other people actually did care about the same things I did; knowing the audience well enough to present the right information; and accepting that that audience really appreciated clear communication with enough detail to actually understand it.

Lesson 3: The power!!! AHAHAHAHAHAAHA!!!

The role treasurer is potentially very powerful. I had all the information about the finances and I drafted the budgets. Between those, I could heavily influence every financial decision made in the church - and most decisions have a financial component. That meant I could change church policy and promote my favourite projects by allocating money and it would be a challenge for anyone to question me as I was the one with all the knowledge.

To be clear - this is a situation I worked very hard to avoid. It was especially true for us - we had a year without a vicar during my term which gave even more scope for abuse of power.

The problem is, the roots are in the control of information - specifically the other members of the PCC and leadership not knowing the finances in enough detail and, despite what I just put in Lesson 2, most simply didn't want this information.

There is a point here about duty of care. A church is a charity and the PCC members are trustees, which means they have a legal responsibility for the finances - a duty they can't properly perform without clear information. It's not a duty that is always made clear and that is why there is a tendency to let the treasurer just get on with it, which is where we came in.

It is a different problem from the last one. That was about answering questions clearly. This is about encouraging the questions to be asked in the first place and that is a cultural shift - a fairly major one in our case. I ended up having to change the way we thought about initiatives and projects in concept - getting costings and financial thinking in from the start to help weigh up the relative merits (rather than deciding on a priority then working out whether we could afford something) and coupling that with changing the book-keeping processes to allow easily-produced monthly financial updates.

There is a lot I can write about the techniques I used here, but the important lesson is that there are some things people have to know, whether they want to or not. In that case it's important to make the knowing as simple as possible - ideally ingrained into process in such a way they pick up the information as they go with no extra effort on their part.

Lesson 4: Having a vision

These three points all link into transparency and communication - being very clear about what one is doing and ensuring people understand why. About three months into my time as a treasurer I wrote a vision for what I wanted to achieve and it could easily be summarised as "make it easy to get information" and "make sure it's not embarrassing if people do".

This document was primarily for myself, so I could get my thoughts in order before moving forward. It proved incredibly useful as something to which I could later refer in order to judge whether things were developing in the right way. It's not exactly insightful, but this was the first time I had written a long-term vision and the lesson for me was how useful it turned out to be. I also learned the difference between strategy and vision and how important both are, but also how to consider them separately.

None of this has touched on the other people involved, but this is getting long so I'm going to split it into two. More soon.

Tuesday, 30 May 2017


Every year I write a post about the various non-work creative things I've done to fill my time making stuff and learning new skills. I started doing this because I needed to remind myself I actually do this, and I have a tendency to forget quite how much. However, there are definitely times when the opposite is true and I spend a week or longer fixing broken things and watching videos on YouTube and after a stint of that it can get quite hard to motivate myself back into some kind of creative action.

It doesn't help that, according to the Belbin personality tests, I'm a "completer-finisher" which means I like to fix errors, polish products and - most significantly - actually finish things. I have noticed a tendency both at home and at work to leave a package of work unstarted in favour of completing something in progress which, while often a good thing, sometimes means something which is easy to put off is left alone for quite some time before I feel I've got the time to "do it properly". At work this is usually broken by some kind of deadline. At home, where there are very few deadlines, this is a great way of saying that I can be really bad at starting things. This has all been exacerbated in the last six months or so due to being generally exhausted because of moving jobs and cities.

This very post is a great example. I've been putting off writing it all weekend and here I find myself writing on a train - something I usually avoid like the plague as I jealously guard this time for reading. Yet, I have promised myself that I will write at least one blog post per month and I've very aware that if I don't get this one done today I will likely miss May.

So, some kind of deadline (even a self-imposed one) clearly works for me so I'm going to state some projects with deadlines in the hope it will kick my motivation back to life. I generally need something technology-based and something writing-based on the go at once so I can pick and choose as the mood takes me. Here we go:

University RPG

This is a comedy RPG, being written from the ground up and full of HE in-jokes. I'd like to have something ready for playtesting by the end of June and ideally have run a first session by the end of July.

Players Without Number RPG

A solution to the impossibility of organising five players to a regular game when two have children, one lives in another city and another has an international sword-fighting career to juggle. Have lots of players and swap them in as needed. I'm going to write a post about this my other blog (which is also a good excuse to kick it off again). I'd like a session and a post done by the end of August.

Year in Pictures on AWS

Every month I have to mark up fifteen blocks of YAML and crop their corresponding pictures for my Year in Pictures site. It would be nice if I could automate as much of this as possible and I may as well gain some hands-on AWS experience along the way. I'm going to aim to collect the July pictures using the first version of the new thing.

I think that'll do for the moment. One thing I've learnt about time management is to make sure there aren't too many things in progress at once else nothing gets done. Let's see if making a proper decision to do these things to a deadline makes me get on with them. Now I'm going to read for the rest of this train journey and not think about giving myself SMART objectives for my spare time...

Sunday, 9 April 2017

How to Mac - part 2

Well, I'm still making use of a Mac. Four months in I'm starting to get used to the keyboard and some of the oddities (good and bad - I still hate the behaviour of this window management). Time to write some more docs for future-me should I ever have to configure one of these systems again.

Clipboard management

I made the switch to using a clipboard manager years ago and frankly now can't comprehend life without one. I found loads of them on the Mac - mostly expensive and part of much larger packages which I don't need.

The one I settled on is called Flycut. It will only work on text (and will occasionally foul up copying images with a keyboard shortcut) but it works really well for my simple use case and is easily installed via homebrew:

brew cask install Caskroom/cask/flycut


Installing services such as Postgres or Elastic Search via homebrew often writes them into the startup sequence. Sadly, these days I am not coding enough to need these all the time and available RAM is precious so I went looking for an easy way to change what is run when. It seems an easy way to do this is homebrew services, which is easily installed via the homebrew interface and lets me edit the startup sequence and run the services directly without them starting next time I boot the machine. This last command requires a very recent version. Docs on the end of the link, above.

Bash and completion

I took a brief foray into Z shell and found it different enough to bash to irritate me. Given time I think I could configure it to be something I really like, but after some time and rage trying to configure the prompt I decided that I don't have the patience for that at the moment.

The motivator here was improving bash autocompletion - especially for git and homebrew. It turns out the version of bash shipped with OSX is ancient so the first stop was upgrading that via homebrew which then meant changing the bash-completion package (written for bash 3) over to bash-completion2 (which is for bash 4). Next I discovered that both git and homebrew ship with their own completion config which just needed to be parsed when the shell starts.

And thus the fun began.

Homebrew bash autocomplete configuration is hidden in /usr/local/etc/bash_completion.d instead of the more usual /etc/bash_completion.d. I needed to encourage it to parse the contents of this directory instead - which proved surprisingly difficult. In the end I had to add this to ~/.bash_profile:

for bcfile in `brew --prefix`/etc/bash_completion.d/* ; do
  . $bcfile

(copied from this Stack Overflow answer because of lazy).

As far as I can tell, bash is supposed to read the contents of the bash_completion.d directory automatically but because homebrew moves it the paths need fixing. There is almost certainly a better way of doing this, but by this point I was bored of this problem and decided to accept something that worked. Then write about it.

I also found I needed to create an empty file at /usr/local/etc/bash_completion because this line was complaining:

[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion

I probably could remove the line, but I had Fear of removing such a standard line of config and ending up breaking something else in the future. Again, probably not the best solution.

And that's it for the moment. Like last time this is mostly my own documentation so I can reproduce these steps in the future written here on the off-chance it is useful to someone else. I certainly don't recommend any of the bash config stuff as the best way of doing things. Think of these notes as a diary, recording my reluctant exploration of MacWorld. End disclaimers...

Saturday, 25 March 2017

Why I like using Monzo

About six weeks ago I was sent a Monzo card, in all its lurid orange/pink (coral!) glory. As a pre-paid cash card it shouldn't be too exciting, but it comes with some great bonus extras within the application.

Give me the monies

Sending and receiving money between friends is incredibly easy. It is like the PayPal network, but with a superior UI and no fees. Admittedly, it cheats a bit here as PayPal is fee-free if your money is within their network already and that is the only way to work with Monzo.

Track my cash

The application does a great job of giving you the basic information you need up front (balance, spend for the day) and sorting your spending into groups so you can see with horror quite how much you're spending on eating out. You can access this information by month, but more importantly you this is all available via a simple API.

My data

The API is where the fun starts. I'm not going to apologise for liking data and graphs and it's really nice to be able to start plotting my finances in different ways to get to grips with the patterns to my spending (and remember how to do data manipulation and visualisation).

Scales redacted :-)
So far I've been plotting my balance per day so I can see if there are any trends. I want to start looking at the breakdown of spending area by week and month (the app UI only gives per month). Once that is done I'll start thinking about what other questions I've got...

If you want to have a look you can get the code from Github.

Thursday, 16 February 2017

I can't review your site - I can't see it

Oh, this article looks interesting. It might solve my problem. I'll have a quick re.. NO I DON'T WANT TO SUBSCRIBE TO YOUR EMAIL UPDATES. Has anyone ever actually engaged with a website overlay, beyond searching for the tiny "close" button in annoyance? They are all over the place so there must be a good reason for them to exist. Maybe if we look closely at some of the steps required to make a successful one we'll start to understand.

Spoiler warning: we wont. Overlays are inherently terrible.

Making a successful overlay #1 - the timing

The overlay needs to appear before your victim leaves the site, so it needs to be quick. Never mind that "quick" roughly corresponds with the amount of time someone who is genuinely engaging with your site takes to orientate themselves and settle in to proper reading. In order to catch those people leaving quickly because they don't care anyway you're going to have to annoy your real visitors. Omelettes, eggs and all that.

Making a successful overlay #2 - make it intrusive

You're trying to catch the attention of your victim and what is more attention-grabbing than the entire screen being replaced by the action you want them to perform? Maybe it should flash too. Make sure they are under no illusions - your only interest in them is harvesting a review or an email address. Any content on the site is strictly secondary.

Making a successful overlay #3 - make it alien and hard to close

We don't use javascript alert popups these days because they are so easy to block and everyone has the location of the close button hardwired into their brain. However with an HTML overlay you can avoid this problem so your victim doesn't miss the information that is so crucial you have to interrupt their browsing. And it is, after all, all about you. So why run the risk they can easily dismiss your overlay? Why use established design patterns to put the close button somewhere obvious? Make sure it's carefully hidden and don't even think of adding a keyboard shortcut to kill it. That would be madness. The "escape" key has much better things to be doing.

Making a successful overlay #4 - make sure it is in the wrong place in your visitor's journey

You can't possibly wait until your victim has finished reading the page before asking their opinion or for them to sign up. They might leave at the end, having learned whatever they wanted, possibly even happy - and all without ever giving you their email address. The horror. Never mind that five seconds into a visit nobody has a useful comment beyond "the overlays annoy me" and that putting them right at the start of the visit means your overlay cannot possibly do the job it is supposed to do. Annoyance is valuable feedback so it should be gathered as early as possible.

Make sure you're considering these crucial four points next time you want to really annoy the poor souls who find your site!

Saturday, 21 January 2017

Continuous Delivery with Codeship

Nobody needs to be sold the virtues of automated deployment in a professional environment any more. I've found personal projects a bit different though. Generally these do not deploy as often and are for fun and I'm sorry to say that, for me, the idea of maintaining a Jenkins server doesn't really fit into the latter category. Still, as I wrote about a bit in a previous post, I appreciate the value of simple, consistent deployment and so I write scripts then run them by hand as a happy medium between rigorous process and focusing my spare time on the things that make me happy.

Over the last few years continuous delivery as a service has become a thing which (in theory) means I should should be able to take my deployment scripts and have them run automatically when I push something to a master branch in git and all without having to run my own software. I tried this with Codeship in its early days and something went horribly wrong, requiring me to completely wipe my website and restore from backups. This somewhat killed my enthusiasm for trying again.

To be fair to Codeship, this seems to be a very unusual experience. Most people I know sing its praises - both its capabilities and ease of use. Clearly I did something stupid somewhere and so when I decided to have another look at using a service I went back to give it another go.

The product has moved on significantly since I last visited, however it is still pretty straightforward. More importantly, this time I got it to work and didn't destroy anything in the process. So, with my extremely minor requirements in mind, I had to:

  • Set it up to run my tests (just bundle install for me)
  • Set up run my deploy script (one line to trigger the mina script)

Then just test via an empty commit to master and I was done:
git commit -m "Empty commit to test deployment" --allow-empty

This is pretty much the experience I wanted the first time around. Who knows what I did wrong. Some very minor gotchas:

  • You need to run bundle install in the test section to ensure you have your deployment dependencies in the later steps, even if you don't have any tests to run (remember kids, always write tests...)
  • If your deployment scripts involve connecting to a server somewhere you're going to need your project SSH key which isn't the easiest thing to find

And that's pretty much it.

So why did I look at this again? Aside from it being one fewer task to do by hand when doing any proper work, I can now make minor changes on the go via the Github web interface and not need a properly set up environment to deploy them. More importantly, I can also give access to non-developers to edit content in that same web interface and it will automatically push without my needing to do anything. This is great as now what was a static website suddenly has a content management system attached to it.

I can also finally join the "Codeship is great" bandwagon. Sorry I'm late.