Remember, C# does not have an exponent operator

This is a cautionary tale for developers who switch between programming languages often. Whilst reviewing some logs, I noticed that durations of pauses between API requests were incorrect. They were expected to double on every subsequent attempt, starting from a fixed base interval; for example, 5 seconds, 10 seconds, 20 seconds, 40 seconds, and so …

Avoiding time drift in virtual machines

If you use a virtual machine, you might have noticed that its system time starts to lag after it has been in the ‘powered on’ state for some time. To address this, it is useful to run an NTP (Network Time Prococol) client within the VM to have its time synchronised regularly. On Windows, this …

Caveat with AddInitialRequestCultureProvider() in ASP.NET Core

AddInitialRequestCultureProvider() in ASP.NET Core localisation seems to have an undefined behaviour when it is used in both services and application builder configurations to add a custom RequestCultureProvider. If you want to use a custom RequestCultureProvider to customise how the applicable culture is determined for an incoming HTTP request (for example, by looking up the chosen …

How can you minimize the impact of the persistence layer on your domain models?

This is a blog response to the question ‘How can you minimize the impact of the persistence layer on your domain models?’ posted on reddit /r/dotnet, showing how I would have implemented the solution in the purest form of OOP that is possible with C#. (Note: The implementation of the factory and persistence classes is …

Disabling Bluetooth auto-suspend with module options

In my previous post I showed how to restart Bluetooth on Debian Linux. Here I explain how to disable Bluetooth auto-suspend by using a kernel module option. Kernel modules can be passed parameters that affect how they work. The parameters accepted by a module can be identified with the command modinfo. In the example below …

Restarting Bluetooth on Debian Linux

On my laptop I use a Bluetooth keyboard and a Bluetooth mouse. Occasionally the Bluetooth adapter in the laptop shuts off completely, which means that it is not even possible to restart the Bluetooth service with sudo systemctl restart bluetooth.service. My troubleshooting points to powersaving as the cause of this, but the TLP setting that …