Dwarves, demons and puzzle questions

Here’s an interesting puzzle question that I was asked once at an interview: Ten dwarves are being held captive by a powerful demon. One day, the demon offers all ten dwarves freedom on the condition that they play… Read More

Quick and dirty table import hack for SQL Server

Every so often, I’ve needed to import data from the QA/Staging database table onto my local machine to help troubleshoot a hard to repro bug. Typically, I only need to import a few table’s worth of data, so… Read More

TSQL query the missing gaps in a table

I’m currently studying to get a Microsoft SQL Server 2008 Database Development Certificate and am going through their official 70$ 400 + page training kit. It covers a wide variety of topics, one of them being how to… Read More

The ReceiveTimeout registry key and the obligatory rant on the registry

The Windows registry is one of those delightful features1 that came out over a decade ago that still manages to screw people over to this day, resulting in tears, bitterness, and a vast collection of horror stories. In… Read More

Fun with sed

Given that I’ve spent most of my employment history at Microsoft shops, I’m always looking for an excuse to use CYGWIN more and gain more experience with the UNIX command line. I ran into a problem a while… Read More

Regex lookahead and lookbehind

A common search scenario involves finding all occurrences of a string x, but that are not followed by string y. Here’s a contrived example. Let’s say you were fond of using the variables foo, bar, and foobar. They… Read More

Reverse all the bits in a byte

A common question encountered in interviews is to reverse all the characters in a string. A fun little variant on this one is to reverse all the bits in a byte. It’s a good way to test the… Read More

Manipulating raw bitmap data in .NET

The Bitmap class found in the .NET Framework provides a lot of useful functionality.   Unfortunately, it doesn’t have any methods that let you easily manipulate the raw bitmap data.   It provides a SetPixel method which takes… Read More

How to add a gradient in css

This is a really simple way to add a gradient to any html element. Note that newer webkit based browers have built in support for the -webkit-gradient property, and the latest and greatest versions of firefox and IE… Read More

Database isolation levels

I remember a job interview where I was asked to rate my SQL Server experience on a scale of 1 to 10.   Not wanting to put my foot in my mouth, I responded with a modest 6…. Read More