How to add an empty directory to a Git repository

How do you add an empty directory to a Git repository? It’s a classic, and yet, I have to look it up every single time. Git does not support this out of the box: Currently the design of the Git index (staging area) only permits files to be listed, and nobody competent enough to make the change to allow empty directories has cared enough about this situation to remedy it. Directories are added automatically when adding files inside them. That is, directories never have to be added to the repository, and are not tracked on their own. You can say git add <dir> and it will add the files in there. If you really need a directory to exist in checkouts you should create a file in it. .gitignore works well for this purpose; you can leave it empty or fill in the names of files you do not expect to show up in the directory. (source) ...

March 22, 2021

My Pusher of Digital Memorabilia

If you are a grumpy old geek like me, you are probably a sucker for vintage computer games too. I don’t play games. Not anymore. I still enjoy reading about them, though. I guess it’s mostly nostalgia. I also believe that the mid-80s up to the mid-90s really was the golden age of computer games. In my book, innovation started with Infocom’s text adventures and soft-ended with Origin’s Ultima Online. After that, it’s been a constant evolution. “Harder, better, faster, stronger”, yes, but hardly a revolution. ...

March 21, 2021

Book Review: Materada

I am very ignorant about the Istrian Peninsula’s history, a gap I always wanted to fill. After some research, Fulvio Tomizza’s book, Materada, surfaced as a good fit to fill this gap. It’s a semi-biographic historical novel set in the Istria of the author’s youth. Fulvio Tomizza was born in Giurizzani di Materada, Istria, in 1935. He had to go through all the torments caused in that disputed area by Fascism first (forced Italianization, cultural suppression), and then by the Second World War and the terrible events that followed: the Foibe massacres and the Istrian-Dalmatian exodus. ...

March 19, 2021

Battling with SSH, cron jobs, and macOS Keyring

So today, I was setting up a cronjob on my trusty MacBook Pro. The goal was to backup some folders from a remote Linux server via rsync. The script is simple. It goes something like this: rsync -avz -e "ssh -i ~/.ssh/my_rsa_keyfile" myuser@myserver:remotedir/ ~/localdir/ Launched by hand, it works seamlessly. Call it from a cron job via crontab, and I get a permission denied error. I then enabled ssh -v option to gather a little intel on what was actually going on. As it turns out, the exact error was: ...

March 17, 2021

How to Write Good Software Documentation

There is a secret that needs to be understood in order to write good software documentation: there isn’t one thing called documentation, there are four. They are: tutorials, how-to guides, technical reference and explanation. They represent four different purposes or functions, and require four different approaches to their creation. Understanding the implications of this will help improve most documentation - often immensely. I dig Daniele Procida’s take on writing good software documentation. It just makes sense. The system is simple, comprehensive, and, crucial, universally-applicable. The “four different functions” scheme works equally well if you are writing for a technical-savvy audience or the general public, which is excellent. The users I’m writing for are software developers, in some cases, and desktop or web application users in others. ...

March 16, 2021

How to Shrink a WSL2 Virtual Disk

I discovered you can use the “diskpart” tool to compact a VHDX. This allows you to shrink a WSL2 virtual disk file, reclaiming disk space. It appeared to work for me without any data corruption, taking the file size down from 100GB to 15GB. (source) I adore Parallels “reclaim disk space” feature. Just the other day, I got back 70GB off my Windows Guest in a breeze. I’m coming from VirtualBox, where reclaiming disk space is a significant pain. I would expect optimize-vhd to achieve the goal with WSL2, but it’s nice to know there are alternatives, like Stephen’s above ...

March 12, 2021

You Have to Write As Though Your Parents Are Dead

The Literary Hub has a great short interview with Ian McEwan. What’s the best writing advice you’ve ever received? When I was living in London at the start of my career in the mid-1970s, I became friends with Philip Roth, who took an avuncular interest in my work. Where many others thought my writing was wild and weird, he thought I wasn’t being wild enough. He once came to my apartment and spread the typescript of my first novel (The Cement Garden) over the floor. He was on his hands and knees, moving the chapters around. What he wanted was for me to be bolder, crazier. He said, “You have to write as though your parents are dead.” My parents were alive. I took that advice. ...

March 12, 2021

Cleaning Up Your Postgres Database

I am an application/backend developer who has to quibble with databases more often than desired. I can get my way around Postgres pretty well, but I can always use a hint or two, especially when it comes to fine-tuning and performance. I stumbled upon Cleaning Up Your Postgres Databases. It offers useful advice on spotting performance bottlenecks in your Postgres database. Take the cache and index hit queries, for example. The first thing you’re going to want to look at is your cache hit ratio and index hit ratio. Your cache hit ratio is going to give the percentage of time your data is served from within memory vs. having to go to disk. Generally serving data from memory vs. disk is going to orders of magnitude faster, thus the more you can serve from memory the better. For a typical web application making a lot of short requests I’m going to target > 99% here. ...

March 9, 2021

Book Review: The Library at Night

As any other bookworm worth its salt, I digested a generous amount of books on books and the history of libraries. Alberto Manguel’s The Library at Night was last, and that is a pity. It probably arrived just a little too late on my shelves. I wish I found it at the beginning of my reading journey when my enthusiasm for libraries and their contents was pristine. Manguel’s writing is mesmerizing and capable. The lover of libraries and their books (in that order because this text is more about libraries than the books they contain) will undoubtedly fall into the rabbit hole and devour this book. Check this out: ...

March 6, 2021

Semantic Versioning Will Not Save You

The always brilliant Hynek recently posted Semantic Versioning Will Not Save You. Primarily targeted at consumers of SemVer-versioned packages, it is full of insightful advice. From my perspective as an open-source maintainer, I can tell you that versioning is hard. Judging when a new release is going to break backward compatibility is not as simple as it might seem on the surface, and Hynek does a great job explaining why. Sometimes it is also hard for me to tell if a change in a codebase classifies as a new feature, small improvement, or fix—subtle differences. In the context of SemVer, it matters a lot because version numbers have a meaning. Consumers will likely decide whether to upgrade or not based on that meaning. ...

March 4, 2021