Drinks in AD

Today, I got the hint to take a deeper look into the AD. Surprisingly I found the following entry in the Active Directory Schema:

drink Attribute

Sounds like a joke, doesn’t it? If you have a look into RFC 1274 search for section 9.3.5. There you will find

9.3.5. Favourite Drink

The Favourite Drink attribute type specifies the favourite drink of
an object (or person).

favouriteDrink ATTRIBUTE
(SIZE (1 .. ub-favourite-drink))
::= {pilotAttributeType 5}

Seems like it is no joke at all…

NUnit .NET 2.0 compliant

The current iteration release of NUnit 2.2.2 should work fine with assemblies build in Visual Studio .NET 2005. Nevertheless some problems occur after installing Visual Studio .NET 2005 Beta 2. Check out the installation folder of NUnit, usually C:\Program Files\NUnit 2.2.2\bin. Here you should modify the file nunit-gui.exe.config.

  <supportedRuntime version="v2.0.50215" />
  <supportedRuntime version="v1.1.4322" />
  <supportedRuntime version="v1.0.3705" />
  <requiredRuntime version="v1.0.3705" />

The version of .NET 2.0 on your system is slightly different due to the installation of Visual Studio .NET Beta 2.

WaitOne and PInvoke

Unfortunately, there is no way to copy a .NET desktop application to a compact framework based system. The compact framework does only support a subset of the .NET library.

Two typical problems while migrating a multi-threaded application to the Compact Framework can be solved as following:

The first issue appears when using the Sleep-method of threads.

System.TimeSpan yield = new System.TimeSpan(10);

The compact framework does not support any signature accepting TimeSpan as parameter. Simply convert the value to an integer using the milliseconds solves this one.

System.TimeSpan ts = new System.TimeSpan(10);
int yield = ts.Milliseconds;

More complex is the usage of the WaitOne-method. WaitOne only provides a signature without any parameters on the compact Ffamework. A simple solution is the usage of the following PInvoke

private extern static Int32 WaitForSingleObject(System.IntPtr Handle,System.Int32 Wait);

Using this you can substitute calls similar to this

foo.WaitOne((int)((bar - System.DateTime.Now.Ticks), false);

by the flowing lines to achieve the same result:

System.IntPtr hProcess = foo.Handle;
System.Int32 wait = (int)((bar - System.DateTime.Now.Ticks));
WaitForSingleObject(hProcess, wait);