media, windows comments edit

HP MediaSmart
ServerIt was two weeks ago that I picked up my Windows Home Server and on the whole, I really do like it. Hanselman seems to like his, too, and his review helped a lot when I was getting things going. That said, there’s a lot I wish I had known as I was setting things up, so here’s a rundown of some of the things I’ve learned.

Initial Setup: There’s a lot more to setting it up than just plugging it in and turning it on. The setup guide that comes with the server runs you through some of that, but there’s definitely some “follow the on-screen instructions” detail-free action in that guide and it’s nice to know up-front what you’re looking at. I found a really nice online description of the initial setup steps for the server that you’ll want to check out.

Pre-Configured Shares: There are pre-configured folders for sharing Video, Music, and Pictures. If you go with the pre-configured defaults and just put the things you want to share into the respective folders, life will be easy for you. You can override these defaults and do your own thing, but there’s no real compelling reason to do that and it’ll just be difficult.

There are also pre-configured shares for software installation (like the recovery CD contents in case your backed-up computers take a dive; and Home Server add-ins) and each user that has an account on the machine. Again, if you just accept the defaults, your life will be easier.

**Media Sharing is Through Windows Media Connect: **The default media sharing is done through Windows Media Connect. For the most part, it works really well… unless your music is based in iTunes and you have a lot of, say, Apple Lossless format music like I do. WMC only supports a few formats and will filter out anything it can’t stream to a client (like your Apple Lossless music) so when you see the server appear on your Playstation 3 or Xbox 360 and only half your music is appearing, that’s why.

The WMC limitations also affect video formats, so if you’ve got your videos stored in the Videos folder and you’re not seeing them on your client, it’s probably a video format issue.

You can potentially overcome some of these issues by using the PVConnect add-in (see below) with the server, but I can’t really tell. A better solution is to run a real media server (like Windows Media Center) which can handle a more robust set of media formats.

PVConnect/TwonkyVision Add-In: The HP MediaSmart Server comes with an add-in called “PVConnect” that appears to have something to do with the TwonkyMedia “TwonkyVision” server. Honestly, I’m having a hell of a time finding any real detail on it. The only concrete thing I can find is that it will provide album art for your music (if the files have album art) and will “transcode” your photos so they display properly on whatever device is requesting them. Neither of these things are compelling enough for me to want to install an add-in without knowing what else is going on. It looks like there were some issues with it working with Playstation 3, but you can do a little manual hack to get around it.

I’d love for someone to tell me more about how this thing works and what it does. If it’ll enable Apple Lossless streaming, I’ll totally install it.

iTunes Library Sharing: The HP MediaSmart Server also comes with an “iTunes Library Sharing” facility that is comprised of two parts: a client part, that reads in your library/music info and copies it to the server; and a server part, that streams the aggregated contents of the “Music” folder over the network in iTunes format so you’ll see it in iTunes as a shared library.

If you already store your iTunes music in the “Music” folder (like if you’re following my multi-user iTunes instructions or if you’ve got iTunes generally set up to store your library on the network), you probably don’t want the client part running. The problem is, it’ll see your iTunes library and then try to copy that again into the shared “Music/iTunes” folder on the server. I’ve read a few horror stories about duplicate copies of songs ending up in the share and confusing things. The downside of not having the client portion running is that you won’t get your playlists to display in the shared library… but maybe that’s not a big deal. It’s not for me. The client portion of sharing is disabled by default.

iTunes sharing settings for the

The server portion of the iTunes shared library service works just like standard iTunes library sharing - you can stream music from the shared library, you can listen to shared playlists, but you can’t add items from the shared library to your own playlists or sync the content to your iPod. It will automatically add anything in the shared “Music” folder into the shared library, even if the content wasn’t originally in iTunes. (“Adding it to the library” means it’ll add it to the list of things that can be streamed from this shared library. It doesn’t mean any files are getting moved around anywhere.) This is enabled by default on the server.

iTunes sharing settings on the

Since my goal here was more just to store the music on a central server, not to have “shared library” content or whatever, I have both the client and server portions of the iTunes music sharing component disabled. If/when I do end up trying to get actual iTunes content with playlists and all streaming across the network, I’ll probably be looking at either just using a Mac Mini as my media center PC or using MCETunes to get Windows Media Center to recognize iTunes content. (I’ve blogged about MCETunes before.)

RAM Upgrade: A lot of folks online say you’ll see a huge performance gain by upgrading the 512MB RAM that comes with the MediaSmart server to 2GB. I, personally, haven’t run into any performance problems yet - it works peachy keen with the 512MB. That said, if I do run into issues, it looks pretty simple to do the upgrade, so I’ll probably look into it then.

Photo Organization is Important: The way Windows Media Connect shares photos, it actually exposes the folder structure you store your photos in. If you’ve not been organizing your photos too well, you’re going to see a mess when you try to browse from your Xbox or Playstation. I tend to organize by date, with top-level year folders and subfolders with the full date in YYYYMMDD and a description of the event being photographed - that way they sort, alphabetically, in date order. It looks like this:

  • 2004
  • 2005
  • 2006
  • 2007
    • 20070704 - Independence Day
    • 20071225 - Christmas
  • 2008
    • 20080704 - Independence Day
    • 20080723 - Trav’s Birthday
    • 20080908 - Screen Shots of Windows Home Server

This makes it very nice and easy to browse when you’re looking at it from a client.

Online Backup: I was backing up my computers using Mozy, but the Windows Home Server offers a full backup feature, too, so I’ve pretty much switched over to using that. Of course, I need to get the Windows Home Server backed up, so I started looking at options there.

Philip Churchill has a great writeup of various online backup solutions for Windows Home Server. I wanted to stick with Mozy, but they require you to get a Mozy Pro account to back up your Home Server, which costs $0.50/GB per month… and with 110GB of music alone, that’s $55/month to back up something I can back up for $50/year from my laptop. Disqualified. I also considered Carbonite but really wanted something that’s officially supported, and while they say it should work, they won’t support you backing up Windows Home Server. I’m also not interested in “tweaking things” to get it to work

  • one of the beauties of the WHS so far has been its “appliance-like” simplicity. I’m not eager to break that. Disqualified.

In the end, I picked KeepVault. It’s $100/year for unlimited storage and has a really nice Windows Home Server add-in so you can see your backup status and do restores right from the console. You tell it which shares you want to keep backed up and it does the rest. The only downside to this is it’s not backing up the OS or your computer backups… but since you can recover the OS reasonably easily, and the chances of my computers AND my WHS taking a dive at the same time are minimal, this is a perfect solution to me, and it seems other folks have had success with it, too. I’ll keep any really precious documents in my user share on the Home Server so they’ll not only be duplicated (for hardware failure fault tolerance) but also backed up by KeepVault. The rest will get backed up by the standard Windows Home Server computer backup facility. Done.

UPDATE 2/25/09: KeepVault has raised its prices to be far, far less affordable and there is no unlimited storage option. Once my current subscription expires, I will most likely switch over to use the built-in Windows Home Server option to backup to a USB drive and store the backups off-site myself. Ripping DVDs: One of my primary goals for getting the server was to store my VIDEO_TS rips of my DVDs so I can play them through some sort of media center. I’ve gotten this working - even over wireless, which was cool - through my primary laptop and Windows Media Center on Vista Ultimate.

It might sound obvious, but when you rip a DVD, rip it to your local drive first and then copy the files to the server. I found the ripping process was cut from like an hour and a half to about 20 min. when ripping it locally. Then you can start the copy over to the server while you’re ripping the next disc.

You will probably want to create a new shared folder on the server outside of the default “Videos” folder that it comes with. Since the server won’t stream VIDEO_TS or ISO anyway, you’re not losing out on functionality. That said, you probably don’t need file duplication turned on for your ripped movies or you’ll be chewing through space. Creating a separate “DVD” share to store your rips in will let you selectively turn off duplication for just the rips.

You’ll probably also not want to set your online backup solution to back up the rips. On both Mozy and KeepVault, it seems to take about a day to back up 7GB, and if you’ve got a lot of movies like I do, it’s going to take years to get the backup completed. Plus, if you ever do lose the data, it’ll be far faster to just re-rip the movie (or even go to the store and re-purchase it, if the disc has been destroyed, and re-rip) than it would be to get the content back from the online backup service. Save the online backup service for your photos, music, smaller videos, and documents.

Continued Work on My Home Media Solution: I’m still learning about the way to handle things - which program I like best for ripping DVDs, what the best way to add metadata to Windows Media Center for the ripped discs is, etc. - and I’ll post updates as I find them. I found one blog that explains almost an identical setup to what I’m trying to put together, so that’s been a lot of help. Right now the decision I’m trying to make is whether to go with Windows Media Center or whether to go with some sort of Mac solution, maybe using Front Row. I seem to be able to find information on WMC a lot easier, but maybe I’m just not looking in the right places. On the other hand, most of the Mac solutions seem to be appliance-like, just like the Home Server, and I’m a big fan of simple. We’ll see.

gists, net, testing, csharp comments edit

I’ve seen this question a few times in the Typemock forums so I figured I’d post a little something on it:

How do you mock a list using Typemock Isolator?

The challenge we currently have is that Isolator can’t mock types that are declared in mscorlib, which includes things like List<T>, so if you expose a list in your class, you have some potentially interesting mocking challenges, depending on how you choose to expose it.

If you wrap the list in methods/properties on your class, when you set up mocks, you’ll be setting up mocks against your class - not the list - so there is no problem there. If you expose the list as a public field, that’s where the challenge sets in.

Below is a code snippet showing an example class that does both things: it has a method and a property that “wrap” a list, and it has a public list field. Below that, you’ll see tests that illustrate different ways to handle the situations using Typemock Isolator.

public class ListExample
  // Publicly accessible list field
  public List<string> PublicList = new List<string>();

  // Private list that gets "wrapped" by methods/properties
  private List<string> _privateList = new List<string>();

  // Wraps the indexer of the private list
  public string this[int index]
      return _privateList[index];
      _privateList[index] = value;

  // Wraps the Add method on the private list
  public void Add(string value)

public class ListTestFixture
  // The problem we have is you can't mock types in mscorlib
  // so you need to either wrap the list or mock the field.

  public void WrappedList()
    // If the list is "wrapped" in members of a type not
    // in mscorlib, we have it pretty easy because the
    // mocks get set up against the members on the ListExample
    // type, not against the List<T> object.

    ListExample example = new ListExample();
    using(RecordExpectations recorder = RecorderManager.StartRecording())
      // No matter what index we ask for, we always want
      // the "expected" value to come back.
      string dummy = example[0];

    // Put these values into the list...

    // ...But what we get out is the mock value.
    // We can even ask for out of range indices.
    Assert.AreEqual("expected", example[0]);
    Assert.AreEqual("expected", example[1]);
    Assert.AreEqual("expected", example[2]);
    Assert.AreEqual("expected", example[3]);
    Assert.AreEqual("expected", example[4]);

  public void FieldListMocks()
    // Here the challenge is that there aren't any
    // members on the ListExample object that wrap
    // the list so we've actually got to "mock" the
    // list proper.

    // To accomplish the mock, we'll modify the object's
    // state by poking in our expected field value.
    ListExample example = new ListExample();
    ObjectState state = new ObjectState(example);
    List<string> expectedList = new List<string>();
    state.SetField("PublicList", expectedList);

    // Now when we ask for the list, we're getting the
    // expected list, not the original member.
    Assert.AreEqual("expected", example.PublicList[0]);

    // When we're done, we can reset things back to the
    // original values, which means the real PublicList
    // will be back - and will still be empty.

  public void FieldListReflection()
    // Of course, you can always do it the brute
    // force way, too, through reflection. It doesn't
    // look much different from the ObjectState version,
    // above, but we can't "return to the original
    // value" at the end of the test.
    ListExample example = new ListExample();
    List<string> expectedList = new List<string>();

        BindingFlags.GetField | BindingFlags.Instance | BindingFlags.Public)
      .SetValue(example, expectedList);

    // Now when we ask for the list, we're getting the
    // expected list, not the original member.
    Assert.AreEqual("expected", example.PublicList[0]);

As you can see, testing with the list solely as a backing data store and exposing the values only through members on your own class is far easier and less… code-smelly… than exposing the list directly as a field. Generally speaking, you shouldn’t expose public or protected fields anyway, opting for property get/set instead to allow for more flexible implementations later should the need arise. That said, if you have something you’ve got to test using a public list field, above are some ways to do it.

net comments edit

The Typemock Insider blog mentions that Patterns & Practices has adopted Typemock Isolator as their mocking framework, at least for testing SharePoint applications. Blaine Wastell and Francis Cheung say they’re using it because it allows them to mock sealed and internal types, which SharePoint is full of.

I think this is cool and definitely says something: Even if you’re writing brand new code, which can be entirely designed for testability (if that’s what you want), at some point you’re going to have to interface with something you didn’t write (SharePoint, .NET Framework) and you’re still going to want to test that interface code, which is where Isolator comes in. I’m so glad they’ve got an open source license now!

GeekSpeak comments edit

OK, my favorite Chrome Easter egg (actually, the only one I’ve heard, but still, so awesome) is if you type “about:internets” in the address bar. Too funny.