Parsing the Command Line

One of the not-so-nice things about writing Command Line applications is that you somehow have to parse the command line. Up until now, I have been using CSharpOptParse, which does the job nicely, but has the drawback of either creating a dependency on the CSharpOptParse.dll, or keeping the license terms in mind. Luckily, this was changed a year ago from GPL to Apache License 2.0, which is a very lenient license.

But nevertheless, it is still overkill for my purposes, and some functionality of CSharpOptParse is not very useful in my opinion. For example, it includes a mechanism to automatically display Usage Information (through the UsageBuilder), but I do not really like the output.

I have started to create a little place for misc. code samples on this site, and one of these samples is a simple command line parser that turns the args string-array into a dictionary. It’s nowhere near as flexible as CSharpOptParse, but it’s good enough for my uses. I have updated MakeDDF to version 1.0.1, with the only change being the change of the command line parser so that it does not require a separate DLL anymore. I will do the same in the next release of the Command Line Tools, which may take a few more weeks though.

MakeDDF Version 1.0.0

Normally, Sharepoint Development feels quite “modern”: You write your stuff with .net 3.0 and add some XML and XSLT into the mix. But then, you have to take a little trip back 20 years when it comes to creating the .wsp file for your solution, using makecab.exe and a .ddf file.

DDF Files are not only unlike any other standard file format, they are also somewhat complicated when it comes to subfolders. In order to ease the work of creating .ddf files a bit, I made a small command line tool called “MakeDDF” which allows you to specify a directory and it will create the .ddf file that contains all the files in that directory. The resulting file can then be passed to makecab /f to create your .wsp file a bit more painless than useful.

It’s freeware and requires the .net Framework 2.0, get it from here.

Denon AKDL1 – one of the best marketing tricks ever

You possibly have heard about the Denon Link cable. Yes, I am talking about the AKDL1, which looks like a normal Ethernet cable, except that the 1.5 Meter cable retails for 500 $ (yes, five hundred).

Now, Denon of course knows how to justify the price – these cables only use the purest and highest quality copper and the Connector and cable structure is designed to thoroughly eliminate adverse effects from vibration. It’s also not an Ethernet Cable, it’s a “Denon Link” cable to “Get the purest signal from multi-channel DVD and CD playback through Denon receiver”.

Or, as we techies say: it’s crap and bullsh** that is once again only there to rip off “audiophiles” who buy everything as long as it’s just expensive and promises better audio quality. However, this one is different. Sure, there are some really bad examples of rip-offs on the market – 150 € HDMI Cables with golden plugs, 100 € Composite cables that are made in a clean room with oxygen within the copper… But Denon really upped the ante here with a 500 € Network Cable. And I have to give Denon my Kudos: This is one of the greatest Marketing Stunts ever.

It not only spawned some of the best reviews ever, but also a strip from, which is quite an achievement. Regardless how useless the product is, the advertising effect is great.

Well done!

So, where is my 800 $ Serial ATA cable that will ensure that music from my hard drive can go to the Denon Link Ethernet Cable without any loss of quality?

SendEmail ignores the “From” Field

More Fun with Sharepoint and it’s excellent (</irony>) Documentation.

Apparently, the SendEmail Workflow Activity ignores the FROM-Property. As per a Comment on the SendEmail.From Page:

This property is currently ignored. The emails it sends are always from the sender specified in the outgoing e-mail settings under SharePoint central administration. Specifying a “From” header in the Headers property also fails.

I can just confirm that, SendEmail.From indeed seems to have no effect, regardless if it’s been set through the Binding Property or directly in the Property Page.

Bonus-Link: Completely unrelated to the EMail problem but regardless very helpful to me: An article about creating custom Sharepoint Timer Jobs. Thanks for that one!

I hate locale-specific content

Back in the old days, the Internet was almost exclusively English. Then, it became a more world-wide thing and now, you find content in all languages of the world on the web. That’s fine.

Then, some people thought: Hey, wouldn’t it be great if we detect your browsers Accept-Language (or your IP) and display content automatically in the language of your choice? Apparently, a lot of people thought the same and now, a lot of sites have such an automatic language-switch now. Of course, your opinion my different, but in my opinion, all of those sites have one thing in common: They all suck. Look at the two screenshots below:

When I go to, the language selection will be set to German and all searches will search German Content. As you see, the German version does not have any results for “ResourcesAttribute”, whereas if I manually change the dropdown to United States English, I get 1110 results, with the first one being the correct one directly.

Now, it’s easy to point fingers at Microsoft and telling them “You Suck!”, but MSDN is not the only site that does it like that, it’s just the site where I encounter that regularly. Another well known offender is Google, as is not English but whatever language you choose. Google is actually even worse. They have domains in pretty much every TLD. So, what do you expect when you go to or What I would expect is the French or Spanish Version. What do I get?

A German Version. Ok, fair enough, so you got German UI. But what do I get if I search the web for something, let’s say “Euro 2008”?

The first picture was made using German as my default Accept-Language, the second one with Spanish. Note that there is a difference in the search results, and that’s what I not only find braindead but also inexcusable. If I go to and select “Search the Web”, then I expect that my results look like the second one, regardless if my Accept-Language is German, Spanish or Swahili.

I find the Google results unusable at times, only to discover that my Language is German and therefore I do not get many good results when searching for Sharepoint-Related articles because frankly, most useful Sharepoint Articles are English and therefore the “English” Google which does not spam the first 10 Pages with useless German results gives a lot better results.

Again, YMMV, but I hate automatic language selection. I want to select my language through the URL and then expect that what I see will always be the same regardless of Accept-Language. Wikipedia does it right: and are entirely separated and I can be sure that they always behave the same regardless of my browser’s language.

Anyway, that was just a long and complicated way of saying: As I reinstalled my operating system a week ago, I still had to change my browsers Accept-Language to get useful content on the Web and that was a good opportunity to rant a bit about sites that believe they do me a favor by displaying content in “my” language.

Solving Sharepoint’s long startup time

When developing on a Sharepoint server, I have to iisreset or recycle the application pool countless times, and that is always paired with some seemlessly endless startup time (usually around 2 Minutes until Sharepoint starts serving pages again).

It turns out that this is not just something that is given, but there is a reason and even a solution to it, as Jeroen Ritmeijer points out in his blog posting:

The problem is that when loading signed assemblies the .net Framework checks the Internet based certificate revocation list. As our servers have, like most secure environments, no outgoing connections to the public Internet the connection to times out after what appears to be 30 seconds. It probably does this a couple of times in succession, causing a 2 minute wait when spinning up SharePoint.

Jeroen also reports some workarounds for this. I have to say, this is one of the most important tips as it really speeds up development! Or, to say it with his words: “life is good again….. well as good as it gets when you are doing SharePoint development.”.

System.AccessViolationException on AnkhSVN with Visual Studio

As quite a few other developers, I use Subversion as my Source Code Control. Being mainly a .net Developer, I am using Visual Studio to do my work, and that means I needed a Subversion-integration for Visual Studio. My choice is AnkhSVN, specifically Version 1.0.3. Yes, it’s pre-release, but it works a lot better than 1.0.2 which loved to put my repository in a state where I had to run the cleanup command first before I could commit. (Renaming, Deleting and moving files within the solution is somethink that could reliably mess up AnkhSVN, and 1.0.3 is a big improvement).

Since I have recently upgraded my PC (From an Athlon 64 X2 4200+ to an Intel Core 2 Quad Q6600), I also reinstalled Windows XP and the applications that I need, including Visual Studio and AnkhSVN. But to my surprise, I started getting Access Violations when starting or using any AnkhSVN Feature:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at svn_config_get_config(apr_hash_t** , SByte* , apr_pool_t* )
at NSvn.Core.ClientConfig.Init(String dir) in e:\projects\2003\ankh\build-3\src\nsvn.core\clientconfig.h:line 73
at NSvn.Core.ClientConfig..ctor() in e:\projects\2003\ankh\build-3\src\nsvn.core\clientconfig.h:line 21
at NSvn.Core.Client..ctor() in e:\projects\2003\ankh\build-3\src\nsvn.core\client.cpp:line 95
at Ankh.AnkhContext.SetupFromConfig() in E:\projects\2003\Ankh\build-3\src\Ankh\AnkhContext.cs:line 552
at Ankh.AnkhContext.LoadConfig() in E:\projects\2003\Ankh\build-3\src\Ankh\AnkhContext.cs:line 516
at Ankh.AnkhContext..ctor(_DTE dte, AddIn addin, IUIShell uiShell) in E:\projects\2003\Ankh\build-3\src\Ankh\AnkhContext.cs:line 49
at Ankh.Connect.OnConnection(Object application, ext_ConnectMode connectMode, Object addInInst, Array& custom) in E:\projects\2003\Ankh\build-3\src\Ankh\Connect.cs:line 89

Hmmm… That looks bad. After some searching and even a memory test (Access Violation is often also a sign of faulty memory, especially if they suddenly start appearing), I found that it was caused by an installed Subversion (if you look into the stacktrace, AnkhSVN eventually goes into Subversion, which then throws the somewhat misleading exception). I do always have the Command Line Version of Subversion installed, in case I want to check out some repository outside of Visual Studio. After renaming the C:\Program Files\Subversion Folder, AnkhSVN works perfectly fine.

It looks as if AnkhSVN was linked against a different Version of Subversion, or in some other way is incompatible with the stuff it finds in my standalone installation. Specifically, it is libapr-1.dll that is causing that issue. If I remove it from my %PROGRAMFILES%\Subversion\bin Directory, Ankh works fine, but obviously the standaone Subversion does not. Armed with that clue, I was able to find the reason:

Subversion-1.4.6 for Apache-2.0 uses APR-0.9(libapr.dll). But Subversion-1.4.6 for Apache-2.2 uses APR-1.2(libapr-1.dll).

Yep, I am indeed using Subversion for Apache 2.2 which uses APR-1.2 (APR stands for Apache Portable Runtime Library), but AnkhSVN uses APR-0.9 and despite them having different filenames, they are referencing each other somehow and as a result, it crashes.

The solution? Since I do not run Apache Web Server on that machine, I just uninstalled Subversion and reinstalled the version built against Apache 2.0 instead – works perfectly! (For normal Desktop use, there is no advantage or disadvantage of using a specific version, it is really only if you want to use Subversion with Apache, as outlined in an older article by me). If you ARE using Apache, I don’t really know how you could resolve it. One guess is to install the Apache 2.2 package, grab the required .so files, uninstall it and install the 2.0 package while placing the 2.2 packages into the Apache extensions. But I have no idea if that works. If not, it looks like you’re in for some recompiling to compile your own compatible versions of your tools.

Anyway, I’m back to having a working Development Environment and I’m working on the next version of my CommandLine Tools.