gaming, xbox comments edit

I’ve been considering upgrading my hard drive from my 20GB drive to something larger in the potentially near future because I’m starting to get somewhat low on free space and, while I have a spare 20GB drive, switching drives isn’t teh hawesome.

I was worried about the licensing issues - like whether or not the licenses would transfer from the old drive to the new one, since the DRM on Xbox Live has been the bane of my very existence - but my friend Alex has done the transfer process and it sounds like it came off without a hitch. I asked and he verified that he was able to log in and use content on the console from an account other than the one that purchased the content, which proves that the content was still licensed to the console, not just his account.

Maybe an upgrade will be in order soon.

aspnet comments edit

I realize I’m probably a bit behind the times on this one, but there was just something I wasn’t getting until now.

I know that .NET 3.0 and 3.5 are still on the .NET 2.0 CLR. I get that. Today, though, I was writing a little web form - a one-page, all-code-in-the-ASPX web form to just do a quick test of something. I wasn’t using Visual Studio, I wasn’t creating a whole web project, I just wanted to drop a single ASPX file into C:\Inetpub\wwwroot and run it to see the outcome of a particular expression evaluation. Sort of like Snippet Compiler gone ASPX.

For the life of me, though, I could not get my .NET 3.5 LINQ code to compile. I had the correct <%@ Assembly %> directive to reference System.Core, I had everything looking right… but it wouldn’t use the .NET 3.5 C# compiler, so it wasn’t understanding my LINQ syntax.

The answer: You absolutely must specify the .NET 3.5 compiler in your <system.codedom> section of web.config. No choice. You can’t just drop an ASPX file in there and expect the latest compiler to be used, even if you have it installed. Here’s a snippet:

    <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <providerOption name="CompilerVersion" value="v3.5"/>
      <providerOption name="WarnAsError" value="false"/>

.NET 3.0 and 3.5 did some great stuff to help you in using the features in ASP.NET. For example, the default web_mediumtrust.config (Medium Trust in ASP.NET) was updated to allow ReflectionPermission so you can use the LinqDataSource control without having to create your own custom trust level.

How come they didn’t update the compiler for ASP.NET to be the latest? Instead, you have to put this in every web.config file of every application you make. (I didn’t notice it because it’s one of the things Visual Studio does for you when you create a new web project.)

Hanselman has a more complete article on the issue, but at a minimum, you need to update the compiler in your web.config.

wcf, net comments edit

Came across an issue today where we want to be able to read WCF service and client configuration from a custom location. That’s actually more difficult than you’d think.

By default, WCF configuration is stored in your app.config (or web.config) file in the <system.serviceModel> section. When you create a client (like with ChannelFactory<T>) or a service host, the application configuration file gets read, the contents get parsed into the appropriate strong types, and “magic happens” - the appropriate object is created.

In our situation, we wanted to do exactly that, but in a Powershell script… and that’s a problem, because the only way we could get WCF to see the configuration was to actually create a Powershell.exe.config file in the Powershell installation directory, run the script, and then remove the configuration. Not so great. We needed the ability to say, “Hey, WCF, use the configuration file that we explicitly specify.”

That, as I said, is a little more difficult than you’d think.

A lot of searching led me to two articles:

I agree, the titles don’t necessarily sound like they’d help much, but they do. They even include source for how to do this so you can see what I’m talking about. That said, I’ll summarize the steps here.

For service hosting, what it boils down to is:

For clients, it’s slightly more work:

  • Create a custom class deriving from ChannelFactory<T>.
  • Override the protected CreateDescription method. In the override, you need to…
    • Call base.CreateDescription().
    • Read in your custom configuration.
    • Create a custom ServiceEndpoint based on your configuration. Don’t forget the bindings, behaviors, etc. (That’s what makes this hard.)
    • Return that custom ServiceEndpoint.

Once you do that, you’re set - you can create a standalone XML configuration file with the <system.serviceModel> section and point WCF at that rather than having to store the configuration in the default app.config/web.config. You are limited to using your custom service host and client classes, but then, if you’re getting into things this deep you’re probably not afraid of getting your hands dirty.

Again, both of those articles contain full source to the solutions so you can see how it works. Check ‘em out.

sharepoint, testing, net comments edit

The folks over at Typemock have done something special to help address the needs of the SharePoint development community and have released a special version of their Isolator mocking framework specifically to help with testing SharePoint solutions: Isolator for SharePoint.

Isolator for SharePoint is the same Isolator we know and love, but will only work on SharePoint-specific classes. (Of course, if you get sucked in, like I know you will, then you can upgrade to the full Isolator with no issue and mock objects outside SharePoint.)

For a limited time, they’re even offering a few free licenses to folks in the blogosphere, so if you want one, check out how to get one. (If you don’t get one of the free ones, the full retail price of Isolator for SharePoint is $149, and they’re offering a discount for a while so you can get it for $99 - a great deal.)

I did quite a bit of SharePoint development in my last job and something like this would have been amazing to have. If you’re doing SharePoint work right now, you owe it to yourself to give it a look.

media, music, windows, vbscript comments edit

I’m a huge stickler for metadata in my iTunes library and for the most part, I can find incorrect or missing data by using the iTunes smart playlists - I have one, for example, that checks for “Year is 0” so I can find tracks that don’t have a year associated with them.

One of the missing features in there is that you can’t set up a smart playlist that tells you which tracks don’t have artwork. So, to fill that gap, I wrote a script that does it for you. This little JScript, when run, will create a regular playlist called “Missing Artwork” with any tracks that it finds that don’t have any artwork items associated (a track can have multiple pieces of artwork, not just one).

Just ran it myself on my library and it works like a champ. Standard disclaimers apply: use at your own risk, YMMV, I’m not responsible for what happens if something goes awry, etc.

    var ITTrackKindFile = 1;
    var iTunesApp = WScript.CreateObject("iTunes.Application");
    var numTracksWithoutArtwork = 0;
    var mainLibrary = iTunesApp.LibraryPlaylist;
    var tracks = mainLibrary.Tracks;
    var numTracks = tracks.Count;
    var foundTracks = new Array();

    WScript.Echo("Checking " + numTracks + " tracks for missing artwork...");
    while (numTracks != 0)
      var  currTrack = tracks.Item(numTracks);

      if (currTrack.Kind == ITTrackKindFile)
        if(currTrack.Artwork == null || currTrack.Artwork.Count == 0)


    if (numTracksWithoutArtwork > 0)
      WScript.Echo("Found " + numTracksWithoutArtwork + " tracks missing artwork. Creating playlist...");

      var playList = iTunesApp.CreatePlaylist("Missing Artwork");
      for(var trackIndex in foundTracks)
        var currTrack = foundTracks[trackIndex];
      WScript.Echo("Playlist created.");
      WScript.Echo("No tracks missing artwork were found.");