zaterdag 13 juni 2026

Do not preserve zone information in file attachments

gpedit.msc

User Configuration / Administrative Templates / Windows Components / Attachment Manager / Do not preserve zone information in file attachments 

Set to enabled, and your zipfiles will not be marked as downloaded and dotnet will execute the unzipped content.

dinsdag 23 december 2025

MSYS2 installation

pacman -Syu
pacman -Su
pacman -S --needed base-devel mingw-w64-x86_64-toolchain

https://packages.msys2.org/packages/?repo=mingw64

zondag 18 mei 2025

PostgreSQL adding a unique GUID column

In PostgreSQL, it is easy to add a GUID column and fill it:

ALTER TABLE public."thetable" ADD aggregateid uuid DEFAULT gen_random_uuid() NOT NULL;
ALTER TABLE public."thetable" ADD CONSTRAINT thetable_unique UNIQUE (aggregateid);


vrijdag 31 januari 2025

Copilot / AI werkt heel goed!

Copilot oftewel Artificial Intelligence werkt erg goed tegenwoordig. Ik stel de volgende vraag:

"How to determine the byte position of an element in a C struct"

Vroeger kon je het vergeten dat je antwoord kreeg via Google. Tegenwoordig krijg je het antwoord:

#include <stdio.h>
#include <stddef.h> // For offsetof macro

struct MyStruct {
    int a;
    float b;
    char c;
};

int main() {
    // Calculate and print the offset of each member
    printf("Offset of 'a': %zu bytes\n", offsetof(struct MyStruct, a));
    printf("Offset of 'b': %zu bytes\n", offsetof(struct MyStruct, b));
    printf("Offset of 'c': %zu bytes\n", offsetof(struct MyStruct, c));

    return 0;
}

En daarmee kon ik mijn oplossing gemakkelijk programmeren:
int theOffset = offsetof(SDL_KeyboardEvent, scancode);

AI werkt goed!

donderdag 30 januari 2025

C#: anonymous lambda using class instance variable

In C#, you can write an anonymous lambda which uses an instance variable of the class you are using:

Hello hello = new Hello();
hello.methodToCall((self) =>
{
    Console.WriteLine("hallo " + self.numberToReach);
});

public class Hello
{
    public int numberToReach = 3;
    public void methodToCall(Action<Hello> operation)
    {
        operation(this);
    }
}

In Kotlin, the Hello instance is bound to this, which is nice (see my trailing lambda's post). In C#, the "this" needs to be transferred using a parameter, in this case called "self".