<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Arnout's Eclectica</title>
	<link>http://grootveld.com</link>
	<description>But I digress...</description>
	<pubDate>Tue, 02 Dec 2008 19:41:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>
	<language>en</language>
			<item>
		<title>Hash heads and happy compilers</title>
		<link>http://grootveld.com/archives/31</link>
		<comments>http://grootveld.com/archives/31#comments</comments>
		<pubDate>Tue, 02 Dec 2008 19:41:18 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Words</category>
		<guid isPermaLink="false">http://grootveld.com/archives/31</guid>
		<description><![CDATA[Just came across the following line in the sources to zlib:
if (hash_head) hash_head = 0;  /* to make compiler happy */
]]></description>
			<content:encoded><![CDATA[<p>Just came across the following line in the sources to <a href='http://zlib.net/' title='Homepage for the zlib project'>zlib</a>:</p>
<pre class="codesample"><span style='color: blue;'>if</span> (hash_head) hash_head = 0;  <span style='color: green;'>/* to make compiler happy */</span></pre>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/31/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Troubleshooting a scheduled task</title>
		<link>http://grootveld.com/archives/30</link>
		<comments>http://grootveld.com/archives/30#comments</comments>
		<pubDate>Fri, 28 Nov 2008 20:08:14 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Windows</category>
	<category>Reminder</category>
	<category>Troubleshooting</category>
		<guid isPermaLink="false">http://grootveld.com/archives/30</guid>
		<description><![CDATA[Earlier today, I was trying to run a batch file as a scheduled task, using a non-admin service account. It didn't work, but the scheduled tasks interface didn't provide a lot of info to go on.
After manually double-checking file system permissions, and running Filemon to try and figure out where stuff was failing, I found [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier today, I was trying to run a batch file as a scheduled task, using a non-admin service account. It didn't work, but the scheduled tasks interface didn't provide a lot of info to go on.</p>
<p>After manually double-checking file system permissions, and running Filemon to try and figure out where stuff was failing, I found out that the task scheduler actually creates a log file. By default it seems to live at <code>%SystemRoot%\Tasks\SchedLgU.Txt</code>, but that location can be changed in the registry by modifying the <code>LogPath</code> value at <code>HKLM\SOFTWARE\Microsoft\SchedulingAgent</code>.</p>
<p>That log file contained an error message (well, several...) that quickly lead me to Microsoft Knowledgebase article <a href='http://support.microsoft.com/kb/867466' title='Microsoft Knowledgebase article about &#39;Access Denied&#39; errors in scheduled tasks'>KB867466</a>. Turns out that on Windows Server 2003 member servers, non-admin users running non-interactively don't have Read or Execute permissions to <code>cmd.exe</code>...</p>
<p>After fixing the permissions, the job ran fine.</p>
<p>That's when I discovered that the batch file was making some assumptions w.r.t. the user's regional settings, so I switched to a VBScript instead. If I'd done that in the first place, I wouldn't have had to spend 15 minutes fighting with the task scheduler, since the permissions issue doesn't apply to <code>cscript.exe</code>...</p>
<p>Oh well.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/30/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Debugging a printer</title>
		<link>http://grootveld.com/archives/29</link>
		<comments>http://grootveld.com/archives/29#comments</comments>
		<pubDate>Sun, 16 Nov 2008 17:28:25 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Uncategorized</category>
		<guid isPermaLink="false">http://grootveld.com/archives/29</guid>
		<description><![CDATA[Lately, our Canon S750 printer has started showing its age (nearly 6 years, which is not bad at all). It begun with a very sudden change in B&#038;W print quality, which was mostly taken care of by cleaning the print head.
Today it stopped functioning altogether. It took me a while to notice that the printer [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, our Canon S750 printer has started showing its age (nearly 6 years, which is not bad at all). It begun with a very sudden change in B&#038;W print quality, which was mostly taken care of by cleaning the print head.</p>
<p>Today it stopped functioning altogether. It took me a while to notice that the printer light was alternating between green and orange (quite subtly so, at least to my colour blind eyes), but once I noticed that, a quick Google showed that it was suffering from a full waste-ink absorber.</p>
<p>That's not really a user-servicable part (I do software, not hardware...), but since the printer wasn't working anyway and I wasn't going to have it repaired, I thought I'd give it a try.</p>
<p>So: opened up the printer, spent some time figuring out which screws to unscrew, took out the sponge, rinsed, rinsed, rinsed, and rinsed some more, and cleaned up the sticky inky sludge that had collected at the bottom of the printer.</p>
<p>Am now waiting for the sponge to dry, so I'm not sure yet whether I fixed the problem or wrecked the printer completely. However, the reason for this post: while cleaning up my work area afterwards, I noticed that something had fallen out of the printer:</p>
<p><img src='/images/CanonS750Bug.jpg' width='282' height='212' alt='The Fly'/></p>
<p>I'm calling her <a href='http://en.wikipedia.org/wiki/Admiral_Grace_Hopper#Anecdotes' title='Article about Grace Hopper at Wikipedia'>Grace</a>...
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/29/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Synchronizing two batch files using WAITFOR.exe</title>
		<link>http://grootveld.com/archives/28</link>
		<comments>http://grootveld.com/archives/28#comments</comments>
		<pubDate>Thu, 28 Aug 2008 20:58:08 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Windows</category>
	<category>Development</category>
	<category>Reminder</category>
		<guid isPermaLink="false">http://grootveld.com/archives/28</guid>
		<description><![CDATA[I was writing some unit tests today where I wanted to start some process asynchronously, but have it automatically exit after a specified number of seconds. Preferably something that's available on a standard W2K3 box, so that I wouldn't be creating any additional prerequisites for other developer boxes or the build machine.
Usually I just use [...]]]></description>
			<content:encoded><![CDATA[<p>I was writing some unit tests today where I wanted to start some process asynchronously, but have it automatically exit after a specified number of seconds. Preferably something that's available on a standard W2K3 box, so that I wouldn't be creating any additional prerequisites for other developer boxes or the build machine.</p>
<p>Usually I just use <code>ping -t -n <i>count</i> <i>host</i></code> for this, but I was also thinking that it would be nice to be able to terminate the process before the timeout. Not sure exactly how I came across it, but somehow I found <code>waitfor.exe</code> lying around in my <code>system32</code> directory.</p>
<p><code>WAITFOR</code> uses a <a href='http://msdn.microsoft.com/en-us/library/aa365576(VS.85).aspx' title='Documentation for Win32 mailslots at Microsoft'>mailslot</a> to wait on or send a signal to. The waiting and sending can happen on the same machine, or the signal can be sent across the network.</p>
<p>In one command prompt, you perform the wait:</p>
<pre class="dosbox">C:\> WAITFOR /T 42 SignalName</pre>
<p>In another, you send the signal:</p>
<pre class="dosbox">C:\> WAITFOR /SI SignalName</pre>
<p>Way nicer than the old-fashioned approach of having process A poll a directory until process B has created a particular file. And, no less important, if the signal is not received within the specified timeout, you get:</p>
<pre class="dosbox">C:\> WAITFOR /T 1 Godot
ERROR: Timed out waiting for 'Godot'.

C:\>_</pre>
<p>:-)
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/28/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>*UPDATE* on REGEDIT experiments</title>
		<link>http://grootveld.com/archives/27</link>
		<comments>http://grootveld.com/archives/27#comments</comments>
		<pubDate>Thu, 21 Aug 2008 20:03:01 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Windows</category>
	<category>Development</category>
	<category>Regedit</category>
		<guid isPermaLink="false">http://grootveld.com/archives/27</guid>
		<description><![CDATA[In my previous post, I wrote about some findings w.r.t. REGEDIT. One of them was about a limitation on the depth of key hierarchies during a registry export.
When I found out about this limitation, I was actually encountering stack overflows in REGEDIT. However, shortly afterwards I wasn't able to reproduce that behaviour, so I considered [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href='http://grootveld.com/archives/26' title='My first post about REGEDIT experiments'>previous post</a>, I wrote about some findings w.r.t. REGEDIT. One of them was about a limitation on the depth of key hierarchies during a registry export.</p>
<p>When I found out about this limitation, I was actually encountering stack overflows in REGEDIT. However, shortly afterwards I wasn't able to reproduce that behaviour, so I considered it to be some fluke and just wrote about the limitation itself.</p>
<p>However, today I managed to overflow REGEDIT's stack again by just having it export a deep hierarchy to <code>.REG</code>, and this time I captured a crash dump:</p>
<pre class='codesample'>
0:000> kb 300
ChildEBP RetAddr  Args to Child
0004308c 77f60938 000002b8 00000000 000430b8 ADVAPI32!LocalBaseRegEnumKey+0x13
000430c4 0100bb37 000002b8 00000000 00043654 ADVAPI32!RegEnumKeyW+0x8c
00043890 0100bb08 000002b8 000438a0 004b0048 regedit!PutBranch+0x124
0004404c 0100bb08 000002bc 0004405c 004b0048 <strong>regedit!PutBranch+0xf5</strong>
00044800 0100bb08 000002c0 00044810 004b0048 <strong>regedit!PutBranch+0xf5</strong>
00044fac 0100bb08 000002c4 00044fbc 004b0048 <strong>regedit!PutBranch+0xf5</strong>

       <em>... Removed 190 lines that all end in</em> <strong>regedit!PutBranch+0xf5</strong>

0007f1d4 0100bb08 00000578 0007f1e4 004b0048 <strong>regedit!PutBranch+0xf5</strong>
0007f458 0100bb08 0000057c 0007f468 004b0048 <strong>regedit!PutBranch+0xf5</strong>
0007f6c8 0100be1b 80000001 0007f6f0 00070e54 <strong>regedit!PutBranch+0xf5</strong>
0007f944 01006be3 0007f974 01059de0 00070e54 regedit!ExportWinNT50RegFile+0x16d
0007f958 01007272 00070e54 00000000 0007f974 regedit!RegEdit_ExportRegFile+0x2e
0007fb80 010062eb 00070e54 0000110a 7739c2ee regedit!RegEdit_OnCommandExportRegFile+0x65
0007fb98 01009751 00070e54 00000293 00000000 regedit!RegEdit_OnCommand+0x7f
0007fbbc 01009947 00070e54 00000293 000ad310 regedit!RegEdit_OnKeyTreeCommand+0xc4
0007fc24 010045ba 00070e54 00160c39 0007fc50 regedit!RegEdit_OnKeyTreeContextMenu+0x1a1
0007fc34 0100689f 00130dc2 00070e54 000002c4 regedit!RegEdit_OnContextMenu+0x2a
0007fc50 7739b6e3 00130dc2 0000007b 00070e54 regedit!RegEditWndProc+0x128
0007fc7c 7739b874 01006777 00130dc2 0000007b USER32!InternalCallWinProc+0x28
0007fcf4 7739c2d3 00000000 01006777 00130dc2 USER32!UserCallWinProcCheckWow+0x151
0007fd30 7739c337 00615210 00615118 00070e54 USER32!SendMessageWorker+0x4bd
0007fd50 7745b0ee 00130dc2 0000007b 00070e54 USER32!SendMessageW+0x7f
0007fd74 7745bcfc 00070e54 00000062 00000025 COMCTL32!TV_SendRButtonDown+0xad
0007fdc4 7739b6e3 00070e54 00000204 00000002 COMCTL32!TV_WndProc+0x616
0007fdf0 7739b874 7745b6e6 00070e54 00000204 USER32!InternalCallWinProc+0x28
0007fe68 7739ba92 00000000 7745b6e6 00070e54 USER32!UserCallWinProcCheckWow+0x151
0007fed0 7739bad0 0007fef8 00000000 0007ff1c USER32!DispatchMessageWorker+0x327
0007fee0 01009cb9 0007fef8 ffffffff 00000000 USER32!DispatchMessageW+0xf
0007ff1c 01016e04 01000000 00000000 000a24a6 regedit!WinMain+0x154
0007ffc0 77e6f23b 00000000 00000000 7ffdf000 regedit!WinMainCRTStartup+0x182
0007fff0 00000000 01016c82 00000000 78746341 kernel32!BaseProcessStart+0x23
</pre>
<p>If somebody wants to dive into the crash dump, let me know.</p>
<p>Exporting a deep key hierarchy on W2K8 X64 didn't work either, BTW:</p>
<p><img src='/images/RegeditStackOverflowW2K8X64.png' width='471' height='385' alt='Screen shot of REGEDIT crashing on W2K8 X64 while trying to export a deep key hierarchy' />
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/27/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>REGEDIT experiments</title>
		<link>http://grootveld.com/archives/26</link>
		<comments>http://grootveld.com/archives/26#comments</comments>
		<pubDate>Tue, 12 Aug 2008 21:11:16 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Windows</category>
	<category>Development</category>
	<category>Regedit</category>
		<guid isPermaLink="false">http://grootveld.com/archives/26</guid>
		<description><![CDATA[NOTE (2008-08-21): Also see the update to this post.
I've been working on a tool that can export registry information in REGEDIT's .REG format. Since that format doesn't seem to be fully documented, I spent quite some time experimenting with REGEDIT. Here are some of my more interesting findings (all on W2K3).
No expansion beyond 32 levels
When [...]]]></description>
			<content:encoded><![CDATA[<p><span style='background-color: #ffffaa;border-style: solid; border-width: 1px; padding: 3px'><strong>NOTE</strong> (2008-08-21): Also see the <a href='http://grootveld.com/archives/27' title='Update about the export limitations'>update</a> to this post.</span></p>
<p>I've been working on a tool that can export registry information in REGEDIT's <code>.REG</code> format. Since that format doesn't seem to be fully documented, I spent quite some time experimenting with REGEDIT. Here are some of my more interesting findings (all on W2K3).</p>
<p><strong>No expansion beyond 32 levels</strong><br />
When you expand a key in REGEDIT, it passes the "root" <code>HKEY</code> (like <code>HKLM</code>) and the full path to <code>RegOpenKey()</code> instead of the immediate parent and just the name of the key you're trying to expand. This means that it will run into the <a href='http://msdn.microsoft.com/en-us/library/ms724872(VS.85).aspx' title='Registry Element Size Limits'>"up to 32 levels at a time" limitation</a> of the registry API:</p>
<p><img src='/images/Registry33levels.png' height='159' width='568' alt='Error message when opening level 33'/></p>
<p><strong>No export beyond 200 levels</strong><br />
Although the registry supports 512 levels of keys, REGEDIT will only export upto a depth of about 200, silently ignoring anything beyond that...<br />
Granted, that's not a very common scenario, but I would expect at least a warning message or something.</p>
<p><strong>Importing values of non-existing types</strong><br />
<a href='http://source.winehq.org/source/include/winnt.h#L4178' title='Registry value type definitions at Wine HQ'><code>WinNT.h</code> defines 12 value types</a>, ranging from <code>REG_NONE</code> (0) to <code>REG_QWORD</code> (11). REGEDIT however, will gladly accept all other 32-bit values as well...</p>
<p><code>[HKEY_CURRENT_USER\RegistryTest]<br />
"Type Test"=hex(42):47,11</code></p>
<p>results in</p>
<p><img src='/images/RegistryValueTypes.png' width='302' height='75' alt='A value of type 0x42...'/></p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/26/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>And then, for the main course we&#8217;ll have&#8230;</title>
		<link>http://grootveld.com/archives/25</link>
		<comments>http://grootveld.com/archives/25#comments</comments>
		<pubDate>Sat, 09 Aug 2008 09:39:36 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Uncategorized</category>
		<guid isPermaLink="false">http://grootveld.com/archives/25</guid>
		<description><![CDATA[I was just looking at Recipezaar for some culinary inspiration, and found the following "popular recipes" on the home page:


]]></description>
			<content:encoded><![CDATA[<p>I was just looking at <a href='http://www.recipezaar.com/'>Recipezaar</a> for some culinary inspiration, and found the following "popular recipes" on the home page:</p>
<p><img src='/images/PopularRecipes.png' width='316' height='445' alt='Popular Recipezaar recipes...'/>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/25/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>VMWare statement on &#8220;Industry Events&#8221; and &#8220;News and Awards&#8221;?</title>
		<link>http://grootveld.com/archives/23</link>
		<comments>http://grootveld.com/archives/23#comments</comments>
		<pubDate>Tue, 03 Jun 2008 13:03:26 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>VMWare</category>
		<guid isPermaLink="false">http://grootveld.com/archives/23</guid>
		<description><![CDATA[I just received issue 49 of VMWare's corporate newsletter.
Since I don't let GMail automatically download images, this is what the message looked like initially:

After downloading the images, it looks like this:

Blah blah indeed.

]]></description>
			<content:encoded><![CDATA[<p>I just received issue 49 of VMWare's corporate newsletter.</p>
<p>Since I don't let GMail automatically download images, this is what the message looked like initially:</p>
<p><img src='/images/vmware-newsletter-before.png' width='577' height='99' alt='blah blah'/></p>
<p>After downloading the images, it looks like this:</p>
<p><img src='/images/vmware-newsletter-after.png' width='604' height='94' alt='still blah blah :-)'/></p>
<p>Blah blah indeed.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/23/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Making HttpWebRequest work while having Fiddler decrypt SSL</title>
		<link>http://grootveld.com/archives/22</link>
		<comments>http://grootveld.com/archives/22#comments</comments>
		<pubDate>Thu, 29 May 2008 11:54:49 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Windows</category>
	<category>Tips &#038; Tricks</category>
	<category>Development</category>
	<category>.NET</category>
	<category>Reminder</category>
		<guid isPermaLink="false">http://grootveld.com/archives/22</guid>
		<description><![CDATA[Just a quick reminder to myself, so that I can forget about it...
Fiddler can act as a man-in-the-middle and decrypt SSL traffic, but then System.Net.Security rightfully complains about an invalid remote certificate ("The remote certificate is invalid according to the validation procedure."). This results in a System.Net.WebException "The underlying connection was closed: Could not establish [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick reminder to myself, so that I can forget about it...</p>
<p><a href='http://www.fiddlertool.com'>Fiddler</a> can act as a man-in-the-middle and decrypt SSL traffic, but then System.Net.Security rightfully complains about an invalid remote certificate ("The remote certificate is invalid according to the validation procedure."). This results in a System.Net.WebException "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.".</p>
<p>To prevent this from happening:</p>
<pre class="codesample">
<span style="color: #2b91af;">ServicePointManager</span>.ServerCertificateValidationCallback = <span style="color: blue;">delegate</span> { <span style="color: blue;">return</span> <span style="color: blue;">true</span>; };
</pre>
<p>Just be sure to not include this in production code :-)
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/22/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>URL-encoded slashes in System.Uri</title>
		<link>http://grootveld.com/archives/21</link>
		<comments>http://grootveld.com/archives/21#comments</comments>
		<pubDate>Wed, 30 Apr 2008 21:11:18 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Development</category>
	<category>.NET</category>
		<guid isPermaLink="false">http://grootveld.com/archives/21</guid>
		<description><![CDATA[Two weeks ago, an ex-colleague asked me to take a look at a problem that he and his team had encountered. They tried using a System.Uri with URL-encoded slashes, but those slashes kept ending up unencoded in the resulting URI:

Uri uri = new Uri("http://somesite/media/http%3A%2F%2Fsomesite%2Fimage.gif");
Console.WriteLine(uri.AbsoluteUri);
// Output: http://somesite/media/http%3A//somesite%2Fimage.gif

That's a totally different URL, which the target server refuses [...]]]></description>
			<content:encoded><![CDATA[<p>Two weeks ago, an ex-colleague asked me to take a look at a problem that he and his team had encountered. They tried using a <code>System.Uri</code> with URL-encoded slashes, but those slashes kept ending up unencoded in the resulting URI:</p>
<pre class='codesample'>
<span style="color: #2b91af;">Uri</span> uri = <span style="color: blue;">new</span> <span style="color: #2b91af;">Uri</span>(<span style="color: #a31515;">"http://somesite/media/http%3A%2F%2Fsomesite%2Fimage.gif"</span>);
<span style="color: #2b91af;">Console</span>.WriteLine(uri.AbsoluteUri);
<span style="color: green;">// Output: <b>http://somesite/media/http%3A<span style='border: #c0c0f7 1px solid;'>//</span>somesite%2Fimage.gif</b></span>
</pre>
<p>That's a totally different URL, which the target server refuses to process.</p>
<p>I was sure that they must have overlooked something, and that there would be some way to tell the Uri constructor to leave all encoded characters as-is. But no, it does not seem possible; dots and slashes are always decoded. I find that quite surprising, so if anyone can point me to an official solution, I'd be much obliged.</p>
<p>In the mean time, a reflection-based hack, courtesy of <a href='http://www.aisto.com/roeder/dotnet/' title="Lutz Roeder's .NET Reflector">Reflector</a> and the <a href='http://weblogs.asp.net/scottgu/archive/2008/01/16/net-framework-library-source-code-now-available.aspx' title="ScottGu's post about the .NET Framework Library Source Code">.NET Reference Source</a>:</p>
<pre class='codesample'>
<span style="color: blue;">static</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">UriHacks</span>
{
&nbsp;&nbsp;&nbsp; <span style="color: green;">// System.UriSyntaxFlags is internal, so let's duplicate the flag privately</span>
&nbsp;&nbsp;&nbsp; <span style="color: blue;">private</span> <span style="color: blue;">const</span> <span style="color: blue;">int</span> UnEscapeDotsAndSlashes = 0x2000000;
&nbsp;
&nbsp;&nbsp;&nbsp; <span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: blue;">void</span> LeaveDotsAndSlashesEscaped(<span style="color: blue;">this</span> <span style="color: #2b91af;">Uri</span> uri)
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> (uri == <span style="color: blue;">null</span>)
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: blue;">throw</span> <span style="color: blue;">new</span> <span style="color: #2b91af;">ArgumentNullException</span>(<span style="color: #a31515;">"uri"</span>);
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #2b91af;">FieldInfo</span> fieldInfo = uri.GetType().GetField(<span style="color: #a31515;">"m_Syntax"</span>, <span style="color: #2b91af;">BindingFlags</span>.Instance | <span style="color: #2b91af;">BindingFlags</span>.NonPublic);
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> (fieldInfo == <span style="color: blue;">null</span>)
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: blue;">throw</span> <span style="color: blue;">new</span> <span style="color: #2b91af;">MissingFieldException</span>(<span style="color: #a31515;">"'m_Syntax' field not found"</span>);
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: blue;">object</span> uriParser = fieldInfo.GetValue(uri);
&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fieldInfo = <span style="color: blue;">typeof</span>(<span style="color: #2b91af;">UriParser</span>).GetField(<span style="color: #a31515;">"m_Flags"</span>, <span style="color: #2b91af;">BindingFlags</span>.Instance | <span style="color: #2b91af;">BindingFlags</span>.NonPublic);
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> (fieldInfo == <span style="color: blue;">null</span>)
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: blue;">throw</span> <span style="color: blue;">new</span> <span style="color: #2b91af;">MissingFieldException</span>(<span style="color: #a31515;">"'m_Flags' field not found"</span>);
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: blue;">object</span> uriSyntaxFlags = fieldInfo.GetValue(uriParser);
&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: green;">// Clear the flag that we don't want</span>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; uriSyntaxFlags = (<span style="color: blue;">int</span>)uriSyntaxFlags &amp; ~UnEscapeDotsAndSlashes;
&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fieldInfo.SetValue(uriParser, uriSyntaxFlags);
&nbsp;&nbsp;&nbsp; }
}
</pre>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/21/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Zen error messages</title>
		<link>http://grootveld.com/archives/20</link>
		<comments>http://grootveld.com/archives/20#comments</comments>
		<pubDate>Thu, 24 Apr 2008 09:12:57 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Uncategorized</category>
		<guid isPermaLink="false">http://grootveld.com/archives/20</guid>
		<description><![CDATA[Triggered by Brent Strange's recent Defect of the day, I remembered a few similarly Zen-like ones from a product I worked on years ago:


]]></description>
			<content:encoded><![CDATA[<p>Triggered by Brent Strange's recent <a href='http://www1.qainsight.net:8080/2008/04/16/Defect+Of+The+Day+Null+Is+Null.aspx'>Defect of the day</a>, I remembered a few similarly Zen-like ones from a product I worked on years ago:</p>
<p><img src='/images/ZenErrorMessage1.png' width='218' height='152' alt="'undefined' is undefined..."/></p>
<p><img src='/images/ZenErrorMessage2.png' width='640' height='205' alt="'True' is undefined..."/></p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/20/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>&#x25a1;ntern&#x25a1;t&#x25a1;&#x25a1;n&#x25a1;l&#x25a1;z&#x25a1;t&#x25a1;&#x25a1;n?</title>
		<link>http://grootveld.com/archives/19</link>
		<comments>http://grootveld.com/archives/19#comments</comments>
		<pubDate>Fri, 18 Apr 2008 11:26:41 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Unicode</category>
		<guid isPermaLink="false">http://grootveld.com/archives/19</guid>
		<description><![CDATA[Looking for information about IRIs, I ended up at W3C's Internationalized Resource Identifiers page. Funnily enough (if you're a Unicode geek, that is...), this page deals with i18N topics but has an encoding issue:

(I've notified W3C's web-human about the fact that the page is served as UTF-8, but contains Latin-1 characters.Updated on 2008-04-29: The page [...]]]></description>
			<content:encoded><![CDATA[<p>Looking for information about <span lang='en' title='Internationalized Resource Identifiers'>IRIs</span>, I ended up at W3C's <a href='http://www.w3.org/International/O-URL-and-ident.html' title='W3C information about internationalized resource identifiers'>Internationalized Resource Identifiers</a> page. Funnily enough (if you're a Unicode geek, that is...), this page deals with i18N topics but has an encoding issue:</p>
<p><img src='/images/w3c.png' width='425' height='84' alt=''/></p>
<p>(<del cite='#updated'>I've notified W3C's web-human about the fact that the page is served as UTF-8, but contains Latin-1 characters.</del><a name='updated'><b>Updated on 2008-04-29:</b> The page has been fixed.</a>)
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/19/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Colleagues from home</title>
		<link>http://grootveld.com/archives/18</link>
		<comments>http://grootveld.com/archives/18#comments</comments>
		<pubDate>Fri, 01 Feb 2008 19:47:47 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Uncategorized</category>
		<guid isPermaLink="false">http://grootveld.com/archives/18</guid>
		<description><![CDATA[When I was enjoying my sabbatical last year, I'd set up my LinkedIn profile to read "Principal Sabbatical Enjoyer at home".
Ever since, I've been receiving notifications from LinkedIn, telling me to get back in touch with colleagues from home:


]]></description>
			<content:encoded><![CDATA[<p>When I was enjoying my sabbatical last year, I'd set up my LinkedIn profile to read "Principal Sabbatical Enjoyer at home".</p>
<p>Ever since, I've been receiving notifications from LinkedIn, telling me to get back in touch with colleagues from home:</p>
<p><img src='/images/ColleaguesFromHome.png' width='450' height='309' alt='LinkedIn colleagues from home...'/>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/18/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Terminology clash</title>
		<link>http://grootveld.com/archives/17</link>
		<comments>http://grootveld.com/archives/17#comments</comments>
		<pubDate>Tue, 29 Jan 2008 18:55:47 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Uncategorized</category>
		<guid isPermaLink="false">http://grootveld.com/archives/17</guid>
		<description><![CDATA[Sometimes, words can have a very different meaning from one night to the next...
Last night, I looked at some CDO-related stuff on MSDN, and then hibernated my computer.
Tonight, I woke up my computer after having watched an episode of Dexter.
Having a Firefox tab titled "BodyParts Property" didn't have any special connotations last night... Funny, that.


]]></description>
			<content:encoded><![CDATA[<p>Sometimes, words can have a very different meaning from one night to the next...</p>
<p>Last night, I looked at some <a href='http://msdn2.microsoft.com/en-us/library/aa565602(EXCHG.80).aspx' title='Description of CDO&apos;s BodyParts property on MSDN'>CDO-related stuff on MSDN</a>, and then hibernated my computer.</p>
<p>Tonight, I woke up my computer after having watched an episode of <a href='http://en.wikipedia.org/wiki/Dexter_(TV_series)' title='Article about the TV show &quot;Dexter&quot; on Wikipedia'>Dexter</a>.</p>
<p>Having a Firefox tab titled "BodyParts Property" didn't have any special connotations last night... Funny, that.</p>
<p><img src='/images/Bodyparts.png' width='379' height='36' alt='Body parts and body parts...'/>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/17/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Registration-free COM</title>
		<link>http://grootveld.com/archives/16</link>
		<comments>http://grootveld.com/archives/16#comments</comments>
		<pubDate>Fri, 30 Mar 2007 22:40:25 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Windows</category>
	<category>COM</category>
	<category>Development</category>
		<guid isPermaLink="false">http://grootveld.com/archives/16</guid>
		<description><![CDATA[A while ago, I had the following problem:

The build system needed to run a unit test of some code that depended on some COM object.

That COM object was not installed on the build system (it wasn't a part of the system we were developing).

Installing that COM object would mean having to install a large system [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, I had the following problem:</p>
<ul>
<li>The build system needed to run a unit test of some code that depended on some COM object.
</li>
<li>That COM object was not installed on the build system (it wasn't a part of the system we were developing).
</li>
<li>Installing that COM object would mean having to install a large system with all kinds of dependencies &mdash; not exactly something I wanted to do on the build machine...</li>
</ul>
<p>Fortunately, the interaction with the particular COM object was very basic. I made a fake implementation of it, just returning hard-coded responses for the few calls I needed. With the fake COM object in place, the unit tests passed.</p>
<p>I added some logic to the build file that checks whether a particular ProgID existed in the registry. If not, the build script registers the fake object, runs the specific tests, and then unregisters it again.<br />If the ProgID is found in the registry, however, just the tests are executed. This allows the build to be also run on a developer's machine containing the back-end system (and not mess up its COM registration). Works great.</p>
<p>Fast-forward to yesterday.</p>
<p>Triggered by a discussion with a co-worker about the fact that the unit tests aren't nicely isolated from the back-end system this way, I suddenly remembered reading about registration-free COM on <a href='http://blogs.msdn.com/junfeng/archive/2006/04/20/579748.aspx' title='Junfeng Zhang&apos;s blog post about registration-free COM'>Junfeng Zhang&apos;s blog</a>.</p>
<h3>Registration-free COM</h3>
<p>As the name implies, registration-free COM makes it possible to use COM objects without registering them. An application gets all activation information (typelib, ProgID-to-CLSID mapping, threading model and the like) from a <a href='http://msdn2.microsoft.com/en-us/library/aa375632.aspx' title='Description of side-by-side manifest and configuration files at http://www.microsoft.com'>manifest file</a>, instead of reading it from the registry. This allows multiple applications to use different versions of a COM object, with the same ProgID and/or CLSID.</p>
<p>That's a much nicer solution for my original problem &mdash; I no longer have to dynamically register and unregister my fake implementation, and I can use the fake implementation on systems containing the real one as well.</p>
<h3>A sample manifest file</h3>
<p>The manifest file I'm using looks like this:</p>
<pre class='codesample'>
<span class='TPXMLkw1'>&lt;</span>?xml <span class='TPXMLkw2'>version</span>=<span class='TPXMLstr'>&apos;1.0&apos; </span><span class='TPXMLkw2'>encoding</span>=<span class='TPXMLstr'>&apos;utf-8&apos;</span>?<span class='TPXMLkw1'>&gt;</span>
<span class='TPXMLkw1'>&lt;</span>assembly <span class='TPXMLkw2'>manifestVersion</span>=<span class='TPXMLstr'>&apos;1.0&apos; </span><span class='TPXMLkw2'>xmlns</span>=<span class='TPXMLstr'>&apos;urn:schemas-microsoft-com:asm.v1&apos;</span><span class='TPXMLkw1'>&gt;</span>
  <span class='TPXMLkw1'>&lt;</span>assemblyIdentity <span class='TPXMLkw2'>type</span>=<span class='TPXMLstr'>&apos;win32&apos; </span><span class='TPXMLkw2'>name</span>=<span class='TPXMLstr'>&apos;RegFreeCOM-sample.exe&apos; </span><span class='TPXMLkw2'>version</span>=<span class='TPXMLstr'>&apos;1.0.0.0&apos; </span>/<span class='TPXMLkw1'>&gt;</span>
  <span class='TPXMLkw1'>&lt;</span>file <span class='TPXMLkw2'>name</span>=<span class='TPXMLstr'>&apos;FakeTCMXML.dll&apos;</span><span class='TPXMLkw1'>&gt;</span>
    <span class='TPXMLkw1'>&lt;</span>comClass <span class='TPXMLkw2'>clsid</span>=<span class='TPXMLstr'>&apos;{69c2082a-61b1-4a83-a947-88420fac54fa}&apos;
              </span><span class='TPXMLkw2'>threadingModel</span>=<span class='TPXMLstr'>&apos;Apartment&apos;
              </span><span class='TPXMLkw2'>progid</span>=<span class='TPXMLstr'>&apos;TCMXML.XMLResponder&apos; </span>/<span class='TPXMLkw1'>&gt;</span>
  <span class='TPXMLkw1'>&lt;</span>/file<span class='TPXMLkw1'>&gt;</span>
<span class='TPXMLkw1'>&lt;</span>/assembly<span class='TPXMLkw1'>&gt;</span>
</pre>
<p>I've saved this as <code>RegistrationFreeCOM.exe.manifest</code> in the same directory as my test application <code>RegistrationFreeCOM.exe</code>, and also copied my fake implementation <code>FakeTCMXML.dll</code> into that directory. The test application will activate <code>TCMXML.XMLResponder</code> from <code>FakeTCMXML.dll</code>, regardless of whether that ProgID already occurs in the registry, and without affecting that registration.</p>
<h3>Creating a manifest file</h3>
<p>For many scenarios, the sample manifest file is sufficient: just update the 'name', 'clsid' and 'progid' attributes. You can find the value for 'clsid' in the IDL for your component, or by using OleView.<br />
You can also have Visual Studio 2005 create a manifest file for you: create a throw-away project, reference your COM dll, view the properties of that reference, and toggle the 'Isolated' flag to 'True'. When you build the project, the manifest file will be generated.</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/16/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>No, no, it&#8217;s resting, look!</title>
		<link>http://grootveld.com/archives/15</link>
		<comments>http://grootveld.com/archives/15#comments</comments>
		<pubDate>Fri, 30 Mar 2007 20:00:20 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Meta</category>
		<guid isPermaLink="false">http://grootveld.com/archives/15</guid>
		<description><![CDATA[For the first 6+ years of its existence, http://grootveld.com said: "This page intentionally left blank."
I maybe should have kept it that way, but late April last year, I decided to start blogging. Just like everybody else (although a few years later than most...). I managed to create a few posts for about a month, and [...]]]></description>
			<content:encoded><![CDATA[<p>For the first 6+ years of its existence, <a href="http://grootveld.com">http://grootveld.com</a> said: "This page intentionally left blank."</p>
<p>I maybe should have kept it that way, but late April last year, I decided to start blogging. Just like everybody else (although a few years later than most...). I managed to create a few posts for about a month, and then lack of inspiration, insufficient time, and too much work caught up with me. The end result: yet another blog that seemed to have died an early death.</p>
<p>Here's an attempt to resuscitate. Let's see how long I can keep it going this time...</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/15/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>So, how do you really feel about Oracle?</title>
		<link>http://grootveld.com/archives/14</link>
		<comments>http://grootveld.com/archives/14#comments</comments>
		<pubDate>Wed, 31 May 2006 20:07:40 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Photos</category>
		<guid isPermaLink="false">http://grootveld.com/archives/14</guid>
		<description><![CDATA[While going through some old e-mails today, I came across a picture I took a few years ago (click for more):


]]></description>
			<content:encoded><![CDATA[<p>While going through some old e-mails today, I came across a picture I took a few years ago (click for more):</p>
<p><a href='/pictures/OracleDrama.html' title='Interesting categorization of Oracle books...'><img src='/images/OracleDramaSmall.jpg' width='400' height='150' alt='Oracle books' /></a>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/14/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Copying message box text to the clipboard</title>
		<link>http://grootveld.com/archives/13</link>
		<comments>http://grootveld.com/archives/13#comments</comments>
		<pubDate>Tue, 09 May 2006 20:22:26 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Windows</category>
	<category>Tips &#038; Tricks</category>
		<guid isPermaLink="false">http://grootveld.com/archives/13</guid>
		<description><![CDATA[
(This post triggered by receiving a lovely screen dump of a message box. A message box covering almost the complete screen, and containing lots of serialized XML. XML containing lots of entitified HTML...)

]]></description>
			<content:encoded><![CDATA[<p><img src='/images/Dialog2Clipboard.png' width='314' height='100' alt='Screen dump of standard Windows message box containing the text &quot;Did you know that CTRL-C copies this text to the clipboard?&quot;'/></p>
<p>(This post triggered by receiving a lovely <em>screen dump</em> of a message box. A message box covering almost the complete screen, and containing lots of serialized XML. XML containing lots of entitified HTML...)
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/13/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Bereavement and other administrative projects</title>
		<link>http://grootveld.com/archives/12</link>
		<comments>http://grootveld.com/archives/12#comments</comments>
		<pubDate>Fri, 05 May 2006 19:27:46 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Uncategorized</category>
		<guid isPermaLink="false">http://grootveld.com/archives/12</guid>
		<description><![CDATA[Trying to notify my manager of a few upcoming days off using Microsoft Project Web Access, I got:

Microsoft sure has interesting ideas about "administrative projects"...

]]></description>
			<content:encoded><![CDATA[<p>Trying to notify my manager of a few upcoming days off using Microsoft Project Web Access, I got:</p>
<p><img class='screenshot' src='/images/msproject-bereavement.png' width='431' height='120' alt='Screenshot stating &quot;You are not assigned to any tasks on any administrative project, such as vacation, sick, or bereavement.&quot;'/></p>
<p>Microsoft sure has interesting ideas about "administrative projects"...
</p>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/12/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Fun with Markov chains</title>
		<link>http://grootveld.com/archives/11</link>
		<comments>http://grootveld.com/archives/11#comments</comments>
		<pubDate>Thu, 04 May 2006 19:40:46 +0000</pubDate>
		<dc:creator>amg</dc:creator>
		
	<category>Words</category>
		<guid isPermaLink="false">http://grootveld.com/archives/11</guid>
		<description><![CDATA[I'm slowly making my way through the posts at languagehat, a linguistics weblog which I discovered a few days ago.
In a comment on one of the articles, someone mentioned that entering 2665 on a mobile phone with predictive text input spells both "book" and "cool". Which got me thinking about what other collisions there might [...]]]></description>
			<content:encoded><![CDATA[<p>I'm slowly making my way through the posts at <a href='http://www.languagehat.com/' title='Links to the linguistics weblog at http://www.languagehat.com'>languagehat</a>, a linguistics weblog which I discovered a few days ago.</p>
<p>In a comment on one of the articles, someone mentioned that entering <code>2665</code> on a mobile phone with predictive text input spells both "book" and "cool". Which got me thinking about what other collisions there might be...</p>
<p>So, after taking Grady Ward's <a href='http://www.gutenberg.org/etext/3201' title="Grady Ward's Moby word list at http://gutenberg.org">Moby word list</a>, and writing a few lines of C#, here are my favourites:</p>
<ul>
<li>acquire = baptise</li>
<li>equitable = fruitcake</li>
<li>hormonic = insomnia</li>
<li>mature = obtuse</li>
<li>mudsucker = overtakes</li>
<li>navaho = obtain</li>
<li>pervert = request</li>
<li>piebald = ridable</li>
<li>pigmaker = signaler</li>
<li>september = sequences</li>
</ul>
<p>And for Dutch (using <a href='ftp://ftp.ox.ac.uk/pub/wordlists/dutch/words.dutch.Z' title='Links to a list of Dutch words at ftp://ftp.ox.ac.uk'>this word list</a>):</p>
<ul>
<li lang='nl'>afgrijselijk = begrijpelijk</li>
<li lang='nl'>aftakking = bevalling</li>
<li lang='nl'>amortisatie = constipatie</li>
<li lang='nl'>deeltallen = edelvalken</li>
<li lang='nl'>emmer = fonds</li>
<li lang='nl'>gesloopt = herkomst</li>
<li lang='nl'>puber = stads</li>
<li lang='nl'>starheid = subsidie</li>
<li lang='nl'>tijdvak = vijftal</li>
<li lang='nl'>uniek = vogel</li>
</ul>
]]></content:encoded>
			<wfw:commentRSS>http://grootveld.com/archives/11/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
