<?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/"
	>

<channel>
	<title>gingerbbm</title>
	<atom:link href="http://gingerbbm.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gingerbbm.com</link>
	<description>code music life</description>
	<pubDate>Wed, 28 Oct 2009 13:49:44 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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 - and safe riding - 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 March 2010
Datatag &#38; Immobiliser
Full service [...]]]></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 - and safe riding - 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>
		</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>
		</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 so:

Disclaimer: Of [...]]]></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>
		</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 (thanks to IE), [...]]]></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="/demo/imagebypost/">here&#8217;s a demo page</a>.<br />
And <a href="/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 - 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>
		</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 - 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 - 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>
		</item>
		<item>
		<title>Bookmarklets</title>
		<link>http://gingerbbm.com/2009/05/bookmarklets/</link>
		<comments>http://gingerbbm.com/2009/05/bookmarklets/#comments</comments>
		<pubDate>Fri, 15 May 2009 23:58:15 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
		
		<category><![CDATA[Development]]></category>

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

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

		<guid isPermaLink="false">http://gingerbbm.wordpress.com/?p=87</guid>
		<description><![CDATA[Not a day goes by without the need at some point to look up a location on Google Maps (UK). Despite the obvious benefits of the quick search bars in All Modern Browsers, I&#8217;ve not really taken to them. In theory they&#8217;re a great feature, but I find that they make me think too much. [...]]]></description>
			<content:encoded><![CDATA[<p>Not a day goes by without the need at some point to look up a location on <a href="http://maps.google.co.uk" target="_blank">Google Maps</a> (UK). Despite the obvious benefits of the quick search bars in All Modern Browsers, I&#8217;ve not really taken to them. In theory they&#8217;re a great feature, but I find that they <a href="http://www.dontmakemethink.com/" target="_blank">make me think</a> too much. <span id="more-87"></span>Like so:</p>
<ol>
<li>pull down the list of search engines</li>
<li>scan for the one I want</li>
<li>type and go</li>
</ol>
<p>To reduce friction when searching in common places I have the following bookmarklets defined.</p>
<h3>Google Maps</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">javascript<span style="color: #339933;">:</span>p<span style="color: #339933;">=</span><span style="color: #000066;">prompt</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'GMaps%20search:'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>if<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span><span style="color: #339933;">%</span>20<span style="color: #009900;">&#123;</span><span style="color: #339933;">%</span>20p<span style="color: #339933;">=</span>p.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\./g</span><span style="color: #339933;">,%</span>20<span style="color: #3366CC;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>window.<span style="color: #660066;">location</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'http://maps.google.co.uk?q='</span><span style="color: #339933;">+</span>p.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Dictionary.com</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">javascript<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span><span style="color: #009900;">&#40;</span>location.<span style="color: #660066;">href</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'http://dictionary.reference.com/browse/'</span><span style="color: #339933;">+</span><span style="color: #000066;">prompt</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Dictionary.com%20search:'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<h3>Prototype API</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">javascript<span style="color: #339933;">:</span>p<span style="color: #339933;">=</span><span style="color: #000066;">prompt</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Prototype%20API%20search:'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>if<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span><span style="color: #339933;">%</span>20<span style="color: #009900;">&#123;</span><span style="color: #339933;">%</span>20p<span style="color: #339933;">=</span>p.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\./g</span><span style="color: #339933;">,%</span>20<span style="color: #3366CC;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>window.<span style="color: #660066;">location</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'http://prototypejs.org/api/'</span><span style="color: #339933;">+</span>p.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>To use these JavaScript snippets, assign them to a bookmark in your browser. For ease of access, place the bookmark on the Bookmarks Toolbar. This reduces the workflow to:</p>
<ol>
<li>click the bookmarklet</li>
<li>type and go</li>
</ol>
<p>It&#8217;s not rocket science. A simple Google search reveals all sorts of much-more-advanced bookmarklets. As far as bookmarklets for straightfoward searching are concerned, any more than three or so would feel like too many to me, and I&#8217;d opt for the browser&#8217;s quick search bar.</p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2009/05/bookmarklets/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Nokia N73 User Interface fail</title>
		<link>http://gingerbbm.com/2009/05/nokia-n73-user-interface-fail/</link>
		<comments>http://gingerbbm.com/2009/05/nokia-n73-user-interface-fail/#comments</comments>
		<pubDate>Thu, 14 May 2009 11:33:54 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
		
		<category><![CDATA[Usability]]></category>

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

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

		<guid isPermaLink="false">http://gingerbbm.wordpress.com/?p=74</guid>
		<description><![CDATA[So I need to send an SMS to a friend who has more than one number listed under his name in my phonebook. I elect to create a new message, select my friend&#8217;s name, and then this happens:

I&#8217;m being prompted to make a choice between two numbers. How do I choose? I can&#8217;t. The only [...]]]></description>
			<content:encoded><![CDATA[<p>So I need to send an SMS to a friend who has more than one number listed under his name in my phonebook. <span id="more-74"></span>I elect to create a new message, select my friend&#8217;s name, and then this happens:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/n73-new-message-ambiguity.jpg"><img class="alignnone size-full wp-image-112" title="n73-new-message-ambiguity" src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/n73-new-message-ambiguity.jpg" alt="n73-new-message-ambiguity" width="240" height="320" /></a></p>
<p>I&#8217;m being prompted to make a choice between two numbers. How do I choose? I can&#8217;t. The only way of discerning the correct one is by recognising the number by its digits.</p>
<p>So, I have to cancel out, and go and looking in the phonebook, where the difference between the two numbers is evident:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/n73-phonebook-entry.jpg"><img class="alignnone size-full wp-image-107" title="n73-phonebook-entry" src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/n73-phonebook-entry.jpg" alt="n73-phonebook-entry" width="240" height="320" /></a></p>
<p>The main point of a phonebook is to prevent me having to remember long numbers. In this case, the Nokia N73 phonebook fails in its principle function.</p>
<p>Screenshots made possible by <a href="http://www.antonypranata.com/screenshot/screenshot-symbian-os" target="_blank">Screenshot for Symbian OS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2009/05/nokia-n73-user-interface-fail/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Writing a Win32 DLL in C++ for Oracle extproc</title>
		<link>http://gingerbbm.com/2009/05/writing-a-win32-dll-in-c-for-oracle-extproc/</link>
		<comments>http://gingerbbm.com/2009/05/writing-a-win32-dll-in-c-for-oracle-extproc/#comments</comments>
		<pubDate>Fri, 08 May 2009 15:35:07 +0000</pubDate>
		<dc:creator>Stuart</dc:creator>
		
		<category><![CDATA[Development]]></category>

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

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

		<category><![CDATA[c++]]></category>

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

		<category><![CDATA[visual studio]]></category>

		<category><![CDATA[win32 dll]]></category>

		<guid isPermaLink="false">http://gingerbbm.wordpress.com/?p=4</guid>
		<description><![CDATA[I was recently tasked with writing a Win32 DLL containing functionality to be used by Oracle procedures and functions via extproc. This post describes the steps required to achieve this using Microsoft Visual Studio 2005 and Oracle 10g.  
Creating the DLL
I used Visual Studio 2005 for this but I&#8217;m sure 2003 or 2008 can [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently tasked with writing a Win32 DLL containing functionality to be used by Oracle procedures and functions via <a href="http://download.oracle.com/docs/cd/A58617_01/server.804/a58236/10_procs.htm" target="_blank">extproc</a>. This post describes the steps required to achieve this using Microsoft Visual Studio 2005 and Oracle 10g.  <span id="more-14"></span></p>
<h2><strong>Creating the DLL</strong></h2>
<p>I used Visual Studio 2005 for this but I&#8217;m sure 2003 or 2008 can be used in a similar way. The important step is to choose the appropriate project type.  Do the following:</p>
<ul>
<li>File > New > Project</li>
<li>Project type: Visual C++ > Win32</li>
<li>Template: Win32 Console Application</li>
<li>Give your project a name (I have used &#8220;rwnet64&#8243; in this example)</li>
</ul>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/001-create-project.png"><img class="alignnone size-full wp-image-108" title="001-create-project" src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/001-create-project.png" alt="001-create-project" width="420" height="305" /></a></p>
<p>When you click OK you should see the Win32 Application Wizard:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/002-create-project.png"><img class="alignnone size-full wp-image-109" title="002-create-project" src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/002-create-project.png" alt="002-create-project" width="420" height="305" /></a></p>
<p>Click Next to configure the application settings. As shown here, ensure that the DLL radio button is selected:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/003-create-project.png"><img class="alignnone size-full wp-image-110" title="003-create-project" src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/003-create-project.png" alt="003-create-project" width="420" height="305" /></a></p>
<p>Click Finish to see the generated code:</p>
<p><a href="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/004-configuration.png"><img class="alignnone size-full wp-image-111" title="004-configuration" src="http://gingerbbm.com/wordpress/wp-content/uploads/2009/05/004-configuration.png" alt="004-configuration" width="420" height="272" /></a></p>
<p>The highlighted block shows a <a href="http://msdn.microsoft.com/en-us/library/ms682583(VS.85).aspx" target="_blank">default entry point</a> for the DLL. This can be safely deleted.</p>
<p>At this point the project should compile and we&#8217;re ready to add some code.</p>
<p>The following is an example of a simple function. The <strong>important thing to note</strong> is the compiler directive <strong>__declspec(dllexport)</strong> which is required for extproc to load the DLL successfully.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">extern</span> <span style="color: #FF0000;">&quot;C&quot;</span> __declspec<span style="color: #008000;">&#40;</span>dllexport<span style="color: #008000;">&#41;</span> <span style="color: #0000ff;">int</span> addTen <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> val<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">return</span> val <span style="color: #000040;">+</span> <span style="color: #0000dd;">10</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>The project should compile. Build the DLL <strong>as a Release build</strong> (a Debug build won&#8217;t work with extproc), then copy it over to your Oracle server&#8217;s BIN or LIB folder.</p>
<h2><strong>Preparing Oracle</strong></h2>
<p>I&#8217;m going to assume that your instance of Oracle is already configured to use extproc, i.e. that <em>listener.ora</em> and <em>tnsnames.ora</em> have been set up correctly. I might come back and explain how to do this later, but in the meantime just Google for it.</p>
<p>To call our DLL from a PL/SQL routine via extproc, we need:</p>
<ol>
<li>an Oracle library</li>
<li>a PL/SQL routine</li>
</ol>
<p>The Oracle library can be created like this at a SQL*Plus prompt:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">&gt; create or replace library rwnet64
  as 'e:\oracle\product\10.2.0\db_2\lib\rwnet64.dll;
&nbsp;
Library created.</pre></div></div>

<p><strong>Note: </strong>If this fails because your user doesn&#8217;t have the necessary privileges, run the following from a SQL*Plus prompt connected as the system user (where <em>myuser </em>is, er, your user):</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">&gt; grant create library to myuser;</pre></div></div>

<p>With the Oracle library created, we now need some code! Here&#8217;s an example package body:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">REPLACE</span> package body dlltest_pkg <span style="color: #993333; font-weight: bold;">AS</span>
&nbsp;
    <span style="color: #993333; font-weight: bold;">FUNCTION</span> addTen<span style="color: #66cc66;">&#40;</span>num <span style="color: #993333; font-weight: bold;">IN</span> pls_integer<span style="color: #66cc66;">&#41;</span>
    <span style="color: #993333; font-weight: bold;">RETURN</span> pls_integer
    <span style="color: #993333; font-weight: bold;">AS</span> external
    <span style="color: #993333; font-weight: bold;">LANGUAGE</span> c
    library rwnet64
    name <span style="color: #ff0000;">&quot;addTen&quot;</span>
    parameters <span style="color: #66cc66;">&#40;</span>num int<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">RETURN</span> int<span style="color: #66cc66;">&#41;</span>;
&nbsp;
end dlltest_pkg;
<span style="color: #66cc66;">/</span></pre></div></div>

<p>Once you&#8217;ve created the package (and you&#8217;ll need to write the accompanying package header script) the DLL can now be tested from a SQL*Plus prompt with the following:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">&gt; select dlltest_pkg.addTen<span style="color: #66cc66;">&#40;</span>5<span style="color: #66cc66;">&#41;</span> from dual;
&nbsp;
DLLTEST_PKG.ADDTEN<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>
---------------------
 <span style="color: #cc66cc;">15</span></pre></div></div>

<p>And that proves it: calling a function in a Win32 DLL written in C++ from a function in an Oracle package via extproc.</p>
<p>If you got this far you are now at liberty to create useful functionality in your DLL. One thing to watch out for is the choice of datatypes between the DLL and PL/SQL. <a href="http://download.oracle.com/docs/cd/A58617_01/server.804/a58236/10_procs.htm#442298" target="_blank">This table is a useful starting point</a> for ironing out any issues.</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://gingerbbm.com/2009/05/writing-a-win32-dll-in-c-for-oracle-extproc/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
