Blog on software engineering


How to setup a new iPad pro from an existing iPad


To setup my new iPad pro based on my existing iPad pro I used the quick start feature (

At first the quick start screen did not appear on the old iPad.

I fixed this by enabeling Bluetooth on the old iPad and then rebooting the new iPad by pressing and holding the power button and the up volume button at the same time.

The iPad then powers off. Wait for 10 seconds then press the power button to turn it on. Now the quick start screen appeared on the old iPad.


Also make sure you don’t have your iPhone nearby, because then it will try to start the quick start from your iPhone.


Split PDF in C# for free with .NET Core and iText.Kernel.Pdf

using iText.Kernel.Pdf;

namespace RvvFacturatie.Services
    public class PdfService
        public void Split(string filePath, string outputFolderPath)
            // Make sure the output folder exists and is empty.
            if (Directory.Exists(filePath))
                Directory.Delete(filePath, true);

            using (var pdfDoc = new PdfDocument(new PdfReader(filePath)))
                // Loop pages in the given document.
                int numberOfPages = pdfDoc.GetNumberOfPages();
                for (int i = 0; i < numberOfPages; i++)
                    // Determine destination file path for current page.
                    int currentPageNumber = i + 1;
                    string fileName = $"Page - {currentPageNumber}.pdf";
                    string pageFilePath = Path.Combine(outputFolderPath, fileName);

                    // Write current page to disk.
                    using (PdfWriter writer = new PdfWriter(pageFilePath))
                        using (var pdf = new PdfDocument(writer))
                            pdfDoc.CopyPagesTo(pageFrom: currentPageNumber, pageTo: currentPageNumber, toDocument: pdf, insertBeforePage: 1);

How to run GitLab in a container hosted by Docker Desktop for Windows




Installing GitLab on WSL 2 container running on Docker Desktop for Windows

* Install Windows feature “Windows Subsystem for Linux” (Start > Turn Windows features on or off > check “Windows Subsystem for Linux”).

  • Install Windows feature “Virtual Machine Platform” (Start > Turn Windows features on or off > check “Virtual Machine Platform”).

  • Reboot system

  • Install the Linux kernel update package (—download-the-linux-kernel-update-package)

  • Reboot system

  • Set WSL 2 as your default version (wsl –set-default-version 2)

  • Install your Linux distribution of choice (


  • Install Docker desktop on Windows (


Follow the step found on



  • Add environment variable GITLAB_HOME = “C:\GitLab” on Windows

  • Add inbound Windows firewall rule “Port” > TCP – 8080 > Name = TCP – 8080 – GITLAB

  • Add inbound Windows firewall rule “Port” > TCP – 4430 > Name = TCP – 4430 – GITLAB

  • Add outbound Windows firewall rule “Port” > TCP – 8080 > Name = TCP – 8080 – GITLAB

  • Add outbound Windows firewall rule “Port” > TCP – 4430 > Name = TCP – 4430 – GITLAB

  • Install Ubuntu-20.04 from Microsoft Store

  • Enable integration with additional distros in Docker Desktop for Windows (Settings > Resources > WSL INTEGRATION > Check “Enable integration with my default WSL distro

    Check Ubuntu-20.04

  • Reboot system

  • Create docker compose file in ‘FolderContainingDockerComposeYml’:



image: ‘gitlab/gitlab-ee:latest’

name: ‘gitlab’

restart: always

hostname: ‘’


- '8080:80'

- '4430:443'

- '22:22'

NOTE: On Windows don’t use GITLAB_OMNIBUS_CONFIG, else GitLab won’t work

external_url ‘’


- '$GITLAB_HOME/config:/etc/gitlab'

- '$GITLAB_HOME/logs:/var/log/gitlab'

- '$GITLAB_HOME/data:/var/opt/gitlab'

NOTE: On Windows don’t use volumes, like described below. Let the Docker Desktop automatically create a volume, else GitLab won’t work.


- '$GITLAB_HOME/config:/etc/gitlab'

- '$GITLAB_HOME/logs:/var/log/gitlab'

- '$GITLAB_HOME/data:/var/opt/gitlab'


Adjust host file (C:\Windows\System32\drivers\etc\hosts) # GitLab in a container runnen on Docker desktop on Windows



On a PowerShell administrator prompt:

Set-Location “C:\FolderContainingDockerComposeYml”

docker-compose up -d


Note: you must wait at least 30 minutes before opening a browser on the host and visit the URL

Or check the container output (when it stops outputing data for 2 minutes, you can try to access the gitlab url).


Log in with username ‘root’ and the password from the following command on a PowerShell commandline:


docker exec -it gitlab grep ‘Password:’ /etc/gitlab/initial_root_password


The password file will be automatically deleted in the first reconfigure run after 24 hours.

How to fix: MSBuild error MSB4226: The imported project was not found


When you get the MSBuild error:

“WebService.csproj” (Rebuild target) (1) ->

WebService.csproj(193,11): error MSB4226: The imported project

“C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets” was not found. Also, tried to find “WebApplications\Microsoft.WebApplication.targets” in the fallback search path(s) for $(VSToolsPath) – “C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v16.0” . These search paths are defined in “C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe.Config”. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.


Make sure you have installed the same components during the Visual Studio setup as during de MSBuild tools setup:



Both should match, if you want MSBUILD to be able to build the same project files as Visual Studio.

How to fix lag with Bluetooth Logitech MX Master 3 and DELL XPS 9710


When I did not use the MX Master 3 for a minute, the mouse would lag, when starting the mouse again on a DELL XPS 9710.

Fixed this by changing the following registry keys:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_8087&PID_0026\5&2816b067&0&10\Device Parameters]




p style=”margin-left: 54pt”>”SelectiveSuspendSupported”=dword:00000000


and then rebooting Windows 10.

Using ‘winston-daily-rotate-file in TypeScript


In TypeScript you need to import the library ‘winston-daily-rotate-file’ like, so:


import ‘winston-daily-rotate-file’


import { createLoggerformatLoggertransports } from ‘winston’;

import ‘winston-daily-rotate-file’;


let _winstonLoggerLogger;


function initialise() {

  _winstonLogger = createLogger({

    format: format.json(),

    transports: [

      new transports.Console({

        format: format.combine(format.colorize(), format.simple()),






function addRotatingFileSystemLogging() {

  const options = {

    filename: ‘application-%DATE%.log’,

    datePattern: ‘YYYY-MM-DD’// Rotate every day

    zippedArchive: true,

    maxSize: ’20m’,

    maxFiles: ’31d’



  const transport = new transports.DailyRotateFile(options);





p style=”background: #1e1e1e”>



Fixing Microsoft store error 0x80d02017

After running Windows update and rebooting, the Windows “Mail and calendar” app disappeared.

So, I went to the Microsoft Store app to install the Windows “Mail and calendar” app, but after clicking on “Install” I got the error message “0x80d02017”.

To fix the error I had to disable IPV6 on my network connection as described here:



How to call an async service function from an ASP .NET razor *.cshtml master page in Full .NET Framework 4.7.2


If you need to call an async C# service method from an ASP .NET razor page, you can use the System.Threading.Tasks.Task.Run method.

Assuming we have a C# service class “MyService.cs” and this service contains an async method called “GetMyData”, then you can call it in a razor page like so:



    var myService = new MyService();

var myData = System.Threading.Tasks.Task.Run(() => myService.GetMyData()).GetAwaiter().GetResult();




How to quickly debug an ASP .NET Core MVC Api Controller by using an Unit Test project


When you have an ASP .NET Core MVC api controller and you want to quickly debug the controller endpoint, you can use the code below.

Just make sure, you set the “Copy to Output Directory” to “Copy always” or “Copy if newer” on the appsettings.json file, inside the unit test project.




using System;

using System.Net.Http;

using System.Threading.Tasks;

using Microsoft.AspNetCore.Hosting;

using Microsoft.AspNetCore.TestHost;

using Microsoft.Extensions.Configuration;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using XmlInterface.WebApi;


namespace UnitTest



    public class SpikeUnitTest


        /// <summary>


        /// </summary>


        public async Task Run()


            IConfigurationRoot configuration = new ConfigurationBuilder()





            // UseConfiguration

            var webHostBuilder = new WebHostBuilder();





            var testServer = new TestServer(webHostBuilder);

            HttpClient httpClient = testServer.CreateClient();

            var response = await httpClient.GetAsync(“/api/Test”);







p style=”background: #1e1e1e”>