RSSAmplifier

Blog

matttproud.com (blog)

Recent content on matttproud.com (blog)

matttproud.comRSS feed ↗60 posts

Latest posts

Dealing with Stray Middle Click Events with Google Chrome in X11

I am writing this mostly for posterity in case other people are running into this problem: I’ve been using a Logitech Trackman Marble Mouse Trackball (p/n 810-000767) for many years in the X Window System 1 — Linux and OpenBSD. It’s worked great — until about two years ago. I’ve not had the chance to bisect what has gone wrong — whether it is X11, an ecosystem library, or Google…

jj Recipe: Collapsing Working Tree for Review

I’ve been using Jujutsu (jj) for a few months now and am generally liking it. My use of it hasn’t been 100% true in form to the version control system’s (VCS) capabilities and philosophy, but I am getting there. One of the things I have found myself at a loss with how to cleanly do from my old Git workflow is something as follows: I am developing something in a dedicated branch…

Requiem for a Hash Function, or: How I learned to love package maphash

I am coming off from surgery right now and have some time on my hands, so I wanted to share a story about a learning experience. This post is a bit of a dual purpose one on a teachable moment as a software engineer — a chance to offer a retrospective from bad decisions and earn penance therefor. There is one episode that sticks out in my memory with a fair bit of shame: implementing the original…

Go: Improving Example Visibility in pkgsite (pkg.go.dev)

Today, a small UI improvement I made to Go’s pkgsite tool was deployed to production. pkgsite is the tool that can be run locally to serve documentation, and it’s also the binary that serves http://pkg.go.dev . The Change This change may seem a bit mundane at first, but ultimately it is part of a larger narrative in building user empathy — empathy toward your fellow developers. So,…

Flagging Files that Ignore Files Match

I found myself wanting an tool recently, and I was honestly surprised that none already existed to do this. What was it that I wanted? Rather simply a way identify files in a project tree that a .gitignore file or similar would ignore. Namely I wanted to identify files that would be ignored and delete them in certain programmatic workflows. Suppose we have a project directory structure like…

Go: Package-Centric Organization

Organizing source code is a critical skill in software mastery, and this remains true in Go . Unfortunately the skill of idiomatic organization in one language does not necessarily translate to another. What makes this trickier is that code organization happens at several levels: the build system the packaging system in code in the file system To understand why, consider this Unified Modeling…

Behind the Scenes: CI and CD with this Web Site and Blog

There’s a fun trope on the Fediverse about the absurdity of using continuous integration (CI) and continuous delivery (CD) on a personal web site: Post by @philgyford@mastodon.social View on Mastodon It’s a cute thought, but the critique has a lot of purchase. I’ve generally been an adherent to a philosophy of spartan simplicity where I can, and that is something I’ve…

Approach to LLMs and Other Reflections

If you asked me where I fall in the AI camp, I’m in the skeptical-but-curious quadrant ( example ). Notwithstanding the various legitimate critiques of what everyone is calling AI and doing with it, I have been finding some interesting utility with it in my — I don’t want to say every day but in — my week to week. This is particularly in the space of large language models (LLM)s.…

The Curious Case of the Misspelled Streets in California's Little Switzerland

I came across something that caught my eye today. When entering “Zürich” (as in the city in Switzerland) into an address input box on a web site, the web site’s autocompletion engine ( example ) suggested something unusual: “Zurich Drive” in California. Now, I have seen these same engines suggest “ Lake Zurich, Illinois ” accidentally before (a lot), but…

Golden File Testing

Today, driven by annoyance, I refactor-extracted a small set of test helper code found in various private personal projects around the topic of golden file management into a dedicated Go module: github.com/matttproud/goldentest ( API documentation ). I’m happy to finally have a canonical solution that I am happy with. I’ll freely admit it: I use change detector tests 1 for some things,…

Elegant Configuration APIs and Command Line Flags

I’d like to share a design pattern with Go that I really find particularly elegant. It orients itself around hermetic, testable configuration using command line flags. But before I do, I need to put three questions to you since they determine if you need to do some pre-reading in advance . If you are familiar with package flag , are you aware of the Var -suffixed flag creation API variants…

Go: Testing Frameworks and Mini-Languages

If you’ve ever read the Go FAQ , it contains a section on testing frameworks that features some provocative language that I’ll quote verbatim below: A related point is that testing frameworks tend to develop into mini-languages of their own, with conditionals and controls and printing mechanisms, but Go already has all those capabilities; why recreate them? We’d rather write tests in…

Go: Debugging Individual Table Tests

Suppose one day you receive a bug report about your code ( func Encode ) and want to build a test to verify the fix or recreate the problem. You might have defined your code’s tests in a table-driven format , similar to below: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 import ( 'testing' 'github.com/google/go-cmp/cmp' ) func TestEncode ( t * testing . T…

Flowchart for Choosing gRPC Methods Types

Scenario Let’s suppose your boss tasks you with the problem of building a data upload service for blobs . The only requirement is the system has to be built on gRPC . How do you go about doing this, and, in the end, does your solution look more like no. 1 or no. 2 below? Prototypical Unary RPC: 1 2 3 4 5 6 7 8 9 10 message UploadRequest { string file_name = 1 ; bytes content = 2 ; } message…

Using Elves to Keep Go Toolchain Up-to-Date

I used to be a rather prolific shell script user; I knew the ins and outs of the Advanced Bash-Scripting Guide by heart. But after Go came into existence, I generally ported most of my scripts to statically-compiled programs. Go continues to work great for this in terms of productivity, ergonomics, and clarity. I still do use shell scripts for very minor procedural things, but there remains a…

Bettering Best Practices

One of the things I enjoy about my line of work is how much reading is involved. The material runs the range from academic scholarship and rigorous empirical analyses all the way down to just some random person’s opinion on something. The perspectives are often interesting and thought-provoking. I learn an awful lot from it. One thing I don’t do is take what I read at face value and…

Reflections on Death and Loss

Today my mother passed away after a battle with cancer. This is an uncomfortable topic for me to write about, so I am doing this to help process what has happened, save my fresh recollection for posterity, and perhaps provide some useful advice to anyone else who finds oneself in a position similar to this in the future. All of this happened rather fast: July 19, 2024 – Dec. 28, 2024. My mother…

Unnumbered S-Bahn-Linien

If you’ve spent much time in Zürich and use public transport, you may have seen a peculiarity like this before: Destination: Unterterzen Notice what it is? If you don’t, this train is labeled purely as “S.” There is no “S2,” “S16,” nor “S24,” nor any other S+numeric-prefix designation. Surely this is an error, right? Let’s look at…

Vagaries of Voting While Abroad: Affordances, Surprises, and Disenfranchisement, etc.

Happy Halloween. I want to talk about something legitimately scary. I want to write about your rights today and some vagaries around them. Important: Before we proceed, I want to just get something out of the way: I am not a lawyer; I am a layperson. That said, I have been living abroad for over a decade, so I have had a chance to research things, talk with officials who are experts, and confer…

Front 242 Live: A Closing Chapter

Still from Front 242: Headhunter A constant trope in my life has been feeling like I was born five-to-ten years too late. This has applied in the space of music. Case in point: One of my favorite bands for years has been Front 242 : Front 242 sounds mostly like a research effort that also produced music as a side-project, yet it is so timeless (if one discounts the question of the vintage of…

Election Loathing: 2024 Edition

I need to get this off my chest. The 2016 election left me profoundly traumatized 1 , and I am finding the same trauma returning to me again in 2024 as we approach the general election. The fire on which Donald Trump’s campaign in 2015–16 rode was astounding. It left me disgusted in that period: The American People: how could they be so stupid as to inflict this kind of brazen wound onto…

Config Management at Scale: The Gold Standard

It dawned on me recently how long I’ve been out of the role of Site Reliability Engineer (SRE). As I look back at that part of my career, I wanted to share a distillation of lessons I learned the hard way to software developers at-large in the hope that they’d avoid them themselves. Namely, the premise of this article is identifying the functional qualities would I expect a gold-tier…

Go: Naming Errors and the Parlance of Error Types

If you read my Go Error Propagation and API Contracts article, you may have noticed that I intimated at a typology of errors . I suggested three main classes: sentinel errors structured error values opaque errors You may be able to guess what these errors are, how they are designed, how they are used, and why from the name of their type, but did you know that these classes of errors have a…

Git: Cheap Task Tracking

I have a couple of hundred small Git repositories for small projects and research, and that number is only going to grow (let’s be honest). I am quintessentially lazy when it comes to tracking open work (“TODOs”) with these. Sometimes I might step away from a project for a few years and return with new ideas, so being able to pick up where I left of easily is key. I’ve…

Notes on Extending Chamberlain Garage Door Opener Receiver Range

About a year ago, I purchased a house in the United States in the Twin Cities . Long story why; will share what went into that calculus in a later post. No plans to leave Switzerland, in case you ask. Earlier this year, the house’s aging garage door opener finally died. I used that opportunity to replace it with one of the quieter more modern belt-driven versions. One my relatives here…

European Road Law for North American Visitors

I want to open with a premise: North American motorists driving in Europe are probably ill-prepared to operate a motor vehicle safely due an inadequate understanding of the local rules of the road . As a (mostly-former) motorist from North America who lives in Europe, a few general observations I have of European road transport are that … the roads require drivers to use contextual clues for safe…

Go: How the Testing Harness Works

This is a smaller piece that I broke off from a larger article. It’s in the space of Go minutiae, but it’s worth considering if you plan on developing full mastery of the language ecosystem. So let’s start out with a question: what happens when you run go test ? Very specifically in the time between when the go tool starts running and before your tests start running? If…

Zürich: Phallic Fountains and Other Water Features

Mention the city of Zürich to someone, and you’re likely to get a somewhat off-base reactive invective: Bankers Stuffy Boring Expensive Overblown City Slickers Maybe all of the above? Who knows, and frankly I don’t care. It’s where I live, and it’s my home. There are a lot of things about it I’ve come to appreciate, but the place’s understated whimsy is…

Hugo Tag Page Counts

One of the things I had been curious how to do in Hugo but readily couldn’t find out was have the tag listings on pages provide a count of the number of pages that also belong to the respective tag. For instance, four pages (at this exact moment) have the “hugo” tag. I’d like the pages that include the “hugo” tag to have a “(4)” follow the name on…

Context Cancellation and Server Libraries like gRPC and net/http

Pop quiz, hot shot : what is the behavior of func f (as defined below) when it is called from a bare gRPC method or HTTP handler as go f(ctx) using the context.Context provided to the handler? 1 1 2 3 4 5 6 7 8 9 10 11 func f ( ctx context . Context ) { // Flimsily make it improbable for this function to return while the // handler is serving. time . Sleep ( time . Second ) select { case <- time .…

Iconography of the X Window System: The Boot Stipple

If you are of a certain vintage, this image is burned indelibly somewhere in your posterior parietal complex: Oh, my old friend. How it&rsquo;s been a long time. Cultural Significance For the uninitiated, what are we looking at? Could it be the Moiré Error from Doom? Well, no. You are looking at (part of) the boot up screen for the X Window System , specifically the pattern it uses as the…

In Praise of the fc Shell Builtin

A recent post by Julia Evans prompted me to share a little trick I have been using in UNIX-like shells for a significant part of my life. It&rsquo;s called fc (short for &ldquo;fix command&rdquo;), and it is a builtin of most modern shells. I tend to use it at least once a day. Origins Thinking about the humble fc sent me down a bit of a rabbit hole as the facility has been in been a fixture of…

Revisiting Test Sizes

Conventionally software engineers have reasoned with how expensive a test is by classifying how it exercises the system under test (SUT): unit, integration, or functional. Each successive one being more — for some definition of — &ldquo;expensive&rdquo; than the previous. This works fine as an approximation, but it starts to break down as nuances of what the test is doing and how are put into…

Cultural Critique: American Penny Pinching

I&rsquo;ve lived outside the United States for well over a decade now. It&rsquo;s not my first time living abroad, but this stint is different in that it has included working and raising a family. Being away from one&rsquo;s country of birth changes a person in both expected and unexpected ways, as distance enables considerable reflection. There are a few cultural hangups I&rsquo;ve developed…

Political Donation Strategy 2024

It&rsquo;s pretty late in the 2024 United States election cycle. I think we all know the stakes: the rule of law and preservation of liberal democracy are on the ballot, notwithstanding women&rsquo;s rights, global warming, and the environment, etc. being there, too. I&rsquo;ve taken a multi-prong approach to donating this cycle with the following PACs and organizations getting my attention: Oath…

Go Error Propagation and API Contracts

I&rsquo;ve been thinking about errors in Go quite a bit lately and what has been bothering me about the practice of error design and usage in the community. The critique starts with this code: 1 2 3 if err != nil { return err } It&rsquo;s such a common piece of code that it has become a trope thanks to folks feeling like the apparent verbosity is an affront to their humanity. The verbosity&rsquo;s…

Rust Borrowed IntoIterator Trait

For purposes of continued learning, I have been futzing around with Rust a little bit in my spare time. I had postponed doing this because I felt that the ecosystem was a bit too immature in terms of churn. 1 I read the The Rust Programming Language several years ago. It&rsquo;s a fine book, but I found it a little bit too superficial at the time. In the interim, the Android and Chrome Teams at…

A Rant on R and the Melt Function in R

I need to be honest: I find the documentation for R frustrating, particularly the API documentation. From the perspective of a professional software engineer, much of the API documentation is unhelpful. There are several common problems: What kind of input does the function accept? What kind of output does the function produce? What does the function actually do? I&rsquo;ll freely admit that I am…

Great Series I Savings Bond Backtest

Premise Before we start out, I want to contextualize what you are about to read. I&rsquo;ve been a practicing Boglehead for a little over decade. Recently, as I have become older, I became interested in Series I Savings Bonds (I Bonds) as a vehicle to preserve the value of my emergency funds over the long term and have been gradually moving money into them. Throughout this process, I became…

Go Fonts as Web Fonts

It&rsquo;s no secret: if you&rsquo;re viewing this page, you can see that I am a fan of the Go Fonts . The problem is that the Go Fonts are not available as web fonts . In years past, I had tried converting them to web fonts, but the process never succeeded. I am not quite sure why, to be honest. Luckily, I was finally able to convert them recently. Third time&rsquo;s a charm — eh?

Book Endorsement: ggplot2: Elegant Graphics for Data Analysis

I want to make a short plug for ggplot2: Elegant Graphics for Data Analysis by Wickham, Hadley, et. al. This book did a great job illustrating the philosophy of ggplot2 as well as demonstrating several interesting recipes and pitfalls. It did more than several evenings of diving into ggplot2 recipes with an internet search engine could ever do. Wishes In a perfect world, somebody 1 would create a…

Preventing LLM Web Site Crawlers

I was recently doing several searches on the public World Wide Web around some niche technical topics. The search results were straight disappointing. The search topics and terms would lead to very specific, canonical documents, ones that have so many inbound links that preferring any other documents from a ranking standpoint would be lunacy — in a sane and just world that is. One we don&rsquo;t…

Neologism: Context Awareness

I would like to propose a set of neologisms for the Go Programming Language based on emergent language use: context awareness : noun, the state of an API being cognizant of and respecting the semantics of the context API . Example: Function f has context awareness. context-aware or 1 context aware : phrasal adjective, whether an API has context awareness. Examples: The API consumes a context-aware…

Contextualizing the Go Context API: Program Scopes

The context API is a critical foundation for modern Go development. This is especially the case with APIs that use concurrency under the hood or perform distributed operations. Given this, I would like to do a deep dive on several topics around the context API. I expect this post to be the first of several. In this one, I cover contexts and program scopes . Program scope and contexts sound like a…

Teaser: Thought Experiment on Representing Temperature in Climate Comparisons

Growing up in Tornado Alley proper, I have had a life-long fascination with weather. And for the longest time, I wanted to become a meteorologist but didn&rsquo;t for indeterminate reasons. Note: This post is a bit of a teaser: I am working on a year-long data collection and analysis project. Once the project completes, I will make a new post with definitive conclusions. Taking several statistics…

Tip: Shell Brace Expansion

Those who know me — I think — would say not say I am lazy. In particular, I have nary an interest in code golf and usually consider it actively harmful. That said, shells provide a number of capabilities that are both clear and compact for expressing complex operations. 1 One of my daily favorites is brace expansion which can be done by forming an expression with { and } in the shell. A simple…

Plain Old Data in Go: POGS

I&rsquo;ve found myself reaching for a set of terms with increasing frequency in recent years when writing technical documentation and providing design feedback. The problem revolves around this: what is Plain Old Data (POD) in Go, and what do you call it in the Go context? A Quick Dive into PODs To answer this, let&rsquo;s consider what a POD typically is: It&rsquo;s a collection of data. That…

RCS Style Keywords in Hugo

If you&rsquo;re of a certain generation, you may remember a period of time when web sites on the World Wide Web may have featured a snippet of text like this at the bottom of their web sites: $Id: index.html,v 1.1 1999/10/07 13:45:15 john Exp $ And if you&rsquo;re of a certain generation a little bit older, you probably know what that fragment means and used it yourself. Don&rsquo;t know? These…

About the Blog

A web log is a web log. Nothing new or revolutionary here. I don&rsquo;t have a lot of free time these days. I do get sporadic windows to write, which I enjoy doing. I take a philosophy to when I write something: Write about a topic I would have enjoyed reading about. Write about a topic to better commit an idea to memory. Write about something for posterity. You&rsquo;ll find a number of musings…

Acknowledgments

One stands on the shoulders of giants. Font This web site makes use of the Go Fonts . The fonts are modified from their original form ( .TTF files) and converted to .WOFF file format. Font File Font Name Derived File Go-Regular.ttf Go Go-Regular.woff Go-Bold-Italic.ttf Go Go-Bold-Italic.woff Go-Bold.ttf Go Go-Bold.woff Go-Italic.ttf Go Go-Italic.woff Go-Medium.ttf Go Medium Go-Medium.woff…