<?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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gingerbbm</title>
	<atom:link href="http://gingerbbm.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gingerbbm.com</link>
	<description>Stuart Jones is a software developer in transition. This is his site.</description>
	<lastBuildDate>Thu, 22 Jul 2010 13:41:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Metamorphosis</title>
		<link>http://gingerbbm.com/2010/07/metamorphosis/</link>
		<comments>http://gingerbbm.com/2010/07/metamorphosis/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 13:41:13 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
				<category><![CDATA[Usability]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[hci]]></category>
		<category><![CDATA[human-computer interaction]]></category>
		<category><![CDATA[reading list]]></category>
		<category><![CDATA[touch]]></category>
		<category><![CDATA[ucl]]></category>
		<category><![CDATA[uclic]]></category>
		<category><![CDATA[ui]]></category>
		<category><![CDATA[university college london]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://gingerbbm.com/?p=378</guid>
		<description><![CDATA[The first books for my course have been delivered. With the arrival yesterday of confirmation of the term dates and an introductory booklet, at last I have a real sense of something happening, that a big change is coming. In two months&#8217; time I&#8217;ll start an MSc in Human-Computer Interaction with Ergonomics at University College [...]]]></description>
			<content:encoded><![CDATA[<p>The first books for my course have been delivered.</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2010/07/Image0086.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2010/07/Image0086-300x225.jpg" alt="Books from the reading list" title="Books from the reading list" width="300" height="225" class="alignnone size-medium wp-image-380" /></a><br />
<span id="more-378"></span><br />
With the arrival yesterday of confirmation of the term dates and an introductory booklet, at last I have a real sense of something happening, that a big change is coming. In two months&#8217; time I&#8217;ll start an <a href="http://www.uclic.ucl.ac.uk/courses/masters/">MSc in Human-Computer Interaction with Ergonomics</a> at <a href="http://www.ucl.ac.uk/">University College London</a>.</p>
<p>I&#8217;ve always been interested in the user interface, the medium between man and machine, and now I get to study it full-time for a whole year. I expect to learn how to measure the efficacy of a UI and how to improve poor designs. As the range of devices with which we interact continues to grow, and the touch revolution is building a head of steam, I anticipate that the methodologies provided in the course will continue to be applicable. The role of the user experience consultant is becoming more important and I&#8217;m looking forward to morphing into one!</p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2010/07/metamorphosis/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Add items to a Word document using C#</title>
		<link>http://gingerbbm.com/2010/06/add-items-to-a-word-document-using-c/</link>
		<comments>http://gingerbbm.com/2010/06/add-items-to-a-word-document-using-c/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 23:28:43 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Word Automation]]></category>
		<category><![CDATA[c sharp]]></category>
		<category><![CDATA[endofdoc]]></category>
		<category><![CDATA[word]]></category>
		<category><![CDATA[word interop]]></category>
		<category><![CDATA[Word.Range]]></category>

		<guid isPermaLink="false">http://gingerbbm.com/?p=362</guid>
		<description><![CDATA[I thought I had found the promised land. Then I tried adding more than one item to a blank Word document using C# and I realised it had been a mirage all along. I simply wanted to create a blank document, add a line of text, followed by another, followed by my table. I was [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gingerbbm.com/2010/06/add-a-table-using-word-interop-and-converttotable/">I thought I had found the promised land</a>. Then I tried adding more than one item to a blank Word document using C# and I realised it had been a mirage all along. I simply wanted to create a blank document, add a line of text, followed by another, followed by my table. I was flummoxed by the <a href="http://msdn.microsoft.com/es-es/library/ms264372(v=Office.11).aspx">Word.Range</a> object &#8211; and I&#8217;ll go into detail in a bit &#8211; but here&#8217;s the solution:<span id="more-362"></span></p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">object oEndOfDoc <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;\\endofdoc&quot;</span><span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/* \endofdoc is a predefined bookmark */</span>
&nbsp;
Word.<span style="color: #202020;">Application</span> app <span style="color: #339933;">=</span> new Word.<span style="color: #202020;">Application</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
Word.<span style="color: #202020;">Document</span> doc <span style="color: #339933;">=</span> app.<span style="color: #202020;">Documents</span>.<span style="color: #202020;">Add</span><span style="color: #009900;">&#40;</span>
    ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
Word.<span style="color: #202020;">Range</span> line1 <span style="color: #339933;">=</span> doc.<span style="color: #202020;">Bookmarks</span>.<span style="color: #202020;">Item</span><span style="color: #009900;">&#40;</span>ref oEndOfDoc<span style="color: #009900;">&#41;</span>.<span style="color: #202020;">Range</span><span style="color: #339933;">;</span>
line1.<span style="color: #202020;">Text</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;First line!&quot;</span><span style="color: #339933;">;</span>
line1.<span style="color: #202020;">InsertParagraphAfter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
Word.<span style="color: #202020;">Range</span> line2 <span style="color: #339933;">=</span> doc.<span style="color: #202020;">Bookmarks</span>.<span style="color: #202020;">Item</span><span style="color: #009900;">&#40;</span>ref oEndOfDoc<span style="color: #009900;">&#41;</span>.<span style="color: #202020;">Range</span><span style="color: #339933;">;</span>
line2.<span style="color: #202020;">Text</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Second line!&quot;</span><span style="color: #339933;">;</span>
line2.<span style="color: #202020;">InsertParagraphAfter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
Word.<span style="color: #202020;">Range</span> r <span style="color: #339933;">=</span> doc.<span style="color: #202020;">Bookmarks</span>.<span style="color: #202020;">Item</span><span style="color: #009900;">&#40;</span>ref oEndOfDoc<span style="color: #009900;">&#41;</span>.<span style="color: #202020;">Range</span><span style="color: #339933;">;</span>
r.<span style="color: #202020;">Text</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Name<span style="color: #000099; font-weight: bold;">\t</span>Age<span style="color: #000099; font-weight: bold;">\t</span>Location<span style="color: #000099; font-weight: bold;">\n</span>Nigel<span style="color: #000099; font-weight: bold;">\t</span>44<span style="color: #000099; font-weight: bold;">\t</span>UK<span style="color: #000099; font-weight: bold;">\n</span>Bill<span style="color: #000099; font-weight: bold;">\t</span>33<span style="color: #000099; font-weight: bold;">\t</span>USA<span style="color: #000099; font-weight: bold;">\n</span>Ruben<span style="color: #000099; font-weight: bold;">\t</span>86<span style="color: #000099; font-weight: bold;">\t</span>Nicaragua<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
object tab <span style="color: #339933;">=</span> Word.<span style="color: #202020;">WdTableFieldSeparator</span>.<span style="color: #202020;">wdSeparateByTabs</span><span style="color: #339933;">;</span>
Word.<span style="color: #202020;">Table</span> t  <span style="color: #339933;">=</span> r.<span style="color: #202020;">ConvertToTable</span><span style="color: #009900;">&#40;</span>
    ref tab<span style="color: #339933;">,</span>
    ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span>
    ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span>
    ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span>
    ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Looks pretty obvious, doesn&#8217;t it? But it took me a while to get there. The important difference is that instead of&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Word.<span style="color: #202020;">Range</span> r <span style="color: #339933;">=</span> doc.<span style="color: #202020;">Range</span><span style="color: #009900;">&#40;</span>ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>&#8230;I used:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Word.<span style="color: #202020;">Range</span> r <span style="color: #339933;">=</span> doc.<span style="color: #202020;">Bookmarks</span>.<span style="color: #202020;">Item</span><span style="color: #009900;">&#40;</span>ref oEndOfDoc<span style="color: #009900;">&#41;</span>.<span style="color: #202020;">Range</span><span style="color: #339933;">;</span></pre></div></div>

<p>What I had been experiencing with the former was a document with only the final item (the table) being added. In fact, all items had been added, but at the same location in the document &#8211; so each item was being overwritten by each subsequent item. This seems obvious too, in retrospect, because I was supplying the <em><a href="http://msdn.microsoft.com/en-us/library/system.reflection.missing.value.aspx">missing</a></em> value to the Range constructor&#8217;s <em>start</em> and <em>end</em> parameters, so the target range became &#8220;everything&#8221;.</p>
<p>I couldn&#8217;t see &#8211; and still can&#8217;t &#8211; how you&#8217;re supposed to identify a range in an empty document, but I was fortunate enough to discover <em>endofdoc</em>, a built-in bookmark signifying the, er, end of a document.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">object oEndOfDoc <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;\\endofdoc&quot;</span><span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/* \endofdoc is a predefined bookmark */</span></pre></div></div>

<p>My requirement was simply to add items to the document sequentially, so using this bookmark for the range of each item did the trick. I think that&#8217;s me done with Word Automation&#8230;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>P.S.</strong> In trying to find a solution I toyed with a Word document template with predefined mail merge fields acting as placeholders for the items I wanted to add. It almost worked until I tried to replace a field with my table. Any ideas why this doesn&#8217;t work?</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">foreach <span style="color: #009900;">&#40;</span>Word.<span style="color: #202020;">Field</span> myMergeField in doc.<span style="color: #202020;">Fields</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// ...</span>
    myMergeField.<span style="color: #202020;">Select</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    app.<span style="color: #202020;">Selection</span>.<span style="color: #202020;">Range</span>.<span style="color: #202020;">Text</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Name<span style="color: #000099; font-weight: bold;">\t</span>Age<span style="color: #000099; font-weight: bold;">\t</span>Location<span style="color: #000099; font-weight: bold;">\n</span>Nigel<span style="color: #000099; font-weight: bold;">\t</span>44<span style="color: #000099; font-weight: bold;">\t</span>UK<span style="color: #000099; font-weight: bold;">\n</span>Bill<span style="color: #000099; font-weight: bold;">\t</span>33<span style="color: #000099; font-weight: bold;">\t</span>USA<span style="color: #000099; font-weight: bold;">\n</span>Ruben<span style="color: #000099; font-weight: bold;">\t</span>86<span style="color: #000099; font-weight: bold;">\t</span>Nicaragua<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    app.<span style="color: #202020;">Selection</span>.<span style="color: #202020;">Range</span>.<span style="color: #202020;">ConvertToTable</span><span style="color: #009900;">&#40;</span>
        ref tab<span style="color: #339933;">,</span>
        ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span>
        ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span>
        ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span>
        ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2010/06/add-items-to-a-word-document-using-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add a table using Word Interop and ConvertToTable</title>
		<link>http://gingerbbm.com/2010/06/add-a-table-using-word-interop-and-converttotable/</link>
		<comments>http://gingerbbm.com/2010/06/add-a-table-using-word-interop-and-converttotable/#comments</comments>
		<pubDate>Mon, 31 May 2010 23:43:56 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Word Automation]]></category>
		<category><![CDATA[add table]]></category>
		<category><![CDATA[c sharp]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[converttotable]]></category>
		<category><![CDATA[word]]></category>
		<category><![CDATA[word interop]]></category>

		<guid isPermaLink="false">http://gingerbbm.com/?p=342</guid>
		<description><![CDATA[The .NET Framework allows us to do many things with relative ease but the main cost is often the time taken in finding a decent example to learn from. I experienced pain when I wanted to create a Word document programmatically and add a simple table to it. But I got there in the end, [...]]]></description>
			<content:encoded><![CDATA[<p>The .NET Framework allows us to do many things with relative ease but the main cost is often the time taken in finding a decent example to learn from. I experienced pain when I wanted to create a Word document programmatically and add a simple table to it. But I got there in the end, and this is how I did it. <span id="more-342"></span></p>
<p>I&#8217;m not going to describe in full how you need to prepare your Visual Studio project. For that, read <a href="http://www.c-sharpcorner.com/UploadFile/amrish_deep/WordAutomation05102007223934PM/WordAutomation.aspx">this</a>. I wanted to utilise the <a href="http://msdn.microsoft.com/es-es/library/microsoft.office.interop.word.range.converttotable(office.11).aspx">ConvertToTable()</a> method of the <a href="http://msdn.microsoft.com/es-es/library/ms264372(v=Office.11).aspx">Word.Range</a> object which allows us to create a table using a string delimited by tabs and newlines such as this:</p>
<div style="font-family:courier new">
<span style="color:red">Name</span><span style="color:blue">\t</span><span style="color:red">Age</span><span style="color:blue">\t</span><span style="color:red">Location</span><span style="color:blue">\n</span><span style="color:red">Nigel</span><span style="color:blue">\t</span><span style="color:red">44</span><span style="color:blue">\t</span><span style="color:red">UK</span><span style="color:blue">\n</span><span style="color:red">Bill</span><span style="color:blue">\t</span><span style="color:red">33</span><span style="color:blue">\t</span><span style="color:red">USA</span><span style="color:blue">\n</span><span style="color:red">Ruben</span><span style="color:blue">\t</span><span style="color:red">86</span><span style="color:blue">\t</span><span style="color:red">Nicaragua</span><span style="color:blue">\n</span></p>
</div>
<p>The MSDN page <a href="http://msdn.microsoft.com/en-us/library/aa537149(office.11).aspx">Automating Word Tables for Data Insertion and Extraction</a> had taken me so far, but not all the way, so here&#8217;s the useful (read: missing) code to bring it all together:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Word.<span style="color: #202020;">Application</span> app <span style="color: #339933;">=</span> new Word.<span style="color: #202020;">Application</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
Word.<span style="color: #202020;">Document</span> doc <span style="color: #339933;">=</span> app.<span style="color: #202020;">Documents</span>.<span style="color: #202020;">Add</span><span style="color: #009900;">&#40;</span>
    ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
Word.<span style="color: #202020;">Range</span> r <span style="color: #339933;">=</span> doc.<span style="color: #202020;">Range</span><span style="color: #009900;">&#40;</span>ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
r.<span style="color: #202020;">Text</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Name<span style="color: #000099; font-weight: bold;">\t</span>Age<span style="color: #000099; font-weight: bold;">\t</span>Location<span style="color: #000099; font-weight: bold;">\n</span>Nigel<span style="color: #000099; font-weight: bold;">\t</span>44<span style="color: #000099; font-weight: bold;">\t</span>UK<span style="color: #000099; font-weight: bold;">\n</span>Bill<span style="color: #000099; font-weight: bold;">\t</span>33<span style="color: #000099; font-weight: bold;">\t</span>USA<span style="color: #000099; font-weight: bold;">\n</span>Ruben<span style="color: #000099; font-weight: bold;">\t</span>86<span style="color: #000099; font-weight: bold;">\t</span>Nicaragua<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
object tab <span style="color: #339933;">=</span> Word.<span style="color: #202020;">WdTableFieldSeparator</span>.<span style="color: #202020;">wdSeparateByTabs</span><span style="color: #339933;">;</span>
Word.<span style="color: #202020;">Table</span> t  <span style="color: #339933;">=</span> r.<span style="color: #202020;">ConvertToTable</span><span style="color: #009900;">&#40;</span>
    ref tab<span style="color: #339933;">,</span>
    ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> 
    ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span>
    ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span>
    ref oMissing<span style="color: #339933;">,</span> ref oMissing<span style="color: #339933;">,</span> ref oMissing
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Please leave a comment if you have any questions on this, or if I&#8217;ve done something heinous that is a crime against Word automation <img style="margin:0" src="http://gingerbbm.com/wordpress/wp-includes/images/smilies/icon_wink.gif" alt=";)" /></p>
<p>Good luck!</p>
<p>&nbsp;
<p>
<strong>EDIT:</strong> If you need to add more than one item to a blank Word document, you might want to take a look at <a href="http://gingerbbm.com/2010/06/add-items-to-a-word-document-using-c/">my subsequent post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2010/06/add-a-table-using-word-interop-and-converttotable/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IE6 Compatibility VPC IETest Password Is P2ssw0rd</title>
		<link>http://gingerbbm.com/2010/04/ie6-compatibility-vpc-ietest-password-is-p2ssw0rd/</link>
		<comments>http://gingerbbm.com/2010/04/ie6-compatibility-vpc-ietest-password-is-p2ssw0rd/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 12:18:25 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[compatibility]]></category>
		<category><![CDATA[ietest]]></category>
		<category><![CDATA[P2ssw0rd]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[vpc]]></category>

		<guid isPermaLink="false">http://gingerbbm.com/?p=338</guid>
		<description><![CDATA[I just downloaded and installed the very useful IE6 Compatibility Virtual PC [IE6-on-XP-SP3.exe] from Microsoft. Within minutes of starting the machine and getting distracted, the screensaver kicked in, locking the machine until I entered the relevant password for the IETest user. The password is P2ssw0rd. This information wasn&#8217;t immediately obvious via Google so I thought [...]]]></description>
			<content:encoded><![CDATA[<p>I just downloaded and installed the very useful IE6 Compatibility Virtual PC [IE6-on-XP-SP3.exe] from <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B64-B5F1-73D0A413C8EF&#038;displaylang=en">Microsoft</a>. Within minutes of starting the machine and getting distracted, the screensaver kicked in, locking the machine until I entered the relevant password for the 	<em>IETest</em> user. The password is <strong>P2ssw0rd</strong>. <span id="more-338"></span></p>
<p>This information wasn&#8217;t immediately obvious via Google so I thought I&#8217;d post it up in an attempt to make it more findable by other folks. I actually got the information from <a href="http://www.spazquest.org/weblog/2009/11/password-for-ie6-app-compatibility-vpc.html">Eric True</a>. Thanks Eric!</p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2010/04/ie6-compatibility-vpc-ietest-password-is-p2ssw0rd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hotel Room Message Retrieval Fail</title>
		<link>http://gingerbbm.com/2010/03/hotel-room-message-retrieval-fail/</link>
		<comments>http://gingerbbm.com/2010/03/hotel-room-message-retrieval-fail/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 18:19:19 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
				<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://gingerbbm.com/?p=333</guid>
		<description><![CDATA[We&#8217;re all familiar with software applications and web sites that require us to enter a password: type in an obscure string of masked characters to proceed to the promised land. So I was amused by the TV-based hotel room message system I recently encountered: It reads: &#8220;To check your messages, please enter your room number [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re all familiar with software applications and web sites that require us to enter a password: type in an obscure string of masked characters to proceed to the promised land. <span id="more-333"></span></p>
<p>So I was amused by the TV-based hotel room message system I recently encountered:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2010/03/p1030166.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2010/03/p1030166-300x169.jpg" alt="Unsecure security screen" title="Unsecure security screen" width="300" height="169" class="alignnone size-medium wp-image-330" /></a></p>
<p>It reads: &#8220;To check your messages, please enter your room number (419)&#8221;. And it&#8217;s followed by our well-known password entry box &#8211; with the characters masked.</p>
<p>I was staying in Room 419.</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2010/03/p1030167.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2010/03/p1030167-300x169.jpg" alt="Unsecure secure screen - Detail #001" title="Unsecure secure screen - Detail #001" width="300" height="169" class="alignnone size-medium wp-image-331" /></a></p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2010/03/p1030168.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2010/03/p1030168-300x169.jpg" alt="Unsecure secure screen - Detail #002" title="Unsecure secure screen - Detail #002" width="300" height="169" class="alignnone size-medium wp-image-332" /></a></p>
<p>Whether or not the room number should be masked is beside the point, although there has been <a href="http://www.useit.com/alertbox/passwords.html">some</a> <a href="http://adactio.com/journal/1618/">debate</a> <a href="http://www.alistapart.com/articles/the-problem-with-passwords/">recently</a> about the usefulness of masking, but it&#8217;s clearly ridiculous to show the room number when the entry box hides it.</p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2010/03/hotel-room-message-retrieval-fail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>For Sale: Kawasaki ZX-9R Ninja</title>
		<link>http://gingerbbm.com/2009/10/for-sale-kawasaki-zx-9r-ninja/</link>
		<comments>http://gingerbbm.com/2009/10/for-sale-kawasaki-zx-9r-ninja/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 15:02:57 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
				<category><![CDATA[Motorcycles]]></category>
		<category><![CDATA[for sale]]></category>
		<category><![CDATA[kawasaki]]></category>
		<category><![CDATA[ninja]]></category>
		<category><![CDATA[zx-9r]]></category>

		<guid isPermaLink="false">http://gingerbbm.com/?p=288</guid>
		<description><![CDATA[Alas, the Ninja has to go. I&#8217;m asking for £1100 but I&#8217;m open to offers. UPDATE: The bike has been sold! Hooray! Thanks &#8211; and safe riding &#8211; to Chris.&#160;&#160; Details as follows; click the images to see bigger versions&#8230; 1999 &#8220;T&#8221; ZX-9R C1 44,000 km (or 27,000 miles) MOT expires June 2010 Tax expires [...]]]></description>
			<content:encoded><![CDATA[<p>Alas, the Ninja has to go. I&#8217;m asking for <strong>£1100</strong> but I&#8217;m open to offers. <span id="more-288"></span></p>
<div style="margin:10px 20px 20px 20px; padding:10px; border:2px solid #66bb66; background-color:#eeffee; text-align:center"><strong>UPDATE:</strong> The bike has been sold! Hooray! Thanks &#8211; and safe riding &#8211; to Chris.&nbsp;&nbsp;<img style="margin:0" src="http://gingerbbm.com/wordpress/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" /></div>
<p>Details as follows; click the images to see bigger versions&#8230;</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/right.jpg"><img class="alignnone size-medium wp-image-301" src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/right-300x168.jpg" alt="" width="300" /></a></p>
<ul>
<li>1999 &#8220;T&#8221; ZX-9R C1</li>
<li>44,000 km (or 27,000 miles)</li>
<li>MOT expires June 2010</li>
<li>Tax expires March 2010</li>
<li>Datatag &amp; Immobiliser</li>
<li>Full service history</li>
<li>One previous owner</li>
<li>&#8220;KAW&#8221; registration</li>
<li>New battery</li>
<li>Parallel import</li>
</ul>
<p>Since it was last serviced in July 2005 it&#8217;s travelled less than 4000 miles. I&#8217;m pretty ashamed I&#8217;ve ridden it so little, but at least it&#8217;s been kept in a secure, dry garage in the meantime.</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/left.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/left-300x168.jpg" alt="left" title="left" width="300" class="alignnone size-medium wp-image-293" /></a></p>
<p>The bike is 10 years old, so it&#8217;s not in perfect condition. I&#8217;d describe it as &#8220;good&#8221;.&nbsp;&nbsp;<img style="margin:0" src="http://gingerbbm.com/wordpress/wp-includes/images/smilies/icon_wink.gif" alt=";)" /><br />
Somewhat predictably it has slightly chipped forks and a cracked mudguard:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/disc.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/disc-300x168.jpg" alt="disc" title="disc" width="300" height="168" class="alignnone size-medium wp-image-292" /></a></p>
<p>The front of the mudguard has been repaired:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/mudguard.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/mudguard-300x168.jpg" alt="mudguard" title="mudguard" width="300" height="168" class="alignnone size-medium wp-image-295" /></a></p>
<p>There&#8217;s some scuffing on the lower fairing:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/lowerfairing.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/lowerfairing-300x168.jpg" alt="lowerfairing" title="lowerfairing" width="300" height="168" class="alignnone size-medium wp-image-294" /></a></p>
<p>And also the engine cover:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/cover.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/cover-300x168.jpg" alt="cover" title="cover" width="300" height="168" class="alignnone size-medium wp-image-291" /></a></p>
<p>The front of the left mirror is also scratched:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/oldmirror.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/oldmirror-300x168.jpg" alt="oldmirror" title="oldmirror" width="300" height="168" class="alignnone size-medium wp-image-299" /></a></p>
<p>But I have a range of replacements that I&#8217;ve not got around to fitting, such as a new mirror:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/newmirror.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/newmirror-300x168.jpg" alt="newmirror" title="newmirror" width="300" height="168" class="alignnone size-medium wp-image-298" /></a></p>
<p>And engine cover:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/newcover.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/newcover-300x168.jpg" alt="newcover" title="newcover" width="300" height="168" class="alignnone size-medium wp-image-296" /></a></p>
<p>There&#8217;s also a replacement front fairing:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/newfairing.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/newfairing-300x168.jpg" alt="newfairing" title="newfairing" width="300" height="168" class="alignnone size-medium wp-image-297" /></a></p>
<p>I also have the original screen (the one currently on the bike is all black):</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/oldscreen.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/oldscreen-300x168.jpg" alt="oldscreen" title="oldscreen" width="300" height="168" class="alignnone size-medium wp-image-300" /></a></p>
<p>And there&#8217;s an after-market can which I took off to get the bike through the MOT and never put back on:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/can.jpg"><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/10/can-300x168.jpg" alt="can" title="can" width="300" height="168" class="alignnone size-medium wp-image-290" /></a></p>
<p>So I&#8217;m asking for <strong>£1100</strong> or near offer, which is a good deal <a href="http://www.parkers.co.uk/motorbikes/used-prices/Valuation.aspx?plate=60&amp;deriv=4458">according to Parker&#8217;s</a>.</p>
<p>I&#8217;m based in <a href="http://maps.google.co.uk/?q=surbiton">Surbiton</a>. If you&#8217;re interested, let me know by leaving a comment below and I&#8217;ll be in touch. The ability to out-accelerate every car on the road doesn&#8217;t get much cheaper than this!</p>
<p> <img src='http://gingerbbm.com/wordpress/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2009/10/for-sale-kawasaki-zx-9r-ninja/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>URL Editor</title>
		<link>http://gingerbbm.com/2009/09/url-editor/</link>
		<comments>http://gingerbbm.com/2009/09/url-editor/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 22:21:29 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[http get]]></category>
		<category><![CDATA[long url]]></category>
		<category><![CDATA[querystring]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[url editor]]></category>

		<guid isPermaLink="false">http://gingerbbm.com/?p=207</guid>
		<description><![CDATA[On a few occasions recently I&#8217;ve had to deal with long URLs, or more accurately, URLs with long querystrings. Each time it was a chore: strings that are a few hundred characters in length are unwieldy, hard to read and tricky to edit. So I decided to make my life easier and build a tool. [...]]]></description>
			<content:encoded><![CDATA[<p>On a few occasions recently I&#8217;ve had to deal with long URLs, or more accurately, URLs with long <a href="http://en.wikipedia.org/wiki/Query_string" target="_blank">querystrings</a>. Each time it was a chore: strings that are a few hundred characters in length are unwieldy, hard to read and tricky to edit. So I decided to make my life easier and build a tool. <span id="more-207"></span></p>
<p>This URL is the kind of thing one encounters when working with Web Map Services:</p>
<div style="margin-left:30px;margin-right:30px;margin-bottom:20px;font-family:courier new,courier;color:blue;border:1px solid #9C9A9C;background-color:#F7F3EF;padding:10px">http://terraservice.net/ogcmap.ashx?SERVICE=WMS&amp;REQUEST=GetMap&amp;VERSION=1.1.1&amp;LAYERS=DRG&amp;FORMAT=image/gif&amp;SRS=EPSG:4326&amp;BBOX=-124.1,41.2,-123.9,41.4&amp;WIDTH=300&amp;HEIGHT=300</div>
<p>It returns a geographic map image based upon the name/value pairs passed in the querystring. <a href="http://code.google.com/apis/chart/" target="_blank">Google Charts</a> work in a similar way:</p>
<div style="margin-left:30px;margin-right:30px;margin-bottom:20px;font-family:courier new,courier;color:blue;border:1px solid #9C9A9C;background-color:#F7F3EF;padding:10px">http://chart.apis.google.com/chart?cht=lc&amp;chd=s:cEAELFJHHHKUju9uuXUc&amp;chco=76A4FB&amp;chls=2.0,0.0,0.0&amp;chs=200&#215;125&amp;chg=20,50,3,3,10,20&amp;chxt=x,y&amp;chxl= 0:|0|1|2|3|4|5|1:|0|50|100</div>
<p>To tackle such long URLs I&#8217;ve developed the boringly-named <strong>URL Editor</strong>.</p>
<p>Find it here: <a href="http://gingerbbm.com/urleditor" target="_blank">http://gingerbbm.com/urleditor</a></p>
<p>It&#8217;s a pretty simple JavaScript application (using Prototype and Scriptaculous) whose main purpose is to split the long querystring of a URL into its constituent name/value pairs in order to dramatically improve legibility. Paste a URL into the main box, click <em>Split</em>, and the name/value pairs appear below:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/09/urleditor01.png"><img class="alignnone size-full wp-image-243" title="urleditor01" src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/09/urleditor01.png" alt="urleditor01" width="500" /></a></p>
<p>Once a URL has been split, any edits to the individual values are immediately applied to the main URL, and vice versa.</p>
<p>The <em>Encode</em> and <em>Decode</em> buttons attempt to <em>encode/decode</em> any relevant values that exist.</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/09/urleditor02.png"><img class="alignnone size-full wp-image-244" title="urleditor02" src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/09/urleditor02.png" alt="urleditor02" width="500" /></a></p>
<p>Click <em>Open</em> to open the URL in its current state in a new window/tab. And <em>Reset</em> resets the whole page.</p>
<p>Reordering of name/value pairs is achieved by dragging them, and you can add and delete them by clicking the relevant buttons.</p>
<h2>Bugs</h2>
<p>It wouldn&#8217;t be hard to trip the application up. The key to it all is the question mark character that denotes the start of a querystring. If you&#8217;re not interested in ever <em>opening</em> the URL you can simply start typing into the main box, e.g. &#8220;?a=1&#8243;, and the name/value pairs will appear.</p>
<h2>Names</h2>
<p>So, &#8220;URL Editor&#8221; is a fairly sober moniker, but it was the best of a bad bunch, and being a pretty good description of what it does I decided to go with it.</p>
<ul>
<li>U.R.[NOT HEL]L.</li>
<li>URL Manager</li>
<li>URL Splitter</li>
<li>Querystring Dechunker</li>
<li>Any ideas?</li>
</ul>
<h2>And Finally</h2>
<p>I&#8217;ve tried it out in FF3, IE8, Safari 3 and Opera 9 on XP and it&#8217;s all good. It also appears to work in FF3 and Safari 3 on the Mac. Not tried it on Chrome yet, but I don&#8217;t expect any surprises. For me it&#8217;s been fairly robust, and a useful tool in my arsenal. I hope others find it useful.</p>
<p> <img src='http://gingerbbm.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2009/09/url-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Path and Filename to Clipboard</title>
		<link>http://gingerbbm.com/2009/09/path-and-filename-to-clipboard/</link>
		<comments>http://gingerbbm.com/2009/09/path-and-filename-to-clipboard/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 11:55:26 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[helper app]]></category>
		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://gingerbbm.com/?p=196</guid>
		<description><![CDATA[Many moons ago I wrote a little helper application for Windows that would allow you to right-click a file in Explorer and get its full path, including filename, into the clipboard. Owing to underwhelming demand I have resurrected it. Get it here: http://gingerbbm.com/software/PathAndFilenameToClipboardSetup.msi It adds itself to the context menu in Explorer and appears like [...]]]></description>
			<content:encoded><![CDATA[<p>Many moons ago I wrote a little helper application for Windows that would allow you to right-click a file in Explorer and get its full path, including filename, into the clipboard. Owing to underwhelming demand I have resurrected it. <span id="more-196"></span></p>
<p>Get it here:<br />
<a href="http://gingerbbm.com/software/PathAndFilenameToClipboardSetup.msi">http://gingerbbm.com/software/PathAndFilenameToClipboardSetup.msi</a></p>
<p>It adds itself to the context menu in Explorer and appears like so:</p>
<p><img src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/09/paftc.png" alt="Path and Filename to Clipboard" title="Path and Filename to Clipboard" width="397" height="477" class="size-full wp-image-201" /></p>
<p><strong>Disclaimer:</strong> Of course this software comes with absolutely no guarantees or warranties of any kind! It should work on Windows XP; I&#8217;ve not tried it on anything else. If you have any difficulties leave a comment and I might take a look&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2009/09/path-and-filename-to-clipboard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HTML images using long GET strings</title>
		<link>http://gingerbbm.com/2009/06/html-images-using-long-get-strings/</link>
		<comments>http://gingerbbm.com/2009/06/html-images-using-long-get-strings/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 21:15:13 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[http get]]></category>
		<category><![CDATA[http post]]></category>
		<category><![CDATA[img]]></category>
		<category><![CDATA[long url]]></category>
		<category><![CDATA[wms]]></category>

		<guid isPermaLink="false">http://gingerbbm.com/?p=127</guid>
		<description><![CDATA[The Problem You&#8217;ve got a piece of code that creates an image in your web page by passing a bunch of parameters in a GET string to some server-side process: $&#40;'tile'&#41;.src = 'http://img.com/generate.php?a=1&#38;amp;b=2&#38;amp;c=3'; But what do you do when the URL goes beyond the limit? Practically, for cross-browser solutions, the limit is around 2000 characters [...]]]></description>
			<content:encoded><![CDATA[<h2>The Problem</h2>
<p>You&#8217;ve got a piece of code that creates an image in your web page by passing a bunch of parameters in a GET string to some server-side process:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tile'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'http://img.com/generate.php?a=1&amp;amp;b=2&amp;amp;c=3'</span><span style="color: #339933;">;</span></pre></div></div>

<p>But what do you do when the URL goes <a href="http://www.boutell.com/newfaq/misc/urllength.html" target="_blank">beyond the limit</a>? Practically, for cross-browser solutions, the limit is around 2000 characters (thanks to IE), and I recently had to find a workaround when generating images via a <a href="http://en.wikipedia.org/wiki/Web_Map_Service" target="_blank">WMS</a>.<span id="more-127"></span></p>
<h2>The Solution</h2>
<p>When we&#8217;re dealing with HTML forms, if a GET isn&#8217;t big enough we have to use a POST. The difficulty in the scenario described above is that there&#8217;s no way to provide the POST variables when making the assignment to the image&#8217;s <em>src</em> attribute.</p>
<p>I thought about how to use an Ajax POST but even if image data could be streamed back to the browser in this way, there&#8217;s no mechanism for getting it into an HTML image.</p>
<p>And then I discovered the <a href="http://en.wikipedia.org/wiki/Data_URI_scheme" target="_blank">data URI scheme</a> which allows us to assign a <a href="http://en.wikipedia.org/wiki/Base64" target="_blank">base64</a> representation of an image to an HTML image like so (where the ellipsis indicates the position of the base64 data string):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tile'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'data:image/gif;base64,...'</span><span style="color: #339933;">;</span></pre></div></div>

<p>If I could issue a POST to the server to generate my image, I could convert that image into a base64 string to pass back to the browser, which I could then utilise in the data URI scheme syntax.</p>
<p>I discovered this method in <a href="http://www.phpied.com/data-urls-what-are-they-and-how-to-use/" target="_blank">this brilliant post</a> where the same trick is used to for CSS and to reduce HTTP requests. And by reading that post I learned that <a href="http://www.phpied.com/mhtml-when-you-need-data-uris-in-ie7-and-under/" target="_blank">we have to do it another way in IE</a>. In IE we have to use <a href="http://en.wikipedia.org/wiki/MHTML" target="_blank">MHTML</a> and it involves a little more work on the server but we can still end up with this (where <em>somestring</em> indicates the position in <em>mhtml.txt</em> of the base64 data string):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tile'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'mhtml:http://img.com/mhtml.txt!somestring'</span><span style="color: #339933;">;</span></pre></div></div>

<p>A proxy script on the server is required to pass the POST variables through to the image-generation program, and convert the resultant image into a base64 data string. Since the WMS I use is located on an external server I was already using <a href="http://www.troywolf.com/articles/php/class_http/proxy.phps" target="_blank">Troy Wolf&#8217;s PHP proxy script</a> (note that it requires <em><a href="http://www.troywolf.com/articles/php/class_http/class_http.phps" target="_blank">class.php</a></em>). Converting to base64 is a cinch in PHP:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$base64_encoded_image</span> <span style="color: #339933;">=</span> <span style="color: #990000;">base64_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$response</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I simply added the code I needed to the end of Troy&#8217;s proxy script.</p>
<p>So, the flow of events is:</p>
<ul>
<li>Client issues an Ajax POST request to the proxy script.</li>
<li>Proxy forwards the request to the image-generation program and converts the resultant image into a base64 data string.
<ul>
<li>For IE, the proxy saves the string to a file and returns the filename to the client.</li>
<li>For all other browsers, the proxy returns the string to the client.</li>
</ul>
</li>
<li>Client&#8217;s Ajax &#8220;on success&#8221; callback assigns the relevant string to the HTML image&#8217;s <em>src</em> attribute.</li>
</ul>
<p>Anyway, <a href="http://gingerbbm.com/demo/imagebypost/">here&#8217;s a demo page</a>.<br />
And <a href="http://gingerbbm.com/demo/imagebypost/imagebypost.zip">here&#8217;s a zip</a> containing all the necessary files.</p>
<h2>A Few Considerations</h2>
<p>The IE workaround involves creating a file on the server that contains the base64 representation of the generated image. The format of the file must be as follows in terms of line breaks, and in terms of the double quotes around the boundary parameter:</p>
<pre>Content-Type: multipart/related; boundary="_ANY_SEPARATOR"

--_ANY_SEPARATOR
Content-Location:somestring
Content-Transfer-Encoding:base64

R0lGODlh...snip...AACgAACoAAC</pre>
<p>The folder in which the MHTML files are generated obviously requires the appropriate privileges. If this method were used in a production environment an automated procedure would be required to delete periodically old MHTML files. <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx" target="_blank">IE8</a> is a great improvement over previous versions and actually supports the data URI scheme, so one day in the distant future all the MHTML workaround shenanigans will be unnecessary. But until then we&#8217;re stuck with having to write a file to the server every time &#8211; and if we&#8217;re doing that it might be preferable simply to write the image to the server and return its URL to the browser. At least it would mean no JavaScript browser-sniffing, and that&#8217;s no bad thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2009/06/html-images-using-long-get-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Meltdown Festival 2009</title>
		<link>http://gingerbbm.com/2009/05/meltdown-festival-2009/</link>
		<comments>http://gingerbbm.com/2009/05/meltdown-festival-2009/#comments</comments>
		<pubDate>Sat, 30 May 2009 07:36:00 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
				<category><![CDATA[Jazz]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[meltdown]]></category>
		<category><![CDATA[ornette coleman]]></category>
		<category><![CDATA[the bad plus]]></category>

		<guid isPermaLink="false">http://gingerbbm.wordpress.com/?p=106</guid>
		<description><![CDATA[This year&#8217;s Meltdown Festival on the South Bank is looking better and better. I already have tickets to three shows, but more great artists keep being added. The festival is curated this year by Ornette Coleman, a free jazz legend whose seminal release came in 1959 &#8211; the same year as Miles Davis&#8217;s. I&#8217;ve yet [...]]]></description>
			<content:encoded><![CDATA[<p>This year&#8217;s <a href="http://meltdown.southbankcentre.co.uk/">Meltdown Festival</a> on the South Bank is looking better and better. I already have tickets to three shows, but more great artists keep being added. <span id="more-106"></span></p>
<p>The festival is curated this year by <a href="http://en.wikipedia.org/wiki/Ornette_Coleman">Ornette Coleman</a>, a free jazz legend whose seminal release came in 1959 &#8211; the same year as <a href="http://en.wikipedia.org/wiki/Kind_of_blue">Miles Davis&#8217;s</a>. I&#8217;ve yet to listen to Ornette Coleman&#8217;s work, but he is the principle inspiration behind one of my favourite bands, The Bad Plus, and his selection of musicians for the Meltdown is awesome.</p>
<p>We&#8217;re going to see Yoko Ono (with Cornelius), Charlie Haden (with The Bad Plus) and Ornette Coleman himself. Bring it right on!</p>
<p>And if money were no object I&#8217;d also go and see James Blood Ulmer, The Roots, Led Bid, Acoustic Ladyland and Bobby McFerrin!</p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2009/05/meltdown-festival-2009/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
