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....

December 11, 2021

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....

November 21, 2021

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. I should do better. Post more TILs, for example. [rss]: https://nicolaiarocci.com/index.xml [tw]: http://twitter.com/nicolaiarocci [nl]: https://buttondown.email/nicolaiarocci ↩︎

November 16, 2021

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....

September 16, 2021

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....

August 27, 2021

How to restore a single Postgres database from a pg_dumpall dump

Today I learned how to restore a single Postgres database from a global dump generated with pg_dumpall. Now, pg_dumpall is handy when you want to back up an entire Postgres cluster. It will dump all databases and global objects in a single text file. In contrast, pg_dump, the go-to tool for Postgres backups, offers more control but only works with a single database and doesn’t dump global objects, such as the roles/users linked to the database....

August 25, 2021

How to remove a file from Git history

Today I learned how to remove a file from a git repository while also cleaning it from the history. When you delete it with git rm or git rm --cached, tracks remain in the commit history (the reflog). That might not be a big deal, but if the file has sensitive contents that you want to disappear from version control entirely, then you also want it cleaned from the reflog. That’s when git filter-branch comes to the rescue....

July 30, 2021

Yet Another Reason to Use DuckDuckGo

I couldn’t recall a tmux command, so I quickly reached for my trusted default search engine DuckDuckGo. I typed “tmux cheat sheet” because, well, once I found an excellent one which I wanted to summon again. To my surprise, the search result included an in-page cheat sheet—a good one too. It isn’t the first time that DuckDuckGo surprises me like that. Need a new GUID? Search for it. Need a quick QR code?...

July 16, 2021

Custom default values for not existing dictionary items (and a lesson learned)

When dealing with dictionaries, a typical problem is when an operation attempts to retrieve an element using a key that does not exist in the dictionary. In .NET, a KeyNotFoundException is raised, and that’s the desired behaviour in most circumstances. Sometimes, however, you know that your program will frequently try to retrieve keys that do not exist. In such cases, it is more efficient to use the TryGetValue method: This method returns the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter is returned (source)...

June 11, 2021

dotnet SmtpClient should not be used

I am very late to the party, but today I learned that the good old dotnet SmptClient is considered obsolete and should not be used. Quoting the documentation: We don’t recommend using the SmtpClient class for new development because SmtpClient doesn’t support many modern protocols. Use MailKit or other libraries instead. (source) Interestingly, Microsoft is recommending a third-party open-source library as an alternative. I hope we’ll see more of that in the future....

May 4, 2021