I have a copy of the [older version of] Electronic Battleship: Advanced Mission game. We played it a bit, but we got really frustrated because the holes in the vertical grid were too big for the pegs to fit in well - a minor bump and the pegs would fall out, causing you to basically start the game over.

We shelved it for a while, but I found that Hasbro has replacement parts order forms, so I ordered a new set of pegs (in case it was actually the pegs that were too small) and a new set of grids (in case the grid holes were too big). I figured, like $7 total to fix the thing would be worth it since it was a $40 game anyway.

I got the parts and the pegs didn’t fit into the grid holes any better, so I figured it was definitely the grids. I looked at the replacement grids they sent… and the grids were too small. The regular Electronic Battleship grids apparently are 10 by 10 while Advanced Mission grids are 14 by 14.

I contacted their support department explaining the problem in detail and asking if they could send me some new Advanced Mission grids. They did me one better: They sent me a whole new game.

That, my friends, is customer service. Hasbro, you rock. Thanks a million!

Jenn and I played last night and it was a fantastic game. Came down to the very last turn - if I missed shooting down Jenn’s last ship, she was going to shoot my last ship down. I made the right guess and got her, but just by that one turn. Great game.

net comments edit

OK, so not really a contest so much as a very short “first come, first serve.” Typemock launched their ASP.NET bundle with Typemock Isolator and Ivonna, an ASP.NET testing tool, and they’ve given me a license to hand out to a lucky reader.

First person to leave a comment on this post wins. Make sure you fill in the “email address” field so I can contact you back. (Your address won’t actually appear on the blog, and I won’t use it for anything other than getting you your license, so don’t worry about spam.)

Good luck!

[UPDATE: The prize has been claimed!]

gists, dotnet, build, csharp comments edit

I’m working on an application where we wanted to be able to provide some config or command line parameters that would specify a particular set of files for processing. What might be considered the “standard” set of .NET framework libraries comes with System.IO.Directory.GetFiles(), but the wildcard support is pretty weak. I don’t want to find *.dll recursively, I want support like “recursively search folders under this tree for *.dll but exclude Foo.dll” or something.

So I started thinking - what has that sort of include/exclude support and robust wildcard matching?

MSBuild.

When you use the CreateItem task, you can specify all nature of wildcards, like this:

<CreateItem
 Include="**/bin/**/*.dll"
 Exclude="**/Foo.dll">
   <Output
    TaskParameter="Include"
    ItemName="MyItemName" />
</CreateItem>

The ** will be expanded to mean “any number of folders” and the filename wildcards will work to properly include/exclude files. Way, way better than GetFiles(). But how do you harness that power for your own use outside of a build system?

Actually, it turns out to be super easy. Basically:

  1. Add references to the Microsoft.Build.Framework, Microsoft.Build.Tasks, and Microsoft.Build.Utilities assemblies. They should be in the GAC.
  2. Instantiate a Microsoft.Build.Tasks.CreateItem task object.
  3. Add items to the Include/Exclude list.
  4. Execute the task and ensure the operation was successful.
  5. Read the results out of the “Include” property on the task object. Read the metadata off of the items using the “GetMetadata” method. The metadata items available are the MSBuild Well-Known Item Metadata values.

Here’s a code snippet showing a simple example:

// Instantiate the task
CreateItem task = new CreateItem();

// Add paths/wildcards to include
task.Include = new ITaskItem[]
{
  new TaskItem(@"C:\path\**\*.txt")
};

// Add paths/wildcards to exclude
task.Exclude = new ITaskItem[]
{
  new TaskItem(@"C:\path\bin\**\*.*"),
  new TaskItem(@"**\_svn\**\*.*"),
};

// Execute the task, check for success
bool success = task.Execute();
Console.WriteLine("Success: {0}", success);
if(!success)
{
  return;
}

// Get the list of matching items from "Include"
// and use the "GetMetadata" property to find out the path.
foreach(ITaskItem include in task.Include)
{
  Console.WriteLine("* {0}", include.GetMetadata("FullPath"));
}

Awesome! Now I don’t have to write that file finding code myself!

I bought these very tasty Carr’s Ginger Lemon Creme cookies a while ago at Costco. They sort of make me crave them. Anyway, the other day I was drinking a lemon drop and thought, “what would this be like if I used vanilla vodka instead of plain?” The answer: very much like the lemon creme filling in the cookies.

A little experimentation later and I came up with a drink that approximates the flavor of the cookies. You’ll need limoncello, vanilla vodka, sweet and sour mix, and candied ginger. When you go to the store for the candied ginger, buy it in bulk and make sure to get some of the sugar that collects at the bottom of the bulk bin - you’ll need that.

Now, combine the following in a shaker:

  • 1.5 oz limoncello
  • 1.5 oz vanilla vodka
  • a splash of sweet and sour mix
  • a generous pinch of that sugar from the candied ginger

Shake that up and pour it in a martini glass. Garnish with a long slice of candied ginger (long enough to stick out of the drink like a cinnamon stick, or else it’ll just sort of float in there and might look nasty).

At the end of the drink, which is pretty sweet, the garnish will have soaked up some of that lemon and will be a very tasty treat at the end.

media, music, windows comments edit

The iTunes COM for Windows SDK seems to have been moved from the location they originally had it - http://developer.apple.com/sdk/itunescomsdk.html. It is now inside the Apple Developer Connections site and you need a free membership for it.

Once you have your membership and log into the ADC site, go to Downloads -> Developer Tools. About 1/3 of the way down the page you’ll find the iTunes COM for Windows SDK.

(You’ll need this if you want to write scripts or programs to automate iTunes from Windows. It used to be really easy to find, but now it’s buried, so here’s a pointer.)