Skip to main content

Interesting write-up on a race car AI

There are a few publications that I follow regularly. They vary from programming, to video games, to just plain humor. On the latest Penny-Arcade comic today they mention something called a Drivatar. Curious as to what it was, I turned to my trusty chrome omnibox.

This lead me to an interesting article from Microsoft Research on it. You can find the article here. It's interesting to see pieces like this coming out in games. It's pretty cool.

Coding Simplicity

Just read a great article in Doctor Dobb's from Andrew Binstock. The conclusion struck me as a great quote and I highly recommend reading.

[...] Simplicity is the quality of code that is no more complex than required to express the underlying complexity. In this way, simple code can be intensely complex. There is no inherent good/bad dichotomy.

- The Misplaced Obsession with Simplicity, Andrew Binstock.'

Parameterized Unit Tests with MSTest (Metro)

I spent a long time looking for this last night as I was trying to decide if I should use MSTest, NUnit, XUnit, or something else on the Windows Store app that I've been developing.

One of the things I've used in the past with NUnit was the ability to create test cases like so:

  1. [TestCase(12,3,4)]
  2. [TestCase(12,2,6)]
  3. [TestCase(12,4,3)]
  4. public void DivideTest(int n, int d, int q)
  5. {
  6.   Assert.AreEqual( q, n / d );
  7. }

(example taken directly from the NUnit documentation here)

However, since I'd used NUnit before and since this was a side-project (no time/budget restrictions) I decided to learn some MSTest. In adding the test project and a reference to my application as well as watching a video from build on Unit Testing Windows 8 store apps I found it nice, easy, and clean. So I went looking for where this feature which to me is a huge, necessary feature and I couldn't find it... So I googled, and I googled, and I googled...

Resizing an image within a Windows 8 app in C#

I'm creating an application where a user can add their own images. Accepting a user's pictures is handy and all but when modern digital cameras regularly take pictures that are greater than 4MB that's not something I want stored in memory.

Here I have image data within a stream and want to resize it to a given width and height - while maintaining aspect ratio. This accomplishes the task nicely...

Reading a StorageFile to a byte array in C#

Reading a StorageFile to a byte[] or an IRandomAccessStream in a Windows 8 app wasn't exactly obvious and the examples I found included other classes or unnecessary processing. I created this solution based upon what I learned and wanted to share it...