the corner office : tech blog

a tech blog, by Colin Pretorius


I was better at Unix when I was younger, but at some point I decided that I could either work on important things or I could get better at Unix.

A commenter at Marginal Revolution

{2018.05.09 21:37} : Comments (0)

GIS Coordinates

Links via:

{2018.04.09 19:31} : Comments (0)

SSD vs Spinny Disks

My PC has an SSD main drive and a traditional HDD. Most of my files (code, music, videos, general documents and stuff) are on the HDD. I need no convincing about the read speed of SSDs - my machine boots up in a few seconds. I was wondering though, whether I could speed up day to day work (particularly, development).

So I copied my 'dev' directory from my HDD to the SSD, and with two cygwin terminals side by side, ran mvn clean package on some of my chunkiest projects, first A, then B, then A, then B, then A, then B, and so on. I didn't take exact measurements, but the results were interesting: the HDD versions built as fast, or faster (I'd say up to 10%) than the SSD versions.

Of course, I wasn't doing all the Right Things, like flushing and whatnot, but the clean meant at least some of the file I/O wasn't pre-cached. The fact is that at no time was the SSD build faster, and it was generally marginally slower. SSD is fast, but my belief that it was very good for random non-sequential reads was wrong.

(Or if it is, then something else is going when it comes to compiling on SSD versus HDD, or how the two copies of my various code directories were laid out on 'disk' matters more than I'd have expected).

Moral of the story: as far as software development goes, having $IDE fire up from the SSD is a big win, but an HDD seems fine for the actual code.

{2018.04.04 19:14} : Comments (0)


I've moved my site to AWS. All the cool kids &c &c. After diving into the tutorials and working through the impenetrable-looking acronym and feature soup ("I just want a simple server dammit"), it wasn't too hard. Within an hour or two I had a running VM, my /etc/apache2 and /var/www were copied over, and within another hour most of the internet had picked up my DNS changes.

It marks the end of more than a decade of happy service from RoseHosting. I'd gladly recommend them for reliable VPSes, if you need one. Cancelling my subscription had a "creative destruction" feel which saddened me, but my requirements are modest, and the cost just wasn't worth it. Even after a year of free tier AWS usage, running a t2.nano EC2 instance will cost next to nothing, if I haven't moved on to something even simpler and cheaper in the meantime.

{2018.03.18 08:28} : Comments (0)


I had great plans for doing interesting things over the Christmas break, but I ended up spending the time sorting out the household's backups.

Until now, my backup system boiled down to semi-regularly rsyncing to one of two external hard drives, and some of my most important directories being far less regularly dumped into encrypted tarballs and synced to a free cloud storage provider.

My main worries are not having data only at home (one fire, flood or burglary away from losing everything), and not tracking changes to important files - even more of a worry these days with the rise of ransomware. After a few false starts, this is what I've settled on:

  • I discovered BorgBackup. It does exactly what I wanted: de-duplicating backups, so your backup 'archives' don't waste space (and in fact, you save space if lots of your files are similar), and it isn't hampered by renaming files and the like. That, and the backup data files are encrypted, so I'm not worried about them being backed up to the cloud.

  • Note to self: send printed copies of encryption keys to friends and family on other continents.

  • I've used borg with WSL, and uploading files seems to work well enough. I haven't tried cygwin. I couldn't back up directly to an external hard drive (iirc, due to a not-yet-implemented system call in WSL which caused borg to choke), but worked around that by setting up some VirtualBox vms and getting the data to them via ssh.

  • for pushing data to cloud storage, I'm using rclone. Like borg, a great piece of free software.

  • I settled on plcloud for online storage. They had a Christmas special which made it pretty cheap to get 2TB for a year. I'm nowhere near that now but if I start ripping our CD collection to flacs, which I want to do in 2018, then I'll be glad to have the headroom.

  • I also looked at Backblaze B2; they're well regarded and I may yet use them for additional redundancy. Their monthly storage costs are only slightly more expensive than Wasabi, but downloads are cheaper, and if you're going to trust your whole life to some encrypted files in a cloud provider's data centre, I think it's a good idea to to download everything occasionally to make sure that restoring your data actually works.

  • Needless to say, Amazon Glacier and Google's equivalent (whatever it was called) have ridiculously complicated and scary pricing models for their cold storage options, so they were non-starters.

{2018.01.06 23:54} : Comments (0)

Firefox caches

To move the cache dir out of your main profile directory, set



Note also comment about a vanilla Firefox separating the profile between Local and Roaming (mine isn't like that, but I've always pointed to a profile in another location.

{2017.12.30 11:08} : Comments (0)

Windows It Is

I lasted a little over a month, but finally gave up on Linux and switched to Windows 10. I enjoyed using Xubuntu, but there were a few frustrations, like erratic support for my bluetooth headphones, a random crash (not something I'm used to with Linux), and fiddly printer set-up, and an overly sensitive wireless mouse, and finally, very disappointing Intellij performance that I just didn't have the energy to try and troubleshoot.

That, and despite me preparing the family for ages ("this is going to be a Linux PC, so your Windows stuff will stay on the laptop"), when it came down to it, I didn't feel that what I was gaining from using Linux was worth it, given what everyone else at home was missing out on.

(Ironically, after switching to Windows, Ronwen said 'I miss Xubuntu'. The eldest has his Roblox on Windows, so he's happy. So perhaps we'll switch the laptop over to Xubuntu instead).

Beyond that, I have to grudgingly admit that Windows 10 is pretty solid, and with VirtualBox, and the performance and memory on this machine, using Linux VMs is not an issue, so Windows doesn't prevent me from using as much Linux as I'd like.

{2017.11.28 21:40} : Comments (0)

New PC

It's taken 11 loooong years since we moved to the UK, but I finally have a desktop PC again.

We've always had laptops because until we moved into the new house, we've never had a dedicated study - so always shuffling between spare room and living room as needed. This time around I hadn't actually thought about getting a PC, and was pretty close to ordering a new laptop when it I thought... why not?

One thing I learned - again - is that buying a laptop is far less complicated than buying a PC. All told, I spent nearly a month getting my head around the latest and greatest in PC hardware. Along the way I discovered PCPartPicker (great site), did a heap of research, waited (im)patiently for all the parts to arrive, built it (without frying or destroying anything), and am now a happy desktop owner, again.

The goal was a beefy PC with lots of memory, running Linux. A solid development machine, not a gaming machine, but with a 'you never know' at the back of my mind. I ended up with an AMD Ryzen 1700 (I'm a sucker for an underdog, but Ryzens are well and truly impressive), and a workable graphics card (because you never know...) and my first ever SSD, and 32GB memory (a decent whack of memory - not as decent as 64GB, but 64GB at today's prices is pure madness).

The main thrill of the Ryzen is 8 cores, 16 threads. Overkill? Maybe. The dream is me doing dev work on the machine, a couple of VMs running, with the eldest logged in remotely and playing MineCraft, without me even noticing.

Oh, and a case with a glass panel, so that my sons (of course), can see the LEDs from the motherboard and CPU. I don't remember those from 11 years ago.

{2017.10.14 23:17} : Comments (0)

Kotlin Properties

A minor Kotlin annoyance. If you have a Java class with a public final field, such that you just reference it as, then it'd be nice for a Kotlin equivalent to be accessible in the same way.

Problem is, Kotlin/Java interop converts that to Java Bean style, so a Kotlin has to be accessed as foo.getBar() from Java code. I was tearing my hear out wondering why the compiler thought the field I was accessing had 'private access' when it so obviously didn't.

Upshot: cue some editing when converting Java classes to Kotlin.

Probably not a huge issue for most 'idiomatic' Java, but I've long been a fan of exposing immutable fields for struct-ish types this way (subject to usual public API caveats etc; it's trivially easy for internal-only code to be refactored into method accessors if you ever need it, and in the meantime, you have cleaner code, cf. any language which supports properties).

{2017.09.14 18:35} : Comments (0)

Thoughts on Kotlin

Living on the edge, throwing caution to the wind, a walk on the wild side and all that, I decided to git checkout -b and give Kotlin a try on a personal budgeting app I use and occasionally tweak. I'll probably update this as I go along:

  • big win: able to start adding Kotlin code to an existing Java project with a few slabs of xml in pom.xml. Java code calling Kotlin classes in the same project and vice versa, inheritance in both directions. Brilliant.

  • C# features that I'm enjoying: extension methods, properties, named parameters, default parameters, var (and even better than C#, val).

  • C# features not there, which aren't a big deal but will be really welcome if Project Valhalla delivers for the JVM: value types and better generics.

  • the whole primary and secondary constructor thing reminds me of my foray into Scala. I'm still ambivalent about it, but trying to be open-minded. Where it gets messy is that suddenly you don't have the cleaner, Java-typical statics-then-instance, publics-then-privates and finals-then-mutable ordering of fields at the top of your class. There's presumably an idiomatic way of doing this, I just don't know it yet. I wonder whether the C++ tendency to keep privates and consts at the bottom of the file make more sense.

  • top-level functions. Great idea, and why not?

  • sad: why not save developers the RSI and call it Bool?

  • sad: no unsigned types. There's a post on the Kotlin forum where Jetbrains say "yes it would be nice but it's many many months of work".

  • the open question for me is always the extent to which the compiler can bypass boxing to get things done. This may not matter for lots of things but for serious performance, it matters (in the same vein in which your average "use BigDecimal dammit" responders on SO rather betray the kinds of systems they don't work on).

  • typealias is a nice idea, but if it was as strict as a typedef it'd be even better.

  • I like the fact that Kotlin re-uses and extends the Java libraries, rather than trying to reimplement everything.

{2017.08.09 11:42} : Comments (0)

« Older


main blog


rssfeed posts

© Colin Pretorius