Category Archives: Uncategorized

Best of drmaciver.com

In an act of self-indulgent navel-gazing I decided to have a look through Google analytics and see what my most popular articles of all time were. This then caused me to want to signal boost and resurrect some old and not-so-old posts. It’s closer to what I think is interesting and worth a read than just the most popular because, well, most of my serious traffic comes from reddit and hacker news, and I don’t necessarily agree with their opinions of which ones are worth reading, but all of the most popular ones are in here too.

I don’t expect you to read all of them. There are a lot, and who the hell has the time? This blog has been going for about 7 years and I don’t know where in that I found the time to write all of these, but I’ve tried to arrange them in such a way that a skim through should find you something interesting.

Also, some advance warning: Some of these posts are quite old. Some of them may contain opinions I no longer hold. Most of them were probably well thought out at the time (or at least I thought they were), but it turns out that that’s no protection against being wrong.

So here you have it. Some highlights from the archive.

Edit: Updated May 13 with some links to fiction

Sections

Some quick navigation links for you if you’re not interested in all of this:

A perfect voting system

At 14k visits (yes I know that’s not a lot), this is my most read article ever. It got linked from a bunch of places, including one of the new scientist blogs.

Which really makes me wish it weren’t so badly written. In order to compensate for that I rewrote it. The new version is substantially better written but was so much less topical by then that it’s not had nearly the same level traffic.

The essential idea, which I proposed mostly as a thought experiment, is that when electing a large number geographic constituencies the correct election procedure to use is random ballot – everyone votes, you pick a random voter and use their choice. I’ve since come around to thinking this is actually a really good idea, but alas it will never get implemented.

I’ve written more on this subject since:

A less perfect system for which I will nevertheless be voting

I got very vocal and angry about the AV referendum. This is in fact what prompted the random ballot post. I had recently written Hammer Principle and so gone down a bit of a rabbit hole of voting theory. As a result it was really obvious to me how bad the existing system was. The fact that the no to AV group were lying through their teeth helped fuel my outrage.

I’ve since written various things both on the practical details of the vote in the UK and on voting theory at large:

Understanding Scala Arrays

I stopped using Scala long ago, and this article is no longer relevant to the current implementation, which I believe uses an explicit manifest object and is much more reliable. This was my description of the old mechanism where arrays could be backed by either an object array or a primitive array and what would happen was essentially that when you realised it as a primitive array the implementation would “snap” to that form. It was a very clever but ultimately quite flaky way of getting around the limitations of the JVM for generics.

The reason it’s got quite so much traffic over the years is that it’s linked from the proposal for the fixed array implementation that came in in 2.8.

Some other “Here’s how this bit of Scala works” posts:

  • How packages work in Scala. This is the old system. I still think it was a good system in itself, but unfortunately it was completely shafted by the combination of the Java conventions and the way package resolution from the file system worked.
  • A note on a useful feature of the Scala class system that most people seemed to miss. I believe this one to still be valid.
  • An introduction to implicit arguments. There are very few programming languages so bad that they have nothing to recommend them (Scala is pretty far from being one), so as a result pretty much every language I’ve ever used has features I miss when I’m not using it. Scala has a few of them, but implicit arguments unquestionably top the list. This is my attempt to write an introduction with lots of an examples on how to use them. I believe it to still be accurate – certainly it still gets linked from places and gets some traffic, so I hope its’ still accurate.
  • A little detail on the difference between Java wildcards and Scala existential types.
  • A more substantiative post about Scala existential types work. This seems likely to still be mostly accurate but I don’t know if it’s still 100%. It’s certainly still quite popular.
  • Once upon a time there was a Scala trait called Application which broke everything. You ended up running your entire application inside class initialization. This turns out to be a really bad idea on the JVM. I believe this was fixed by introducing deferred initialization rather than by removing Application.

Other posts from the Scala years:

  • No, seriously, why scala? An attempt at a pro-Scala advocacy piece that was a little more interesting than the standard “zomg functional programming is amazing!!1” fluff pieces
  • Why not Scala? A post on its downsides. Obviously some of these have now changed. I could write an updated piece, but I’m not going to. Someone who actually still uses the language is far better placed to complain about it.
  • How do you talk about Scala? In which I asked people about how they sold other programmers on Scala.

Understanding Timsort, Part 1: Adaptive Mergesort

One of my more read articles, mostly because it’s linked from the Wikipedia page on Timsort (not my doing, I promise).

I unfortunately never followed up with a part 2. I got about a third of one written before it got stuck in the eternal drafts folder of doom but decided not to bother – I got further with my understanding (although I certainly couldn’t recite all the details off from memory) but then realised I wasn’t all that interested in learning the details of the sorting algorithm.

A manifesto for error reporting

This was part of the storm of activity I had at the beginning of this year. I think I had three popular articles going in a week (and yet unlike last week HN didn’t bring my site down once. Oops). I forget what triggered this. I think it might have been the way Padrino handled certain problems, but really it could have been anything Ruby related. Basically: People who handle and report errors often seem to go out of their way to make things difficult to debug. This makes me sad and angry and you, the reader, thus get to listen to me being sad and angry. Apparently this sad angriness (sandgriness?) struck a chord with a lot of other people.

I also published A rewritten version of the manifesto because some people misunderstood the first one. There’s less shouting and more condescending prescriptivism. A friend described it as “the most passive aggressive thing she’d ever read” because of how obviously pissed off I was and yet going out of my way to be scrupulously polite in it. This is almost as popular as the inspiring post.

Relatedly, I appear to have strong opinions on exceptions:

How to quickly become effective when joining a new company

(original title: How did you get started so quickly?)

A rather recent post, so if you’re reading this archive post close to when I wrote it you’ve probably already read it. This post had the surprising characteristic of being remarkable well received on hacker news and derided on reddit. Clearly this means that Hacker News are better people than Reddit. Um.

This starts out with some practical advice on the philosophy of learning and rapidly descends into some very speculative things about mental models and how to apply them. I actually have more of the mental models stuff to come which I’m currently procrastinating from by writing this post instead. Such is life.

I’ve written a follow on post about how to apply this technique as a way of reading code.

In general I care quite a lot about the art of problem solving and how it’s applied to software development, and I have a few other posts on that subject:

OpenVPN repeatedly losing connections with inactivity timeout

You have no need to read this post. I practically guarantee it. If you’re not experiencing this problem then you don’t care. If you are experiencing this problem then you’ve probably found this page due to my advanced SEO skills (read: I struggled for ages to find anyone explaining what in the actual was going on, couldn’t find anything, so when I figured it out made sure that other people would not suffer this problem). This still gets a lot of traffic and every now and then someone will give me warm fuzzies by saying “Thanks! This completely solved a really annoying problem for me”.

Another example of my doing this that you don’t really care about is my posts on Linux wifi recently. Unfortunately those are less helpful because I haven’t actually solved the problem (I still haven’t. I’ve avoided it with a £15 wifi dongle).

Writing things right

This was a surprisingly popular article about a cute hack you can do in Haskell. I totally stole it from someone else at the time but was never able to figure out who I stole it from (I think it was someone on some mailing list). Basically: You can mess with Haskell syntax to make it look almost exactly like an OO language with surprisingly little difficulty.

This is part of what I think of as “The programming language years”. I still care about programming languages and like picking up new ones (it’s pretty easy using the “How did you get started so quickly?” guide, though knowing a variety of them already definitely helps with that). But once upon a time I was really quite obsessed with languages and thought that solving them was the key to a lot of software development’s problems. These days I think not being so completely dysfunctional is the key to solving a lot of software development’s problems and that most of our problems are social. I miss the days when I thought it was about programming languages. Those were nice, cuddly, delusions.

Other things from the programming language years:

  • Tell us why your language sucks. The thesis is that all languages suck in one way or another, and most criticisms of languages are shallow because they come from people who don’t use that language. This was an opportunity for people to complain about the languages they actually use and like. I think it went pretty well.
  • Criticizing programming languages. Me deliberately saying some good and bad things about different languages I used. Some of these are quite shallow (e.g. I could probably say more interesting things about python now), some of them are pretty fair.
  • Functional code != Good code. This might actually be an early sign of my disillusionment. A post that spells out in detail the seemingly obvious point that making your code more functional doesn’t automatically make it better and that what you actually need is better factoring and more modularity.
  • Functional programming lies. AKA “Please engage in truth-based advocacy, thanks”.
  • A problem of language.  What do we actually mean when we say “This is a functional programming language”? Draws the distinction between “This thing exhibits X behaviours” and “This is an X thing”, which I think is important and undervalued. I keep meaning to write another post on a similar subject in a different context.
  • I later elaborated on how you don’t actually need definitions to seek agreement.
  • Notes on the design of a Haskell API. Some problems I had when trying to design a metric space API in Haskell.
  • What’s a monad? So, yeah, I’ve written a monad tutorial. I’m not proud of this.
  • Then I accidentally wrote another one.
  • Interest bandwidth. The theory that interest in programming languages is strongly correlated to lack of interest in what you’re doing with them. This was my theory at the time for my waning interest in the subject. I think it was true but incomplete.

A more recent thing which isn’t from the programming years but fits into a similar category is How learning Scala made me a better programmer, in which I reflect on the fact that writing code in a language with a buggy compiler is surprisingly useful.

Commiting to calling out sexism

This was a bit of a transition point for me. The actual post itself is not that phenomenal, but it marks the point where I started writing about feminism and related issues and started being more vocal about them, both online and in person. I’d been what I suppose you might call a closet feminist before that – it’s not that I was secret about my feminism, but I didn’t make a big deal of it. This was the point at which I realised that this was not OK and that I needed to start getting on with helping make the world a slightly less shit place.

Annoyingly I haven’t actually done all that much explicit calling out of sexism recently (I’ve corrected some people on various things, but it was more of a “Hey, actually the world works like this” “oh, ok” scenario than “Hey you’re being sexist. Can you stop?”). I think this is mostly because I haven’t been in situations where it was necessary, but I’m not sure why that is and I think I’ll keep an eye on this.

I have done a certain amount of shouting on twitter on the subject, and I’ve definitely been a bit more vocal on the subject in casual conversation, but I’m not sure how substantial that’s really been.

I also promised at the time to try and document this. Again, failure. The only documented case of it was relatively near the beginning with if programming language articles were people. A workplace incident in which someone forward around a “If programming languages were women” post. I was not amused.

A more recent example is my I am angry too piece, in which I write about men’s tendency to dismiss women’s anger as a way to avoid hearing about things that make us uncomfortable.

This discussion around hiring practices maybe also counts. I think I might be reaching though.

I do have a bunch of posts about identity, which are clearly inspired by a lot of thoughts around intersectional feminism. I don’t know if I would call them explicitly feminist, but I think that’s clearly where I’m coming from:

  • I believe I can fly. Some thoughts about what we consider part of our identity and how these may not correspond to “objective” reality. I’m clearly on the fence on the subject (and remain so) but as a result people from both sides basically went “Yes exactly! This completely supports my point!” about it. I still think it’s an interesting exploration though.
  • You are not your labels. A post about the difference between your identity and the words you use to describe your identity, especially in the context of sexuality. In it I attempt to explain everything ever by the failure to understand the difference between these two. This had an interesting split in its reactions. People who knew me received it mostly positively (they didn’t necessarily agree, but they thought it was an interesting point). People who didn’t know me so well were… more mixed. Apparently a mostly-straight cis white dude who works in tech gets pattern matched to some relatively unpleasant behaviours when talking about identity. Not all that surprising and hard to blame people for.
  • So I wrote a follow up post in which I made it fairly explicit that I wasn’t saying that identity wasn’t important.

How to write good software

In which I outline my three step program for writing better software. It approximately goes:

  1. Smash the system
  2. Smash the patriarchy
  3. Figure out how to write good software

It’s proven to be fairly popular, I think mostly because people who are interested in both social justice and software are extremely keen to share it.

Ignorance is bliss for whom?

Also on a more or less feminist topic. Basically: Knowing more can make your life worse. The reason for this is not that knowing more is harmful it’s that your life was currently “better” because you were less aware that you were causing problems for other people.

Related are:

Questions for prospective employers

A distilled list of questions to ask companies before joining. I did ask all of these at my current employer, but I confess I didn’t guide my decision by these as thoroughly as I might have. To be honest, I completely failed to stick to my guns. Next time, whenever that is, I will do better.

Also, the long list from which the short list was distilled.

A manifesto for what I will do when I take over the country

(And the world)

Also in this series:

How to legally(?) and efficiently bribe a democracy

I’m pretty disillusioned with the state of modern democracy, which meant I was very receptive when Terence Edent gave a talk about how to effect real political change: By bribing MPs, because they turn out to be really quite cheap. This then collided with my peculiar obsession with randomisation and came up with this model for bribing MPs without directly bribing MPs. I then came up with another one.

Fiction

I sometimes write fiction. I’m not actually very good at it (mainly due to being unable to write good dialogue) but sometimes it turns out well anyway (mainly due to being able to avoid needing to write dialogue). Notable examples:

  • Gates – a story being told to you in a bar
  • Spam – my contribution to the rare genre of post-singularity humour
  • They called me mad – secret agent vs mad scientist. Contains actual dialogue. Also contains my favourite line from any of the fiction I have written.

Less notable but still decent examples:

  • Dark Lord – a hero rises to defeat the dark lord. Unfortunately the dark lord was already defeated with high explosives.
  • The man who named the stars – a vaguely lord Dunsany inspired fairy tail / creation myth..

A freemium model for scheduling

This was actually inspired by my world domination ideas for health care systems.

It’s an interesting way to do a business model: Give the service away for free, but dedicate a certain percentage of resources to the people who pay you the most, with people being able to pay as much or as little as they like to get access to this (and the amount of access you get scaling with the amount of money you’ve paid (plus some bonuses for regular customers). It has some problems, some of which I later patched.

On vegetarians who eat chicken

A practical and linguistic defence of people who describe themselves as “Vegetarian but I eat chicken” against people who immediately go “Well you’re not vegetarian then, are you?!” in a self-righteous “Gotcha!”. I get a surprising amount of Google traffic for this post.

Some simple theorems about dominance of probability distributions

I spent a little bit of time looking at the question of when one real valued random variable is “better” than another, where a higher score is always better but we’re not sure about the distributions. I gave a nice definition of the minimal possible partial order we accept has to be included in this and explored some of its properties.

I later proved that this was equivalent to the nice characterisation that one distribution dominated another iff it had greater or equal expectation under every monotonic increasing transformation.

I also characterised this for normal distributions. In short, a normal distribution dominates another iff it has greater or equal mean and the same variance. Normal distributions with distinct variances are incomparable under this order.

Studying a certain notion of “decision strategy”

I defined a thing I called a subset consistent decision strategy. I provided a full characterisation of all finite ones, and then did some work on characterising infinite ones:

How to get free tea from pret a manger

One of various “isn’t my life interesting?” amusing stories. Occasionally funny things happen to me and I blog about them. These tend to be surprisingly well received, although never get that much traffic. Other examples include:

Customers who read this blog might also like…

As if the 80-some links that I’m already providing in this post weren’t enough, here’s a whole bunch of book recommendations.

I also have a similar post for webcomics.

Miscellaneous

I have no idea where else to put these but think they’re worth reading

That’s it for now. I’ve missed out the cooking and fiction sections entirely, and I suspect there’s some interesting stuff lurking in the early days of my archive, but the process of curating this is exhausting. I may come back to it later, but I don’t have a good track record of doing that.

This entry was posted in Uncategorized on by .

Hammer Principle back online

You might have noticed that Hammer Principle has been down for a while. It should be back up now, and I’ll continue to try to keep it so.

The TLDR of what was going on is that its codebase is really old and hasn’t seen much love in a while. In particular all its dependencies hadn’t been updated in about 3 years. Oops. My bad. (It wasn’t running anything with security critical vulnerabilities that I know of – certainly none of the big news remote code execution ones that have come out in the ruby world in the last year or so are present). My last experience of trying to bring a similar set of dependencies in another project up to date was somewhere between “unpleasant” and “intractable”, so I’d been putting this off.

Which was fine, but about a month ago it started regularly eating up 100% CPU and making my hosting provider sad and fretful at me (sorry, dude), so I turned it off until I could look at it. I then repeatedly failed to getting around to looking at it.

I have now finally got around to looking at it after someone poked me about it recently. I decided the first thing to do was just to get the dependencies upgraded – running an ancient version of datamapper on an ancient version of ruby was basically never going to go well. To my embarrassment this turned out to be one of those tasks you put off for ages and then it turns out to be really easy. Took me a couple of hours last evening. I’ve also set up website monitoring and set things up so that unicorn workers will regularly be killed off rather than letting them get too big.

Then on further investigation I discovered that the varnish setup that was supposed to protect it from large numbers of visits was completely broken. It was completely broken in no less than three ways:

  1. The app was setting session cookies for everyone who arrived. This is something I’d fixed in the past. I’m not sure when it regressed
  2. Varnish was set up to run behind another web server, which was just silly
  3. The config pointing it to varnish was commented out and wrong

Err. Yeah. Ops: I’m still not especially good at it, but I was especially bad at it when I first set hammer principle up.

That should be fixed now.

Anyway, so hopefully hammer principle should be pretty stable now. If it isn’t, I’ll fix it. I’d like to do some more work on it, but I’ve got to admit that my track record of doing so is not astoundingly good, so no promises for now.

This entry was posted in Uncategorized on by .

Thesis: Job hopping is good for companies

For some reason, I’ve seen a few pieces recently on us “millenials” and our job-hopping tendencies. It’s certainly a thing I do. I’ve worked for two companies for ~ 3 years (one slightly under, one slightly over), one for a year and a half and a few short several-month stints. (This isn’t counting Lumi, my current one. No idea/comment yet on how long that one is going to last).

A lot is mentioned about the structural reasons for this, and how it makes total sense from the employee side of things. One thing I don’t think is often mentioned is that it’s actually really useful for the employer’s point of view (ok. This is often mentioned to be the case for cynical reasons of it meaning they don’t have to be loyal to their employees, but I for one am disinclined to count the loyalty of the corporation hive minds for much of anything anyway).

From the company’s perspective it sucks when people leave. But people leaving you readily comes with a pleasant side effect which I think might outweigh its cost: people also leave other companies readily and join yours.

Why is this a good thing when compared to just having the same people stay?

Because groups of the same people who have been solving the problem together for some time start to experience a very stagnant meme pool. They’ve all been thinking about the same things for some time, and they’ve been doing so in close collaboration. The result is that they will have broadly shared blind spots and habits. They can get very focused on solving the wrong problem, they get used to things in a “We know that’s shit but we’ve largely gotten used to it or figured out ways to ignore it” way, and they’ve got very used to specific ways of doing things as they’ve mostly been exposed to the same set of ideas.

And this is where constantly bringing in new employees helps. They’ve a fresh perspective grown in a different set of ideas. They’ve seen different ways of doing things and can cherry-pick the best of them to propose here (“Hey, this problem you’re stuck on, I’ve totally seen it before and we solved it this way”). They also have a fresh supply of outrage at the things you’re doing wrong – sure, this can be annoying. It can also be really useful because sometimes those things you’ve been ignoring aren’t actually harmless and are in fact ticking time bombs and it’s really helpful to have someone shouting about them and getting them fixed.

This entry was posted in Uncategorized on by .

Some webcomic recommendations

As you may be aware, I read a lot of webcomics. Fewer these days than it used to be, but there are still probably a dozen or so I regularly follow. My cousin, Alex, asked me to recommend some to him, and I figured the list might be of general interest, so I’m putting it up here.

Finished comics

These are comics which have completed their run. This makes it especially easy to recommend them, because I know for sure they won’t turn bad (webcomics have a habit of going a bit wrong in a variety of different ways. There are a lot of comics that I used to read that I got really tired of).

Digger

Our cynical and pragmatic protagonist is a miner. She hits a patch of bad gas underground, wanders off course, and finds herself surfacing in a strange land full of gods and monsters.

Oh yes, she’s also a wombat.

Digger is a wonderfully charming story. It balances light entertainment with good fiction and some darker themes really well, and you absolutely have to go read it.

A Miracle of Science

A policeman from an organisation whose job it is to hunt down and help to cure people suffering from Science Related Memetic Disorder (colloquially, “mad scientists”) is assigned a partner who represents the giant global brain formed by the Mars colony. As per the job description, they have to hunt down a mad scientist. This doesn’t go entirely as well as expected.

Full disclosure: I love mad scientist fiction. A lot. So I was pretty much going to like this unless it was really quite dreadful. Fortunately it’s not at all dreadful and is in fact really quite good. If you like hard sci-fi and mad science you’ll definitely like this. If you’re merely indifferent to those I’d recommend it anyway – it’s solidly plotted and with really enjoyable characters.

Narbonic

More mad science! A very different tone though. Although it does grow more serious as the strip goes on and we get more attached to the characters, this is mostly a fairly light-hearted strip.

The plot? Our protagonists are Helen Narbon, a mad scientist, Mel, her slightly psychotic intern and Dave, the computer science graduate who ended up working for them as their tech guy because a) It seemed slightly less evil than Microsoft and b) Casual dress, smoking permitted. Hijinks ensue.

(There are various significant subplots, and there is an over-all arc, but it’s very much a character driven comic rather than having a single grand plot)

Similar disclaimers to a miracle of science, but I really love this strip and think it’s worth reading. Although the tone changes throughout, I think you’ll figure out fairly quickly from the first couple of dozen strips if this is your cup of tea or not.

One over zero

One over zero is… decidedly experimental. It’s a comic entirely without a fourth wall – the author is an active participant in it and regularly talks to the characters. The characters in turn actively contribute to the creative process. It starts out a bit weakly as the author finds his feet, but once the main cast appear it’s a really neat exploration of the medium.

Qualified recommendation. I really enjoyed it, but many wouldn’t. Give it a little while to get going before deciding if you do or not though – until junior, manny and the running gag are around it doesn’t really look very much like the way it does for the rest of the run.

Buck Godot: Zap gun for hire

Goofy noir space-opera done by the authors of Girl Genius. If that sounds appealing, you should probably read this.

Ongoing comics

Schlock Mercenary

Schlock Mercenary is probably my favourite webcomic. It tracks the antics of a group of mercenaries in the 31st century. It started out very light-hearted, but has evolved into extremely solid and well constructed fiction over its run whilst still maintaining a good balance with the humour. The beginning is a bit rough, particularly artistically speaking, but it quickly finds its feet and has been an incredibly enjoyable read ever since.

Part of why I’m very attached to it is that it has been consistently updating every single day (seriously: It has never missed a day. There was the day when the data center it was hosted in exploded. Howard posted the comic for that day on his livejournal) for the last thirteen years. I think I started reading it in year one or two. It’s the only webcomic I know of that has managed to stay good over that sort of stretch of time. This does unfortunately mean that the archives are kinda huge, so you might want to schedule some time to read them…

Girl Genius

I said I like mad science, right?

Girl Genius is a fun steampunk comic set in an alternate Europe where a largish subset of the population are mad scientists (“sparks”). Our protagonist, Agatha, discovers that she is one of them and that her family history is much more interesting than she’d been lead to believe.

A lot of people really love this strip. I merely likely it a lot. It has its problems, not least amongst them that it’s very visible in the artistic style that the artists got their start in pornographic comics, but it’s pretty thoroughly enjoyable.

Recommendation: Solid for what it is.

Subnormality

Surreal comic, mostly about how people relate to eachother. Full of walls of text. Usually lovely. I don’t really know how to describe it other than that. More idea-centric than anything else – there are some recurring characters, but there’s no plot per se.

Recommendation: Really quite worth checking out.

Skin Horse

Effectively the successor to Narbonic. Set in the same world, and occasionally with overlapping characters. The thing about having a world full of mad scientists is that you end up with a world full of the mad scientists’ non-human creations. Skin Horse is the government department responsible for assisting said creations (and any other non-human sapients along the way) and helping them become productive members of society.

Recommendation: Read Narbonic first. If you liked Narbonic you will like Skin Horse.

Misc

Here are some comics I like enough to read but not enough to strongly recommend (at least partly because I’m bored of writing reviews at this point). Your mileage may vary.

This entry was posted in Uncategorized on by .

I suppose it’s not terribly surprising that WordPress are bad at security

Fact: If you try to leave a comment on a wordpress.com blog with an email address you have registered to a wordpress.com account, it will ask you to sign in.

Fact 2: wordpress.com allows you to have custom domains (I think this might be a paid feature, not that that matters).

Fact 3: If you combine the previous two facts, WordPress asks you to log in on the custom domain you are currently trying to leave a comment on.

Yes, that’s right. WordPress is asking you to put your account password into a third party domain simply on the strength of it telling you that it’s a wordpress.com blog, honest for reals.

But I guess it’s OK. There’s totally a WordPress icon on the page where it asks you to log in, and there’s no way anyone could fake that.

This entry was posted in Uncategorized and tagged on by .