Friday, January 8, 2010

NHibernate: Mapping a Generic List of Enum

I recently ran into a case where I wanted to have a collection of an enumeration on one of my domain classes.

E.g.

public class MyDomainClass
{
public List<MyRoleEnum> Roles { get; set; }
}

But how is do we map something like this in an xml mapping? A quick google didn't turn up the answer, so I played around a bit and found the following works as desired.

<bag name="Roles" table="MyDomainClass2Role">    
<key column="MyDomainClassId" />
<element column="Role" type="MyRoleEnum" />
</bag>

To confirm this usage I checked the documentation at hibernate.org. Turns out the <element /> tag was designed for value type bags anyway.

Wednesday, November 4, 2009

Demote 2003 Domain Controller: NETLOGON Timeout

As you may know, I occasionally copy information here which I feel needs better exposure on the web. This is just such a post.

I recently tried to demote a server 2003 domain controller (using dcpromo), and hit the following error message:

The operation failed because:

Failed to configure the service NETLOGON as requested

"The wait operation timed out"
This is a particularly useless message because the actual problem has nothing to do with netlogon.

I corrected this problem by modifying the TCP/IP settings to point DNS at the remaining domain controller (e.g. remove 127.0.0.1 or any other IP which points to the machine being demoted).

Tuesday, September 29, 2009

Running IE6 in Windows 7 with Virtual PC

With the advent of Windows 7 and improved application virtualization, legacy browser testing has been greatly simplified.

Thanks to the XP Mode vmc that Microsoft provides here, it is quite easy to setup an instance of IE6 to run almost seamlessly alongside your native Windows 7 apps.


After installing Windows Virtual PC and the XP Mode vhd, perform the following steps:
  1. In Windows Explorer, navigate to "c:\documents and settings\all users\start menu".
  2. Right-click and select New -> Shortcut.
  3. Type in http://www.google.com or whatever you would like your home page to be.
  4. Give the shortcut a name (I called mine "IE6").
  5. Finish the wizard, log off, and close the virtual PC.
  6. In your Windows 7 start menu you will now find a folder at All Programs -> Windows Virtual PC -> Windows XP Mode Applications which contains the shortcut you just created. Click this shortcut and TADA! IE6 runs in a window of it's own.
One limitation of this approach is that you can only have one instance of any XP Mode application running at one time. You may be able to open multiple IE6 instances by creating more than one shortcut in the xp start menu, but I didn't try it.

Sunday, August 30, 2009

No DVD Sound in Windows 7

I installed Windows 7 on an older (4 years) laptop this past weekend and encountered a rather irksome problem that has a very simple fix.

Symptoms:
  • Audio works fine, until you stick in a DVD and try to play it with WMP12: no sound.
  • WMP12 playing mp3's is fine, but stick in a DVD: no sound.
  • Load a DVD ISO on a virtual drive and try to play: no sound.
Because of some trouble I had with the Realtek drivers for windows 7, and the Sony DVD drive, I was not certain at this point where precisely the problem lay. Searching a bit for Realtek, DVD and Sony's DW-D56A didn't turn anything up, so I started looking more broadly.

Turns out a post on AVForums by Damernath pointed out a very simple solution that worked like a charm. I repeat below for your benefit:
  1. Go to: Control Panel -> Sound
  2. On the "Playback" tab select "Speakers" and click "Properties"
  3. On the "Advanced" tab uncheck "Allow applications to take exclusive control of this device"
That's it. Restart WMP and watch your DVD glory.

Thursday, August 6, 2009

MS Deploy RC1 Install ... Odd!

In upgrading from MS Deploy Beta1 to RC1, I found an undocumented oddity which could stump you for who knows how long.

If you install the RC without first uninstalling the beta, the Web Deployment Agent Service refuses to start. From the command line, "net start msdepsvc" returns

The service did not report an error

And no error is logged in the Event Log either.

The fix? Simple, just go into Programs and Features, select the Web Deployment Tool Release Candidate 1 and choose "Repair".

All fixed.