Don't write code, generate it!

Posted on Fri 06 September 2024 in Coding • Tagged with csharp, coding, test, tdd

A while back, I got fed up with writing code. Not writing code in general, mind you, but I did face a situation where I needed to write a lot of boilerplate code, and having to write such code is a certain way of losing interest in software development. Not …


Continue reading

Discovering Nim, part 1

Posted on Fri 02 December 2022 in Coding • Tagged with aoc, coding, nim

For this year’s Advent of Code, I use the programming language Nim. I wrote a little bit about Advent of Code yesterday.

For today’s puzzle, I got stuck on something that normally is so trivial that you don’t think twice about it—accessing a variable in the …


Continue reading

🎄 Advent of Code 2022, at last! 🎄

Posted on Thu 01 December 2022 in Coding • Tagged with aoc, coding

The time has come for another December with the alarm clock set earlier than usual! The yearly Advent of Code challenge opened its gates to the first puzzle at 00:00 Eastern Time, meaning 06:00 in Sweden.

This is my 6th year, and I’m looking forward to a …


Continue reading

A quick look at Cypress component testing

Posted on Wed 29 June 2022 in Coding • Tagged with ui-testing, cypress

Co-authors: Andreas Cederström and Sebastian Porling.

Cypress has recently released support for component testing in their 10.0 release. You read the announcement here. We decided to take a quick look and try it out, to gather some first impressions and see how it can fit into our development workflow …


Continue reading

Consequences of array covariance in C#

Posted on Fri 22 October 2021 in Coding • Tagged with csharp, covariance, cast

In today’s post, I’ll talk about array covariance in C#, how it hid a bug in code that was covered by a passing unit test (*gasp*), and some ideas for how to avoid such bugs.

What is covariance?

In computer science, variance has to do with how complex …


Continue reading

Nashorn's JSObject in context

Posted on Sun 12 November 2017 in Coding • Tagged with java, nashorn

The JSObject interface in Nashorn makes it possible to expose an object to script code and control in detail how it appears and behaves. The purpose of this article is to explain when the different JSObject methods are called during script execution and in some cases how they should be implemented.


Continue reading

Scala pattern matching & lowercase case objects

Posted on Wed 30 November 2016 in Coding • Tagged with scala, functional

I just learned something about pattern matching and case objects in Scala which I thought I’d share.


Continue reading

How Enumerable.Concat brought down a production server

Posted on Wed 26 November 2014 in Coding • Tagged with .net, linq, iis

TL;DR Using Enumerable.Concat to build a long sequence one item at a time is a particularly bad idea, since enumerating the items will consume a lot of stack space.

A while ago, a customer reported that our .NET application running in IIS started crashing on user registration after …


Continue reading

The mysteriously escaped request path in ASP.NET

Posted on Tue 19 November 2013 in Coding • Tagged with asp.net, nancy, uri

This blog post answers the question “Why does Uri.AbsolutePath sometimes return an escaped path and sometimes an unescaped path for the request URL in an ASP.NET application?”

I spent some time googling for a possible reason, but search terms like URL/URI, request, path, encoding, and escaping are …


Continue reading

Why I hate implicit return in CoffeeScript

Posted on Fri 26 October 2012 in Coding • Tagged with coffeescript, javascript

CoffeeScript is “a little language that compiles into JavaScript.” If you haven’t seen or tried it, go check it out! I’ve been using it in a project for a while now, and its obvious advantage over pure JavaScript is that it is very concise and has high expressive …


Continue reading