And other Unixy bits & pieces. A tutorial. To follow along with this tutorial you will need a Unix-like system such as Linux, BSD, Mac OS X, or (on Windows) Cygwin. We’ll begin with a very simple C (not C++) program. Unless mentioned otherwise, everything we’ll see about C also applies to C++ (which was designed with C compatibility in mind); in due course we will move onto C++ specifics. Our program, reproduced below in full, is a complete implementation of a read-only “database” of ...| David Röthlisberger
I want to create a typed implementation of the relational algebra using the D programming language’s template meta-programming and compile-time evaluation. Please keep in mind that I’m new to D, so I may be misusing (or abusing) its capabilities. I’ll be using D version 2, which is not compatible with version 1 of the language. You won’t need to know any D to follow along, but you will need to understand C++ templates.| David Röthlisberger
The Microsoft Natural Ergonomic Keyboard 4000 doesn’t feel very “Mac-like”, at least not out-of-the-box. Read on for helpful settings to improve the experience, and a brief review of the keyboard at the end.| David Röthlisberger
Eclipse’s default syntax highlighting seems to thinks that the language’s keywords are the most important part of a C++ program. Template! Class! Public! Typedef! Const! Return! It might not seem that hard to pick out the class and member names from the wall of code below, but when working with unfamiliar code all day, the effort does drain me. The colour scheme that ships with Emacs isn’t any better — I find its rainbow effect rather distasteful, more distracting than helpful. The ri...| David Röthlisberger
This guide is aimed at computer programmers who want to master the GNU Emacs text editor. It has been said that the Emacs learning curve is not so much steep as long. While the initial learning curve is indeed much steeper than other editors, that is a hump you’ll get over fairly soon. This guide does start from the basics, but its real aim is to help you reach the next level —programming the behavior of Emacs itself— in months rather than years. The focus is on self-driven discovery by...| David Röthlisberger
Rough notes for a half-hour course on Unix shell basics.| David Röthlisberger
I used to be a fan of "set -e" in shell scripts. It causes the script to exit immediately if an error occurs, except where you explicitly handle the error with:| David Röthlisberger
This is a summary of techniques for implementing a large build system, written in plain GNU make, for a Unix-based C or C++ codebase. By "large" I mean a build system that coordinates the building of many different "projects" or "modules"; this is sometimes called a "meta build system".| David Röthlisberger
Ninja is a build tool that claims to be much faster than good old Make. Ninja was originally created because a no-op build of the Chrome browser (where all the targets are already up to date) took 10 seconds with GNU Make. Ninja reportedly takes less than a second on the same codebase. Let’s get some measurements from a more controlled environment.| David Röthlisberger
At the recent Selenium Conference, Test.ai (a startup doing "AI-Powered Test Automation") announced that they open-sourced one of their Machine Learning models as a plugin for Appium, which is a popular test automation tool for testing mobile apps. In this article I explore what Test.ai's Appium plugin does, how it works, and how well it performs (in terms of accuracy).| David Röthlisberger
This is the first in a series of articles on the "PageObject", which is a software design pattern used in automated testing of graphical user interfaces.| David Röthlisberger
Problem: Automated UI tests are difficult to maintain. Solution: Press a button and instantly see how your PageObjects are affected by the latest change in your application-under-test.| David Röthlisberger
Gilles Vandewiele et al’s 2020 paper Overly Optimistic Prediction Results on Imbalanced Data: Flaws and Benefits of Applying Over-sampling provides a sobering reminder to take Machine Learning studies with a grain of salt: Almost 50% of the 24 peer-reviewed studies that use machine learning based on a particular publicly-available dataset, were fundamentally flawed. These studies claimed near-perfect accuracy at predicting the risk of pre-term birth for a patient; after correcting the metho...| David Röthlisberger
At my day job we recently implemented a moderately complex scheduling system for running low-priority “background” tasks on idle “nodes”. I wanted a web interface to visualise the status of the various tasks and nodes. Not all nodes are suitable for all types of tasks, so in the web interface we display several different “queues”, just for clarity of the visualisation — the queues aren’t an explicit concept in our scheduling implementation. Instead of having the front-end (bro...| David Röthlisberger
Ninja’s “-d explain” command-line option is supposed to explain what caused a build target to be re-built, but it’s next to useless in a large build: It says what’s dirty but it’s hard to relate which dirty input caused which output to be re-built. At the beginning of your build you get pages & pages of “these things are dirty” and then it starts the actual build. Also, this “explain” output is printed before ninja has realised that a lot of those things aren’t actually ...| David Röthlisberger
If your software depends on a third-party library, “vendoring” the dependency means to commit the source code of that library into a “vendor” folder alongside your own source code. A “vendor branch” is a technique for integrating new releases of that third-party library when you are maintaining your own custom patches to it. Git makes this technique particularly easy, but I haven’t seen it documented well, so here’s my attempt.| David Röthlisberger
I used Stb-tester to generate a textual representation of the Apple TV’s screen, fed that to GPT-3, and fed GPT-3’s response back to Stb-tester. It’s super flaky —I don’t need to worry about my job security just yet— but it’s pretty neat to watch when it does work. Here’s a quick demo:| David Röthlisberger
Experience report: Linux pwm-ir-tx accuracy/reliability| david.rothlis.net
Simple declarative schema migration for SQLite| david.rothlis.net