Faster C# array access

In .Net memory access is safe by default. This means that every time you access an array item the index is checked against the length of the array. In this post I explore how you can speed up plain old array access by allowing the compiler to prove that you will do no harm. I compile the C#… Read More »

Automatic unlock QNAP volumes from network

Automatically unlock encrypted volumes in QNAP via network using a BASH-script in a Cron-job. This script will log on, list locked drives and unlock them. Data stored on the disks are encrypted, and you need a key do access the disks. The key is kept in memory, so if power is lost the disks are no longer unlocked.… Read More »

Demystifying async/await

If you have used async/await, but feel some details are still a bit fuzzy then this may be for you. I thought I’d hop down into the rabbit hole and give some examples of how async/await it actually works. Hopefully this will provide some understanding and get you further on your journey to become an expert. Async/await is… Read More »

Recompress zip-files (PowerShell)

PowerShell script to recursively recompress ZIP-files with higher compression. Note that Deflate64 isn’t strictly zip standard afaik, but it works for most zip applications.

ASP.NET Core TypeScript

I have adapted a style of mirroring C# in TypeScript. I use class instances and interfaces. I also associate scripts with their cshtml counterparts. For type safety I use TypeScript definition files for each JS library I use.

ASP.NET Core memory cache

Response cache is fine for simpler operations, but sometimes you need more fine grained control. System.Runtime.Caching.MemoryCache has builtin support for in-memory cache with expiry.

ASP.NET Core response cache

ASP.NET Core comes with built-in support for response caching. Unlike cache-control header that tells client/proxies how long to cache data, the response cache will cache output of an action.

ASP.NET Core AutoMapper

Mappers solve the problem of copying/translating data from one model to another. I’ve been using AutoMapper for some years and it does the job without too much hassle, and supports a lot of complex scenarios.

EF Core in separate project

Whether writing stand alone application or web application you may want to put database related code into a separate project. I find it good for separating concerns.

ASP.NET Core API with Swagger UI

Swagger makes the API machine readable. This means documentation and client implementations can be produced automatically. Swashbuckle runs top of Swagger and provides an UI. Together they provide nice functionality for documenting and testing your API.