<?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>Otaqui.Com</title>
	<atom:link href="http://otaqui.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://otaqui.com/blog</link>
	<description>Pete Otaqui's blog about web development and everything else</description>
	<lastBuildDate>Tue, 31 Jan 2012 23:23:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Multiple jQuery instances can&#8217;t unbind each others events</title>
		<link>http://otaqui.com/blog/1115/multiple-jquery-instances-cant-unbind-each-others-events/</link>
		<comments>http://otaqui.com/blog/1115/multiple-jquery-instances-cant-unbind-each-others-events/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 10:56:05 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=1115</guid>
		<description><![CDATA[If you have multiple versions (or indeed instances of the same version) of jQuery on a page, you may end up with the problem of not being able to unbind events between them. Here&#8217;s an example:]]></description>
			<content:encoded><![CDATA[<p>If you have multiple versions (or indeed instances of the same version) of jQuery on a page, you may end up with the problem of not being able to unbind events between them.</p>
<p>Here&#8217;s an example:</p>
<script>document.write('<link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"/>')

document.write('<div id=\"gist-1267113\" class=\"gist\">\n\n        <div class=\"gist-file\">\n          <div class=\"gist-data gist-syntax\">\n              <div class=\"gist-highlight\"><pre><div class=\'line\' id=\'LC1\'><span class=\"cp\">&lt;!DOCTYPE html&gt;<\/span><\/div><div class=\'line\' id=\'LC2\'><span class=\"nt\">&lt;html&gt;<\/span><\/div><div class=\'line\' id=\'LC3\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;head&gt;<\/span><\/div><div class=\'line\' id=\'LC4\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;title&gt;<\/span>Multiple jQuery Hell<span class=\"nt\">&lt;/title&gt;<\/span><\/div><div class=\'line\' id=\'LC5\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;script <\/span><span class=\"na\">src=<\/span><span class=\"s\">&quot;jquery-1.6.3.min.js&quot;<\/span><span class=\"nt\">&gt;&lt;/script&gt;<\/span><\/div><div class=\'line\' id=\'LC6\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;script&gt;<\/span><\/div><div class=\'line\' id=\'LC7\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c1\">// keep a reference to jQuery 1.6.3, and clear the name from the global scope<\/span><\/div><div class=\'line\' id=\'LC8\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">jQuery163<\/span> <span class=\"o\">=<\/span> <span class=\"nx\">jQuery<\/span><span class=\"p\">;<\/span><\/div><div class=\'line\' id=\'LC9\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">jQuery<\/span><span class=\"p\">.<\/span><span class=\"nx\">noConflict<\/span><span class=\"p\">(<\/span><span class=\"kc\">true<\/span><span class=\"p\">);<\/span><\/div><div class=\'line\' id=\'LC10\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;/script&gt;<\/span><\/div><div class=\'line\' id=\'LC11\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;script <\/span><span class=\"na\">src=<\/span><span class=\"s\">&quot;jquery-1.6.4.min.js&quot;<\/span><span class=\"nt\">&gt;&lt;/script&gt;<\/span><\/div><div class=\'line\' id=\'LC12\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;script&gt;<\/span><\/div><div class=\'line\' id=\'LC13\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c1\">// keep a reference to jQuery 1.6.4, and clear the name from the global scope<\/span><\/div><div class=\'line\' id=\'LC14\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">jQuery164<\/span> <span class=\"o\">=<\/span> <span class=\"nx\">jQuery<\/span><span class=\"p\">;<\/span><\/div><div class=\'line\' id=\'LC15\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">jQuery<\/span><span class=\"p\">.<\/span><span class=\"nx\">noConflict<\/span><span class=\"p\">(<\/span><span class=\"kc\">true<\/span><span class=\"p\">);<\/span><\/div><div class=\'line\' id=\'LC16\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;/script&gt;<\/span><\/div><div class=\'line\' id=\'LC17\'><br/><\/div><div class=\'line\' id=\'LC18\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;script&gt;<\/span><\/div><div class=\'line\' id=\'LC19\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c1\">// check that we have two distinct jQueries<\/span><\/div><div class=\'line\' id=\'LC20\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">console<\/span><span class=\"p\">.<\/span><span class=\"nx\">log<\/span><span class=\"p\">(<\/span><span class=\"nx\">jQuery163<\/span><span class=\"p\">().<\/span><span class=\"nx\">jquery<\/span><span class=\"p\">);<\/span> <span class=\"c1\">// 1.6.3<\/span><\/div><div class=\'line\' id=\'LC21\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">console<\/span><span class=\"p\">.<\/span><span class=\"nx\">log<\/span><span class=\"p\">(<\/span><span class=\"nx\">jQuery164<\/span><span class=\"p\">().<\/span><span class=\"nx\">jquery<\/span><span class=\"p\">);<\/span> <span class=\"c1\">// 1.6.4<\/span><\/div><div class=\'line\' id=\'LC22\'><br/><\/div><div class=\'line\' id=\'LC23\'><br/><\/div><div class=\'line\' id=\'LC24\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c1\">// we could use either for the onDomReady bit ...<\/span><\/div><div class=\'line\' id=\'LC25\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">jQuery163<\/span><span class=\"p\">(<\/span><span class=\"kd\">function<\/span><span class=\"p\">()<\/span> <span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC26\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c1\">// bind a click event callback<\/span><\/div><div class=\'line\' id=\'LC27\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">jQuery163<\/span><span class=\"p\">(<\/span><span class=\"s1\">&#39;a&#39;<\/span><span class=\"p\">).<\/span><span class=\"nx\">bind<\/span><span class=\"p\">(<\/span><span class=\"s1\">&#39;click&#39;<\/span><span class=\"p\">,<\/span> <span class=\"kd\">function<\/span><span class=\"p\">()<\/span> <span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC28\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">console<\/span><span class=\"p\">.<\/span><span class=\"nx\">log<\/span><span class=\"p\">(<\/span><span class=\"s1\">&#39;clicky!&#39;<\/span><span class=\"p\">);<\/span><\/div><div class=\'line\' id=\'LC29\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">});<\/span><\/div><div class=\'line\' id=\'LC30\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c1\">// now try and unbind it<\/span><\/div><div class=\'line\' id=\'LC31\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">jQuery164<\/span><span class=\"p\">(<\/span><span class=\"s1\">&#39;a&#39;<\/span><span class=\"p\">).<\/span><span class=\"nx\">unbind<\/span><span class=\"p\">(<\/span><span class=\"s1\">&#39;click&#39;<\/span><span class=\"p\">);<\/span> <span class=\"c1\">// this doesn&#39;t unbind the click event callback<\/span><\/div><div class=\'line\' id=\'LC32\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">});<\/span><\/div><div class=\'line\' id=\'LC33\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;/script&gt;<\/span><\/div><div class=\'line\' id=\'LC34\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;/head&gt;<\/span><\/div><div class=\'line\' id=\'LC35\'><br/><\/div><div class=\'line\' id=\'LC36\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;body&gt;<\/span><\/div><div class=\'line\' id=\'LC37\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;h1&gt;<\/span>Multiple jQuery Hell<span class=\"nt\">&lt;/h1&gt;<\/span><\/div><div class=\'line\' id=\'LC38\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;a<\/span> <span class=\"na\">href=<\/span><span class=\"s\">&quot;#&quot;<\/span><span class=\"nt\">&gt;<\/span>Clicky<span class=\"nt\">&lt;/a&gt;<\/span><\/div><div class=\'line\' id=\'LC39\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nt\">&lt;/body&gt;<\/span><\/div><div class=\'line\' id=\'LC40\'><span class=\"nt\">&lt;/html&gt;<\/span><\/div><div class=\'line\' id=\'LC41\'><br/><\/div><\/pre><\/div>\n          <\/div>\n\n          <div class=\"gist-meta\">\n            <a href=\"https://gist.github.com/raw/1267113/8d9e58d2020e2c02ecee46b7797f7996f6e495f8/multiple_jquery_hell.html\" style=\"float:right;\">view raw<\/a>\n            <a href=\"https://gist.github.com/1267113#file_multiple_jquery_hell.html\" style=\"float:right;margin-right:10px;color:#666\">multiple_jquery_hell.html<\/a>\n            <a href=\"https://gist.github.com/1267113\">This Gist<\/a> brought to you by <a href=\"http://wordpress.org/extend/plugins/github-gist/\">GitHub Gist WordPress Plugin<\/a>.\n          <\/div>\n        <\/div>\n<\/div>\n')
</script><div style='margin-bottom:1em;padding:0;'><noscript><code><pre style='overflow:auto;margin:0;padding:0;border:1px solid #DDD;'>&lt;html&gt;&lt;body&gt;You are being &lt;a href=&quot;https://raw.github.com/gist/1267113/multiple_jquery_hell.html&quot;&gt;redirected&lt;/a&gt;.&lt;/body&gt;&lt;/html&gt;</pre></code></noscript></div>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/1115/multiple-jquery-instances-cant-unbind-each-others-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stop console.log causing errors in IE6 and other browsers</title>
		<link>http://otaqui.com/blog/1079/stop-console-log-causing-errors-in-ie6-and-other-browsers/</link>
		<comments>http://otaqui.com/blog/1079/stop-console-log-causing-errors-in-ie6-and-other-browsers/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 09:13:26 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=1079</guid>
		<description><![CDATA[You know what it&#8217;s like &#8230; you leave a console.log buried somewhere in your code, and the error that causes in IE stops your javascript from running. Well, this little snippet will create a fake copy of the Firebug API if it can&#8217;t find a window.console.]]></description>
			<content:encoded><![CDATA[<p>You know what it&#8217;s like &#8230; you leave a console.log buried somewhere in your code, and the error that causes in IE stops your javascript from running.  Well, this little snippet will create a fake copy of the Firebug API if it can&#8217;t find a window.console.</p>
<script>document.write('<link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"/>')

document.write('<div id=\"gist-1234379\" class=\"gist\">\n\n        <div class=\"gist-file\">\n          <div class=\"gist-data gist-syntax\">\n              <div class=\"gist-highlight\"><pre><div class=\'line\' id=\'LC1\'><br/><\/div><div class=\'line\' id=\'LC2\'><span class=\"cm\">/**<\/span><\/div><div class=\'line\' id=\'LC3\'><span class=\"cm\"> * Create a fake console api, mimicing Firebug.<\/span><\/div><div class=\'line\' id=\'LC4\'><span class=\"cm\">*/<\/span><\/div><div class=\'line\' id=\'LC5\'><span class=\"p\">(<\/span><span class=\"kd\">function<\/span><span class=\"p\">(<\/span><span class=\"nx\">global<\/span><span class=\"p\">)<\/span> <span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC6\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"kd\">var<\/span> <span class=\"nx\">noop<\/span> <span class=\"o\">=<\/span> <span class=\"kd\">function<\/span><span class=\"p\">(){};<\/span><\/div><div class=\'line\' id=\'LC7\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"k\">if<\/span> <span class=\"p\">(<\/span> <span class=\"o\">!<\/span><span class=\"nx\">global<\/span><span class=\"p\">[<\/span><span class=\"s1\">&#39;console&#39;<\/span><span class=\"p\">]<\/span> <span class=\"p\">)<\/span> <span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC8\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">global<\/span><span class=\"p\">.<\/span><span class=\"nx\">console<\/span> <span class=\"o\">=<\/span> <span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC9\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">log<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC10\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">debug<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC11\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">info<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC12\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">warn<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC13\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">error<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC14\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">assert<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC15\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">clear<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC16\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">dir<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC17\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">dirxml<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC18\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">trace<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC19\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">group<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC20\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">groupCollapsed<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC21\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">groupEnd<\/span> <span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC22\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">time<\/span><span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC23\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">timeEnd<\/span><span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC24\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">profile<\/span><span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC25\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">profileEnd<\/span><span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC26\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">count<\/span><span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC27\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">exception<\/span><span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><span class=\"p\">,<\/span><\/div><div class=\'line\' id=\'LC28\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nx\">table<\/span><span class=\"o\">:<\/span> <span class=\"nx\">noop<\/span><\/div><div class=\'line\' id=\'LC29\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">}<\/span><\/div><div class=\'line\' id=\'LC30\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">}<\/span><\/div><div class=\'line\' id=\'LC31\'><span class=\"p\">})(<\/span><span class=\"nb\">window<\/span><span class=\"p\">);<\/span><\/div><div class=\'line\' id=\'LC32\'><br/><\/div><div class=\'line\' id=\'LC33\'><br/><\/div><\/pre><\/div>\n          <\/div>\n\n          <div class=\"gist-meta\">\n            <a href=\"https://gist.github.com/raw/1234379/370a74da3b3fcfcf1bfc1d5641fdc75430b656f9/fake_console.js\" style=\"float:right;\">view raw<\/a>\n            <a href=\"https://gist.github.com/1234379#file_fake_console.js\" style=\"float:right;margin-right:10px;color:#666\">fake_console.js<\/a>\n            <a href=\"https://gist.github.com/1234379\">This Gist<\/a> brought to you by <a href=\"http://wordpress.org/extend/plugins/github-gist/\">GitHub Gist WordPress Plugin<\/a>.\n          <\/div>\n        <\/div>\n<\/div>\n')
</script><div style='margin-bottom:1em;padding:0;'><noscript><code><pre style='overflow:auto;margin:0;padding:0;border:1px solid #DDD;'>&lt;html&gt;&lt;body&gt;You are being &lt;a href=&quot;https://raw.github.com/gist/1234379/fake_console.js&quot;&gt;redirected&lt;/a&gt;.&lt;/body&gt;&lt;/html&gt;</pre></code></noscript></div>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/1079/stop-console-log-causing-errors-in-ie6-and-other-browsers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Javascript Validator Library &#8211; Validator.js</title>
		<link>http://otaqui.com/blog/1076/simple-javascript-validator-library-validator-js/</link>
		<comments>http://otaqui.com/blog/1076/simple-javascript-validator-library-validator-js/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 05:58:36 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=1076</guid>
		<description><![CDATA[I had a need to do some data validation in javascript, and all the libraries I looked at seemed quite opinionated about *what* you were going to validate &#8211; i.e. form data &#8211; let alone the increase in server-side javascript in the last couple of years. My data wasn&#8217;t directly tied to a form, so [...]]]></description>
			<content:encoded><![CDATA[<p>I had a need to do some data validation in javascript, and all the libraries I looked at seemed quite opinionated about *what* you were going to validate &#8211; i.e. form data &#8211; let alone the increase in server-side javascript in the last couple of years. My data wasn&#8217;t directly tied to a form, so it didn&#8217;t quite seem worthwhile trying to shoe horn my needs into what the libraries expected, and I could also see a need for a validation library that could be adapted for Node.</p>
<p>Enter <a href="https://pete-otaqui.github.com/Validator.js">Validator.js</a>.</p>
<p>Validator&#8217;s only dependency is on <a href="http://documentcloud.github.com/underscore.js">underscore.js</a> from Document Cloud.</p>
<p>Validator has two usage forms: the first for very quick and simple one-off cases:</p>
<pre class="brush: javascript">
// Simple use:
var result
result = Validator.isEmail(&#039;not_an_email&#039;);
console.log(result); // false
result = Validator.isEmail(&#039;joe@example.com&#039;);
console.log(result); // true
</pre>
<p>I found this on its own quite a lot more flexible than most of the form-driven libraries out there.  However, I also wanted to be able to create more complex sets of validations to run on a piece of data.  For that case, you create an instance of Validator and use it&#8217;s add() method:</p>
<pre class="brush: javascript">
var result,
    myValidator

myValidator = new Validator();

myValidator.add(&#039;unique&#039;);
myValidator.add(&#039;minLength&#039;, 6);

result = myValidator.validate( [1, 2, 3, 4, 5, 6, 6] );
console.log(result); // false, the array is long enough but contains non-unique members
</pre>
<p>This got me a fair bit closer to what I wanted, but you don&#8217;t know which part failed, so it&#8217;s harder to give reasonable feedback. I added a set of error messages to validator instances which gets populated after a call to validate():</p>
<pre class="brush: javascript">
var result,
    myValidator

myValidator = new Validator();

myValidator.add(&#039;unique&#039;);
myValidator.add(&#039;minLength&#039;, 6);
myValidator.add(&#039;maxLength&#039;, 8);

result = myValidator.validate( [1, 2, 3, 4, 5, 6, 6, 8, 9, 10] );
console.log(result); // false, the array is long enough but contains non-unique members
console.log(myValidator.errors);
/*
myValidator.errors == [
    &#039;The list must be made up of unique items&#039;,
    &#039;The list is too long&#039;
]
*/
</pre>
<p>Again, this is pretty good but even though Validator supports adding messages in any language you want and falling back (by default) to English (see the source code), default error messages still aren&#8217;t always what you need.  I also added the ability to set a custom error message per &#8220;validation&#8221;.</p>
<pre class="brush: javascript">
var result,
    myValidator

myValidator = new Validator();

myValidator.add(&#039;unique&#039;).message(&#039;You are repeating yourself&#039;);
myValidator.add(&#039;minLength&#039;, 6).message(&#039;Too tiny!&#039;);
myValidator.add(&#039;maxLength&#039;, 8).message(&#039;Too bloated!&#039;);

result = myValidator.validate( [1, 2, 3, 4, 5, 6, 6, 8, 9, 10] );
console.log(result); // false, the array is long enough but contains non-unique members
console.log(myValidator.errors);
/*
myValidator.errors == [
    &#039;You are repeating yourself&#039;,
    &#039;Too bloated!&#039;
]
*/
</pre>
<p>You can also chain calls to add() and message():</p>
<pre class="brush: javascript">
var result,
    myValidator

myValidator = new Validator();

myValidator.add(&#039;unique&#039;).message(&#039;You are repeating yourself&#039;)
    .add(&#039;minLength&#039;, 6).message(&#039;Too tiny!&#039;)
    .add(&#039;maxLength&#039;, 8).message(&#039;Too bloated!&#039;);
</pre>
<p>I&#8217;ve added some code which should make it easy to use this as a CommonJS AMD javascript module.  In it&#8217;s default form you can just include it with a script tag.</p>
<p>If you&#8217;re interested in developing Validator itself, the project is tested with <a href="http://pivotal.github.com/jasmine/">Jasmine</a> and documented with <a href="http://code.google.com/p/jsdoc-toolkit/">JSDoc</a>.  Both of these can be run with Rake, and the easiest way to get setup is to use <a href="http://gembundler.com/">Bundler</a>.  Once you&#8217;ve got the dependencies you get three rake tasks:</p>
<pre class="brush: bash">
# Start the jasmine server, and open http://localhost:8888/ to run the test suite:
$ rake jasmine
# Start the jasmine server and also run a browser through the tests automatically:
$ rake jasmine:ci
# Generate the docs
$ rake jsdoc
</pre>
<p>If you fork the project and add any more validations, please also add tests and docs.</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/1076/simple-javascript-validator-library-validator-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing remote (PHP) websites with Capybara, Cucumber, Mechanize, Selenium 2 Webdriver &#8230; and SauceLabs</title>
		<link>http://otaqui.com/blog/1072/testing-remote-php-websites-with-capybara-cucumber-mechanize-selenium-2-webdriver-and-saucelabs/</link>
		<comments>http://otaqui.com/blog/1072/testing-remote-php-websites-with-capybara-cucumber-mechanize-selenium-2-webdriver-and-saucelabs/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 14:40:16 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[capybara]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=1072</guid>
		<description><![CDATA[This is more or less the perfect setup for me, and it lets us run our tests against our PHP web application using the very fast mechanize driver where possible, and for tests that require javascript we can use either the &#8220;normal&#8221; selenium driver in capybara, or send the tests off to your local grid, [...]]]></description>
			<content:encoded><![CDATA[<p>This is more or less the perfect setup for me, and it lets us run our tests against our PHP web application using the very fast mechanize driver where possible, and for tests that require javascript we can use either the &#8220;normal&#8221; selenium driver in capybara, or send the tests off to your local grid, or even send them off to Sauce Labs where we want to cover more platforms and versions than we have setup locally.</p>
<p>https://gist.github.com/1139797</p>
<p><script src="https://gist.github.com/1139797.js"> </script></p>
<p>Next step &#8230; running the tests in parallel!</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/1072/testing-remote-php-websites-with-capybara-cucumber-mechanize-selenium-2-webdriver-and-saucelabs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Conway&#8217;s Game of Life in Javascript</title>
		<link>http://otaqui.com/blog/1020/building-conways-game-of-life-in-javascript/</link>
		<comments>http://otaqui.com/blog/1020/building-conways-game-of-life-in-javascript/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 12:00:06 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=1020</guid>
		<description><![CDATA[As part of an interesting exercise at work, I built an implementation of Conway&#8217;s Game Of Life in Javascript. If you haven&#8217;t come across the Game Of Life, it&#8217;s really quite interesting and worth looking at. My colleagues also made variations, including canvas-based and Web GL 3 dimensional (there was even discussion about n-dimensional, with [...]]]></description>
			<content:encoded><![CDATA[<p>As part of an interesting exercise at work, I built an implementation of <a href="http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Conway&#8217;s Game Of Life</a> in Javascript.  If you haven&#8217;t come across the Game Of Life, it&#8217;s really quite interesting and worth looking at.  My colleagues also made variations, including canvas-based and Web GL 3 dimensional (there was even discussion about n-dimensional, with sliders to view the 4th, 5th and further dimensions).  My particular take was to make the game space &#8220;infinite&#8221; rather than a fixed grid.</p>
<p>It&#8217;s not really infinite of course, I haven&#8217;t made any attempt to have a position greater than Number.MAX_VALUE.  The real point is that it is possible to have a huge playing area, and only the living &#038; possibly-living-next-round cells are taken into account.</p>
<p>I avoided using any ready-made frameworks, in part so that it could be transported to the server-side on top of something like <a href="http://nodejs.org">NodeJS</a> &#8211; I was imagining a multi-player game where each user could &#8220;paint&#8221; cells onto the canvas, and maybe even that next-generation cells would take an identifier from their parents, letting people &#8220;fight&#8221;.  I haven&#8217;t really got the time for that at the moment, but it seemed a nice idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/1020/building-conways-game-of-life-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting a reference to an unselected radiobutton (using jQuery)</title>
		<link>http://otaqui.com/blog/1033/getting-a-reference-to-an-unselected-radiobutton-using-jquery/</link>
		<comments>http://otaqui.com/blog/1033/getting-a-reference-to-an-unselected-radiobutton-using-jquery/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 11:59:09 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=1033</guid>
		<description><![CDATA[The &#8220;change&#8221; event on a radiobutton input only fires when it becomes selected. If you want to trigger some behaviour on an unselected radiobutton, then you have to bind to the change event of the radiogroup, which you can do like so: &#60;ul&#62; &#60;li&#62; &#60;input id=&#34;r1&#34; name=&#34;something&#34; type=&#34;radio&#34; value=&#34;basic&#34; /&#62; &#60;label for=&#34;r1&#34;&#62;Basic&#60;/label&#62; &#60;/li&#62; &#60;li&#62; &#60;input [...]]]></description>
			<content:encoded><![CDATA[<p>The &#8220;change&#8221; event on a radiobutton input only fires when it becomes selected.  If you want to trigger some behaviour on an unselected radiobutton, then you have to bind to the change event of the radiogroup, which you can do like so:</p>
<pre class="brush: html">
&lt;ul&gt;
  &lt;li&gt;
    &lt;input id=&quot;r1&quot; name=&quot;something&quot; type=&quot;radio&quot; value=&quot;basic&quot; /&gt;
    &lt;label for=&quot;r1&quot;&gt;Basic&lt;/label&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;input id=&quot;r2&quot; name=&quot;something&quot; type=&quot;radio&quot; value=&quot;standard&quot; /&gt;
    &lt;label for=&quot;r2&quot;&gt;Standard&lt;/label&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;input id=&quot;r3&quot; name=&quot;something&quot; type=&quot;radio&quot; value=&quot;advanced&quot; /&gt;
    &lt;label for=&quot;r3&quot;&gt;Advanced&lt;/label&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;script&gt;
$(&quot;input[name=&#039;inputName&#039;]&quot;).change(function(ev) {

});
&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/1033/getting-a-reference-to-an-unselected-radiobutton-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RTL Input text with large text-indent value &#8220;magically scrolls&#8221; in Opera</title>
		<link>http://otaqui.com/blog/1028/rtl-input-text-with-large-text-indent-value-magically-scrolls-in-opera/</link>
		<comments>http://otaqui.com/blog/1028/rtl-input-text-with-large-text-indent-value-magically-scrolls-in-opera/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 16:32:31 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=1028</guid>
		<description><![CDATA[This is a pretty weird browser bug. Opera RTL Scrolly Text Indent Bug. If your content is RTL and you are using the large text-indent CSS property on an input tag (so that you can use a background image, while keeping the text invisible to most users but still available to screen readers) you get [...]]]></description>
			<content:encoded><![CDATA[<p>This is a pretty weird browser bug.</p>
<p><a href="http://otaqui.com/code/opera-rtl-scrolly-text-indent/">Opera RTL Scrolly Text Indent Bug</a>.</p>
<p>If your content is RTL and you are using the large text-indent CSS property on an input tag (so that you can use a background image, while keeping the text invisible to most users but still available to screen readers) you get a couple of odd behaviours in Opera:</p>
<ol>
<li>The text is not indented.  Well ok, that&#8217;s at least a &#8220;normal&#8221; kind of bug.</li>
<li>If you right-click on the button, and leave the menu open for a few seconds, the text <em><strong>magically starts scrolling out of the way</strong></em>.</li>
</ol>
<p>I&#8217;ve submitted a bug report to Opera.  I&#8217;d be interested if anyone else is seeing the same behaviour, or any related RTL weirdness.</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/1028/rtl-input-text-with-large-text-indent-value-magically-scrolls-in-opera/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript EventEmitter Redux, now on github</title>
		<link>http://otaqui.com/blog/1025/javascript-eventemitter-redux-now-on-github/</link>
		<comments>http://otaqui.com/blog/1025/javascript-eventemitter-redux-now-on-github/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 14:37:00 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=1025</guid>
		<description><![CDATA[I&#8217;ve added some more features to the EventEmitter mixin (like actually working listener removal) and posted it to github: EventEmitter on github It&#8217;s fairly simple to use &#8230; something like this: var MyKlass = function() {}; EventEmitter.augment(MyKlass.prototype); /** * Show me * * @fires shown */ MyKlass.prototype.showMe = function() { this.trigger(&#039;shown&#039;, {&#039;visible&#039;:true}); } var myInstance [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added some more features to the EventEmitter mixin (like actually working listener removal) and posted it to github:</p>
<p><a href="https://github.com/pete-otaqui/EventEmitter">EventEmitter on github</a></p>
<p>It&#8217;s fairly simple to use &#8230; something like this:</p>
<pre class="brush: javascript">
var MyKlass = function() {};
EventEmitter.augment(MyKlass.prototype);

/**
 * Show me
 *
 * @fires shown
 */
MyKlass.prototype.showMe = function() {
  this.trigger(&#039;shown&#039;, {&#039;visible&#039;:true});
}

var myInstance = new MyKlass();
myInstance.on(&#039;shown&#039;, function(e) {
  console.log(e.visible);
}
myInstance.showMe();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/1025/javascript-eventemitter-redux-now-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Vertical Split support to GNU Screen in Mac OS X Snow Leopard</title>
		<link>http://otaqui.com/blog/1011/adding-vertical-split-support-to-gnu-screen-in-mac-os-x-snow-leopard/</link>
		<comments>http://otaqui.com/blog/1011/adding-vertical-split-support-to-gnu-screen-in-mac-os-x-snow-leopard/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 09:27:44 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[command-line]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=1011</guid>
		<description><![CDATA[Evan Meagher supplies a great patch to the source of GNU Screen which adds vertical split support on OS X. This is really useful, since so many displays are widescreen these days, and it also means you can create a reasonable dashboard with screen. The patch has worked without a hitch for me so far. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://evanmeagher.net/2010/12/patching-screen-with-vertical-split-in-os">Evan Meagher supplies a great patch</a> to the source of GNU Screen which adds vertical split support on OS X.</p>
<p>This is really useful, since so many displays are widescreen these days, and it also means you can create a reasonable dashboard with screen.  The patch has worked without a hitch for me so far.</p>
<p>Thanks Evan!</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/1011/adding-vertical-split-support-to-gnu-screen-in-mac-os-x-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript EventEmitter Mixin</title>
		<link>http://otaqui.com/blog/953/javascript-eventemitter-mixin/</link>
		<comments>http://otaqui.com/blog/953/javascript-eventemitter-mixin/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 21:18:58 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=953</guid>
		<description><![CDATA[/** * EventEmitter Mixin * * Designed to be used in conjunction with a mixin &#34;augment&#34; function, * such as http://chamnapchhorn.blogspot.com/2009/05/javascript-mixins.html * * @usage augment(MyClass, EventEmitter); * my_inst = new MyClass(); * my_inst.on(&#039;someEvent&#039;, function(e){ console.dir(e); }); * my_inst.trigger(&#039;someEvent&#039;, {eventProp:&#039;value&#039;}); */ var EventEmitter = function() {}; EventEmitter.prototype.on = function(name, callback, context) { if ( !context ) [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: javascript">
/**
 * EventEmitter Mixin
 *
 * Designed to be used in conjunction with a mixin &quot;augment&quot; function,
 * such as http://chamnapchhorn.blogspot.com/2009/05/javascript-mixins.html
 *
 * @usage augment(MyClass, EventEmitter);
 * my_inst = new MyClass();
 * my_inst.on(&#039;someEvent&#039;, function(e){ console.dir(e); });
 * my_inst.trigger(&#039;someEvent&#039;, {eventProp:&#039;value&#039;});
 */
var EventEmitter = function() {};
EventEmitter.prototype.on = function(name, callback, context) {
  if ( !context ) context = this;
  if ( !this._listeners ) this._listeners = {};
  if ( !this._listeners[name] ) this._listeners[name] = [];
  var f = function(e) { callback.apply(context, [e]); };
  this._listeners[name].push(f);
};
EventEmitter.prototype.trigger = function(name, event) {
  if ( !this._listeners ) this._listeners = {};
  if ( !this._listeners[name] ) return;
  var i = this._listeners[name].length;
  while ( i-- ) this._listeners[name][i](event);
};
EventEmitter.prototype.removeListener = function(name, callback) {
  if ( !this._listeners ) this._listeners = {};
  if ( !this._listeners[name] ) return;
  var i = this._listeners[name].length;
  while ( i-- ) {
    if ( this._listeners[name][i] === callback ) {
      this._listeners[name].splice(i, 1);
    }
  }
};
</pre>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/953/javascript-eventemitter-mixin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Started work on jQuery UI Modal widget</title>
		<link>http://otaqui.com/blog/919/started-work-on-jquery-ui-modal-widget/</link>
		<comments>http://otaqui.com/blog/919/started-work-on-jquery-ui-modal-widget/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 14:26:49 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=919</guid>
		<description><![CDATA[I&#8217;ve started working a jQuery UI Modal widget, for use in a project built on top of the widget library. We have very high accessibility standards, and the current &#8220;{modal:true}&#8221; option for the dialog widget unfortunately wasn&#8217;t as good as we needed. Seeing that the team had identified the need for a standalone Modal widget, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started working a jQuery UI Modal widget, for use in a project built on top of the widget library.</p>
<p>We have very high accessibility standards, and the current &#8220;{modal:true}&#8221; option for the dialog widget unfortunately wasn&#8217;t as good as we needed.  Seeing that the team had identified the need for <a href="http://wiki.jqueryui.com/Modal">a standalone Modal widget</a>, the team thought we could try and get the ball rolling.</p>
<p>You can see the work in progress here in <a href="http://github.com/pete-otaqui/jquery-ui/blob/master/ui/jquery.ui.modal.js">the modal widget in my fork of jquery ui</a>.</p>
<p>I&#8217;ve also been having <a href="http://forum.jquery.com/topic/refactoring-dialog-overlay-in-preparation-for-modal-better-keyboard-accessibility">a discssion about the modal widget</a> with Scott Gonzalez of the jQuery UI team.</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/919/started-work-on-jquery-ui-modal-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSSP: Loading CSS with Javascript &#8211; and getting an onload callback.</title>
		<link>http://otaqui.com/blog/890/cssp-loading-css-with-javascript-and-getting-an-onload-callback/</link>
		<comments>http://otaqui.com/blog/890/cssp-loading-css-with-javascript-and-getting-an-onload-callback/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 14:16:18 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=890</guid>
		<description><![CDATA[It seems fairly straightforward to require CSS with Javascript. The most obvious method that I thought of was creating a &#60;link&#62; tag and appending it to the head of the document. An alternative would be to load the text of the css file with an ajax XHR call, and then inject that into a &#60;style&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>It seems fairly straightforward to require CSS with Javascript.  The most obvious method that I thought of was creating a &lt;link&gt; tag and appending it to the head of the document. An alternative would be to load the text of the css file with an ajax XHR call, and then inject that into a &lt;style&gt; tag.</p>
<p>These are both fine for most cases, but what about a situation where you have a hard dependency on the css for the javascript to work correctly?  You could take a best-guess at a wait time for the CSS to load, or even set the XHR to be synchronous &#8211; however both of these are very poor for both actual and perceived performance of your page (and the former may simply fail).</p>
<p>When might this be the case?  Let&#8217;s say you have some asynchronously loaded javascript that is intended to create a widget on the page, something like this (which assumes you are using jQuery as your dom library):</p>
<pre class="brush: javascript">

function moveLargePanels() {
    // make a panel container for large panels
    $(&#039;&lt;div id=&quot;largePanelContainer&quot;&gt;&lt;/div&gt;&#039;)
        .appendTo(&#039;body&#039;);
    $(&#039;.panel&#039;).each( function(i, panel) {
        if ( panel.outerWidth() &gt; 300 ) {
            panel.appendTo(&#039;#largePanelContainer&#039;);
        }
    }
}
</pre>
<p>And some corresponding CSS:</p>
<pre class="brush: css">
.panel {
    border:1px solid #000;
    padding: 20px;
}
</pre>
<p>The idea here is that, since there is some interaction between the logic in the javascript (a test for the &#8220;outerWidth&#8221;) and the styling in the CSS (setting the padding) that the javascript can only work correctly once the CSS has been loaded and applied.</p>
<p>This should be fine right?  Start the javascript and the css loading, and have events attached to the load of each letting you know when everything is ready and it&#8217;s safe to fire &#8220;moveLargePanels()&#8221;.  Wrong, or at least tricky, and essentially impossible if the CSS is loaded from a different domain to the hosting webpage.</p>
<p>You can get James Burke&#8217;s excellent description of this problem here:<br />
<a href="http://requirejs.org/docs/faq-advanced.html#css">http://requirejs.org/docs/faq-advanced.html#css</a><br />
And a first pass at solving this (in some browsers) here:<br />
<a href="http://bugs.dojotoolkit.org/ticket/5402">http://bugs.dojotoolkit.org/ticket/5402</a></p>
<p>Burke mentions a using a &#8220;well known&#8221; style rule to test whether the style is loaded.  I suggest a standard pattern for the rule, and also a mechanism for dynamically setting it.</p>
<h2>Enter CSSP</h2>
<p>You may have heard of <a href="http://remysharp.com/2007/10/08/what-is-jsonp/">JsonP</a> &#8211; a way of serving dynamically generated JSON which is padded with a method call (the method name is supplied in the query string of the URL), which allows for cross domain loading of javascript.  The idea behind CSSP is similar &#8211; it defines a pattern for loading css cross domain.  Instead of wrapping in a callback though, we can use the URL query string mechanism to supply the special &#8220;test rule&#8221; that we use.</p>
<h3>Dynamic Rule Pattern</h3>
<p>Given this url:</p>
<p>http://someserver.com/stylefile.css?cssp=123456</p>
<pre class="brush: php">
.panel { ... }
.largePanelsContainer { .. }

/* and the special rule: */
cssp { zIndex:123456; }
</pre>
<p>So, in whatever loader we want to build, we can add something like this (n.b. this isn&#8217;t tested code):</p>
<pre class="brush: javascript">
var cssp_counter = 0;
function loadCss(url, callback, className, zIndex) {
    // create a counter for special class names, so they are unique
    className = className || &#039;cssp&#039; + (cssp_counter++);
    zIndex = zIndex || 123456;
    url = url + &#039;?&#039; + className + &#039;=&#039; + zIndex;
    $(&#039;&lt;link&gt;&#039;)
        .attr({
            rel: &quot;stylesheet&quot;,
            type: &quot;text/css&quot;,
            href: url
        .appendTo(&#039;head&#039;);
    // append a dummy div to the body for the test
    var div = $(&#039;&lt;div&gt;&lt;/div&gt;&#039;)
        .addClass(className)
        .appendTo(&#039;body&#039;);
    // now poll for the z-index value:
    var cssp_interval = setInterval( function() {
        // if the zIndex is applied, we know the css has loaded
        if ( div.css(&#039;zIndex&#039;) == zIndex ) {
            div.remove();
            // callback:
            callback();
            clearInterval( cssp_interval );
        }
    }, 100);

}
</pre>
<p>The code above to do the loading and fire a callback is very naive.  It would be much better to have an event that can have listeners added, and to have some tests and some failure management like a maximum timeout.</p>
<h3>Default Rule Pattern</h3>
<p>This obviously presupposes that the CSS is dynamically generated to some degree, even just by adding the special rule to an otherwise static file.  I think that an alternative to the performance-conscious would be a &#8220;default&#8221; special rule, based on the css filename.  This needs some thought, and could well be tied to a build-step in your deployment process (you do have one, right?).  The pattern comes in two parts:</p>
<ul>
<li>There is a standard zIndex that is always used.</li>
<li>The filename includes the &#8220;special class name&#8221; that is used within.</li>
</ul>
<p>For example:</p>
<p>Given the file: <strong>styles.fhddgso9j.css</strong></p>
<pre class="brush: css">
.someclass { ... }
.otherclass { ... }

/* and the special rule */
.fhddgso9j { z-index: 123456; }
</pre>
<p>The javascript to go alone with this might look something like:</p>
<pre class="brush: javascript">
var cssp_counter = 0;
function loadCss(url, callback) {
    // create a counter for special class names, so they are unique
    className = getSpecialClassName(url);
    zIndex = 123456;
    $(&#039;&lt;link&gt;&#039;)
        .attr({
            rel: &quot;stylesheet&quot;,
            type: &quot;text/css&quot;,
            href: url
        .appendTo(&#039;head&#039;);
    // append a dummy div to the body for the test
    var div = $(&#039;&lt;div&gt;&lt;/div&gt;&#039;)
        .addClass(className)
        .appendTo(&#039;body&#039;);
    // now poll for the z-index value:
    var cssp_interval = setInterval( function() {
        // if the zIndex is applied, we know the css has loaded
        if ( div.css(&#039;zIndex&#039;) == zIndex ) {
            div.remove();
            // callback:
            callback();
            clearInterval( cssp_interval );
        }
    }, 100);
}
function getSpecialClassName(url) {
  // get just the filename, e.g. &quot;styles.9ufosdfij.css&quot;
  var filename = url.substring( url.lastIndexOf(&#039;/&#039;)+1, url.length);
  // split on the &quot;.&quot; marks
  var parts = filename.split(&#039;.&#039;);
  // assume it will be the second-to-last part (since the last should be &quot;css&quot;)
  var className = parts[ parts.length-2 ];
  return className;
}
</pre>
<p>As noted above, this naive, untested code.</p>
<h2>Wrapping Up</h2>
<p>Ideally I&#8217;d like any &#8220;css loader&#8221; to use actual browser events (or properties) where possible, and to fallback on this setup as a last resort.</p>
<p>If I get time I&#8217;ll implement this and put the code on github.  Please do get in touch if you&#8217;d like to pair on this!</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/890/cssp-loading-css-with-javascript-and-getting-an-onload-callback/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Review of &#8220;Simplicity is Highly Overrated&#8221;</title>
		<link>http://otaqui.com/blog/697/review-of-simplicity-is-highly-overrated/</link>
		<comments>http://otaqui.com/blog/697/review-of-simplicity-is-highly-overrated/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 05:05:05 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=697</guid>
		<description><![CDATA[Dan Norman writes that &#8220;simplicity is highly overrated&#8221; and asks whether you would buy an equivalent product with less features for the same, or more, money. Dan is a usability expert and although says that while he prefers simplicity and what I would call &#8220;poignancy&#8221; in design, most purchases are not based on the premise [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jnd.org/dn.mss/simplicity_is_highly.html">Dan Norman writes that &#8220;simplicity is highly overrated&#8221;</a> and asks whether you would buy an equivalent product with less features for the same, or more, money.</p>
<p>Dan is a usability expert and although says that while he prefers simplicity and what I would call &#8220;poignancy&#8221; in design, most purchases are not based on the premise of being &#8220;just right&#8221;.  The article is a good read, but I think he misses a swathe of well selling products. He details various things like washing machines and other white goods (although lots of the same issues apply to software) but completely misses any discussion of personal electronics, and how long can one talk about design in that area without mentioning the ipod.</p>
<p>When the ipod first came out it was a very poor cousin to a great deal of its competitors in terms of features, let alone the number of controls.  It could play fewer music formats, it stopped you from powerful management of your music, it didn&#8217;t even have a radio!  Yet it sold incredibly well and very quickly got to the same point in the public consciousness that the Sony WalkMan did where a single product&#8217;s name became synonymous with a whole class of devices.</p>
<p>The ipod was not cheap.  Nor, despite its simplicity, did it *look* cheap, which Dan seems to be suggesting is inevitable.   It was excellently marketed, but it was also just a really good product with the entire user interface (what there was of it &#8211; not even a radio remember, let alone picture-viewing or other features that other mp3 players had at the time) being very simple to use.</p>
<p>Adding features is the &#8220;simple&#8221; way to try and boost the cost and sales of product (or a piece of software) but making &#8220;simplicity&#8221; the key feature that makes it worth more is pretty hard to beat in the long run.</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/697/review-of-simplicity-is-highly-overrated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe CS3 &#8220;licensing for this product has stopped working&#8221; fix</title>
		<link>http://otaqui.com/blog/699/adobe-cs3-licensing-for-this-product-has-stopped-working-fix/</link>
		<comments>http://otaqui.com/blog/699/adobe-cs3-licensing-for-this-product-has-stopped-working-fix/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 09:55:00 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=699</guid>
		<description><![CDATA[After getting a new computer, and restoring my old system from a Time Machine backup, I found my Adobe Web Premium CS3 stopped working. Every application I started (Photoshop, Fireworks, Flash, etc) gave the error message: Licensing for this product has stopped working. After following every suggestion I could find in Adobe&#8217;s knowledge base and [...]]]></description>
			<content:encoded><![CDATA[<p>After getting a new computer, and restoring my old system from a Time Machine backup, I found my Adobe Web Premium CS3 stopped working.  Every application I started (Photoshop, Fireworks, Flash, etc) gave the error message:</p>
<blockquote><p>Licensing for this product has stopped working.</p></blockquote>
<p>After following every suggestion I could find in Adobe&#8217;s knowledge base and various online articles, I still couldn&#8217;t get any of the applications to start.</p>
<p>As a final act of complete desperation, after many rounds of removal-reboot-reinstall, I finally ran the installer and chose a product that I had not installed before (Contribute).  Once that was done I started up the new app, and it asked me for my license key &#8211; which I entered and the app started.  Then I tried Photoshop and it started up fine!</p>
<p>So &#8211; if you didn&#8217;t do a complete install int he first place, one of the easiest things could be to add a new app to your install, and get that to reset your licensing for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/699/adobe-cs3-licensing-for-this-product-has-stopped-working-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Public Opinion</title>
		<link>http://otaqui.com/blog/695/public-opinion/</link>
		<comments>http://otaqui.com/blog/695/public-opinion/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 08:13:02 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=695</guid>
		<description><![CDATA[News networks giving a greater voice to viewers because the social web is so popular are like a chef on the Titanic who, seeing the looming iceberg and fleeing customers, figures ice is the future and starts making snow cones. via XKCD.]]></description>
			<content:encoded><![CDATA[<blockquote><p>News networks giving a greater voice to viewers because the social web is so popular are like a chef on the Titanic who, seeing the looming iceberg and fleeing customers, figures ice is the future and starts making snow cones.</p></blockquote>
<p>via <a href="http://xkcd.com/756/">XKCD</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/695/public-opinion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>If We Had A Web Of Data I Would Build &#8230;</title>
		<link>http://otaqui.com/blog/643/if-we-had-a-web-of-data-i-would-build/</link>
		<comments>http://otaqui.com/blog/643/if-we-had-a-web-of-data-i-would-build/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 14:24:45 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[linked-data]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=643</guid>
		<description><![CDATA[Georgi Kobilarov has a post up asking what would you build with a function web of data and I have a few ideas. These all need fleshing out (and probably spell-checking ;), but if I didn&#8217;t post them now I might never get round to it! Shopping I think there are a few ways you [...]]]></description>
			<content:encoded><![CDATA[<p>Georgi Kobilarov has a post up asking <a href="http://blog.georgikobilarov.com/2010/04/with-a-web-of-data-what-would-you-do/">what would you build with a function web of data</a> and I have a few ideas.  These all need fleshing out (and probably spell-checking ;), but if I didn&#8217;t post them now I might never get round to it!</p>
<p><strong>Shopping</strong></p>
<p>I think there are a few ways you could use a web of linked data to make online grocery shopping better &#8211; comparing prices across stores, create shopping lists from recipes, and get recipes from lists of goods.</p>
<p><strong>Recruitment</strong></p>
<p>With jobs and resumés available as linked data, recruitment could become much more machine-enabled, giving managers better abilities to find people themselves rather than relying on agents who don&#8217;t always understand their clients&#8217; business or industry.  It could also help people looking for work in a similar way.  Types of skill, training and qualification could also be linked in, as could &#8220;linkedin&#8221; style personal recommendations.</p>
<p><strong>E-Learning</strong></p>
<p>Serious attempts have been made at making learning materials shareable and reusable.  As part of the data web, finding and consuming these materials becomes easier but more than that we could build a development plan generator.  Competency can be aligned to skills or training received, something that could be useful to government departments, schools, universities and business.</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/643/if-we-had-a-web-of-data-i-would-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BBC Fisheye Greasemonkey Script</title>
		<link>http://otaqui.com/blog/646/bbc-fisheye-greasemonkey-script/</link>
		<comments>http://otaqui.com/blog/646/bbc-fisheye-greasemonkey-script/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 09:15:08 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=646</guid>
		<description><![CDATA[Greasemonkey script to reformat &#8220;Author&#8221; select elements on the BBC&#8217;s Fisheye repository browser, which are ridiculously long (because they contain a considerable chunk of certificate data) which messes with the whole page layout. Shrinking the selects to a more reasonable width fixes this and makes the site more usable. http://otaqui.com/code/bbc-fisheye/bbc-fisheye.user.js // ==UserScript== // @name BBC [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.greasespot.net/">Greasemonkey</a> script to reformat &#8220;Author&#8221; select elements on the BBC&#8217;s Fisheye repository browser, which are ridiculously long (because they contain a considerable chunk of certificate data) which messes with the whole page layout.  Shrinking the selects to a more reasonable width fixes this and makes the site more usable.</p>
<p><a href="http://otaqui.com/code/bbc-fisheye/bbc-fisheye.user.js">http://otaqui.com/code/bbc-fisheye/bbc-fisheye.user.js</a></p>
<pre class="brush: javascript">
// ==UserScript==
// @name           BBC FishEye
// @namespace      http://otaqui.com/code/bbc-fisheye
// @description    Make BBC&#039;s Fisheye look more like it should
// @include        https://fisheye.dev.bbc.co.uk/*
// ==/UserScript==
var elems = document.evaluate(
    &#039;//select[@name=&quot;wbauthor&quot;]&#039;,
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null
);
var i=0;
var sel;
while ( sel = elems.snapshotItem(i++) ) sel.style.width = &#039;200px&#039;;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/646/bbc-fisheye-greasemonkey-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things a family can do with a new DSLR</title>
		<link>http://otaqui.com/blog/609/things-a-family-can-do-with-a-new-dslr/</link>
		<comments>http://otaqui.com/blog/609/things-a-family-can-do-with-a-new-dslr/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 13:28:18 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[baby]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[photography]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=609</guid>
		<description><![CDATA[So you&#8217;ve just got a shiny new DSLR camera (maybe a Nikon D3000 or something similar) to take nice pictures of your family.  Some friends of mine are in this situation, so I thought I&#8217;d write a post with some tips.  You could also check out my other photography posts. Portraits Portraits don&#8217;t always have [...]]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;ve just got a shiny new DSLR camera (maybe a Nikon D3000 or something similar) to take nice pictures of your family.  Some friends of mine are in this situation, so I thought I&#8217;d write a post with some tips.  You could also check out <a href="http://otaqui.com/blog/tag/photgraphy/">my other photography posts</a>.</p>
<p><strong>Portraits</strong></p>
<p><a href="http://otaqui.com/blog/wp-content/uploads/DSC_00601.jpg"><img src="http://otaqui.com/blog/wp-content/uploads/DSC_00601-150x150.jpg" alt="Hope the wind doesn&#039;t change" title="Yasmine Portrait" width="150" height="150" class="alignleft size-thumbnail wp-image-612" /></a> Portraits don&#8217;t always have to be formal and posed.  I&#8217;d call this a portrait shot of my daughter showing off her face-pulling skills.  There is one technical thing to note here, which will help all your portraits a lot &#8211; notice how everything in <strong><em>the background is really blurry</em></strong>.  There isn&#8217;t much background in this shot (and that&#8217;s another good thing in a portrait) but if you look at the curtain in the left, the check pattern is almost hidden.  The fact that the only thing in sharp focus is the subject of the portrait really makes it stand out.  This picture also works because the subject is really in contrast with the background, but also has a couple of highlights that are brought out (her eyes go really well with our kitchen wall!).  Your camera will have a &#8220;Portrait&#8221; mode which will automatically try and open the aperture really wide, to get that nice &#8220;crisp subject, blurry background&#8221; look &#8211; and try zooming your lens to something like 50mm.<br />
<br style="clear:left;" /><br />
<a href="http://otaqui.com/blog/wp-content/uploads/portrait.jpg"><img src="http://otaqui.com/blog/wp-content/uploads/portrait-150x150.jpg" alt="Baby and her grandfather" title="Sido" width="150" height="150" class="alignleft size-thumbnail wp-image-616" /></a> Then there are more &#8220;classic&#8221; portraits like this one.  While this wasn&#8217;t staged, I had a fairly good idea of what I wanted on the day &#8211; a really nice picture of my daughter with her Sido (grandfather).  Something that *really* helps with all photography is good lighting, and if you can&#8217;t afford vast sums for both a professional light rig and a team of monkeys to lug it around for you, then <strong><em>natural light is your best friend</em></strong>.  Direct sunlight coming from the side will often give your subject a lovely dark / light contrast, as in this picture.<br />
<br style="clear:both" /><br />
<a href="http://otaqui.com/blog/wp-content/uploads/DSC_0240.jpg"><img src="http://otaqui.com/blog/wp-content/uploads/DSC_0240-150x150.jpg" alt="Very cosy" title="Cosy" width="150" height="150" class="alignleft size-thumbnail wp-image-622" /></a> If you look at a lot of &#8220;professional&#8221; pictures of babies, you&#8217;ll notice they are very often <strong><em>wrapped in a plain, white blanket</em></strong> (preferably natural fibres with a good texture).  This makes the whole picture really cosy.  You can also try taking a picture of them &#8220;along their length&#8221; making sure you focus on their face or other interesting feature (toes are a favourite).<br />
<br style="clear:both" /><br />
<strong>Composition &#038; The Rule of Thirds</strong></p>
<p><a href="http://otaqui.com/blog/wp-content/uploads/portrait_thirds.jpg"><img src="http://otaqui.com/blog/wp-content/uploads/portrait_thirds-150x150.jpg" alt="The rule of thirds" title="The rule of thirds" width="150" height="150" class="alignleft size-thumbnail wp-image-629" /></a> I&#8217;ve added in some rough lines dividing this image into thirds, to show you something about composition called the &#8220;rule of thirds&#8221;.  If you imagine the frame of any imagedivided into thirds, you get <strong><em>four points around the centre that make excellent points of interest</em></strong>.  This particular one isn&#8217;t perfectly on those points, but is near enough that the whole thing feels &#8220;balanced&#8221;.</p>
<p>One of the great things about modern high resolution cameras, is that you can crop an image quite a lot and still have something that looks great.  Don&#8217;t be afraid of shooting &#8220;more than you need&#8221; and then composing the image later in your computer (or even on the camera if it has that feature).  This is something I did a lot in the darkroom years ago, and it isn&#8217;t cheating!<br />
<br style="clear:both" /><br />
<strong>Forget the Rules</strong></p>
<p><a href="http://otaqui.com/blog/wp-content/uploads/DSC_0837.jpg"><img src="http://otaqui.com/blog/wp-content/uploads/DSC_0837-150x150.jpg" alt="Very handy" title="Handy" width="150" height="150" class="alignleft size-thumbnail wp-image-620" /></a> You can, of course, forrget all the rules (although <strong><em>it does help if you know them before you break them</em></strong>).  Personally I love this picture even though it was an accident, the composition is weird and the colours are all wrong, and no-one else seems to like it much.  For me, there&#8217;s something about her perfect little hand and the fact that you can just make out she&#8217;s having a nap in her favourite chair.<br />
<br style="clear:both" /></p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/609/things-a-family-can-do-with-a-new-dslr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash Script for Serving Multiple Trac Projects and Sharing Authentication</title>
		<link>http://otaqui.com/blog/600/bash-script-for-serving-multiple-trac-projects-and-sharing-authentication/</link>
		<comments>http://otaqui.com/blog/600/bash-script-for-serving-multiple-trac-projects-and-sharing-authentication/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 08:55:25 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=600</guid>
		<description><![CDATA[I use Trac for personal projects, and I share some of these out with people as required. I use tracd (TracStandalone) for this, rather than a full-blown apache setup, since it serves my needs quite nicely and is a lot easier to turn on and off as required without tweaking apache config and rebooting the [...]]]></description>
			<content:encoded><![CDATA[<p>I use Trac for personal projects, and I share some of these out with people as required.  I use tracd (TracStandalone) for this, rather than a full-blown apache setup, since it serves my needs quite nicely and is a lot easier to turn on and off as required without tweaking apache config and rebooting the whole webserver.</p>
<p>All my projects live under a single parent directory, and I prefer to share a single users digest file between them all &#8211; so ideally I wanted to share a single tracd to run all my projects.  This is fairly straightforward on the command line:</p>
<pre class="brush: bash">
tracd --hostname=webhost.com -p 9876 \
--auth=&quot;*,/path/projects/people.htdigest,Realm&quot; \
/path/projects/p1 \
/path/projects/p2
</pre>
<p>That is &#8230;.<br />
Line 1 &#8211; start tracd for a given hostname and port,<br />
Line 2 &#8211; specify auth for all projects (*), the auth file and the &#8220;Realm&#8221; you specified when creating the file with apache&#8217;s htdigest command<br />
Lines 3+ &#8211; specify as many projects as you want to run</p>
<p>This is ok with a couple of projects, but gets unwieldy quite quickly.  What I needed was a little shell script to open up all projects under a given directory quickly.  Here&#8217;s what I came up with:</p>
<pre class="brush: bash">
#!/bin/bash

# make / truncate a temp file to store names:
temp=/tmp/tracdpaths
&gt; $temp

# specify base directory:
base=/path/projects/

# output all subdirectories to temp file:
find $base -maxdepth 1 -mindepth 1 -type d \
-exec echo -n &quot;{} &quot; &gt; $temp \;

# now start tracd
tracd --hostname=webhost.com -p 9876 \
--auth=&quot;*,/path/projects/people.htdigest,Realm&quot; \
`cat $temp`
</pre>
<p>Essentially this script uses &#8216;find&#8217; to get all of the directories exactly 1 level down from your projects directory, and will echo their paths to a temp file (suppressing the newlines).  It will then run run tracd, appending the contents of this file to the end of the call.</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/600/bash-script-for-serving-multiple-trac-projects-and-sharing-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Salmon stew with honey, mustard and thyme</title>
		<link>http://otaqui.com/blog/585/salmon-stew-with-honey-mustard-and-thyme/</link>
		<comments>http://otaqui.com/blog/585/salmon-stew-with-honey-mustard-and-thyme/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 20:12:16 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[food]]></category>

		<guid isPermaLink="false">http://otaqui.com/blog/?p=585</guid>
		<description><![CDATA[I fancied something different for dinner, and without much in the cupboards managed to come up with this delicious, and very healthy, dish that couldn’t be simpler to make.]]></description>
			<content:encoded><![CDATA[<p>I fancied something different for dinner, and without much in the cupboards managed to come up with this delicious, and very healthy, dish that couldn&#8217;t be simpler to make.</p>
<p>Ingredients</p>
<p>• 4 salmon fillets<br />
• several sprigs of tenderstem brocolli, some french beans, or other green<br />
• good cherry tomatoes<br />
• wholegrain mustard<br />
• honey<br />
• thyme<br />
• white wine (optional) </p>
<p>Method</p>
<p>Turn the oven on, quite hot (200 degrees or more).</p>
<p>Cut the salmon into good sized chunks, and the veg however you like &#8211; chuck all this in an oven dish with a lid.</p>
<p>Mix a good tablespoon or so of honey with a couple of good teaspoons of mustard, a teaspoon of thyme and some salt and pepper with either 200ml of white wine (or water) and a tablespoon of cornflour (or normal plain flour). Combine very well, pour over the fish and vegetables and stir.</p>
<p>Cover and put in the oven.</p>
<p>After about 25 minutes crack the lid and stir again. Cook for a further 15 minutes.</p>
<p>Serve with rice. Yum!</p>
]]></content:encoded>
			<wfw:commentRss>http://otaqui.com/blog/585/salmon-stew-with-honey-mustard-and-thyme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

