Recent Posts

Solving Einstein's Riddle the lazy way

There's a logic puzzle called Einstein's Riddle (originally known as the Zebra Puzzle) which is supposedly pretty well-known, as far as logic puzzles are concerned. It's also claimed to be quite difficult, with only 2% of people capable of solving it, although that sounds pretty sensationalist and I can't find a source for that figure. Anyway, here's the puzzle as it is ... read full post

Intercepting interpolated strings in C#

If you use C#, you're probably familiar with interpolated strings, introduced in C# 6. In case you're not, this: string.Format("Hello, {0}! The year is {1}.", name, DateTime.Now.Year) equivalent to this: $"Hello, {name}! The year is ... read full post

Entity Framework conditional includes

If you've ever worked with Entity Framework, then you're probably familiar with the .Include(...) function. You've probably also wondered if it's possible to perform a conditional include (i.e. including only those entities that match a certain predicate). The include function itself doesn't allow for this, and I thought it simply wasn't possible until a coworker ... read full post

More Windows Phone annoyances

There's lots to love about Windows Phone, but since I'm nitpicking stuff anyway I figure I might as well rant about the rest of my annoyances. 1. Headphone volume The EU has some dumb rule about audio devices not being allowed to output more than a certain dB level without nagging you every 20 hours. My Windows Phone ... read full post

PIN required: a Windows Phone usability annoyance

When you power on your Windows Phone, it automatically prompts you for your SIM PIN to unlock, well, the phone part of the phone. Of course it's possible to cancel out of this dialog, because unlocking the phone is not required to access the rest of the device. When you do this, the OS will indicate that the phone hasn't been unlocked yet: There's nothing wrong with any of this. The ... read full post

Sony MDR-1000X first impressions

The Sony MDR-1000X are wireless, over-ear headphones with support for active noise cancelling. I've owned them for a few weeks now and want to share some of my first impressions. This won't be a formal review; I'll just talk about my own, subjective experiences with these headphones. Active Noise Cancelling The reason I bought these headphones is for their Active ... read full post

Targeting multiple .NET platforms in a single NuGet package with Visual Studio 2017

As the proud owner of a NuGet package (72 downloads and counting!), I'm interested in targeting the new .NET Standard, in order to make my package available on a wider variety of platforms. In a previous post, I showed how to create and publish a simple NuGet package. However, this only covered the ... read full post

C# 7: what's new?

Visual Studio 2017 hit RTM this week, so it's time to take a look at all the new features that made it into C# version 7. There's quite a lot to get through, so let's dive right in... Tuples The .NET framework has known tuples through the System.Tuple type since .NET 4. In C# 7, tuples are made an actual language feature. This is done through the new System.ValueTuple type, which is a mutable struct (System.Tuple is a class). This type is not part of the ... read full post

Implementing an async producer/consumer queue using BlockingCollection

In this post, I'd like to shine some light on a relatively unknown class from the .NET framework: BlockingCollection. I'll use this powerful class to implement an asynchronous, multi-threaded, in-memory producer/consumer queue using just a few lines of code. Use case First off, let's consider an extremely common real-world use case: logging. Every app or service ... read full post

Fireworks in the fog

With New Year's Eve upon us once more, I suddenly realized that because I now own a camera, I'm required by law to take pictures of the fireworks. It would prove quite the challenge. I had never taken pictures of fireworks before, and I obviously didn't get any time to practice. I read some tips online, set up my tripod, and hoped for the best. There was a nasty fog that had lingered all throughout the day on December 31st, and by the time evening rolled around it ... read full post