Recent Posts

Static variables, constructors, and JIT optimizations

We ran into an interesting problem at work the other day. A unit test was always passing locally, but failing on the build server. Here's a minimal reproduction of the code involved, so we can take a look at what went wrong. The (relevant bits of the) class that was being tested looked something like this: public class Foo { private static readonly ConcurrentDictionary<int, Foo> _map = new ConcurrentDictionary<int, ... read full post

TIS-100, final part

It's time to bite the bullet and grind our way through the final puzzles of TIS-100. Segment 60099: signal window filter This is the only puzzle in the game where the histograms tell me I have a genuinely poor performing solution (in terms of cycles). I have taken the straightforward approach here, which in this case is apparently naive. I have no interest in improving it, though, as this final batch of puzzles is already pushing the boundary of what I consider ... read full post

TIS-100, part 4

It's time for some ASCII art with the TIS-100! Segment 50370: image test pattern 1 Here we are introduced to the fine graphics capabilities of the TIS-100. This first puzzle is basically a tutorial on how to work the graphics output. The top node keeps track of the Y position, while the bottom node loops over the X axis and outputs the color value for white 30 times. I initially used to simply loop 30 ... read full post

TIS-100, part 3

More fake assembly programming with TIS-100! Segment 40196: signal pattern detector Not the most optimal solution here (if the histograms are to be believed), but one that is easy to understand, with a clear separation of concerns between the nodes. The first node keeps track of how many sequential zeros it has seen, resetting the count if a non-zero value is found. It passes this value to the second node, which then checks if this value is at least 3. If so, it outputs ... read full post

TIS-100, part 2

Let's continue our TIS-100 adventure, and see if we can make it out of tutorial land today. Segment 30647: sequence generator This is the first puzzle that hints at how painful it is to compare two numbers with the TIS-100, which is something we will unfortunately be doing a lot in the future. As for right now, we can get away with this clunky solution. The node reading A acts as a cache for that ... read full post

TIS-100, part 1

Once upon a time, I played a game called SHENZHEN I/O. I wrote some blog posts about it (1, 2, 3, 4), but stopped after a while. This wasn't due to me getting bored with the game. On the contrary. I was writing my posts as I went, but the game was so much fun that I didn't want to take breaks in between puzzles in order to write about them for my blog. I have in fact long ... read full post

Azure Essentials: getting started with Search Services with SQL Server and ASP.NET MVC Core

In this post about the very basics of Microsoft Azure, I'll show how to provision and use Azure's search-as-a-service offering to index and search contents from an Azure SQL Server database. I'll also show how to talk to the search service from an ASP.NET MVC Core application. I'm assuming you've already got the database for this, as well as an existing MVC app. Creating a Search Service First order of business will be provisioning the Search ... read full post

Azure Essentials: getting started with Cosmos DB

In this post about the very basics of Microsoft Azure, I'll show how to use Cosmos DB to store unstructured documents in the cloud. I'll also show how to talk to this database from an MVC Core 2 application. I'm assuming you've already got an MVC app to work with. Creating a Cosmos DB First things first: let's create a Cosmos DB. Open the Cosmos DB service: ... read full post

Azure Essentials: getting started with Table Storage

In this post about the very basics of Microsoft Azure, I'll show how to get started with Table Storage. The Table Storage is a key/value store for non-relational structured data. It offers especially high performance on inserts, and is a good option to use for logging. We'll use the Storage Account from our previous post, so we won't have to deal with setting one of those up again. Writing to Table Storage The first ... read full post

Azure Essentials: getting started with Blob Storage

In this post about the very basics of Microsoft Azure, I'll show how to upload and download files from a Blob Storage account using an ASP.NET MVC Core 2 application. I assume you have an existing MVC application to use. Creating a Storage Account The first thing we'll need, not just for Blob Storage, but for all sorts of storage-related things in Azure, is a Storage Account. To create one, go to the Storage Account service: ... read full post