<?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>David Laing's blog &#187; Platforms</title>
	<atom:link href="http://davidlaing.com/category/platforms/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidlaing.com</link>
	<description>Craftmanship over crap</description>
	<lastBuildDate>Mon, 19 Jul 2010 00:39:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9-rare</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Learning functional Javascript through Koans</title>
		<link>http://davidlaing.com/2010/07/19/learning-functional-javascript-through-koans/</link>
		<comments>http://davidlaing.com/2010/07/19/learning-functional-javascript-through-koans/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 23:37:39 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Software Craftmanship]]></category>
		<category><![CDATA[koans; javascript; functional]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=236</guid>
		<description><![CDATA[Given how Javascript interpreters are improving in leaps and bounds; and that it seems to be the only language that will be supported by all web devices; its time to for me to revive my Javascript skilz.  Fortunately the tooling has improved greatly; Eclipse 3.6 for Web Developers and JsTestDriver bring a refactoring and [...]]]></description>
			<content:encoded><![CDATA[<p>Given how Javascript interpreters are improving in leaps and bounds; and that it seems to be the only language that will be supported by all web devices; its time to for me to revive my Javascript skilz.  Fortunately the tooling has improved greatly; Eclipse 3.6 for Web Developers and JsTestDriver bring a refactoring and a unit test runner to Javascript development.</p>
<p>Interestingly, Javascript seems to have more functional than object orientated characteristics; so it seems reasonable to learn it wearing my functional hat.</p>
<p>I&#8217;ve been enjoying learning Ruby syntax via <a href="http://github.com/edgecase/ruby_koans" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://github.com/edgecase/ruby_koans');">RubyKoans &#8211; little tests that teach you syntax and convention as you make them pass</a></p>
<p>I though I&#8217;d create a similar set of <a href="http://github.com/mrdavidlaing/functional-koans" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://github.com/mrdavidlaing/functional-koans');">Functional Javascript Koans</a> to help refresh my Javascript skills.</p>
<p>Its a bit rough; so please fork and contibute back improvements.<br />
<a href="http://github.com/mrdavidlaing/functional-koans" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://github.com/mrdavidlaing/functional-koans');">http://github.com/mrdavidlaing/functional-koans</a></p>
<p><object width="490" height="310"><param name="movie" value="http://www.youtube.com/v/qAoWxXPLB0Q&amp;hl=en_US&amp;fs=1?rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&amp;border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/qAoWxXPLB0Q&amp;hl=en_US&amp;fs=1?rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&amp;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="490" height="310"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2010/07/19/learning-functional-javascript-through-koans/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CI for Flex 4; running FlexUnit4 unit tests and FlexMonkey4 acceptance tests with Maven and FlexMojos</title>
		<link>http://davidlaing.com/2010/06/04/ci-for-flex-4-running-flexunit4-unit-tests-and-flexmonkey4-acceptance-tests-with-maven-and-flexmojos/</link>
		<comments>http://davidlaing.com/2010/06/04/ci-for-flex-4-running-flexunit4-unit-tests-and-flexmonkey4-acceptance-tests-with-maven-and-flexmojos/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 23:21:08 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Continuous Deployment]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[HOWTO]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=216</guid>
		<description><![CDATA[The FlexMojos project is a great way to bring your Flex application under a grown up continuous build system like Maven.
Getting FlexMojos 3.6.1 working with Flex 4, running Flash Builder 4&#8217;s version of unit tests and FlexMonkey4&#8217;s version of acceptance/UI tests is pretty tricky.
Hopefully this sample project &#8211; http://github.com/mrdavidlaing/flexmojos-sample along with this screencast will save [...]]]></description>
			<content:encoded><![CDATA[<p>The FlexMojos project is a great way to bring your Flex application under a grown up continuous build system like Maven.</p>
<p>Getting FlexMojos 3.6.1 working with Flex 4, running Flash Builder 4&#8217;s version of unit tests and FlexMonkey4&#8217;s version of acceptance/UI tests is pretty tricky.</p>
<p>Hopefully this sample project &#8211; <a href="http://github.com/mrdavidlaing/flexmojos-sample" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://github.com/mrdavidlaing/flexmojos-sample');">http://github.com/mrdavidlaing/flexmojos-sample</a> along with this screencast will save someone else the pain I went through to get all these playing together.</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12228897&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=12228897&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object>
<p><a href="http://vimeo.com/12228897" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://vimeo.com/12228897');">Howto add new component to FlexITP</a> from <a href="http://vimeo.com/user2901435" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://vimeo.com/user2901435');">David Laing</a> on <a href="http://vimeo.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://vimeo.com');">Vimeo</a>.</p>
<p>Patches welcome &#8211; just clone the git repo make your change, and request a pull.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2010/06/04/ci-for-flex-4-running-flexunit4-unit-tests-and-flexmonkey4-acceptance-tests-with-maven-and-flexmojos/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HOWTO Reset MySQL 5.0 root password in Ubuntu 8.04 LTS</title>
		<link>http://davidlaing.com/2009/09/19/howto-reset-mysql-5-0-root-password-in-ubuntu-8-04-lts/</link>
		<comments>http://davidlaing.com/2009/09/19/howto-reset-mysql-5-0-root-password-in-ubuntu-8-04-lts/#comments</comments>
		<pubDate>Sat, 19 Sep 2009 15:20:08 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=194</guid>
		<description><![CDATA[Turns out there are lots of complicated ways, but in Ubuntu you can just reconfigure the package:

dpkg-reconfigure mysql-server-5.0

Hopefully that will save someone some hair pulling
]]></description>
			<content:encoded><![CDATA[<p>Turns out there are lots of complicated ways, but in Ubuntu you can just reconfigure the package:</p>
<p><code><br />
dpkg-reconfigure mysql-server-5.0<br />
</code></p>
<p>Hopefully that will save someone some hair pulling</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2009/09/19/howto-reset-mysql-5-0-root-password-in-ubuntu-8-04-lts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utils anti-pattern &amp; AutoMapper</title>
		<link>http://davidlaing.com/2009/06/02/utils-anti-pattern-automapper/</link>
		<comments>http://davidlaing.com/2009/06/02/utils-anti-pattern-automapper/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 09:18:41 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Code smells]]></category>
		<category><![CDATA[automapper]]></category>
		<category><![CDATA[utils-anti-pattern]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=190</guid>
		<description><![CDATA[These are more for my reference purposes &#8211; hopefully you&#8217;ll find them useful:
If you&#8217;re about to name a class **Util; think harder &#8211; there is a better name that discribes what that class is for:
Chriss Missal has some advice for you
Faced with the prospect of heaps of left hand side => right hand side code [...]]]></description>
			<content:encoded><![CDATA[<p>These are more for my reference purposes &#8211; hopefully you&#8217;ll find them useful:</p>
<p>If you&#8217;re about to name a class **Util; think harder &#8211; there is a better name that discribes what that class is for:<br />
<a href="http://www.lostechies.com/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.lostechies.com/blogs/chrismissal/archive/2009/06/01/anti-patterns-and-worst-practices-utils-class.aspx');">Chriss Missal has some advice for you</a></p>
<p>Faced with the prospect of heaps of left hand side => right hand side code in your DTO of anti-corruption layer?  Consider <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/01/22/automapper-the-object-object-mapper.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/01/22/automapper-the-object-object-mapper.aspx');">Jimmy Bogard&#8217;s Automapper</a></p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2009/06/02/utils-anti-pattern-automapper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Try/Catch for SQL!?</title>
		<link>http://davidlaing.com/2009/03/05/trycatch-for-sql/</link>
		<comments>http://davidlaing.com/2009/03/05/trycatch-for-sql/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 11:42:05 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[MSSQL]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=167</guid>
		<description><![CDATA[Thanks to Nick Sertis for this trick &#8211; who knew TSQL could do try/catch statements!
Very useful when you need to write data manipulation scripts for production databases.

[-]?View Code SQL1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
BEGIN TRY
&#160;
    BEGIN TRAN
&#160;
        --Some SQL
&#160;
&#160;
    COMMIT TRAN
&#160;
END TRY
-- Catch the errors on the [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://www.sertis.net" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.sertis.net');">Nick Sertis</a> for this trick &#8211; who knew TSQL could do try/catch statements!</p>
<p>Very useful when you need to write data manipulation scripts for production databases.</p>

<div id="wp_codebox_msgheader"><span class="right"><a href="javascript:;" onclick="toggle_collapse('p1672');">[<span id="p1672_symbol">-</span>]</a><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p167code2'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div id="wp_codebox"><table width="100%" ><tr id="p1672"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code" id="p167code2"><pre class="sql">BEGIN TRY
&nbsp;
    BEGIN TRAN
&nbsp;
        <span style="color: #808080; font-style: italic;">--Some SQL</span>
&nbsp;
&nbsp;
    COMMIT TRAN
&nbsp;
END TRY
<span style="color: #808080; font-style: italic;">-- Catch the errors on the inserts</span>
BEGIN CATCH
&nbsp;
    ROLLBACK TRAN
    <span style="color: #993333; font-weight: bold;">SELECT</span> ERROR_MESSAGE<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
END CATCH</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2009/03/05/trycatch-for-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Functions with side effects are just rude!</title>
		<link>http://davidlaing.com/2009/02/25/functions-with-side-effects-are-just-rude/</link>
		<comments>http://davidlaing.com/2009/02/25/functions-with-side-effects-are-just-rude/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 14:30:26 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Code smells]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=155</guid>
		<description><![CDATA[Today I fell into a trap when using a function that had a side effect &#8211; it unexpectedly changed an input parameter; causing a later statement to fail.  Debugging took an age!
For example, consider the following function:

[-]?View Code CSHARP1
      string StringReplace&#40;string haystack, string needle&#41;

If this function is side-effect free, [...]]]></description>
			<content:encoded><![CDATA[<p>Today I fell into a trap when using a function that had a side effect &#8211; it unexpectedly changed an input parameter; causing a later statement to fail.  Debugging took an age!</p>
<p>For example, consider the following function:</p>

<div id="wp_codebox_msgheader"><span class="right"><a href="javascript:;" onclick="toggle_collapse('p1555');">[<span id="p1555_symbol">-</span>]</a><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p155code5'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div id="wp_codebox"><table width="100%" ><tr id="p1555"><td width="1%" class="line_numbers"><pre>1
</pre></td><td class="code" id="p155code5"><pre class="csharp">      <span style="color: #FF0000;">string</span> StringReplace<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> haystack, <span style="color: #FF0000;">string</span> needle<span style="color: #000000;">&#41;</span></pre></td></tr></table></div>

<p>If this function is side-effect free, we can use it without fear like this:</p>

<div id="wp_codebox_msgheader"><span class="right"><a href="javascript:;" onclick="toggle_collapse('p1556');">[<span id="p1556_symbol">-</span>]</a><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p155code6'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div id="wp_codebox"><table width="100%" ><tr id="p1556"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p155code6"><pre class="csharp">        <span style="color: #FF0000;">string</span> menagerie <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;cat,dog,bee,llama&quot;</span><span style="color: #008000;">;</span>
        <span style="color: #FF0000;">string</span> catFreeMenagerie <span style="color: #008000;">=</span> StringReplace<span style="color: #000000;">&#40;</span>menagerie, <span style="color: #666666;">&quot;cat&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #FF0000;">string</span> beeFreeMengerie <span style="color: #008000;">=</span> StringReplace<span style="color: #000000;">&#40;</span>menagerie, <span style="color: #666666;">&quot;eric&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        Assert.<span style="color: #0000FF;">AreEqual</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;,dog,fish,llama&quot;</span>, catFreeMenagerie<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        Assert.<span style="color: #0000FF;">AreEqual</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;cat,dog,,llama&quot;</span>, beeFreeMengerie<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>However, if StringReplace() had the side effect of also changing the passed in haystack, then the second Assert would fail, because the first StringReplace has the unexpected side effect of changing one of its arguments.</p>
<p>Evans in the DDD book has quite a bit to say about this; arguing that <a href="http://my.safaribooksonline.com/0321125215/ch10lev1sec2" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://my.safaribooksonline.com/0321125215/ch10lev1sec2');">having side effect free functions goes a long way towards making a supple design</a></p>
<p><a href="http://webmat.wordpress.com/2007/12/13/an-easy-way-to-make-your-code-more-testable/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://webmat.wordpress.com/2007/12/13/an-easy-way-to-make-your-code-more-testable/');">Side effect free functions also make testing &#038; refactoring easier</a> (less state to worry about etc)</p>
<p>Remember, a function that changes its parameters is rude, and should not be trusted!</p>
<p>PS:  <a href="http://lyrics.doheth.co.uk/songs/monty-python/sings/eric-the-half-a-bee.php" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://lyrics.doheth.co.uk/songs/monty-python/sings/eric-the-half-a-bee.php');">Eric the half a bee lyrics</a></p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2009/02/25/functions-with-side-effects-are-just-rude/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selenium gotcha &#8211; selenium.GetHtmlSource() returns processed HTML</title>
		<link>http://davidlaing.com/2008/12/29/selenium-gotcha-seleniumgethtmlsource-returns-processed-html/</link>
		<comments>http://davidlaing.com/2008/12/29/selenium-gotcha-seleniumgethtmlsource-returns-processed-html/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 18:11:01 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[acceptance test]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[selenium]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=142</guid>
		<description><![CDATA[Whilst writing some Selenium based acceptance tests today; I bumped into a hair pulling gotcha.  Hopefully this post will prevent you from the same pain.
The test was to check whether some tracking tag javascript was being inserted into the page correctly or not.
I assumed that I could get the page source as it was being [...]]]></description>
			<content:encoded><![CDATA[<p>Whilst writing some Selenium based acceptance tests today; I bumped into a hair pulling gotcha.  Hopefully this post will prevent you from the same pain.</p>
<p>The test was to check whether some tracking tag javascript was being inserted into the page correctly or not.</p>
<p>I assumed that I could get the page source as it was being delivered to the browser by calling selenium.GetHtmlSource(); and then check that for the javascript string I was expected.</p>
<p>Unfortunately, GetHtmlSource is just a proxy for the browsers DOM.InnerHTML method; and that returns the Html <strong>after</strong> it has been preprocessed by the browser.</p>
<p>Turns out that preprocessing does a couple of funky things, including</p>
<ul>
<li>Changing line-endings (Firefox)</li>
<li>Changing capitalization (IE6)</li>
<li>Seemingly random removal / insertion of &#8221; &amp; &#8216;  (IE6)</li>
</ul>
<p>So, when I was expecting a string like this:</p>

<div id="wp_codebox_msgheader"><span class="right"><a href="javascript:;" onclick="toggle_collapse('p14210');">[<span id="p14210_symbol">-</span>]</a><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p142code10'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div id="wp_codebox"><table width="100%" ><tr id="p14210"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p142code10"><pre class="javascript"><span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;!--</span>
   <span style="color: #003366; font-weight: bold;">var</span> amPid <span style="color: #339933;">=</span> <span style="color: #3366CC;">'206'</span><span style="color: #3366CC;">';
   var amPPid = '</span><span style="color: #CC0000;">4803</span><span style="color: #3366CC;">';
   if (document.location.protocol=='</span>https<span style="color: #339933;">:</span><span style="color: #3366CC;">')
...[snip]...
</span</pre></td></tr></table></div>

<p>IE6 was presenting me with:</p>

<div id="wp_codebox_msgheader"><span class="right"><a href="javascript:;" onclick="toggle_collapse('p14211');">[<span id="p14211_symbol">-</span>]</a><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p142code11'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div id="wp_codebox"><table width="100%" ><tr id="p14211"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p142code11"><pre class="javascript"><span style="color: #339933;">&lt;</span>SCRIPT language<span style="color: #339933;">=</span>javascript type<span style="color: #339933;">=</span>text<span style="color: #339933;">/</span>javascript<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;!--</span>
   <span style="color: #003366; font-weight: bold;">var</span> amPid <span style="color: #339933;">=</span> <span style="color: #3366CC;">'206'</span><span style="color: #3366CC;">';
   var amPPid = '</span><span style="color: #CC0000;">4803</span><span style="color: #3366CC;">';
   if (document.location.protocol=='</span>https<span style="color: #339933;">:</span><span style="color: #3366CC;">')
...[snip]...
</span</pre></td></tr></table></div>

<p>A possible solution is to ignore case, whitespace and quotes when doing the comparison, with a helper method like this:</p>

<div id="wp_codebox_msgheader"><span class="right"><a href="javascript:;" onclick="toggle_collapse('p14212');">[<span id="p14212_symbol">-</span>]</a><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p142code12'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div id="wp_codebox"><table width="100%" ><tr id="p14212"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p142code12"><pre class="csharp"><span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Use this to compare strings to those returned from selenium.GetHtmlSource for an Internet Explore instance</span>
        <span style="color: #008080; font-style: italic;">/// (IE6 seems to change case and inclusion of quotes, especially for Javascript.?)</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;expected&quot;&gt;&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;actual&quot;&gt;&lt;/param&gt;</span>
        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> AssertStringContainsIgnoreCaseWhiteSpaceAndQuotes<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> expected, <span style="color: #FF0000;">string</span> actual<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #FF0000;">string</span> expectedClean <span style="color: #008000;">=</span> Regex.<span style="color: #0000FF;">Replace</span><span style="color: #000000;">&#40;</span>expected, <span style="color: #666666;">@&quot;\s&quot;</span>, <span style="color: #666666;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToLower</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Replace</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\&quot;</span>&quot;</span>,<span style="color: #666666;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Replace</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;'&quot;</span>,<span style="color: #666666;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">string</span> actualClean <span style="color: #008000;">=</span> Regex.<span style="color: #0000FF;">Replace</span><span style="color: #000000;">&#40;</span>actual, <span style="color: #666666;">@&quot;\s&quot;</span>, <span style="color: #666666;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToLower</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Replace</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\&quot;</span>&quot;</span>, <span style="color: #666666;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Replace</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;'&quot;</span>, <span style="color: #666666;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            StringAssert.<span style="color: #0000FF;">Contains</span><span style="color: #000000;">&#40;</span>expectedClean,actualClean,
                                  <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Expected string <span style="color: #008080; font-weight: bold;">\n</span><span style="color: #008080; font-weight: bold;">\n</span>{0} <span style="color: #008080; font-weight: bold;">\n</span><span style="color: #008080; font-weight: bold;">\n</span>is not contained within <span style="color: #008080; font-weight: bold;">\n</span><span style="color: #008080; font-weight: bold;">\n</span>{1}&quot;</span>, expected, actual<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>It was the line endings that really floored me; because they were automatically normalized/corrected by my test runner when displaying the error.  Aaargh!</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2008/12/29/selenium-gotcha-seleniumgethtmlsource-returns-processed-html/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Apache2 on Ubuntu 8.04LTS; restrict access to PAM authenticated users</title>
		<link>http://davidlaing.com/2008/12/27/apache2-on-ubuntu-804lts-restrict-access-to-pam-authenticated-users/</link>
		<comments>http://davidlaing.com/2008/12/27/apache2-on-ubuntu-804lts-restrict-access-to-pam-authenticated-users/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 19:40:26 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[pam]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=140</guid>
		<description><![CDATA[I have a couple of static pages that I want to restrict access to.
I don&#8217;t want to manage another set of usernames &#38; passwds, so I&#8217;d like apache2 to authenticate off the standard users on my system, via PAM.
To get this to work, you need to install and configure mod_auth_pam and mod_auth_shadow
aptitude install libapache2-mod-auth-pam libapache2-mod-auth-shadow
Ensure [...]]]></description>
			<content:encoded><![CDATA[<p>I have a couple of static pages that I want to restrict access to.</p>
<p>I don&#8217;t want to manage another set of usernames &amp; passwds, so I&#8217;d like apache2 to authenticate off the standard users on my system, via PAM.</p>
<p>To get this to work, you need to install and configure mod_auth_pam and mod_auth_shadow</p>
<pre>aptitude install libapache2-mod-auth-pam libapache2-mod-auth-shadow</pre>
<p>Ensure the <a href="http://ubuntuforums.org/showthread.php?t=275996" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://ubuntuforums.org/showthread.php?t=275996');">www-data user is part of the shadow group</a>, so apache2 can read the passwords</p>
<pre>usermod -G shadow www-data</pre>
<p>And set up the relevent virtual host:</p>
<pre>
<Directory />
                AuthPAM_Enabled On
                AuthShadow on
                AuthPAM_FallThrough Off
                AuthBasicAuthoritative Off
                AuthType Basic
                AuthName "Restricted to group: sysadmins"
                AuthUserFile /dev/null
                Require group sysadmins</pre>
<p>Restart apache, and you&#8217;re done!</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2008/12/27/apache2-on-ubuntu-804lts-restrict-access-to-pam-authenticated-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Self Cert SSL certificate for Apache2 on Ubuntu 8.04LTS</title>
		<link>http://davidlaing.com/2008/12/27/self-cert-ssl-certificate-for-apache2-on-ubuntu-804lts/</link>
		<comments>http://davidlaing.com/2008/12/27/self-cert-ssl-certificate-for-apache2-on-ubuntu-804lts/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 00:42:02 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=136</guid>
		<description><![CDATA[Generate a self cert certificate:
https://help.ubuntu.com/8.04/serverguide/C/certificates-and-security.html
Create a new virtual host (you can only have one SSL virtual host / IP)
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
Edit ssl sothat it looks like this:
NameVirtualHost *:443

        ServerName webangle-www1.everyangle.co.uk
        ServerAdmin webmaster@localhost
        DocumentRoot [...]]]></description>
			<content:encoded><![CDATA[<p>Generate a self cert certificate:</p>
<p><a href="https://help.ubuntu.com/8.04/serverguide/C/certificates-and-security.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://help.ubuntu.com/8.04/serverguide/C/certificates-and-security.html');">https://help.ubuntu.com/8.04/serverguide/C/certificates-and-security.html</a></p>
<p>Create a new virtual host (you can only have one SSL virtual host / IP)</p>
<pre>sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl</pre>
<p>Edit ssl sothat it looks like this:<br />
<code>NameVirtualHost *:443<br />
<VirtualHost *:443><br />
        ServerName webangle-www1.everyangle.co.uk<br />
        ServerAdmin webmaster@localhost</p>
<p>        DocumentRoot /var/www/</p>
<p>        SSLEngine on</p>
<p>        SSLOptions +StrictRequire</p>
<p>        SSLCertificateFile /etc/ssl/certs/server.crt<br />
        SSLCertificateKeyFile /etc/ssl/private/server.key<br />
</code></p>
<p>Finally, if you want to force redirect of all traffic to a certain folder via SSL (e.g, /phpmyadmin), add the following to /etc/apache2/sites-available/default</p>
<pre>
#Redirect traffic to /phpmyadmin through https
        RewriteEngine   on
        RewriteCond     %{SERVER_PORT} ^80$
        RewriteRule     ^/phpmyadmin(.*)$ https://%{SERVER_NAME}/phpmyadmin$1 [L,R]
</pre>
<p>Enable it:</p>
<pre>sudo a2ensite ssl
sudo /etc/init.d/apache2 reload
</pre>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2008/12/27/self-cert-ssl-certificate-for-apache2-on-ubuntu-804lts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automount remote filesystem over SSH</title>
		<link>http://davidlaing.com/2008/12/27/automount-remote-filesystem-over-ssh/</link>
		<comments>http://davidlaing.com/2008/12/27/automount-remote-filesystem-over-ssh/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 23:08:31 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[autofs]]></category>
		<category><![CDATA[sshfs]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=132</guid>
		<description><![CDATA[Previously I posted on how I backup my server&#8217;s data to rsync.net&#8217;s remote storage.
A convienient way to access that remote storage is to configure rsync over sshfs:
sudo aptitude install sshfs
mkdir /mnt/sshfs
mkdir /mnt/sshfs/rsync.net
sshfs **username**@ch-s011.rsync.net: /mnt/rsync.net
Now, test that you can access /mnt/rsync.net, and copy a few files to your remote storage.  if all works well, the next step [...]]]></description>
			<content:encoded><![CDATA[<p>Previously I posted on how I backup my server&#8217;s data to rsync.net&#8217;s remote storage.</p>
<p>A convienient way to access that remote storage is to configure rsync over sshfs:</p>
<pre>sudo aptitude install sshfs
mkdir /mnt/sshfs
mkdir /mnt/sshfs/rsync.net
sshfs **username**@ch-s011.rsync.net: /mnt/rsync.net</pre>
<div>Now, test that you can access /mnt/rsync.net, and copy a few files to your remote storage.  if all works well, the next step is to <a href="http://www.tjansson.dk/?p=84" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.tjansson.dk/?p=84');">have sshfs automatically connect whenever we try to access the directory</a></div>
<p>First, unmount</p>
<pre>fusermount -u /mnt/rsync.net</pre>
<p>Then, install autofs, and edit the config file</p>
<pre>sudo aptitude install autofs
sudo vi /etc/auto.master</pre>
<p>Add the following line </p>
<pre>/mnt/sshfs /etc/auto.sshfs --timeout=30,--ghost</pre>
<p>Then,  </p>
<pre>sudo vi /etc/auto.sshfs</pre>
<p>Add</p>
<pre>rsync.net -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs\#**username**@ch-s011.rsync.net\:</pre>
<p> </p>
<p>And finally restart autofs </p>
<pre>sudo /etc/init.d/autofs restart</pre>
<p> </p>
<p>Now, when you cd /mnt/sshfs/rsync.net, after a short delay you will automatically be connected to the remote filesystem over SSH.  After 30 seconds of inactivity, the connection will be closed.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2008/12/27/automount-remote-filesystem-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
