Marius's Personal site

My personal blog & gallery
Welcome to Marius's Personal site Sign in | Join | Help
in Search

Blogging About .NET

  • Calculate System Score in Windows 7 when booting from VHD

    In can you don't already know it, Windows 7 supports booting from VHD, which I'm a big fan of. This way you don't need to worry with partitioning scheme, shuffling around when you want to install additional Windows versions, backup / restore or these kind of issues.  Booting from VHD allows you easy migration to Hyper-V if you chose to do so in the future.

    However if you choose to install your OS to a VHD then you need to know that you will loose some things:

    1. Hibernate support. Unfortunately it seems that there is no way (at least not in the RTM version) to enable that. Sleep support still works fine, but if you need hibernate (or hybrid sleep) then you need to install to a partition.
    2. Calculate System Score. WinSAT fails to calculate the disk score if your system boots from VHD, because it wouldn't be accurate. Fortunately there is a solution for this. All you need to do is to launch an elevated command prompt and type the following command:
      winsat formal -drive D
      I found this while trying to setup an HTPC that needed to run Digital Cable Advisor, and while trying to calculate the system performance score it would crash very badly. It seems that they forgot to check if WinSAT actually completed successfully before parsing the results!

    Hope it helps!

    And if you find a way to enable hibernate while booting from VHD just leave a comment.

  • Giving up on Webhost4life

    After almost 6 years of running my site with Webhost4life where I didn't have a lot of complaints I was kind of forced to move away because they could no longer accomodate my hosting.

    It all started in May of 2010 when suddenly I received an email that my account was moved to a new platform, and there shouldn't be any changes but I should check if everything is all right, just in case. And the journey began!

    None of my sites were working and almost none of my email was migrated to the new platform. As a result I started to open tickets to their support, asking how to do stuff that it used to work in the old platform. Instead of the usual response time of a couple of hours, now they would not respond even for a few days. Asking their live chat about the status of my tickets usually I would get a "somebody will take care of this ticket as soon is possible". In the mean time, no email is flowing, no web site running. Apparently their new infrastructure does not support a lot of things, like a decent catch all, or changing permissions on the file system. A quick look on Bing showed that I was not alone. Actually there was community estabilished at that shared the pain. Over there I found the suggestion of requesting imediate revert of the settings and be re-enabled on the old platform in order to perform a manual migration. A few days later my email and site was operational again. Great! Or so I thought!

    After a few weeks while scrambling for a solution I receive an email again, stating that I was moved to the new platform! Oh, no, not again! Knowing the drill next day I was again in the business, on the old plaform!

    Trying to assess the damage I realized that I cannot continue to host my site at Webhost4life because that would mean to work around too many limitations and I had to switch away to alternate solutions. As a result at the end of June I canceled my account and Webhost4life and I stopped recommending them because they are too unreliable.

    After canceling my account I realized that I still had 3 months of hosting that I prepaid 3 years ago, and I would like to get the money back. I contacted their support team asking to get the prepaid money back. The answer came pretty quick (they know when to be quick) saying that since I had a discount for prepaying for 3 years they would recalculate the fees without discount and I will not get anything back because of that and I am very lucky that they don't ask for more money because after recalculating I would have owed them money. I answered back that under normal circumstanced I would understand this reasoning, however they basically forced me to move elsewhere because they no longer can accomodate my hosting needs. In the end I had to escalate my request to their SVP of sales and customer support, which agreed with me that I should be refunded the remainder of the prepaid hosting. And, this was end of July 2010.

    After a quick exchange of emails I was transferred to somebody from customer support for processing the refund. We concluded that I would like to get a check for the amount and finish this saga. August 3rd 2010, I sent back my address where should I get the check and they acknowledged it and this was the last communication from them. No check, no nothing.

    A month passed I asked them about the status of my check. No answer! Another month passed, another inquiry. Nothing! Mail to their SVP of sales and customer support. No answer! Middle of October I sent another mail saying that if I don't hear anything from them in 2 weeks I will report them to BBB. Of course, nothing, no email, no check!

    Here it comes BBB. I reported them and a few days later I receive a call from them worried what happened with the check, maybe it was lost in the mail (yeah, right!) and if they can refund the money on the credit card. A few days later I had the money on my credit card. Finally I finished the business with Webhost4life.

    Conclusion: My recommandation from Moving to a new home post is no longer valid. Since Webhost4life was acquired, they are no longer reliable. If you were thinking about switching to them, think again! I think there are a lot of other hosting providers that do a better job. I've heard that Arvixe ( is a pretty good hoster. I don't get any financial incentive to recommend them, but they seem nice. Do you own due diligence and ask question about what you care at a hosting provider.

  • A new home for Reflector

    A few days ago Red Gate has announced that it acquired Reflector from Lutz Roeder, which is big news given the fact it is kind of core tool for .NET.

    In case you don't know yet Reflector was listed in top 10 of the tools that every .NET developer must have, as can unlock many of the misteries of the .NET Framework and almost every other tool based on .NET. Red Gate announced that it will keep Reflector free so we don't need to worry at least for now and maybe we will find more addins for Reflector and community will be more interested to create for it.

    In my opinion this move was somehow determined by the fact that some of the products from Red Gate's portfolio have now some competition from Visual Studio Team System, but this is the subject of another post.

  • Sitemap Provider for Communityserver

    A few months ago I was looking for a Sitemap provider for CommunityServer, given that more and more search engines are using this technology to obtain additional information from indexed sites. I found Dan Bartel's Sitemap provider which is explained on Community Server's forum, and it was incorporated in Community Server 2007 release, or at least that's my understanding. However it has some significant drawbacks at least for CS 2.0 which I was interested in:
    • It was not customizable enough. My configuration has two different sites plugged in the same DB, and you could not exclude for example the gallery list for sitemap. Dan Bartel's version put everything it found in the DB in the sitemap index
    • It worked only on English locale servers
    • It used an older version of sitemap schema (0.84), instead of a more current version that is used by non-Google search (0.90)
    • Last modification date wasn't working correctly for blog categories
    • The name was pretty much hardcoded to GoogleSitemap.aspx
    • It was listing incorrectly only 10 posts available per blog (by using Individual Blog Post count property)
    • There are different binary versions depending on CS version and .NET Framework version
    As a result I started to write my own Sitemap provider for Community Server which I'm sharing with the world. My version should solve all the above issues, however it doesn't support Google Ping feature from Dan Bartel's version, firstly because it cannot be implemented just as a ASPX and I didn't need it at all.

    My version consists just from 2 different ASPX pages, which host the source code in them, so if you do not like any aspect of how the sitemap is generated you can tweak it to suit your needs. In order to install it you just need to copy ASPX files in root of your installation and merge SiteUrls.merge.config file from archive with your SiteUrls.config, keeping in mind that if you don't want some particular types of posts in your index, you just do not put that in your SiteUrls.config.

    For example if you don't want your galleries listed in your sitemap index, then you will remove <url name="GallerySiteMap"> entry.

    This code was tested only with Community Server 2.0, and I might have introduced some dependency to this particular version, but I haven't got a 2.1 installation to test it against. However the modifications should be trivial to make it work against 2.1 version, or even a 2007 version, if you want.

    Any comments welcomed on how this can be improved.

    CS Sitemap by Marius Constantin is licensed under a Creative Commons Attribution Non-Commercial 3.0 License. Permissions beyond the scope of this license may be available at

  • Sharepoint Hidden Gems

    Sharepoint leverages a lot of things, and developers can focus on their added value instead of figuring out basic stuff like authentication, document storage, search and so on. This makes Sharepoint a great platform to develop on, but it has some hidden tricks that can easy your tasks a lot. If you need more reasons to think about learning Sharepoint then MSDN Magazine has some more reasons.

    One of the first thing that I want to emphasize is that Sharepoint is built using ASP.NET. What this means for a developer? You can do all the things you can do in ASP.NET, and more! FindControl for example, you can enumerate the list of controls from code behind, Master pages, you name it.

    One of the hidden gems of Sharepoint (at least for developers that want to extend the platform) is the Delegate control. Delegate Control works similar to delegates in .NET and basically are placeholders where Sharepoint platform instantiate specific controls depending on the installed features. So for example you can provide an alternate implementation of the search box control to display your bells and whistles instead of the default one, which is a great feature if you want to override something you don't like. Now comes the better part: Delegate control has another mode where the platform instantiate all the controls with the same id no matter what Sequence number they have, basically allowing adding of generic functionality, without having to implement something you don't want to.

    Example: you want to display your custom magical text in all the pages of your Sharepoint site, no matter what. If you would override SmallSearchInputBox control, then you would be able to display the text, and also you would have to implement the search functionality also. This mode is called AllowMultipleControls and is placed as an attribute for DelegateControl tag. Now everything is fine, however how do you find such control? Sharepoint was kind enought to provide AdditionalPageHead delegate control in the master page, basically allowing to be able to intercept every single request for that farm or site. In your OnInit/OnLoad event you can filter the request based on your needs and then inject your own control tree, or alter the request as needed.

    To do that you would create a feature like: .codeblock, .codeblock pre { font-size: x-small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #dddddd; } .codeblock pre { margin: 0em; } .codeblock .kwrd { color: #0000ff; } .codeblock .str { color: #006080; } .codeblock .html { color: #800000; } .codeblock .attr { color: #ff0000; } .codeblock .lnum { color: #606060; }

    <?xml version="1.0" encoding="utf-8"?>
    <Feature Id="INVALID!-GUID-0000-0000-000000000000" 
        Title="My Feature Title"
        Description="My Description"
            <ElementManifest Location="Controls\mycontrol.xml" />
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="">
    	ControlAssembly="My.Assembly, Version=, Culture=neutral, PublicKeyToken=................">
        My Code.cs
    public sealed class My.Own.Control.Class : Control
        public My.Own.Control.Class()
        protected override void OnInit(EventArgs e)
    		if (some conditions) 
    			LiteralControl ctl = new LiteralControl();
    			ctl.InnerText="Hello everyone!"

    Also remember to place your control in SafeControls section of web.config like:

    <SafeControl Assembly="My.Assembly"
     Namespace="My.Own.Control" TypeName="Class" Safe="True" /> 
    between <SafeControls> and </SafeControls> tags.

    This technique can be found useful for example if you want to alter the behavior of webpart pages and you don't have control over their base class (for example if they are in a webpart document library).

  • Working with Wix - Patching reloaded

    Since my last update some changes have appeared in the steps needed to create a patch using Wix. The good news is that you no longer need MSIMSP to create a patch (and all the hurdles required to obtain MSIMSP).

    Pyro is the new tool that can be used instead of MSIMSP and streamlines the patch creation process.

    For more information about Pyro and how to use it you can use this link

    Also here you can find "updated instructions for building patches using the new WiX v3.0 patch building system".

    With this information Wix gains new strength, and it seems that Wix will be incorporated into Visual Studio Rosario (the one after Visual Studio Team System 2008, just released), instead of existing infrastructure for creating Windows Installer packages.

  • Upgrading from Windows 2000 to Windows 2003

    In the past couple of weeks I've been busy trying to update a Windows 2000 installation to Windows 2003. Apparently something went very wrong, so the upgrade took about a week in total or so, because setup program failed to do some steps apparently required in order to complete the upgrade.

    After running WINNT32.EXE in the working Windows 2000 installation, program asked for a reboot, I agreed and BOOM! blue screen. The famous BSOD stating stop 7F (aka INACCESIBLE_BOOT_DEVICE). Trying to debug the issue via WINDBG and serial cable (yeah, I had to run to COMPUSA, they are closing the stores in my region and get a plain old serial cable) didn't revealed anything terribly wrong. After long sessions of registry compare revealed that the culprit was VIAAGP1.SYS driver. If you are wondering what has to do VIAAGP1 with disk access (INACCESSIBLE_BOOT_DEVICE is directly tied with disk access), well, the only explanation I came up with is that VIAAGP1 is marked in UpperFilters key for the AGP bus which has PCI.SYS as a driver, and apparently VIAAGP1 failure was tearing down the entire PCI bus access.

    If you think it's the end you are terribly wrong. After that, SETUP was crashing with access violation at the "Installing Devices" step. The culprit? Apparently, MS_NDISWANBH instance which is the network monitor filter driver for WAN.

    And after a week of rebooting and debugging, Windows 2003 finally came up, with the fenomenal problem of not starting TCPIP driver. Reinstalling the protocol fixed the issue.

    The short conclusion: now it works fine!

    So if someone face similar problems this is what I've done (standard disclaimers apply, I'm not responsible if anything fails on your machine, make backups, you know the story):

    • Delete VIAAGP1 from UpperFilters entry in HKLM\SYSTEM\ControlSetxxx\ENUM subtree. More specifically the AGP bus, but there is no standard location. Just search here for VIAAGP1
    • Delete CDR4_2K entries UpperFIlters from HKLM\SYSTEM\ControlSetxxx\Control\Classes subtree
    • Delete all the entries for NDISWANBH in HKLM\SYSTEM\ControlSetxxx. This might was the cause for TCPIP driver not starting, however since setup kept crashing I could find a better solution at that moment. You might want to backup all the keys you are deleting, and restore them after the setup completes, YMMV

    And a side note: kernel debugging via WinDBG / serial cable at 115200 bps is not that bad. However the best is not to need such a debug.

  • Working with WiX - Patching hints

    If you are trying to create MSP files ( aka MSI patches ), one of the best tool I found to create PCP files is Wix. The amount of documentation for MSP creation is extremely small in my opinion, most of the required hints are in the Wix documentation. However I want to emphasize some of the steps that might be skipped by mistake:

    • You need MSIMSP Wix automates the creation of PCP files only. It's not a one stop shop
    • MSIMSP doesn't work with compressed MSIs. Yes! It's true, do not try to bend this rule.

    Otherwise the process it's fairly simple. Type the wxs file (using your favorite text editor), compile the file to PCP and run MSIMSP tool after having administrative install MSIs (uncompressed versions).

    A good start to more information about Windows Installer can be found here

  • Clutter free plugin hosts in .NET

    This post is inspired from another post (in Romanian, sorry for the not Romanian speakers), which asks about the usefulness of System.Reflection.Assembly class.

    This class is primarly your one stop shop if you want to implement a plugin host in .NET Framework. The implementation of a plugin host in .NET Framework is somehow different than the old "C/C++" way of implementing by the simple fact that we no longer have header files to ship to the plugin writers in order to describe our interface. But no worry, this doesn't means that it's more complicated to do such a thing in .NET. The closest way to do this is to generate a class library DLL project, that doesn't implement code (or maybe just some utility classes) but to have the definitions of our interfaces. This is the easy way, but in my opinion it's not the cleanest way. If we go this route we will have to ship our "interface" DLL to clients since it's a required dependency. For large projects where you have hundreds of files shipped to client, it might be fine, but for small project where you ship just your host and few plugins the clutter it's less desirable. A clever way to do this is to implement your interfaces in your host project, and make the plugins dependant on your host .exe file. This way you will have always up-to-date dependencies, since you cannot break the host (or, your code won't compile at all). Prior to Visual Studio 2005, you weren't able to add to a project a dependency to another project whose output is a .exe file. This was recognized more or less a bug, since .exe and .dll files doesn't differ at all internally, so the workaround for Visual Studio 2002 and 2003, was to build your project, get the output, rename it to .dll extension, and add the dependency to your plugin project.

    If you are new to plugins in .NET and you come from C/C++ plugins a warning that might save you a lot of time: do not try to reimplement your host interfaces with the same definition in your plugin project, just to remove the intermediary DLL file dependency (the easy way above). IT WON'T WORK. Objects in .NET (interfaces, classes, etc) have the same identity only if they have the same name AND come from the same assembly.

    Someone said there that is not normal that Visual Studio accepts dependecies to .EXE files. Well, the fact that they prevented explicitly this (I believe, since they were filtering some types of projects) in VS 2002 and 2003, and now it works in 2005, it might mean that some people finds the feature useful. And I come and say why not accept dependencies of .EXE files/projects?

  • Compete for a Visual Studio 2005 Team System Suite and MSDN License

    Yesterday I found that Cory at AddressOf has a spare subscription to Visual Studio 2005 Team System Suite with MSDN and it's giving for free to the one that impress him the most. Now the problem is how I catch his attention to get this subscription.

    To get the things straight, I believe that this subscription is every developers dream, but is way to much, even for a small workshop to get it. What I would do to get it? Not sure about the tangible things, but I can rest him assured that the license will be very well used. I am a big fan of embedded and mobile devices, and I believe they worth the learning investment. Just imagine the possibilities: Windows Mobile applications (developed with Visual Studio 2005 of course), together with Exchange, Biztalk, SQL Server (just to name a few), from the MSDN license, working together bringing productivity to the masses.

  • New Vista & Office 2007 boxes

    Have you seen the design of Vista and Office boxes? Apparently I'm not the only one that after seeing the Vista and Office 2007 boxes thought that they look like the Office for Mac retail boxes.

    In case you want to know more about Vista, you can use the "Windows Vista blog" to find out, as it's packed with a lot of useful information.

  • Hacking Community Server

    If you are having a split configuration where you are hosting the external Community Server site on a different server than the web site that is visible internally but you are sharing the exact same database, or the URL for your blog differs depending if you access it internally or externally, you may find yourself in the situation that Community Server will ping the configured site (or just the links from your post) with the wrong URL. Actually it's not wrong as it is the URL as if you are accessing the site internally, but for all other people outside your firewall this URL doesn't make sense. I have this kind of configuration because I want to post using SSL site, and by default Webhost4life isn't configured for SSL for the subdomains. As a result I found myself in the situation that CS was pinging sites with the administrative URL (SSL), instead of the public URL.

    After digging a little bit I didn't found something very relevant and I decided to recompile Community Server to make SiteUrlsData provider aware of absolute URLs. I was ready to send the patch to Community Server team, when while I was browsing for a completely different thing, I found this URL on the Community Server site, that appeared to be linked to my previous needs. So all my patching process was not required at all because the team thought at this kind of need.

    So, if you need this kind of configuration do not search further, all you have is to place for the url tag a new attribute named "navigateUrl" with your absolute location and you are done. Apparently, this is not very well documented since even the guy that was asking about the problem found the answer from the CS support. In my case I modified the URL only for "weblogpostId" key, but you may want to modify it for "weblogpostName" too, depending on your configuration.

    Also, the good news is that this week it appeared Service Pack 1 for Community Server 2.1, and they are also working hard for the next release that will be named Community Server 3.0. Since 2.0 works good enough for me, I think I'll wait for the later.

  • Reporting Services Uploader

    Quite some time ago I have written a small utility that allows users to upload multiple Reporting Services reports (RDL files) at once to a Reporting Services Server. I have decided to make this utility public as others might find it useful.

    The main problem with Microsoft SQL Reporting Services (either 2000 or 2005) is the lack of capability of uploading or downloading multiple RDL files at once. I know that the RS.exe utility exists, and it's presence is more proeminent in the 2005 version by adding the SQL Management Studio ability to script files of RS.exe, but you cannot upload quickly a locally stored folder full with RDL files, or for example copy a lot of reports from one server to another. That's why I decided to create this utility named RSUploader at this time at the version 0.5. Although I intent to update it a little bit I cannot promise that this will happen or a timeline for it's improvement.

    RSUploader was built using .NET framework and presently the user interface is not the best in the world, but still gets the job done. The minimum requirement is .NET Framework 2.0 and it can connect to Microsoft SQL Reporting Services versions 2000 and 2005. You can download it from here

    Among it's features you can:

    • Browse the folder structure of Reporting Services
    • Download all report definitions from one Reporting Services folder
    • Upload a local folder containing RDL files in a reporting services folder
    • Delete reports
    • Hide/Unhide reports
    In addition to the ZIP archive I also attached a screenshot to know what to expect.

    In order to successfully use RSUploader you have to type the URL of Reporting Service Web service, usually http://[machine]/ReportServer, do not swap it with the URL of Reporting Service Manager, and also if you are not using Integrated Authentication, type the username and password in the corresponding textboxes, and click Refresh in order to connect to the Reporting Services. Any time you change the URL or user / password you must click on Refresh in order to pick the new location.

    Then expand the folder structure in the left view and in the right view you will have the actual list of reports and datasources. The checkbox in the front denotes the visibility of the item (if it is not checked it means it is hidden). Also you will have fix datasources for reports if you uploaded reports before you created your datasource and the GUID that Reporting Services is using for matching the datasources is not in sync.

    If you find this utility useful please drop a note using the contact form.

    Of course, the information in this post and the utility is provided "AS IS" with no warranties, and confers no rights. I am not responsible if any thing doesn't work as expected or for any loss of data.

  • Running IPv6 on a router near you

    I told you before that I updated my WRT54GL router to DD-WRT. One of the neat things of this new firmware is IPv6 support. In case you do not know IPv6 is the next generation of IP protocol, which addresses a major problem nowadays, the fact that IPv4 addresses will most likely to run out in a few years.

    The setup is fairly simple, you enable two radio buttons in the DD-WRT web management interface, setup the RADVD and tunnel configuration according to DD-WRT Wiki and enable IPv6 on your Windows XP / 2003 box. Simple to say, simple to do, but I ran into a few problems, the main one being the fact that I wasn't able to communicate with anything over IPv6 from computers connected to the router. After a little bit of digging I found out that the scripts and configuration on the DD-WRT wiki were a little bit wrong, and with a minor fix I was able to use IPv6 successfully. This made me to write this post as it might be helpful to someone in the future.

    In the original startup script V6IPNET variable was wrongly computed along with the netmask on V6IP which I think it should be /48, because 2002:x:y:z:w::1/16 is equivalent of 2002::/16, and the routing table would be wrong as it adds address on br0 interface and route also on br0. Anyway the modified script is presented below, and it works for me:

    sleep 5
      WANIP=$(ip -4 addr show dev vlan1 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
      if [ -n "$WANIP" ]  then
       V6IP=$(printf '2002:%02x%02x:%02x%02x::1/48' $(echo $WANIP | tr . ' '))
       ip tunnel add tun6to4 mode sit ttl 255 remote any local $WANIP
       ip link set tun6to4 mtu 1280
       ip link set tun6to4 up
       ip addr add $V6IP dev br0
       ip -6 route add 2002::/16 dev tun6to4
       ip -6 route add 2000::/3 via :: dev tun6to4
       kill -HUP $(cat /var/run/

    Additionally, you may want to modify the RADVD configuration to advertise prefix 0:0:0::/48 instead of 0:0:0:1::/64, to match the above script, but it is not necessary, as 0:0:0:1::/64 it is a subset of 0:0:0::/48.

    These modifications were inspired from OpenWRT wiki, where I found also an interesting configuration tip on how to make Windows XP more IPv6 friendly, not to discriminate IPv6 protocol by favoring IPv4.

    If you are interested in IPv6 (and you should be as the change is near), you can find a lot of links for various operating systems at ManyBytesAgo.

  • Upgrading the WRT54GL

    As I was saying quite some time ago I decided to upgrading my router firmware. Originally, I wanted to buy this particular model, due it's upgradeability to a open source firmware. The upgrade was a little bit postponed due the fact my computer decided to stop working so I finally managed to do it. If you ask me which were the primary reasons of the upgrade, well static DHCP allocation and SNMP daemon are in the top list. If Linksys would add these feature in the stock firmware, right now I would not add this post. Static DHCP allocation is a very nice feature these days, as you can reshuffle your network (I mean especially in a more business scenario) without touching all the computers/devices out there, but eliminates the disadvantages of changing the device address without any reasons, or not having a predictable numbering scheme. As I said these are quite important in a business scenario, but even at home if you have more than a few devices it worths. Actually, I had a problem with the stock firmware that if I unplugged the router all the devices would have new addresses that usually are not the same, depending which device was faster to request addresses.

    The next feature I do not think requires much explanation: graphing the network traffic is quite essential in pinpointing potential problems, so here it goes.

    And the lucky winner was DD-WRT after all. I investigated a little bit over OpenWRT, but I decided to go after DD-WRT, since it seemed to me a little bit more interesting. I agree that both distribution have pretty much the same offerings, and even found that they even want to merge to concentrate the effort.

    The upgrade process was plain simple, just followed the Wiki installation tutorial and in about 10 minutes it was completed. I decided to skip the mini version and go directly to the voip version. I found that works perfectly going directly to the bigger version, with the warning that it might not work for some devices/versions, but apparently if it doesn't work it doesn't brick your router. This being said I very happy with my latest DD-WRT v23 SP2, and it seems very stable to me. So, keep up the good work with DD-WRT!

More Posts Next page »

This Blog

Post Calendar

<July 2018>


Listed on BlogShares


Powered by Community Server, by Telligent Systems