rsync with a different user

Today I learned how to rsync with a user different than the one connected to the remote. Why would one want to do such a thing? The data I need to download from that server is owned by ‘backup,’ a different, service-only user. I wanted to avoid going the change-permissions slippery route and allow my user direct access to the data. Looking at the rsync documentation, I learned about the nifty --rsync-path=PROGRAM option: »

Homebrew and .NET 8 Preview don't like each other

Today I learned that .NET 8 Preview could play better with Homebrew (or vice-versa). I’m working on a C# 12 presentation for our local developer meetup, and for that, I wanted .NET 8 Preview to run side by side with version 7 on my Mac. As version 7 was initially installed with Homebrew, I also wanted to install version 8 Preview with Homebrew, but that recipe was unavailable. Not perfectly happy with that, I fell back to the stand-alone installer, expecting problems. »

Python `decimal.getcontext` does not work with bpython

I have been working on a side project for which I’m using bpython, a “fancy interface to the Python interpreter.” If you use the Python REPL often, you should check it out. It offers unique features like in-line syntax highlighting, readline-like autocomplete, a “rewind” function to pop the last line of code from memory, auto-indentation and more. Anyway, today I found a bug in bpython, and that’s that Python’s decimal.getcontext() does not work with it. »

macOS networkQuality tool

Today I learned about a precious little macOS command line tool, networkQuality. The networkQuality tool is a built-in tool released in macOS Monterey that can help diagnose network issues and measure network performance. Usage: networkQuality -v Example output: ==== SUMMARY ==== Uplink capacity: 44.448 Mbps (Accuracy: High) Downlink capacity: 162.135 Mbps (Accuracy: High) Responsiveness: Low (73 RPM) (Accuracy: High) Idle Latency: 50.125 milliseconds (Accuracy: High) Interface: en0 Uplink bytes transferred: 69. »

The real cost of interruption

I’m just back from reading Programmer Interrupted: The Real Cost of Interruption and Context Switching, an interesting short piece in which I learned about at least two new things. First, The Parable of the Two Watchmakers, introduced by Nobel Prize winner Herbert Simon, describes the complex relationship between sub-systems and their larger wholes. In the context of the article, it helps explain, even for non-programmers, the cost of an interruption. It also hints at a possible mitigation technique: »

Hand dryers

via Subscribe to the newsletter, the RSS feed, or follow me on Mastodon »

Awesome psql tips

Today I learned about psql-tips.org by Lætitia Avrot, an excellent repository of psql (the CLI tool, not the database itself) tips. I like how one randomized tip is playfully served on the home page while the complete list is always at hand. Subscribe to the newsletter, the RSS feed, or follow me on Mastodon »

Making the latest C# language features available in older .NET versions

In a C# library I’ve been working on, I wanted to use C# 9.0’s init keyword. Quoting the documentation: The init keyword defines an accessor method in a property or indexer. An init-only setter assigns a value to the property or the indexer element only during object construction. This enforces immutability so that once the object is initialized, it can’t be changed again. Consider the following class: public class Person { public string FirstName { get; init; } } You can initialize it like this: »

On implementing the ASP.NET Core 7 rate-limiting middleware

Today, my last self-assigned duty before the Christmas break was to migrate our in-house rate-limiting implementation (based on the AspNetCoreRateLimiting third-party package) to the new, shiny rate-limiting middleware introduced by ASP.NET Core 7. While the process was relatively straightforward, I stumbled upon a few quirks I want to annotate here. Our use case is simple. We use what the ASP.NET Core 7 documentation defines as a “fixed window limiter.” It uses a specified time window to limit requests. »

Brazilian Ju-Jitsu and me

I attended my first BJJ class a little more than a month ago. Going into it, I was hesitant. After many years doing what most people today call calisthenics, I wanted to try something new and challenging. But would it be appropriate for me to get into martial arts at the age of fifty-two? When I discovered that we have a branch of the renowned Roger Gracie Academy here in my hometown, I thought it was time to find out. »

Author image Nicola Iarocci on #til, #bjj,

How to avoid unwanted calls on iPhone

Oh, joy. After many years with an iPhone, today I learned how to stop spam calls with a single, not-really-super-secret move. Settings > Phone > Silence Unknown Callers That’s it. Unknown callers now go straight to my recent calls list for me to (eventually) review. Most importantly, the phone doesn’t ring. I initially had True Caller installed and enabled, which worked for a while. Spammers use throw-away numbers anyway, so it’s super-hard for tools like that to keep track. »

The Docker Event Monitor

I added a new tool to my amateurish DevOps toolbox. Developed in the open by Tom Williams, the Docker Event Monitor is a “tiny container that monitors the local Docker event system in real-time and sends notifications to various integrations for event types that match the configuration. For example, you can trigger an alert when a container is stopped, killed, runs out of memory or health status change.” At its core sits a simple python script that monitors the docker. »

How to copy a file's path in macOS Finder

No matter how long I’ve possessed a Mac and how hard I try, there will always be a helpful keyboard shortcut hidden somewhere that I don’t know about. Today I learned about holding the Option key while clicking on the Copy command in Finder. It activates the super-useful (and super-secret) “copy as pathname” feature. I spotted this trick on Jamie Smith’s website, where other handy shortcuts (and the pretty gif above) reside. »

The curious origins of Bluetooth's name

When Giulia came home from school today, she was anxious to tell me what she learned about a Viking King and his legacy. She told me the story of King Harald Gormsson, who ruled Denmark and Norway from c. 958 to c. 986. Harald is mainly known for introducing Christianity to Denmark and consolidating his rule over most Jutland and Zealand. However, what sparked my interest is that Harald was nicknamed “Bluetooth”, and, in 1997, the Bluetooth wireless specification design was named after him. »

Automatic deletion of older records in Postgres

We have a Postgres cluster with a database for each user. Each database has a table that records events, and we want this table to only record the last 15 days. If we were on MongoDB, we could use a capped collection, but we are in Postgres, which does not have equivalent functionality. In Postgres, you have to make do with something homemade. My first idea was to install a cron job in the system. »

Migrating a Windows 10 VM to Windows 11 in Parallels Desktop: a story of TPM chips and BIOS upgrades

This weekend assignment was to upgrade a couple of old Windows 10 VMs to Windows 11 in Parallels Desktop 17. I couldn’t do that right away because Windows Update was complaining about the lack of the TPM chip. A little research revealed that TPM chips only work on UEFI BIOS. To check which BIOS version was being used in my VMs, I used the msinfo32 (System Information) application. It showed the BIOS to be of “Legacy” type. »

How to automatically pull and deploy updated Docker images

We want our test and production stacks to be automatically updated every time something new is pushed to the test or release branch. CI builds the docker image on successful test runs, then stores it in our private registry. But how do you automatically pull and deploy those updated images? I looked into the Watchtower project, which is interesting. You add Watchtower to the stack, and it will diligently check for new versions of the images used by the containers in the stack, pulling, building and deploying as needed while the stack is up and running. »

Learn in public

Today I searched the internet for something, and the first result I got from @duckduckgo was a note I wrote months ago to my future self; how meta is that. Learn in public, it gives superpowers1. Also, in recent years, adopting POSSE was the best thing I did for my personal development. Subscribe to the newsletter, the RSS feed, or follow @nicolaiarocci on Twitter I should do better. Post more TILs, for example. »

The American Style of quotation mark punctuation makes no sense

Years ago, I translated an essay by Terry Windling, On Tolkien and Fairie-Stories, from American English to Italian. I remember arguing with the author about her use of periods in quotations. Each quotation would end with a period before the closing mark. I was puzzled. We don’t do that in Italy. More importantly, I read many English texts where the period was left outside the quotation itself. She insisted that her style was correct1. »

How to read Windows-1252 encoded files with .NETCore and .NET5+

Another day, another lesson learned: modern .NET does not support the Windows-1252 encoding out of the box. Today my colleague was happily porting a legacy NET4+ app to NET6. As usual, the port was super-easy; it would compile and run just fine, so he was surprised when the app crashed reading a few specific XML files. That’s when I was called in. A closer inspection revealed a pattern: all those crashing files were Windows 1252-encoded (the rest, a vast majority, were UTF-8. »