Programming

I mostly blog about solutions I’ve made for problems I’ve encountered during my workday. The stack we use at Wehkamp is huge, so there’s always an interesting topic to blog about and many programming challenges to deal with. My main specialty is backend (.NET Core / ASP.NET / C#), but I do my fair share of Node.js and Python.`

Linq is a wonderful way to work with lists in C#. This article focuses on how you can create a round robin ordering for segments of your list. It will distribute items of each segment evenly over the list.

Having a diagram of how your C# projects interlink, can be a big help. I’ve created a small PowerShell script that will produce the diagram based on the .csproj files in a directory. It will generate Yuml.me diagrams based on the dependencies!

Wouldn’t it be nice if we could restrict the value written to a Knockout observable? Some values might mess up your model completely while others just don’t make sense. How would one create a conditioned observable that rejects invalid values? It turns out that conditioning an observable is not so hard.

In a previous article I wrote how to parse Roman Numerals in C#. This article will focus on how to calculate with the class in an intuitive way. It will show how to implement implicit casting and the add and subtraction operator overloads. Fun stuff that’s probably useful in other projects.

Lately I’ve become fascinated with the Latin language. I’m working on a project that converts photographs of Latin inscriptions on medieval statues into translated text. One of the challenges is parsing years, usually expressed in the form of Roman Numerals.

After building a parser class I noticed that it had a lot of nice characteristics: parsing, operator overloading, implicit conversions. A nice way to play around with C#.

Lately I’ve been playing around with USB led lights in .Net. I wanted the animations to be separated from my code. Wouldn’t it be great if you could define what animations are executed in a JSON file? And map it to code?

Normally one would build a mapper that does the conversion of the JSON commands to the methods. I like to use a more generic approach. I’ve created a small utility class that executes commands by mapping and executing them as a method of the object.

TypeScript allows for better JavaScript development. JavaScript is getting useful in more domains. But different systems require different ways of handling modules and exposing features. TypeScript solves this by compiling differently when a target is specified.

But what if you need a TypeScript script that supports both vanilla browser JS and Node.js? What if you need to expose 10+ classes?

Recently I’ve been playing around with NPM. I switched my unit tests from QUnit to Mocha. This was not as straight forward as one would hope. In this blog I’ll show some example code. At the end I’ll link to a side by side comparison of the entire test project. Hopefully it helps you to convert your code. I’ll be using the Chai BDD assertion engine.

Node.js is getting more popular by the day. It breaks JavaScript free from the browser. I would love to auto start an application – much like a Windows service – without keeping a console window open. There are many services to wrap node applications into an executable, but I like to stick with just Node. This small trick will make your Node application windowless on Windows.

Turns out that I needed an even smaller type of event: the signal. It is an event that has no data; it just fires. The Strongly Typed Events project started with the IEvent event that was styled after .Net. Then the ISimpleEvent was added in 0.2.0, for scenarios when no sender is necessary. Now I’ve added the ISignal to version 0.3.0.