Skip to content

Blog

The Split Phase Refactoring

When we write code to solve a tricky problem, we often end up with methods that show us the whole journey of how we got to the solution: there is code to load data, followed by transformation logic intertwined with data clean-up hacks to prevent the creation of a report from exploding.

It is nothing wrong with writing code that way and to iterate until we reach the goal. The problem is that we keep everything in the order in which we initially wrote it. The developer who needs to fix a bug does not care if we found a missing default value at the beginning of the implementation or at the end. They much more prefer code that separates the different phases (load, clean-up, transform, report) and guides them towards the place where they should implement the fix.

How to Calculate the Time Between Two Rows in SQL Server

I had an interesting problem to solve: How long did a task take to complete? The challenge was that our task history table contains one row for the start and another one for the end of a task:

Id TaskId Action Timestamp
1 100 Start 2022-08-01 08:00:00.000
2 101 Start 2022-08-02 07:30:00.000
3 100 Stop 2022-08-03 17:00:00.000
4 102 Start 2022-08-04 08:00:00.000
5 102 Stop 2022-08-04 17:00:00.000
6 101 Stop 2022-08-05 18:00:00.000

What to Do if OpenSSL Does Not Find Your Private Key

As we were trying to combine a private key with a certificate into a pkcs12 file, we got this OpenSSL error:

openssl pkcs12 -export -name "Domain" -out Domain.pfx -inkey private.key -in Domain.crt

unable to load private key 11528:error:0909006C:PEM 
routines:get\_name:no start line:crypto\\pem\\pem\_lib.c:745:
Expecting: ANY PRIVATE KEY

Free App Service Managed Certificates in Azure

For the last 3 years we used Let's Encrypt certificates for our user group site. Since there is no direct and easy-to-use solution in Azure, we needed the sjkp plug-in. Unfortunately, that no longer works after we moved from Windows to Linux as the hosting platform and we needed to fall back to a manual process for the renewal of the certificates.

How to Fix 'Headers Already Sent' Error in Urvanov Syntax Highlighter

If you wrote a comment in this blog in the past weeks, you got an error like this one:

Warning: Attempt to read property "comment_ID" on null in /home/*/class-urvanov-syntax-highlighter-plugin.php on line 714 Warning: Attempt to read property "comment_ID" on null in /home/*/class-urvanov-syntax-highlighter-plugin.php on line 724 Warning: Cannot modify header information - headers already sent by (output started at /home/*/class-urvanov-syntax-highlighter-plugin.php:714)...