<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Duncan Smart's Weblog</title>
	<atom:link href="http://blog.dotsmart.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dotsmart.net</link>
	<description>insert witty, geeky tagline here...</description>
	<pubDate>Thu, 17 Jul 2008 19:19:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>Solved: &#34;Cannot read from the source file or disk&#34;</title>
		<link>http://blog.dotsmart.net/2008/06/12/solved-cannot-read-from-the-source-file-or-disk/</link>
		<comments>http://blog.dotsmart.net/2008/06/12/solved-cannot-read-from-the-source-file-or-disk/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 09:17:12 +0000</pubDate>
		<dc:creator>duncansmart</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dotsmart.wordpress.com/2008/06/12/solved-cannot-read-from-the-source-file-or-disk/</guid>
		<description><![CDATA[I&#8217;ve finally solved a problem that&#8217;s been bugging me for years. One of our file shares ended up with several undelete-able files. Attempting to delete them results in &#8220;Error Deleting File or Folder - Cannot delete file: Cannot read from the source file or disk&#8220;.

Even going to the file&#8217;s properties to check permissions presented a [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve finally solved a problem that&#8217;s been bugging me for years. One of our file shares ended up with several undelete-able files. Attempting to delete them results in &#8220;<em>Error Deleting File or Folder - Cannot delete file: Cannot read from the source file or disk</em>&#8220;.</p>
<p><a href="http://dotsmart.files.wordpress.com/2008/06/image.png"><img style="border-width:0;" height="191" alt="" src="http://dotsmart.files.wordpress.com/2008/06/image-thumb.png?w=415&h=191" width="415" border="0"></a></p>
<p>Even going to the file&#8217;s properties to check permissions presented a very blank properties dialog. And a CHKDSK didn&#8217;t sort thing out either.</p>
<p>It turns out the problem was: <strong>the filename ended with a dot, </strong>e.g. it was something like &#8220;<code>C:\Temp\Stuff\Sales Agreement<u>.</u></code>&#8220;. As far as Windows is concerned this is an invalid file name: so although it gets reported in a directory listing, the standard Windows APIs for manipulating files subsequently deny its existence. </p>
<p>So how did this file get created in the first place? The answer: a Mac. The file was on a file share which had been accessed by a Mac user. Macs tend to write all sorts of metadata to extra &#8220;._DSStore&#8221; files and suchlike and had left this file behind.</p>
<p>So if Windows doesn&#8217;t appear to allow these file names, how did they get to be created? Well, it turns out that NTFS allows all sort of file name/path weirdness that Windows, or specifically the Win32 API, doesn&#8217;t allow. For example, NTFS actually allows file paths up to 32K but Windows restricts file paths to no more than 260 characters (MAX_PATH). I suppose this is all for DOS/Windows 9x backwards compatibility. As these files were being accessed over a file share I guess the usual Win32 checks are bypassed. </p>
<p>But thankfully you <em>can </em>get Win32 to ignore these checks by prefixing your file paths with <code>\\?\</code>, (ie. <code>C:\Temp\SomeFile.txt</code> becomes <code>\\?\C:\Temp\SomeFile.txt</code>) which I discovered after reading <a href="http://blogs.msdn.com/bclteam/archive/2008/06/10/long-paths-in-net-part-3-of-3-kim-hamilton.aspx">this blog post about long paths in .NET</a>.</p>
<p>So at a command prompt I was able to delete the file using:</p>
<pre>del "\\?\C:\Temp\Stuff\Sales Agreement."</pre>
<p>Of course the corollary of this is that you could really annoy somebody by doing this:</p>
<pre>echo Hi &gt; "\\?\%USERPROFILE%\Desktop\Annoying file you can't delete<u>.</u>"</pre>
<p>But you wouldn&#8217;t do that would you?</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotsmart.wordpress.com/57/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotsmart.wordpress.com/57/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotsmart.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotsmart.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotsmart.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotsmart.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotsmart.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotsmart.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotsmart.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotsmart.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotsmart.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotsmart.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.dotsmart.net&blog=2355202&post=57&subd=dotsmart&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dotsmart.net/2008/06/12/solved-cannot-read-from-the-source-file-or-disk/feed/</wfw:commentRss>
	
		<media:content url="http://dotsmart.files.wordpress.com/2008/06/image-thumb.png" medium="image" />
	</item>
		<item>
		<title>Converting Visual Studio 2003 WinForms to Visual Studio 2005/2008 partial classes</title>
		<link>http://blog.dotsmart.net/2008/05/20/converting-visual-studio-2003-winforms-to-visual-studio-20052008-partial-classes/</link>
		<comments>http://blog.dotsmart.net/2008/05/20/converting-visual-studio-2003-winforms-to-visual-studio-20052008-partial-classes/#comments</comments>
		<pubDate>Tue, 20 May 2008 08:56:59 +0000</pubDate>
		<dc:creator>duncansmart</dc:creator>
		
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://dotsmart.wordpress.com/2008/05/20/converting-visual-studio-2003-winforms-to-visual-studio-20052008-partial-classes/</guid>
		<description><![CDATA[.NET 2.0 introduced partial classes which enables &#8220;.designer&#8221; files in Visual Studio 2005 and later. That is, all of the visual designer-generated code (control declarations, the InitializeComponent method, etc) can be kept in a file separate from your regular code. When you open up a .NET 1.x Visual Studio 2003 WinForms project up in Visual [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>.NET 2.0 introduced partial classes which enables &#8220;.designer&#8221; files in Visual Studio 2005 and later. That is, all of the visual designer-generated code (control declarations, the InitializeComponent method, etc) can be kept in a file separate from your regular code. When you open up a .NET 1.x Visual Studio 2003 WinForms project up in Visual Studio 2005/2008 it will upgrade your project to .NET 2.0 just fine, but unfortunately it doesn&#8217;t migrate your WinForms classes over to the new &#8220;.designer&#8221; project structure.</p>
<p>Initially I thought this would be a job for a <a href="http://www.devexpress.com/Products/NET/DXCore/">DXCore</a> plug-in (the free framework upon which <a href="http://www.devexpress.com/CodeRush">CodeRush</a> is built) as it provides plug-ins with an object model of the code which could be used to grab all the right members and move them over into a designer file. Before I looked into this though I checked what the options were for simply implementing it as a Visual Studio Macro. I was fully expecting to have to use a regular expression to grep the code file to perform the task, but was pleasantly surprised to find that the Visual Studio extensibility API in available to macros provides a code model (based on the .NET CodeDom I presume) which you can traverse to inspect and manipulate the underlying code. </p>
<p>So, here&#8217;s what the resulting &#8220;<strong>ExtractWinFormsDesignerFile</strong>&#8221; macro does:</p>
<ul>
<li>Locates the first class in the selected project item (<code>DTE.SelectedItems.Item(1).ProjectItem</code>) by traversing the <code>ProjectItem.FileCodeModel.CodeElements</code>
<li>Extracts the <code>InitializeComponent</code> and <code>Dispose</code> methods from the class by traversing <code>CodeClass.Members</code>
<li>Extracts all control fields: that is, all fields whose type derives from <code>System.Windows.Forms.Control</code> or <code>System.ComponentModel.Container</code> or whose type name starts with <code>System.Windows.Forms</code>
<li>Puts all the extracted code into&nbsp; a new &#8220;FormName.Designer.cs&#8221; file.</li>
</ul>
<p>This is currently C# only - it could easily be converted to generated VB.NET code or adapted use the FileCodeModel properly and perhaps create the code in an language-agnostic way when generating the designer file. I took a shortcut in just generating the designer file as a string and writing it directly to a file.</p>
<p>To &#8220;install&#8221;: <a href="http://dotsmart.net/files/ExtractWinFormsDesignerFile.txt">download the macro text</a> and copy the methods into a Visual Studio Macro Module (use ALT+F11 to show the Macro editor).</p>
<p>To use:</p>
<ul>
<li>Select a Windows Form in the Solution Explorer
<li>Run the macro by showing the Macro Explorer (ALT+F8) and double-clicking the &#8216;ExtractWinFormsDesignerFile&#8217; macro. (Obviously you can hook the macro up to a toolbar button if you like.)
<li>You will then be prompted to manually make the Form class partial (another bit I was too lazy to work out how to get the macro to do): i.e. change <br /><code>public class MyForm : Form</code> <br />to <br /><code>public <strong><em>partial</em></strong> class MyForm : Form</code></li>
</ul>
<p>Please leave a comment if this helps you.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotsmart.wordpress.com/54/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotsmart.wordpress.com/54/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotsmart.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotsmart.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotsmart.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotsmart.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotsmart.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotsmart.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotsmart.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotsmart.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotsmart.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotsmart.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.dotsmart.net&blog=2355202&post=54&subd=dotsmart&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dotsmart.net/2008/05/20/converting-visual-studio-2003-winforms-to-visual-studio-20052008-partial-classes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fight Spam with jQuery!</title>
		<link>http://blog.dotsmart.net/2008/05/16/fight-spam-with-jquery/</link>
		<comments>http://blog.dotsmart.net/2008/05/16/fight-spam-with-jquery/#comments</comments>
		<pubDate>Fri, 16 May 2008 09:16:13 +0000</pubDate>
		<dc:creator>duncansmart</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://dotsmart.wordpress.com/2008/05/16/fight-spam-with-jquery/</guid>
		<description><![CDATA[OK, maybe title should actually be &#8220;Prevent email address harvesting with jQuery&#8221;. But anyway - I came up with a technique for our company web site today which will hopefully prevent some of the email addresses that we publish being picked up by email address-harvesting bots. The idea is that an email address is put [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>OK, maybe title should actually be &#8220;Prevent email address harvesting with jQuery&#8221;. But anyway - I came up with a technique for our company web site today which will hopefully prevent some of the email addresses that we publish being picked up by email address-harvesting bots. The idea is that an email address is put on the website using the following obfuscation:</p>
<pre>&lt;span class='email'&gt;joebloggs [at] example [dot] com&lt;/span&gt;</pre>
<p>And then transformed by JavaScript into:</p>
<pre>&lt;a href='mailto:joebloggs@example.com'&gt;joebloggs@example.com&lt;/a&gt;</pre>
<p>It&#8217;s a progressive enhancement in that the content is still quite legible by people with JavaScript turned off. Here&#8217;s the jQuery script that does it:</p>
<pre>$(function() {
   $('.email').each(function() {
      var $email = $(this);
      var address = $email.text().replace(/\s*\[at\]\s*/, '@')
                                 .replace(/\s*\[dot\]\s*/g, '.');
      $email.html('&lt;a href="mailto:' + address + '"&gt;'+ address +'&lt;/a&gt;');
   });
});</pre>
<p>I&#8217;m perhaps being naïve about how email addresses are collected these days, and maybe embedding email addresses in images is a better approach - but this was quick and simple and worth a try.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotsmart.wordpress.com/53/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotsmart.wordpress.com/53/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotsmart.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotsmart.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotsmart.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotsmart.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotsmart.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotsmart.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotsmart.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotsmart.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotsmart.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotsmart.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.dotsmart.net&blog=2355202&post=53&subd=dotsmart&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dotsmart.net/2008/05/16/fight-spam-with-jquery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Lines between methods in the C# editor (CodeRush/DxCore plugin)</title>
		<link>http://blog.dotsmart.net/2008/05/02/lines-between-methods-in-the-c-editor-coderushdxcore-plugin/</link>
		<comments>http://blog.dotsmart.net/2008/05/02/lines-between-methods-in-the-c-editor-coderushdxcore-plugin/#comments</comments>
		<pubDate>Fri, 02 May 2008 14:10:05 +0000</pubDate>
		<dc:creator>duncansmart</dc:creator>
		
		<category><![CDATA[C#]]></category>

		<category><![CDATA[CodeRush]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://dotsmart.wordpress.com/?p=13</guid>
		<description><![CDATA[Like most .NET developers,&#160; I used to do VB/VBA coding before C# came along. But, one thing I always missed in in the C# code editor was the lines that the VB editor puts between methods. An an avid user of CodeRush and Refactor! Pro, which itself does code structure painting in Visual Studio, I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Like most .NET developers,&nbsp; I used to do VB/VBA coding before C# came along. But, one thing I always missed in in the C# code editor was the lines that the VB editor puts between methods. An an avid user of <a href="http://www.devexpress.com/Products/NET/IDETools/CodeRush/">CodeRush and Refactor! Pro</a>, which itself does code structure painting in Visual Studio, I&#8217;ve created a <strong>DxCore </strong>Plugin that draws lines between methods which (IMHO) improves on the ones in the VB code editor.</p>
<p>Here&#8217;s a screen shot of it in action:</p>
<p><img alt="Draw Lines Between Methods - in action" src="http://dotsmart.files.wordpress.com/2007/12/draw_lines_between_methods_-_in_action.png"></p>
<p>And here&#8217;s the exciting options page:</p>
<p><img alt="Draw Lines Between Methods -&nbsp;settings" src="http://dotsmart.files.wordpress.com/2007/12/draw_lines_between_methods_-_settings.png"></p>
<p>Even if you&#8217;re a VB.NET person you might like to try it to see if it works any better for you than VB&#8217;s built-in lines (although I guess you&#8217;d need to turn off the built-in method-separating lines somewhere in Tools Options).</p>
<p>As I wrote the code a while ago, it&#8217;s compiled as a .NET 1.1 DLL, so will work equally as well in <strong>Visual Studio 2003 </strong>as it does for me now in <strong>Visual Studio 2008</strong>.</p>
<p><strong>Download </strong>(VS2003 source included): <a title="http://dotsmart.net/files/CR_DrawLinesBetweenMethods.zip" href="http://dotsmart.net/files/CR_DrawLinesBetweenMethods.zip">CR_DrawLinesBetweenMethods.zip</a></p>
<p>Let me know how you get on with it in the comments :)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotsmart.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotsmart.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotsmart.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotsmart.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotsmart.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotsmart.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotsmart.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotsmart.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotsmart.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotsmart.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotsmart.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotsmart.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.dotsmart.net&blog=2355202&post=13&subd=dotsmart&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dotsmart.net/2008/05/02/lines-between-methods-in-the-c-editor-coderushdxcore-plugin/feed/</wfw:commentRss>
	
		<media:content url="http://dotsmart.files.wordpress.com/2007/12/draw_lines_between_methods_-_in_action.png" medium="image">
			<media:title type="html">Draw Lines Between Methods - in action</media:title>
		</media:content>

		<media:content url="http://dotsmart.files.wordpress.com/2007/12/draw_lines_between_methods_-_settings.png" medium="image">
			<media:title type="html">Draw Lines Between Methods -&#160;settings</media:title>
		</media:content>
	</item>
		<item>
		<title>IE 6 bug causes jQuery globalEval error</title>
		<link>http://blog.dotsmart.net/2008/04/21/ie-6-bug-causes-jquery-globaleval-error/</link>
		<comments>http://blog.dotsmart.net/2008/04/21/ie-6-bug-causes-jquery-globaleval-error/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 16:45:22 +0000</pubDate>
		<dc:creator>duncansmart</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://dotsmart.wordpress.com/2008/04/21/ie-6-bug-causes-jquery-globaleval-error/</guid>
		<description><![CDATA[UPDATE: this is fixed in jQuery 1.2.6 and later, see ticket #2709.
After upgrading our code base to use the latest jQuery 1.2.3 (previously we were using 1.2.1) our testers discovered a quite ridiculous bug in IE 6 that caused jQuery to fail (IE 7 is fine, which is why we didn&#8217;t experience it development). The [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="border:solid 1px #ccc;padding:0.5em;"><strong>UPDATE: </strong>this is fixed in jQuery 1.2.6 and later, see <a href="http://dev.jquery.com/ticket/2709">ticket #2709</a>.</p>
<p>After upgrading our code base to use the latest jQuery 1.2.3 (previously we were using 1.2.1) our testers discovered a quite ridiculous bug in IE 6 that caused jQuery to fail (IE 7 is fine, which is why we didn&#8217;t experience it development). The issue manifested itself as the script error message &#8220;<em>Problems with this web page might prevent it from being displayed properly&#8230;</em>&#8220;</p>
<pre>Line: 24
Char: 76
Error: Invalid Argument
Code: 0
...</pre>
<p>&#8230;and various document.onready handlers not running.</p>
<p>Of course line 24, char 26 doesn&#8217;t really help much because IE always seems to get this a few lines out of whack and with the minified version of jQuery it would be <em>way </em>out. So I replaced the minified version jQuery.js with the uncompressed version, cleared the browser cache and re-visited the web app in IE 6. This then gave line 659, char 4 as the offending location:</p>
<p><a href="http://dotsmart.files.wordpress.com/2008/04/image1.png"><img style="border-width:0;" src="http://dotsmart.files.wordpress.com/2008/04/image-thumb1.png?w=396&h=433" border="0" alt="image" width="396" height="433" /></a></p>
<p>After whacking in a several <strong>alert()</strong>s in the lines in the vicinity of 659, it turns out the issue is with head.removeChild(script) in the globalEval function, 4 lines up. Obviously.</p>
<p>So, why was <strong>head.removeChild </strong>failing? I put the following debug code in:</p>
<pre>alert(head.tagName) // displays "HEAD" as expected
alert(script.parentNode.tagName) // displays "BASE" !!!</pre>
<p>So, it transpires that our pages having a &lt;base&gt; tag within the &lt;head&gt; contributes to the issue. IE 6 seems to get totally confused as to the structure of the document HEAD when there&#8217;s a self-closing or unclosed BASE tag. BASE tags I suppose are quite rare and this is probably why this issue doesn&#8217;t appear to be commonplace. (The BASE tag is in there for legacy reasons in our code, but they&#8217;re also quite useful when you save the source of HTML pages they still pick up images and script from the originating server which is handy for debugging automatically-generated HTML.)</p>
<p>So, before, the offending base tag looked something like this:</p>
<pre>&lt;base href='http://example.com/blah' /&gt;</pre>
<p>After some experimentation it appears IE6 doesn&#8217;t exhibit its odd behaviour if you do this instead:</p>
<pre>&lt;base href='http://example.com/blah'&gt;<strong>&lt;/base&gt;</strong></pre>
<p>Job done.</p>
<p><strong>Update: </strong>Chris Venus comments about the reason for the weird behaviour in IE6 and earlier. Previously &lt;base&gt; was interpreted as a container, which could appear multiple times in a document: different sections within the page could have different bases, so would logically end up wrapped within each &lt;base&gt; (now there&#8217;s a feature <em>everybody </em>wanted, right?). Because of this, &lt;head&gt; got treated as a &#8220;section&#8221; of the document and elements added to it ended up as children of any &lt;base&gt; it contained rather than siblings. See <a href="http://blogs.msdn.com/ie/archive/2005/08/29/457667.aspx">IEBlog: All your &lt;base&gt; are belong to us</a>.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotsmart.wordpress.com/52/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotsmart.wordpress.com/52/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotsmart.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotsmart.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotsmart.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotsmart.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotsmart.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotsmart.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotsmart.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotsmart.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotsmart.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotsmart.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.dotsmart.net&blog=2355202&post=52&subd=dotsmart&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dotsmart.net/2008/04/21/ie-6-bug-causes-jquery-globaleval-error/feed/</wfw:commentRss>
	
		<media:content url="http://dotsmart.files.wordpress.com/2008/04/image-thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Images Broken When Viewing Windows SharePoint Services RSS Feeds in Outlook</title>
		<link>http://blog.dotsmart.net/2008/04/01/images-broken-when-viewing-windows-sharepoint-services-rss-feeds-in-outlook/</link>
		<comments>http://blog.dotsmart.net/2008/04/01/images-broken-when-viewing-windows-sharepoint-services-rss-feeds-in-outlook/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 14:26:18 +0000</pubDate>
		<dc:creator>duncansmart</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://dotsmart.wordpress.com/2008/04/01/images-broken-when-viewing-windows-sharepoint-services-rss-feeds-in-outlook/</guid>
		<description><![CDATA[If using Windows Live Writer or Microsoft Word 2007 to create blog posts in Windows SharePoint Services (WSS) 3.0 it appears, at least on our installation of SharePoint, that when you embed new images in the post, the image tags are generated with relative links, e.g. &#60;img src="/Lists/Posts/Attachments/51/image_thumb.png"&#62; . This is fine if you&#8217;re viewing [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If using Windows Live Writer or Microsoft Word 2007 to create blog posts in Windows SharePoint Services (WSS) 3.0 it appears, at least on our installation of SharePoint, that when you embed new images in the post, the image tags are generated with relative links, e.g. <code>&lt;img src="/Lists/Posts/Attachments/51/image_thumb.png"&gt;</code> . This is fine if you&#8217;re viewing the feeds in a web browser as it can resolve the server name for the links from the feed address. But if you&#8217;re using Outlook 2007 to subscribe to the feeds, any images you embedded in the post using Live Writer or Word are generated as relative links, Outlook can&#8217;t/doesn&#8217;t resolve the site name hence the images are broken:</p>
<p><a href="http://dotsmart.files.wordpress.com/2008/04/image.png"><img style="border-width:0;" height="367" alt="image" src="http://dotsmart.files.wordpress.com/2008/04/image-thumb.png?w=494&h=367" width="494" border="0"></a> </p>
<p>Whose fault this is (Outlook/SharePoint/Live Writer) I don&#8217;t know, but fixing it required a bit of coding hackery - I couldn&#8217;t find any option in the SharePoint configuration for controlling the generation of RSS.</p>
<p>WSS v3.0&#8217;s default RSS generator is a page called ListFeed.aspx that lives in <code>Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\template\layouts</code>. By default it looks like this: </p>
<pre>&lt;%@ Assembly Name="Microsoft.SharePoint.ApplicationPages" %&gt;
&lt;%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.ListFeed" %&gt; </pre>
<p>Clearly all the logic is in Microsoft.SharePoint.ApplicationPages.dll. So to fix this, I backed up this file and added the following code to ListFeed.aspx which basically passes all of the feed content through a filter using <a href="http://msdn2.microsoft.com/en-us/library/system.web.httpresponse.filter.aspx">HttpResponse.Filter</a> which uses a regular expression to replaces any relative <code>&lt;img src="<u>/blah</u>&#8220;&gt;</code> tags with the absolute <code>&lt;img src="<u>http://site</u>/blah&#8221;&gt;</code>.</p>
<pre>&lt;%@ Assembly Name="Microsoft.SharePoint.ApplicationPages" %&gt;
&lt;%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.ListFeed" %&gt;
&lt;script language="C#" runat="server"&gt;
protected override void OnInit(EventArgs e)
{
  base.Response.Filter = new RelativePathFilter(base.Response.Filter, this.Request, this.Response);
  base.OnInit(e);
}

class RelativePathFilter : System.IO.Stream
{
  System.IO.Stream _innerStream;
  string _siteUrl;
  Regex _imagesRegex;
  HttpResponse _response;

  public RelativePathFilter(System.IO.Stream innerStream, HttpRequest request, HttpResponse response)
  {
    _innerStream = innerStream;
    _siteUrl = (new Uri(request.Url, HttpRuntime.AppDomainAppVirtualPath)).AbsoluteUri;
    _response = response;

    // Finds rooted images &lt;img ... src="/ ...
    _imagesRegex = new Regex(@"(&lt;img .*? \s src \s* = \s* [""']?)/", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
  }

  public override void Write(byte[] buffer, int offset, int count)
  {
    string content = _response.ContentEncoding.GetString(buffer, offset, count);

    // Ignore the fact that it's theoretically possible for the &lt;img&gt; tag to be split between 2 Write()s
    content = _imagesRegex.Replace(content, @"$1" + _siteUrl);

    byte[] newBuffer = _response.ContentEncoding.GetBytes(content);
    _innerStream.Write(newBuffer, 0, newBuffer.Length);
  }

  public override bool CanRead { get { return _innerStream.CanRead; } }
  public override bool CanSeek { get { return _innerStream.CanSeek; } }
  public override bool CanWrite { get { return _innerStream.CanWrite; } }
  public override void Flush() { _innerStream.Flush(); }
  public override long Length { get { return _innerStream.Length; } }
  public override long Position { get { return _innerStream.Position; } set { _innerStream.Position = value; } }
  public override int Read(byte[] buffer, int offset, int count) { return _innerStream.Read(buffer, offset, count); }
  public override long Seek(long offset, System.IO.SeekOrigin origin) { return _innerStream.Seek(offset, origin); }
  public override void SetLength(long value) { _innerStream.SetLength(value); }
}
&lt;/script&gt;</pre>
<p>I&#8217;m not entirely sure whether hacking around with these files is supported (although it did seem to survive the installation of WSS 3.0 SP1), or if there&#8217;s a better way of doing this, so use at your own risk. </p>
<p><strong>Update 22 April 2008</strong>: Modified code so that it doesn&#8217;t assume the site is at the root of a virtual server.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotsmart.wordpress.com/49/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotsmart.wordpress.com/49/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotsmart.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotsmart.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotsmart.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotsmart.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotsmart.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotsmart.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotsmart.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotsmart.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotsmart.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotsmart.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.dotsmart.net&blog=2355202&post=49&subd=dotsmart&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dotsmart.net/2008/04/01/images-broken-when-viewing-windows-sharepoint-services-rss-feeds-in-outlook/feed/</wfw:commentRss>
	
		<media:content url="http://dotsmart.files.wordpress.com/2008/04/image-thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Tests-behind: Tests as Code-Behind Files</title>
		<link>http://blog.dotsmart.net/2008/03/04/tests-behind-tests-as-code-behind-files/</link>
		<comments>http://blog.dotsmart.net/2008/03/04/tests-behind-tests-as-code-behind-files/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 11:30:18 +0000</pubDate>
		<dc:creator>duncansmart</dc:creator>
		
		<category><![CDATA[C#]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://dotsmart.wordpress.com/2008/03/04/tests-behind-tests-as-code-behind-files/</guid>
		<description><![CDATA[One the first issues that you have to deal with when writing unit tests is - where do I put the the tests? Here&#8217;s where I prefer to have them: as close to the code that&#8217;s being tested as possible, like so:
 
The tests class is hooked up to the original source file in the [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>One the first issues that you have to deal with when writing unit tests is - <em>where do I put the the tests</em>? Here&#8217;s where I prefer to have them: <strong>as close to the code that&#8217;s being tested as possible</strong>, like so:</p>
<p> <img style="border-width:0;" height="305" alt="tests behind 1" src="http://dotsmart.files.wordpress.com/2008/03/tests-behind-1.png?w=511&h=305" width="511" border="0"></p>
<p>The tests class is hooked up to the original source file in the same way that ASP.NET code-behind files are, as a dependent project item.</p>
<p>You can do this by hacking the *csproj file directly using the &lt;DependentUpon&gt; tag, but to automate it I&#8217;ve written a Visual Studio macro (works in Visual Studio 2008, <em>should </em>work in Visual Studio 2005) that creates an appropriately-named tests class that can be invoked like so:</p>
<p><img style="border-width:0;" height="255" alt="tests behind 2" src="http://dotsmart.files.wordpress.com/2008/03/tests-behind-2.png?w=315&h=255" width="315" border="0"> </p>
<p>Here&#8217;s the macro code (copy and paste  into a code module in the Visual Studio Macros IDE: <em>Tools &gt; Macros &gt; Macros IDE</em>)</p>
<pre>Sub AddTestsFile()
   Dim item As ProjectItem = DTE.SelectedItems.Item(1).ProjectItem
   Dim fileName As String = item.FileNames(1)
   Dim dir As String = System.IO.Path.GetDirectoryName(fileName)
   Dim bareName As String = System.IO.Path.GetFileNameWithoutExtension(fileName)
   Dim newItemPath As String = dir &amp; "\" &amp; bareName &amp; ".Tests.cs"

   Dim codeClass As CodeClass = findClass(item.FileCodeModel.CodeElements)
   Dim namespaceName As String = codeClass.Namespace.FullName

   System.IO.File.WriteAllText(newItemPath, "" _
     &amp; "#if DEBUG" &amp; vbCrLf _
     &amp; "using System;" &amp; vbCrLf _
     &amp; "using System.Diagnostics;" &amp; vbCrLf _
     &amp; "using NUnit.Framework;" &amp; vbCrLf _
     &amp; "" &amp; vbCrLf _
     &amp; "namespace " &amp; namespaceName &amp; vbCrLf _
     &amp; "{" &amp; vbCrLf _
     &amp; "	[TestFixture]" &amp; vbCrLf _
     &amp; "	public class " &amp; codeClass.Name &amp; "_Tests" &amp; vbCrLf _
     &amp; "	{" &amp; vbCrLf _
     &amp; "		" &amp; vbCrLf _
     &amp; "	}" &amp; vbCrLf _
     &amp; "}" &amp; vbCrLf _
     &amp; "#endif" &amp; vbCrLf _
    )

   ' Add as sub-item and show
   Dim newItem As ProjectItem = item.ProjectItems.AddFromFile(newItemPath)
   newItem.Open().Activate()

End Sub

' Utility used by AddTestsFile
Function findClass(ByVal items As System.Collections.IEnumerable) As CodeClass
   For Each codeEl As CodeElement In items
      If codeEl.Kind = vsCMElement.vsCMElementClass Then
         Return codeEl
      ElseIf codeEl.Children.Count &gt; 0 Then
         Dim cls As CodeClass = findClass(codeEl.Children)
         If cls IsNot Nothing Then
            Return findClass(codeEl.Children)
         End If
      End If
   Next
   Return Nothing
End Function</pre>
<p>(Note: WordPress is putting curly quotes in parts of the code, so you may need to find/replace them with straight quotes)</p>
<p>The right-click Project Item context menu shortcut can be wired up to the macro with the help of <a href="http://blogs.msdn.com/saraford/archive/2008/01/30/did-you-know-you-can-customize-the-commands-on-the-context-menus.aspx">Sara Ford&#8217;s tip about customizing Visual Studio context menus</a>.</p>
<p><strong>Update 11 March 2008: </strong>Fixed findClass subroutine which resulted in null reference error, it now recurses correctly.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotsmart.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotsmart.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotsmart.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotsmart.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotsmart.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotsmart.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotsmart.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotsmart.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotsmart.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotsmart.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotsmart.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotsmart.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.dotsmart.net&blog=2355202&post=37&subd=dotsmart&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dotsmart.net/2008/03/04/tests-behind-tests-as-code-behind-files/feed/</wfw:commentRss>
	
		<media:content url="http://dotsmart.files.wordpress.com/2008/03/tests-behind-1.png" medium="image">
			<media:title type="html">tests behind 1</media:title>
		</media:content>

		<media:content url="http://dotsmart.files.wordpress.com/2008/03/tests-behind-2.png" medium="image">
			<media:title type="html">tests behind 2</media:title>
		</media:content>
	</item>
		<item>
		<title>Backing up an Exchange Mailbox to a PST file</title>
		<link>http://blog.dotsmart.net/2008/02/20/backing-up-an-exchange-mailbox-to-a-pst-file/</link>
		<comments>http://blog.dotsmart.net/2008/02/20/backing-up-an-exchange-mailbox-to-a-pst-file/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 11:13:02 +0000</pubDate>
		<dc:creator>duncansmart</dc:creator>
		
		<category><![CDATA[Exchange]]></category>

		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://dotsmart.wordpress.com/2008/02/20/backing-up-an-exchange-mailbox-to-a-pst-file/</guid>
		<description><![CDATA[I&#8217;ve never trusted Exchange Server backup 100% ever since Exchange 2000, following a service pack, refused to restore backups from the non-service packed version (yes honestly).
So I&#8217;ve always had a 2-pronged approach to backup, do the usual monolithic backup using NTBackup, but also have mailboxes individually backed up as plain old PST files, which Outlook [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve never trusted Exchange Server backup 100% ever since Exchange 2000, following a service pack, refused to restore backups from the non-service packed version (yes <a href="http://support.microsoft.com/kb/316794">honestly</a>).</p>
<p>So I&#8217;ve always had a 2-pronged approach to backup, do the usual monolithic backup using NTBackup, but also have mailboxes individually backed up as plain old PST files, which Outlook can easily mount to make it easier to do partial restores. In the past I&#8217;ve used <a href="http://support.microsoft.com/kb/174197">ExMerge</a> to do this, but it&#8217;s a becoming a bit neglected and is very clunky to script: it&#8217;s a Windows app (rather than a console app) that&#8217;s driven by an INI file.</p>
<p>Anyway, whilst doing some integration work against Exchange for a client I came across Dmitry Streblechenko&#8217;s superb <a href="http://www.dimastr.com/redemption/">Redemption Data Objects</a> library. It is a really easy to use COM wrapper around Extended MAPI - a super-charged version of Collaboration Data Objects (CDO). </p>
<p>Honestly I really can&#8217;t understand why Microsoft didn&#8217;t ship a library like this (or improve CDO) rather than expecting you to write gnarly C++/COM/MAPI code to do what this library allows you to do easily from .NET code or a script. The Exchange API goalposts move from one release to the next: &#8220;Use the M: drive! No, use WebDAV! No, use ExOLEDB!&#8230; No, use Web Services!&#8221; with the only constant being good old MAPI. </p>
<p>Anyway - here&#8217;s part of our PST backup script - it relies on the <a href="http://www.dimastr.com/redemption/">Redemption Data Objects</a> (RDO) COM DLL being registered. The free developer version pops up a prompt once when you RegSvr32 it, the royalty-free redistributable version is a incredibly reasonable $199.99. RDO relies on MAPI being installed, so <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e17e7f31-079a-43a9-bff2-0a110307611e">grab it here</a> if it&#8217;s not present on your system.</p>
<pre>/* BackupPst.js */

// e.g. copyMailboxToPst(
           "EXCH01",
           "FredB",
           "c:\\backups\\fredb.pst",
           "FredB backup")

function copyMailboxToPst(serverName, userName, pstFile, pstName)
{
  var session = new ActiveXObject("Redemption.RDOSession");
  session.LogonExchangeMailbox(userName, serverName);
  WScript.Echo("Logged on to " + session.ExchangeMailboxServerName);

  var mailbox =  session.Stores.DefaultStore;
  var pstStore = session.Stores.AddPSTStore(pstFile, 1, pstName);

  try
  {
    WScript.Echo("Opened " + mailbox.IPMRootFolder.FolderPath);
  }
  catch(err)
  {
    WScript.Echo("Error opening mailbox '" + userName
       + "' (access denied?). " + err.description);
    return;
  }

  foreach(mailbox.IPMRootFolder.Folders, function(folder)
  {
    WScript.Echo(" * " + folder.Name);
    folder.CopyTo(pstStore.IPMRootFolder);
  });

  pstStore.Remove();
}

// Utility to allow enumeration of COM collections
function foreach(collection, fn)
{
  for(var e = new Enumerator(collection); !e.atEnd(); e.moveNext())
  {
    if(fn(e.item()))
      break;
  }
}
</pre>
<p>This could be further improved for incremental backups by using RDO&#8217;s newly introduced wrappers to the &#8220;Incremental Change Synchronization&#8221; API where you can use the same syncing technology that Outlook&#8217;s cached Exchange mode uses!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotsmart.wordpress.com/33/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotsmart.wordpress.com/33/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotsmart.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotsmart.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotsmart.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotsmart.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotsmart.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotsmart.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotsmart.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotsmart.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotsmart.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotsmart.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.dotsmart.net&blog=2355202&post=33&subd=dotsmart&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dotsmart.net/2008/02/20/backing-up-an-exchange-mailbox-to-a-pst-file/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Moving on from SVN_ASP_DOT_NET_HACK</title>
		<link>http://blog.dotsmart.net/2008/02/19/moving-on-from-svn_asp_dot_net_hack/</link>
		<comments>http://blog.dotsmart.net/2008/02/19/moving-on-from-svn_asp_dot_net_hack/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 11:30:07 +0000</pubDate>
		<dc:creator>duncansmart</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dotsmart.wordpress.com/2008/02/19/moving-on-from-svn_asp_dot_net_hack/</guid>
		<description><![CDATA[I noticed that I was running TortoiseSVN in SVN_ASP_DOT_NET_HACK mode (where Subversion clients use &#8216;_svn&#8217; instead of &#8216;.svn&#8217; directories) unnecessarily as I don&#8217;t have silly old Visual Studio 2003 installed anymore which caused this mess in the first place.
The _svn directories work just as well as .svn, but nevertheless (due to mild OCD?), I created [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I noticed that I was running TortoiseSVN in <b><a href="http://svn.collab.net/repos/svn/trunk/notes/asp-dot-net-hack.txt">SVN_ASP_DOT_NET_HACK</a> </b>mode (where Subversion clients use &#8216;_svn&#8217; instead of &#8216;.svn&#8217; directories) unnecessarily as I don&#8217;t have silly old Visual Studio 2003 installed anymore which caused this mess in the first place.</p>
<p>The _svn directories work just as well as .svn, but nevertheless (due to mild <a href="http://en.wikipedia.org/wiki/Obsessive-compulsive_disorder">OCD</a>?), I created a batch script that ripped through my project directory renaming all &#8216;_svn&#8217; directories to &#8216;.svn&#8217;, so I could remove the <em>SVN_ASP_DOT_NET_HACK </em>mode. It uses the wonderfully flexible FOR command drive the whole process. We don&#8217;t need no stinkin&#8217; Powershell round these parts&#8230;</p>
<p>Save this script as something like &#8220;SvnRenameDirs.cmd&#8221; in the root of your projects folder:</p>
<pre>:: Make script directory current
pushd "%~dp0"

:: Unhide, rename and re-hide svn dirs
for /r /d %%D in (*) do @if exist "%%D\_svn" (
   attrib -H "%%D\_svn"
   ren "%%D\_svn" ".svn"
   attrib +H "%%D\.svn"
)
popd

rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,0,3
</pre>
<p>At the end click the Environment Variables button in the System Properties dialog and remove the <em>SVN_ASP_DOT_NET_HACK </em>environment variable and then log out and back in again (or restart explorer.exe and TSVNCache.exe).</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotsmart.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotsmart.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotsmart.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotsmart.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotsmart.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotsmart.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotsmart.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotsmart.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotsmart.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotsmart.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotsmart.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotsmart.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.dotsmart.net&blog=2355202&post=32&subd=dotsmart&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dotsmart.net/2008/02/19/moving-on-from-svn_asp_dot_net_hack/feed/</wfw:commentRss>
		</item>
		<item>
		<title>System.Net.Mail: The specified string is not in the form required for a subject</title>
		<link>http://blog.dotsmart.net/2008/02/15/systemnetmail-the-specified-string-is-not-in-the-form-required-for-a-subject/</link>
		<comments>http://blog.dotsmart.net/2008/02/15/systemnetmail-the-specified-string-is-not-in-the-form-required-for-a-subject/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 12:12:48 +0000</pubDate>
		<dc:creator>duncansmart</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dotsmart.wordpress.com/2008/02/15/systemnetmail-the-specified-string-is-not-in-the-form-required-for-a-subject/</guid>
		<description><![CDATA[Having your ASP.NET error handling routine, which sends you emails when an error occurs on your site, itself fail is annoying. Especially when you think you&#8217;ve made the code robust enough. Anyway the error handler for one site I work on was failing with &#8220;ArgumentException: The specified string is not in the form required for [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Having your ASP.NET error handling routine, which sends you emails when an error occurs on your site, itself fail is annoying. Especially when you think you&#8217;ve made the code robust enough. Anyway the error handler for one site I work on was failing with &#8220;<code>ArgumentException: The specified string is not in the form required for a subject</code>&#8220;.</p>
<p>So what is exactly &#8220;the form required for a subject&#8221;? Googling for this error message returns a lot of junk and misinformed forum posts. It turns out that setting the Subject on a System.Net.Mail.Message internally calls MailBnfHelper.HasCROrLF (thank you Reflector) which does exactly what it says on the tin. Therefore one forum poster&#8217;s solution of <code>subject.Replace("\r\n", " ")</code> <i>isn&#8217;t</i> going to work when your have <i>either </i>a carriage return <i>or </i>line feed in there.</p>
<p>So, obviously, the solution is:</p>
<pre>message.Subject = subject.Replace('\r', ' ').Replace('\n', ' ');</pre>
<p>Personally, I think that the MailMessage should to this for you or at least Microsoft should <b>document what actually constitutes a &#8220;form required for a subject&#8221; </b>in MSDN or, even better, in the actual error message itself!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotsmart.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotsmart.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotsmart.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotsmart.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotsmart.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotsmart.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotsmart.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotsmart.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotsmart.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotsmart.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotsmart.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotsmart.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.dotsmart.net&blog=2355202&post=31&subd=dotsmart&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dotsmart.net/2008/02/15/systemnetmail-the-specified-string-is-not-in-the-form-required-for-a-subject/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>