Copy-on-write on APFS

APFS (like many modern file systems but unlike its predecessor HFS+) supports copy-on-write. This means you can logically copy a file – it looks and behaves like a distinct file – but it doesn’t immediately copy the file’s contents on disk – it merely shares them with the original. Only if and as you modify… Read more

Swift sucks at web serving… or does it?

Chart showing throughput (requests per second) over number of concurrent requests, for four different web servers (representing the programming languages JavaScript, PHP, Kotlin - erroneously labelled as Java on the chart - and Swift).

A few weeks ago, Axel Roest published a simple web server comparison, that turned out to not be doing what it was thought to be doing. Figuring that out was a very interesting discussion that warrants a retrospective, to look at which parts were particularly helpful and which not so much. Tangentially, I want to… Read more

Swift tip: the swap function

The following code prints the Fibonacci sequence. You’ve probably seen it before. It’s one of the simplest and most well-known examples of a sliding window operation – where the next value depends on the preceding two (or more) values. While almost all programs do not calculate the Fibonacci sequence, many do contain similar sliding-window algorithms.… Read more

Option-dragging while defining the bounds of a screenshot

I’ve been taking screenshots on Macs for more than thirty years. I thought I was pretty much a power user. I’ve known forever that you can do not just the whole screen (⇧⌘3) but a specific target area (⇧⌘4), and of course the space trick for capturing a window (including menus!). But what I didn’t know is… Read more

Zsh has neat shortcuts for decomposing file names & paths

I only just learned that the venerable basename and dirname are no longer necessary, let-alone the horrible string splitting required for teasing apart names from file extensions. Zsh has some awesomely convenient expansion modifiers which do it all! e.g. given the path “/Users/me/Documents/Work.zip”: $file:t → Work.zip $file:h → /Users/me/Documents $file:r → /Users/me/Documents/Work $file:e → zip… Read more

Attention trumps experience

It’s always bemused me that I did better in electronic engineering than computer science. I studied them simultaneously, receiving degrees in both after five years (some classes counted towards both, thus why it wasn’t seven or eight years). I grew up playing on, dabbling with, and programming computers. From BASIC II to Hypercard to RealBasic… Read more