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

<channel>
	<title>Stickblog</title>
	<atom:link href="http://the-stickman.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://the-stickman.com</link>
	<description>Random developer notes</description>
	<pubDate>Tue, 22 Jul 2008 07:34:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Multiple file uploader: Mootools 1.2 version</title>
		<link>http://the-stickman.com/uncategorized/multiple-file-uploader-mootools-12-version/</link>
		<comments>http://the-stickman.com/uncategorized/multiple-file-uploader-mootools-12-version/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 14:00:15 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

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

		<guid isPermaLink="false">http://the-stickman.com/uncategorized/multiple-file-uploader-mootools-12-version/</guid>
		<description><![CDATA[Just a quick heads-up for those who&#8217;ve been complaining about the MooTools version of the multiple-file uploader not working with MooTools 1.2 &#8212; it&#8217;s now been updated. The widget required three small modifications due to changes to MooTools&#8217; syntax.
Get the modified code here (old 1.1x-compatible version also included).
]]></description>
			<content:encoded><![CDATA[<p>Just a quick heads-up for those who&#8217;ve been complaining about <a href="http://the-stickman.com/web-development/multiple-file-uploader-mootools-version/">the MooTools version</a> of <a href="http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/">the multiple-file uploader</a> not working with MooTools 1.2 &#8212; it&#8217;s now been updated. The widget required three small modifications due to changes to MooTools&#8217; syntax.</p>
<p>Get the modified code <a target="" title="" href="http://the-stickman.com/files/mootools/multiupload/Stickman.MultiUpload.zip">here</a> (old 1.1x-compatible version also included).</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/uncategorized/multiple-file-uploader-mootools-12-version/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Making Firebug even better&#8230;</title>
		<link>http://the-stickman.com/uncategorized/making-firebug-even-better/</link>
		<comments>http://the-stickman.com/uncategorized/making-firebug-even-better/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 13:24:23 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://the-stickman.com/uncategorized/making-firebug-even-better/</guid>
		<description><![CDATA[&#8230;yes, I know, I go on about Firebug a bit. 
OK, a lot. 
But good as it is it can still be improved, as this list of Firebug extensions proves. There were several on the list that I hadn&#8217;t heard of before and have already installed.
]]></description>
			<content:encoded><![CDATA[<p>&#8230;yes, I know, I go on about <a href="http://www.softwareishard.com/blog/firebug/list-of-firebug-extensions/">Firebug</a> a bit. </p>
<p>OK, a lot. </p>
<p>But good as it is it can still be improved, as <a href="http://www.softwareishard.com/blog/firebug/list-of-firebug-extensions/">this list of Firebug extensions</a> proves. There were several on the list that I hadn&#8217;t heard of before and have already installed.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/uncategorized/making-firebug-even-better/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Binding a function to any class method in MooTools</title>
		<link>http://the-stickman.com/web-development/javascript/binding-a-function-to-any-class-method-in-mootools/</link>
		<comments>http://the-stickman.com/web-development/javascript/binding-a-function-to-any-class-method-in-mootools/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 14:27:40 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://the-stickman.com/web-development/javascript/binding-a-function-to-any-class-method-in-mootools/</guid>
		<description><![CDATA[Some time back, while experimenting with MooTools, I found myself with the requirement to be able to call a function whenever a particular method on a given class was called. In effect, I needed to treat the class&#8217;s method as an event and fire a particular function when the method was called.
So I wrote a [...]]]></description>
			<content:encoded><![CDATA[<p>Some time back, while experimenting with MooTools, I found myself with the requirement to be able to call a function whenever a particular method on a given class was called. In effect, I needed to treat the class&#8217;s method as an event and fire a particular function when the method was called.</p>
<p>So I wrote a very small addition to the Mootools&#8217; own Class code, which allowed this. The new method, Class.bindFunctionToMethod(), allows you either to intercept the method call before or after it&#8217;s fired. If fired before you can change the arguments being passed in, while if fired after then you can alter the return value.</p>
<p>Of course you need to be careful how you use it: by &#8216;piggy-backing&#8217; on method calls like this (especially if you alter the arguments or return value) you&#8217;re potentially altering the script&#8217;s behaviour in a way that&#8217;s not necessarily evident by looking at the classes themselves. </p>
<p>You can download the code <a href="http://www.the-stickman.com/files/mootools/bindfunctiontomethod/Stickman.Class.BindFunctionToMethod.zip">here</a>: it&#8217;s heavily commented, so it should be fairly obvious how to use it. It works just fine with MooTools version 1.1+ and 1.2.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/javascript/binding-a-function-to-any-class-method-in-mootools/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Firebug alternative for Internet Explorer</title>
		<link>http://the-stickman.com/web-development/a-firebug-alternative-for-internet-explorer/</link>
		<comments>http://the-stickman.com/web-development/a-firebug-alternative-for-internet-explorer/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 14:36:17 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://the-stickman.com/web-development/a-firebug-alternative-for-internet-explorer/</guid>
		<description><![CDATA[I spend most of my time developing server-side code and testing in Firefox so I don&#8217;t usually worry too much about other browsers. But when &#8212; as now &#8212; I find myself writing JavaScript and CSS, and struggling with all the cross-browser horror that comes with it, I need all the help I can get.
Opera [...]]]></description>
			<content:encoded><![CDATA[<p>I spend most of my time developing server-side code and testing in Firefox so I don&#8217;t usually worry too much about other browsers. But when &#8212; as now &#8212; I find myself writing JavaScript and CSS, and struggling with all the cross-browser horror that comes with it, I need all the help I can get.</p>
<p>Opera has made great strides recently with <a href="http://www.opera.com/products/dragonfly/">Dragonfly</a>, its own answer to <a href="http://getfirebug.com/">Firebug</a> (the current yardstick by which all other developer tools are measured), and while not quite as good it&#8217;s improving all the time. Safari is lagging well behind with its Web Inspector, which <a href="http://webkit.org/blog/108/">promised much when it was relaunched last year</a> but thus far has failed to deliver. </p>
<p>When it comes to Internet Explorer, the situation isn&#8217;t as awful as one might expect. Until recently I&#8217;d been using a combination of <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=E59C3964-672D-4511-BB3E-2D5E1DB91038&amp;displaylang=en">Developer Toolbar</a> and <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2f465be0-94fd-4569-b3c4-dffdf19ccd99&amp;displaylang=en">Script Debugger</a> but today I stumbled upon <a href="http://www.debugbar.com/">DebugBar</a>, an IE extension which comes a lot closer to Firebug&#8217;s functionality, especially when it comes to inspecting CSS rules and so on. Its handling of JavaScript errors doesn&#8217;t improve much on IE&#8217;s own abilities &#8212; it still won&#8217;t tell you which file an error has occurred in, for example &#8212; and it seems to have trouble inspecting some script-created elements. Still, worth a look.</p>
<p><b>UPDATE:</b> while we&#8217;re on the subject of developing in IE, I should mention <a href="http://www.bartdart.com/">CachePal</a>, a shortcut button that clears IE&#8217;s cache. Handy when you&#8217;re developing (say) JavaScript, because IE has a tendency to hang onto old JavaScript files even after a SHIFT+Reload.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/a-firebug-alternative-for-internet-explorer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MochaUI, ExplorerCanvas and dynamically-loaded JavaScript</title>
		<link>http://the-stickman.com/web-development/javascript/mochaui-explorercanvas-and-dynamically-loaded-javascript/</link>
		<comments>http://the-stickman.com/web-development/javascript/mochaui-explorercanvas-and-dynamically-loaded-javascript/#comments</comments>
		<pubDate>Fri, 04 Jul 2008 15:56:06 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://the-stickman.com/web-development/javascript/mochaui-explorercanvas-and-dynamically-loaded-javascript/</guid>
		<description><![CDATA[Another one of those really obscure ones&#8230;
So as previously mentioned, I&#8217;m looking at using MochaUI in a CMS project I&#8217;m working on. Everything was going swimmingly, except that for some reason it was having rendering problems with (you guessed it) Internet Explorer. At first I thought that it must be a CSS problem, but lengthy [...]]]></description>
			<content:encoded><![CDATA[<p>Another one of those really obscure ones&#8230;</p>
<p>So <a href="http://the-stickman.com/web-development/javascript/popupsdialog-boxes-in-mootools/">as previously mentioned</a>, I&#8217;m looking at using <a href="http://code.google.com/p/mocha-ui/">MochaUI</a> in a CMS project I&#8217;m working on. Everything was going swimmingly, except that for some reason it was having rendering problems with (you guessed it) Internet Explorer. At first I thought that it must be a CSS problem, but lengthy experimentation suggested that this was not the case.</p>
<p>With the help of a colleague I eventually narrowed the problem down to MochaUI&#8217;s use of Google&#8217;s <a href="http://excanvas.sourceforge.net/ExplorerCanvas">ExplorerCanvas library</a> (excanvas), which provides a wrapper for IE that simulates canvas support. One wrinkle in our use of MochaUI is that the scripts are being <a href="http://the-stickman.com/web-development/javascript/mootools-12-assetcss-onload-problem-and-fix/">loaded dynamically</a> when needed (using <a href="http://mootools.net/">MooTools</a>&#8216; Asset methods). It turns out that excanvas expects to be loaded at page load time, so attaches its initalisation function to the page&#8217;s onreadystatechange event &#8212; waiting for the page to be &#8216;complete&#8217; before initialising. Of course, this didn&#8217;t apply in our case since the page had already finished loading when the script was included. So it was never initialised.</p>
<p>All that was required to fix the problem was a slight change to the library&#8217;s init method (bear in mind, I downloaded the latest version (0002 &#8212; dated May 4 2007):</p>
<p><code>init: function (opt_doc) {<br />
var doc = opt_doc || document;<br />
if (/MSIE/.test(navigator.userAgent) &amp;amp;&amp;amp; !window.opera) {<br />
var self = this;<br />
if(doc.readyState == "complete"){<br />
self.init_(doc);<br />
} else{<br />
doc.attachEvent("onreadystatechange", function () {<br />
self.init_(doc);<br />
});<br />
}<br />
}<br />
},</code></p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/javascript/mochaui-explorercanvas-and-dynamically-loaded-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MooTools 1.2 Asset.css onload problem, and fix</title>
		<link>http://the-stickman.com/web-development/javascript/mootools-12-assetcss-onload-problem-and-fix/</link>
		<comments>http://the-stickman.com/web-development/javascript/mootools-12-assetcss-onload-problem-and-fix/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 10:10:26 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://the-stickman.com/web-development/javascript/mootools-12-assetcss-onload-problem-and-fix/</guid>
		<description><![CDATA[As part of the experiments I mentioned yesterday, I&#8217;ve been looking at the feasibility of loading CSS on-the-fly. MooTools has a method to achieve this (Asset.css) but I found to my disappointment that its onload event only works in Internet Explorer, so in other browsers you have no way of knowing when the CSS has [...]]]></description>
			<content:encoded><![CDATA[<p>As part of <a href="http://the-stickman.com/web-development/javascript/popupsdialog-boxes-in-mootools/">the experiments I mentioned yesterday</a>, I&#8217;ve been looking at the feasibility of loading CSS on-the-fly. MooTools has a method to achieve this (<a href="http://docs.mootools.net/Plugins/Assets#Assets:css">Asset.css</a>) but I found to my disappointment that its onload event only works in Internet Explorer, so in other browsers you have no way of knowing when the CSS has finished loading (or if it&#8217;s failed).</p>
<p>I posted <a href="http://mootools.lighthouseapp.com/projects/2706/tickets/186-asset-css-onload-event-does-not-fire-in-ff3-safari-opera">a bug report</a> yesterday and as far as I can tell it&#8217;s slated to be looked at for the next release (1.3), but while pondering the problem overnight I came up with an idea and with some help from <a href="http://yuiblog.com/blog/2007/06/07/style/">this blog post</a> I was able to create an interim fix. Because it uses XMLHTTPRequest it can&#8217;t load CSS from a third-party domain, but it works for what I need and it&#8217;s better than nothing until the official fix is forthcoming.</p>
<p>I&#8217;ve put the code into <a href="http://the-stickman.com/files/mootools/temp_asset_css_fix/mootools-assets-tempcssfix.js">this file</a> (right-click, save as&#8230;) which you simply load after MooTools itself (it replaces the existing Asset.css definition with a new one).</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/javascript/mootools-12-assetcss-onload-problem-and-fix/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Popups/dialog boxes in MooTools</title>
		<link>http://the-stickman.com/web-development/javascript/popupsdialog-boxes-in-mootools/</link>
		<comments>http://the-stickman.com/web-development/javascript/popupsdialog-boxes-in-mootools/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 14:16:36 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://the-stickman.com/web-development/javascript/popupsdialog-boxes-in-mootools/</guid>
		<description><![CDATA[I&#8217;m just starting preliminary work on a complete (and long overdue) rewrite of our project&#8217;s CMS. Right now I&#8217;m really just tinkering around, exploring some ideas. As part of this process I wanted to experiment with some dialog boxes, and not wanting to reinvent the wheel I decided to look for a ready-to-use project based [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m just starting preliminary work on a complete (and long overdue) rewrite of our project&#8217;s CMS. Right now I&#8217;m really just tinkering around, exploring some ideas. As part of this process I wanted to experiment with some dialog boxes, and not wanting to reinvent the wheel I decided to look for a ready-to-use project based on <a href="http://mootools.net/">MooTools</a>, our JavaScript library of choice.</p>
<p>My first stop would have been the official MooTools forum, but in their wisdom the project&#8217;s leaders have decided to remove them completely. The oft-mooted &#8216;MooForge&#8217; has never materialised but after exploring a variety of blind alleys I came across <a href="http://www.mooscripts.com/">MooScripts</a>, an unofficial but quite comprehensive collection of MooTools add-on scripts.</p>
<p>From there I was led to the <a href="http://code.google.com/p/mocha-ui/">Mocha UI</a> project, which is a fairly lightweight implementation of dialog boxes for MooTools 1.2. It&#8217;s feature list is impressive and it&#8217;s quick too (compared to others I tried). Like Mootools it also uses the very permissive MIT licence, which basically says &#8216;use it how you like, at your own risk&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/javascript/popupsdialog-boxes-in-mootools/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Firefox 3: portable version slowdown</title>
		<link>http://the-stickman.com/web-development/firefox-3-portable-version-slowdown/</link>
		<comments>http://the-stickman.com/web-development/firefox-3-portable-version-slowdown/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 10:41:06 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://the-stickman.com/web-development/firefox-3-portable-version-slowdown/</guid>
		<description><![CDATA[I&#8217;ve been using Firefox 3 for several months now (through various betas and release candidates) and I have to say I&#8217;m pretty happy with it. I&#8217;ve resisted blogging about it because I think more than enough words have already been written on the subject, but I&#8217;ll just say that I&#8217;ve been very happy with its [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a href="http://www.getfirefox.com">Firefox 3</a> for several months now (through various betas and release candidates) and I have to say I&#8217;m pretty happy with it. I&#8217;ve resisted blogging about it because I think more than enough words have already been written on the subject, but I&#8217;ll just say that I&#8217;ve been very happy with its improved speed and stability over FF2. </p>
<p>However I do have one caveat to add. I use <a href="http://portableapps.com/apps/internet/firefox_portable">the portable version</a> (running from a USB key) and found, after some weeks of use, that it was becoming increasingly sluggish. I put up with it for a while but was getting quite frustrated when, one day, I got an error when shutting down the browser. I don&#8217;t remember the specifics, but it mentioned a file in my profile directory called urlclassifier3.sqlite. </p>
<p>Out of curiosity I looked at the file and found that it was over well over 70MB in size. This made me even more curious, so I did some searching and found various references to it and its potentially detrimental effect on Firefox&#8217;s performance. So I renamed it, restarted Firefox and &#8212; presto! &#8212; the browser was back to its former, sprightly self.</p>
<p>Some further digging revealed that this is a cache file for data about phishing and malware sites, and can be disabled by unchecking the &#8220;Tell me if the site I&#8217;m visiting is a suspected attack site&#8221; and &#8220;Tell me if the site I&#8217;m visiting is a suspected forgery&#8221; options in Tools &gt; Options &gt; Security. Of course, you do so at your own risk &#8212; you could alternatively leave theese options enabled and just delete the file once in a while, when it gets really big and FF starts to slow down.</p>
<p>OK, two caveats: I&#8217;m definitely in the &#8216;I hate the <a href="http://www.google.co.uk/search?q=awesomebar">AwesomeBar</a>&#8216; camp &#8212; I&#8217;m a<br />
creature of habit and the old-style auto-complete worked just fine for<br />
me. Bah.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/firefox-3-portable-version-slowdown/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Monitor site uptime for free</title>
		<link>http://the-stickman.com/web-development/monitor-site-uptime-for-free/</link>
		<comments>http://the-stickman.com/web-development/monitor-site-uptime-for-free/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 08:07:16 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://the-stickman.com/web-development/monitor-site-uptime-for-free/</guid>
		<description><![CDATA[A while back I thought up, but never implemented, a plan to develop a free web site uptime monitoring service. Basically, I spent a few hours thinking about features, wrote a few dozen lines of code and bought a smart domain name. It would&#8217;ve been great, seriously &#8212; there were other services out there but [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I thought up, but never implemented, a plan to develop a free web site uptime monitoring service. Basically, I spent a few hours thinking about features, wrote a few dozen lines of code and bought a smart domain name. It would&#8217;ve been great, seriously &#8212; there were other services out there but none that offered the sort of thing I was planning.</p>
<p>I&#8217;m still kind of disappointed that I didn&#8217;t follow through with it but recently I found something that ticks most of the boxes that I was interested in, and plenty more besides. Going by the slightly ungainly name of <a href="http://mon.itor.us/">mon.itor.us</a>, you get plenty of neat options for keeping track of your site&#8217;s responsiveness, several types of notification (including SMS if you need it) - and they even send you a weekly summary report. The basic service, which will probably be fine for most people, is ad-supported and free.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/monitor-site-uptime-for-free/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Note to self: PHP object constructors never return false</title>
		<link>http://the-stickman.com/web-development/php/note-to-self-php-object-constructors-never-return-false/</link>
		<comments>http://the-stickman.com/web-development/php/note-to-self-php-object-constructors-never-return-false/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 12:55:59 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://the-stickman.com/uncategorized/note-to-self-php-object-constructors-never-return-false/</guid>
		<description><![CDATA[As part of my ongoing refactoring work (see previous post) and having decided to take a more active stand against broken windows syndrome I&#8217;ve been cleaning up various coding oddities as I&#8217;ve found them.
Today I came across (something like) this little snippet:

if( ! $obj = new myObject( $id ) )
{
  throw new Exception( 'Not [...]]]></description>
			<content:encoded><![CDATA[<p>As part of my ongoing refactoring work (see <a href="http://the-stickman.com/web-development/firefox-extensions/screenshot-web-sites-easily-with-fireshot/">previous post</a>) and having decided to take a more active stand against <a href="http://en.wikipedia.org/wiki/Fixing_Broken_Windows#In_software_development">broken windows syndrome</a> I&#8217;ve been cleaning up various coding oddities as I&#8217;ve found them.</p>
<p>Today I came across (something like) this little snippet:</p>
<pre>
<code>if( ! $obj = new myObject( $id ) )
{
  throw new Exception( 'Not a valid object' );
}</code>
</pre>
<p>At first glance we might assume that the constructor attempts to populate the new object with some data loaded from (say) a database, but if no data matching the supplied ID is available, then the constructor returns <em>false</em> to indicate this. All very reasonable, right?</p>
<p>Except that it&#8217;s not possible to return <em>false</em>, or indeed any value, from a constructor because the &#8216;return value&#8217; of the constructor is the object itself. Which means that the above snippet is redundant, because the expression will always evaluate to <em>true</em>.</p>
<p>It would&#8217;ve made more sense to throw an exception within the method that loads the data &#8212; and in fact this is exactly what happens, which makes the quoted code doubly redundant and even more inexplicable.</p>
<p>I don&#8217;t <em>think</em> I&#8217;m the one who&#8217;s responsible for this particular brain fart but it&#8217;s OK because the only other likely candidate left the company last year so I happily can blame it on him&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/php/note-to-self-php-object-constructors-never-return-false/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
