Linus Torvalds on the impact of LLMs and AI on programming

I think I like his take on the topic.

January 21, 2024

How to implement a PKCE code challenge in C#

Today’s fun was implementing OAuth2’s RFC 7636’s PKCE (Proof Key for Code Exchange) in C#. It’s relatively straightforward, but I decided to share my implementation should it be helpful to someone else out there. PKCE is an extension to the Authorization Code flow to prevent CSRF and authorization code injection attacks. [..] It was originally designed to protect the authorization code flow in mobile apps, but its ability to prevent authorization code injection makes it useful for every type of OAuth client, even web apps that use client authentication (source)....

January 17, 2024

How to use XmlWriter along with StringWriter to properly serialize a UTF-8 string

Today, I (re)learned how to serialize an XML to a UTF-8 string. Like all the other times I did this, I got backstabbed by StringWriter, which only supports UTF-16. A simple code snippet like this: await using var sw = new StringWriter(); await using var w = XmlWriter.Create(sw, new() { Async = true }); ... await w.FlushAsync(); return sw.ToString(); Will emit this output: <?xml version="1.0" encoding="utf-16"?><... There’s nothing inherently wrong with UTF-16, but XML is usually UTF-8, so one must do something about it....

November 9, 2023

LINQ DistinctBy on a property for .NET Standard and older .NET versions

Today I learned how to implement a custom Enumerable.DistinctBy extension method that returns distinct elements from a sequence according to a specified key selector function. .NET 6 and its successors have the method built in within LINQ, but I needed it in a .NET Standard 2.0 class library, so I was out of luck. My implementation is simple, not different from others I found online, and should also work fine with old ....

October 25, 2023

I won the Microsoft MVP Award

I’ve just received news that I’ve been awarded the Microsoft Most Valuable Professional (MVP) Award in the Software Development category. It is an honor and a pleasure to be renewed for the eighth time. Being a Microsoft MVP means a lot to me; I remember how intimidated I felt when I met MVPs at various events and how totally out of reach the title seemed for someone like me. Besides my everyday work, I kept doing the things I loved:...

July 6, 2023

Homebrew and docfx don't like each other too

Another day another Homebrew incompatibility emerges, this time with docfx, the technical documentation building tool of reference in .NET space. I’ve been using docfx for years to build the FatturaElettronica.NET website, and it’s always been working without a glitch. Lately, however, my builds have been failing with strange errors I was too lazy to diagnose until today when I decided to grasp the nettle and sort the whole thing out....

June 20, 2023

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

June 13, 2023

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

June 6, 2023

A new modern MSBuild terminal logger is coming with .NET 8

The latest .NET 8 Preview is out, and I love that they’re finally changing how MSBuild logs are printed to the terminal. The new Terminal Logger ditches the infamous “wall of text” that is a nightmare to parse in favor of a cleaner, leaner, and more organized output. Once enabled, the new logger shows you the restore phase, followed by the build phase. During each phase, the currently-building projects are at the bottom of the terminal, and each building project tells you both the MSBuild Target currently being built, as well as the amount of time spent on that target....

May 20, 2023

Story of Redis and its creator antirez

I read a well-researched story about Redis and its creator Salvatore Sanfilippo, also known as antirez. I was already familiar with many details as I have been following him since OKNotizie and Segnalo, of which I was a user. At the time, as a user, I exchanged a few emails with Salvatore, whom years later I had the pleasure of meeting in person, as we were both speakers at several conferences....

May 11, 2023