The long path of installing Windows Home Server 2011 under Hyper-V R2

Here is my experience of Windows Home Server 2011 aka Vail installation under Hyper-V R2 server (Core2 Duo E7600, 8GB RAM, 500GB RAID 1 and 3TB RAID5). What could have gone wrong it actually went but let’s go by steps.

  1. During file copy at the very beginning I was experiencing couldn’t copy file XY. Problem: corrupt ISO file I was using. Solution: re-download the file.
  2. The setup make it further but I started experiencing random reboots and BSODs during install, this time it was happening soon after initial files copy finished. On the bright side I caught few of them and they were mostly mentioning memory corruption. Time for memtest86+ and for RAM test. It turned out that one of four Patriot DDR2 2GB CAS6 memory sticks was bad. Solution: Throw out the problematic stick and run the server with three sticks. Also donated to memtest86+, well deserved.
  3. Memory issues were still present during setup. Argh.  Solution: Throw out the third memory stick (they like to work in pair it seems and a pair and a third wheel obviously isn’t something one should use) and replaced it with two older 1GB sticks I had collecting dust.
  4. I’ve made it to the step when setup says “Waiting for installation to continue” and shows a marquee progress bar. Except it didn’t finish. Ever. Now what. After peeking into log files located at C:\Users\All Users\Microsoft\Windows Server\Logs I’ve more or less soon understood that it has something to do with the “waiting for a web page to show”. After more digging I’ve found out that there were problems connecting to the internet and the internal web page wasn’t showing. Problem: the network card didn’t get an address from my DHCP for some reason. Solution: I’ve set a fixed IP and DNS records.
    Hint: Type Ctrl+Alt+End to simulate Ctrl+Alt+Del from Hyper-V client. Pick Start Task Manager and File/Run. Run explorer.exe and you can browse around the file system.

It took me a couple of days to make it through but at least I did it. Hura. It took me that much because I was installing on a 1TB VHD disk on a RAID5 array and setup takes time each retry.

So, that’s it. Now it looks fine.

Automating the Righthand Dataset Visualizer build process and a refresh build

Since the last version released I become aware of an issue in the visualizer. If you were working on a project that referenced newer DevExpress assemblies the visualizer might have reported an exception due to the binary incompatibility with its references to the DevExpress assemblies - a assembly binding issue.

(If you want just the binaries you can skip to the end of the article and download them.)

The solution is to use a custom build of DevExpress assemblies. If you have their sources you can build your custom DevExpress assemblies using these useful scripts.

Then I have to use those custom built assemblies with my visualizer but I want to use them only for release build, not for debug. So I created a folder named CustomAssemblies under visualizer solution. I added a reference path to this folder to all of the visualizer projects. Which means that the MSBuild will use assemblies in this folder if they are present or ones from GAC (the original ones) if the folder is empty. Unfortunatelly the reference paths are global to the project and you can't have two different sets for two different configurations.

So the building of the release version looks like: populate CustomAssemblies folder with custom DevExpress assemblies, run MSBuild on Release configuration and at the end clear the CustomAssemblies folder so the debug version works with the original DevExpress assemblies. But there is one more obstacle. The license.licx file lists public key of the DevExpress assemblies and it doesn't match the one found in custom version. So I have to replace all occurences of the original public key with my custom version public key before the build and restore the originals after the build. Problems solved.

The actual release process involves also {SmartAssembly} which merges all assemblies into a single file and signing it with a certificate+timestamping and finally zipping the rather large result. Because I am not a masochist I decided to create a FinalBuilder project that does all of this automatically for me (except for building custom DevExpress assemblies).

Let me know if there are still problems!

Righthand.DebuggerVisualizer.Dataset.2008_v1.0.1.zip (12.67 mb)

Righthand.DebuggerVisualizer.Dataset.2010_v1.0.1.zip (12.67 mb)

Read more about Righthand DataSet Visualizer here.

About strongtyped datasets, DBNulls, WPF and binding

The mix of strongtyped datasets, DBNull values, WPF and bindings will likely yield exceptions of invalid cast type when binding nullable columns.

Imagine you have a table with a single, nullable, column Description. You would bind it against a TextBox (or any other control) with this syntax: {Binding Description}. When binding is performed against a row that has a DBNull value (remember, ADO.NET uses DBNull.Value for null values) in that column you get an Unable to cast object of type 'System.DBNull' to type 'System.String' exception.

The reason for that exception is quite simple. Let’s take a look at how ADO.NET implements the strongtyped Description column:

   1: [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   2: [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
   3: public bool IsDescriptionNull() {
   4:     return this.IsNull(this.tableXXX.DescriptionColumn);
   5: }
   6:  
   7: [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   8: [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
   9: public string Description {
  10:     get {
  11:         try {
  12:             return ((string)(this[this.tableXXX.DescriptionColumn]));
  13:         }
  14:         catch (global::System.InvalidCastException e) {
  15:             throw new global::System.Data.StrongTypingException("The value for column \'Description\' in table \'XXX\' is DBNull.", e);
  16:         }
  17:     }
  18:     set {
  19:         this[this.tableXXX.DescriptionColumn] = value;
  20:     }
  21: }

The obvious problem is that WPF binding goes straight to Description property without checking IsDescriptionNull() method (as your code should) and then property getter fails to convert DBNull.Value to a string. And no, at this point even a converter won’t help you because the value is read before converter is even invoked.

But fear not, the solution is a very simple one. Just add square brackets around Description in binding syntax, like this: {Binding [Description]}. Looks similar but it is different. The former syntax uses strongtyped property to access the data while the later uses the DataRow’s this[string] accessor instead which returns an object and thus no exceptions are raised due to the DBNull.Value to string conversion. Furthermore a DBNullConverter value converter can come handy as well:

   1: public class DBNullConverter: IValueConverter
   2: {
   3:     public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
   4:     {
   5:         if (value == DBNull.Value)
   6:             return DependencyProperty.UnsetValue;
   7:         else
   8:             // return base.Convert(value, targetType, parameter, culture);
   9:             return value;
  10:     }
  11:  
  12:     public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  13:     {
  14:         if (value == null)
  15:             return DBNull.Value;
  16:         else
  17:             // return base.ConvertBack(value, targetType, parameter, culture);
  18:             return value;
  19:     }
  20: }

Migrating a Windows Home Server guest machine from VMWare Virtual Server 2.x to Hyper-V

I was running a Windows Home Server under VMWare Virtual Server as a guest machine. It had a dedicated 750GB hard disk to host a fixed size virtual disk spanning entire hard disk.

These days I am migrating this and other virtual machine to the Hyper-V 2008 R2 free server and here is how I did migrate it.

  1. Uninstall Virtual Server Tools from guest machine (this is important at this point in time because later it can’t be done easily through add/remove programs).
  2. Shut down guest.
  3. Copy all VMDK files to a spare (new) 1.5 TB Seagate disk. This step isn’t strictly necessary but it was for me because the source disk had troubles reading some sectors – if I wanted to proceed I had to have all the files on a good disk. This step took something like 4 hours over 1Gb LAN.
  4. Download and run VMDK to VHD Converter.
  5. Convert VMDK files (as input select the one without numbers if your virtual disk is partitioned across many files, i.e. SomeDisk.vmdk). I converted to the same hard disk (it barely fits) and it took something like 7 hours.
  6. Copy the resulting VHD to the Hyper-V server (I could pick the server as target location in step 5. but I felt more comfortable doing conversion locally). This step again took something like 4 hours.
  7. Create a new Virtual Machine on Hyper-V server, attach the resulting VHD file as its disk.
  8. Run the machine, activate OS (it will detect “huge” hardware change and it will require activation).
  9. Install Integration Services (Action/Insert Integration Services Setup Disk on connection window) and that’s it.

Lessons learned:

  • Hard disks are growing fast in size but network speed doesn’t. Thus such transfers will be slower and slower due to the sheer amount of data to transfer between disks.
  • Such operation might take whole day
  • If you use an external disk like I am then you should really stick with e-Sata instead of USB 2 or firmware (it is up to 4x faster)
  • Have enough free space on hard disks

An odd error when adding items to toolbox in Visual Studio 2010

Ever got an error like this when trying to add a toolbox item?

image

Textual representation (for search engines):

---------------------------
Microsoft Visual Studio
---------------------------
Could not resolve mscorlib for target framework '.NETMicroFramework,Version=v4.1'.  This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted.
---------------------------
OK  
---------------------------

and here is another one:

error

---------------------------
Microsoft Visual C++ Runtime Library 
--------------------------- 
Runtime Error!

Program: C:\Program File…

R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application’s support team for more information.
---------------------------
OK
---------------------------

The later one is really useful.

Note: It isn’t strictly linked to v4.1 – it happens with earlier versions as well.

Another side effect is that toolbox is somewhat corrupted, only certain tabs are loaded. But fear no more, here is the culprit and the workaround we found.

It turns out that there are problems when .net microframework is installed and its assemblies can’t be loaded.

Update (23.12.2011)

Microsoft wisely broke the link to the thread containing the solution - the solution thread has vanished into the black hole of the internet.
So, here is the solution as far as I remember :-):
Rename the files (or delete them) FrameworkList.xml which are installed in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETMicroFramework\v4.x\RedistList. Note that each .NET Micro Framework installs its own file in its own folder.

Comparing heating costs using Silverlight

Out of curiosity I’ve decided to compare actual heating costs versus theoretical heating costs. The calculation shows how much it would cost If I used a modern conditioner instead of a centralized heating provided by city and fuelled by natural gas. Hence I crafted a simple Silverlight application using DevExpress Silverlight components (which helped a lot, but that’s another story).

The default data is my data for January but you can enter your own. While the application is in Slovene you can pretty much understand the huge difference just by looking at the chart below. So much for naively believing that heat provided directly by fire is the cheapest one.

Follow this link to the heating cost calculator

Waiting for a tablet

It has been quite a while since I’ve started thinking about an e-Reader. The primary reason is that I have a bunch of e-books (many of them from Manning). I bought them with an e-reader in mind. However, they are in various formats, PDF among them.

The mainstream e-reader is still a 6” device with a single 9” out there - Kindle DX which is quite expensive and run by Amazon. This could be a worrisome fact – they demonstrated it twice at least: first they removed legally bought books from e-readers just like that (ironically those were Orwell’s) and they denied hosting Wikileaks on their cloud servers because of a single phone call made by a politician. Being at the mercy of such a company isn’t really something good, is it? Anyway, the thing is that 6” devices are suitable for displaying more or less e-books only, not all e-content (think PDF) due to the screen size. And e-readers with bigger screens are not coming yet, are they? During this time iPad happened  which shows that a tablet is a good alternative to e-readers if properly done (plus it can be used for many daily tasks where e-readers simply don+t work). Thanks for that, iPad. Hence I shifted my focus to tablets.

Here are my requirements for a tablet capable of displaying e-books in various formats, reading e-mail, surfing, etc:

  1. Real battery life at least 6hrs
  2. Screen resolution at least 1024x600
  3. Screen size at least 7” (not sure if I rather set it to 9” – have to check them in real world)
  4. Not being at the mercy of anybody for content installation
  5. Applications can be developed on PC (.net is preferred)
  6. A decent chipset (nVidia Tegra 2 looks the best bet right now)
  7. Open architecture with an option to install custom OS (when the manufacturer stops supporting it)

So let’s start with the eliminations.

iPad

I’ll never buy iPad due to the conflict with requirements 4, 5 and 7. My biggest problem with iPad is the Apple politics behind it. If you have it then you are at the mercy of Jobs who decides what are you allowed to run, install, share and read - Apple censors content for no reason, at least they don’t even try to explain it, Wikileaks application was one of them. From the hardware point of view it is a fine device though.

Windows 7 tablets aka slates

There are some and come in various forms and factors. However, none of them makes it over my first requirement. They are slow, too - thanks to Windows 7 not being optimized for tablet format. I could survive slowness but not being able to run over 3hrs straight is a complete showstopper. Imagine, you just boot Windows 7, open Word and your document within it and you have to recharge already. It is beyond me why the manufacturers even bother producing them. The only bright point here is that Microsoft announced support for ARM and SoC with forthcoming Windows 8. I guess I’ll have to re-evaluate Windows based tablets in two years or more.

Chrome

No idea.

Android

Which leaves the Android based tablets as the only alternative. Currently the only decent one is Samsung Galaxy Tab which is heavily overpriced. It is more expensive than iPad even though it features much smaller display (7” compared to iPad’s 9”) and a free open source OS. Furthermore it is running Gingerbread (or is it Froyo) without any upgrade commitment from Samsung (you can’t just use stock Android due to Samsung’s customization).

The real deal are many Tegra 2 based tablets running Honeycomb announced at CES and I guess many more are coming in the near future. I think this spring there will be enough tablets on the market to choose from. I don’t know yet which one I’ll buy but I am skeptic about Motorola and HTC. The first one because of Milestone fiasco .They released the same hardware as Droid in the US which is a Google reference device. Meaning Google support and stock Android. But they released its twin as Milestone in EU as completely closed system with rare and very late updates (requirement 7) as if EU doesn’t deserve and open device. Screw you Motorola. Nor do I trust HTC which, rather than supporting their phones or putting some effort and care into them, releases new and new models almost monthly. Not saying others are better or worse but I just don’t trust these two.

To be honest Samsung is very bad at supporting as well. Just look at their flagship Galaxy S phone which could be much better. Having a top notch hardware is FUBAR slow due to the incredible stupid decision to use RFS as their file system. You have to use one of the lagfixes to see it fly. OS customization bloat named Touch Wiz doesn’t help with upgrades - The OS upgrade speed shown so far is poor – upgrading to Froyo took them around 6 months.

I don’t know about other manufacturers but I assume they can be even worse. Hence I’d really appreciate a tablet running a stock Android or the possibility to install a stock Android. This way updates would be piece of cake. This is valid for phones as well, not just tablets.

I am still optimistic for this spring. Am I too demanding?

Righthand DataSet Visualizer goes 1.0

As a New Year’s gift I’ve fixed few bugs in Righthand DataSet Visualizer and set its version to 1.0.

Here are some changes:

  • uncompressed assembly is a bit larger due to avoiding compression within merged assembly.
  • RowState is visible again
  • some grid drawing related fixes

Read more about Righthand DataSet Visualizer here.

Download the newest and older versions from download section.

2008 version is here.

2010 version is here.