Excruciating rhymes

I was watching How the Grinch Stole Christmas and I was struck by this rhyme (from the song  “You’re a Mean One, Mr. Grinch:”) You’re a nauseous super naus!You’re a dirty crooked jockey, and you drive a crooked hoss    — Dr. Seuss, How the Grinch Stole Christmas I tried to see what other particularly excruciating…


What is a perfect score in Yahtzee?

The dice game Yahtzee takes thirteen turns. Each turn involves rolling a set of five dice (with two possible rerolls, the player having the option to reroll only a subset of the dice), then marking one of thirteen boxes and scoring points according to whether the numbers on the dice meet the rules of the…


Programmatically grabbing a screenshot of the primary display

It’s sometimes difficult to explain to people what my job actually is. “I test Windows sound.” “Cool.  How does that work?” A product like Windows has a lot of components that interact with each other.  If everything works, the user doesn’t know that most of these components even exist; everything is invisible and seamless. Most testing…


Generating primes using the Sieve of Eratosthenes plus a few optimizations

When solving Project Euler problems I frequently need to iterate over prime numbers less than a given n. A Sieve of Eratosthenes method quickly and easily finds the small prime numbers; there are more complicated methods that find larger prime numbers, but with a couple of tweaks the Sieve of Eratosthenes can get quite high….


How to create a shortcut from the command line

Working on Windows, I install Windows a lot.  This means a lot of my customizations have to be re-applied every time I install.  To save myself some time I created a script which applies some of them. Last time I showed how to set the desktop wallpaper from a command-line app. This time, a script…


Command-line app to set the desktop wallpaper

Working on Windows, I find myself installing Windows a lot. I find that I like to change a lot of the settings that Windows offers to non-default values.  (That is, I’m picky.) I have a script which automates some of these things, which I add to now and again.  Some of the bits of the…


Welcome Yuk Lai Suen to the blogosphere!

Please help to welcome my colleague fellow Windows Sound team test dev Yuk Lai Suen to the blogosphere!  Yuk Lai’s first post discusses the utility of manual testing. Yuk Lai Suenhttp://blogs.msdn.com/b/yuk_lai_suen/


Beep sample

A question came in today about the Beep(…) API1 not being able to set the frequency of the beep that was generated. In order to confirm that it worked I whipped up a quick sample which would take the frequency (and duration) on the command line. Source and binaries attached. For fun I added the…


Mark your variadic logging function with __format_string to have PREfast catch format specifier errors

There are a handful of Problems (with a capital P) which occur over and over again in programming. One of them is Logging. It is incredibly convenient to use the variadic printf function to log strings with values of common types embedded in them: // spot the bugLOG(L”Measurement shows %lg% deviation”, 100.0 * abs(expected -…


How to install unsigned drivers

Most device drivers these days have signatures which allow the operating system to validate that the driver files have not been tampered with since the author sent them out into the world. It is still possible to run into an unsigned driver. If you try to install an unsigned driver, Windows will warn you at…