<?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>wheresrhys &#187; Web development</title>
	<atom:link href="http://wheresrhys.co.uk/category/computers-and-all-that/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://wheresrhys.co.uk</link>
	<description>on the internet</description>
	<lastBuildDate>Fri, 16 Mar 2012 16:31:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Updating plugins to use the new jQuery.on event binding method in a backwards compatible way</title>
		<link>http://wheresrhys.co.uk/2012/01/updating-plugins-to-use-the-new-jquery-on-event-binding-method-in-a-backwards-compatible-way/</link>
		<comments>http://wheresrhys.co.uk/2012/01/updating-plugins-to-use-the-new-jquery-on-event-binding-method-in-a-backwards-compatible-way/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 11:59:12 +0000</pubDate>
		<dc:creator>wheresrhys</dc:creator>
				<category><![CDATA[Computers and all that]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://wheresrhys.co.uk/?p=1482</guid>
		<description><![CDATA[I&#8217;m going through all my written/half-written/never really gonna get written properly probably jQuery plugins to ready them for the new jQuery plugins site. While I&#8217;m at it I&#8217;m updating as many event handlers as I can to use the new $.on method (as other event binding methods are likely to be deprecated in future). This [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going through all my written/half-written/never really gonna get written properly probably jQuery plugins to ready them for the new <a href="http://plugins.jquery.com/">jQuery plugins site</a>. While I&#8217;m at it I&#8217;m updating as many event handlers as I can to use the new <a href="http://api.jquery.com/on/">$.on</a> method (as other event binding methods are <a href="http://blog.jquery.com/2011/11/03/jquery-1-7-released/">likely to be deprecated in future</a>).</p>
<p>This presents a problem as I would like to achieve backwards compatibility too. A simple solution for the bind method is:</p>
<pre>var binder = $.fn.on ? "on": "bind";
$(this)[binder]("click", handler);</pre>
<p>But I&#8217;ve also put together this more generic solution (this is <em>completely</em> untested, but something like this should work)</p>
<pre>if(!$.fn.on) {
   $.fn.on = function(events, selector, data, handler) {
       if(typeof selector == "function") {
           return $.fn.bind.call(this, selector);
       } else if(typeof selector == "object"){
           return $.fn.bind.call(this, selector, data)
       } else {
           return $.fn.delegate.call(this, selector, data, handler)
       }
   }

   $.fn.off = function(events, selector, handler) {
       if(typeof selector == "function") {
           return $.fn.unbind.call(this, selector);
       } else {
           return $.fn.undelegate.call(this, selector, handler)
       }
   }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://wheresrhys.co.uk/2012/01/updating-plugins-to-use-the-new-jquery-on-event-binding-method-in-a-backwards-compatible-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find that campsite!</title>
		<link>http://wheresrhys.co.uk/2011/05/find-that-campsite/</link>
		<comments>http://wheresrhys.co.uk/2011/05/find-that-campsite/#comments</comments>
		<pubDate>Sat, 07 May 2011 23:07:02 +0000</pubDate>
		<dc:creator>wheresrhys</dc:creator>
				<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://wheresrhys.co.uk/?p=1480</guid>
		<description><![CDATA[I&#8217;ve been very busy lately. Busy making it easier for YOU &#8211; yes YOU! &#8211; to find the perfect campsite in the UK. As of a few days ago, my campsite listing website has some new features. And not just any new features &#8211; these are (to the best of my knowledge) unique new features. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="../"></a>I&#8217;ve been very busy lately. Busy making it easier for YOU &#8211; yes YOU! &#8211; to find the perfect campsite in the UK.</p>
<p>As of a few days ago, <a href="http://ukcampingmap.co.uk/">my campsite listing website</a> has some new features. And not just any new features &#8211; these are (to the best of my knowledge) unique new features. The already pretty handy map of campsites now lets you&#8230;</p>
<ul>
<li>Filter campsites based on what facilities they have &#8211; you can either specify that your ideal campsite must have a certain feature, or definitely must not have it. Ideal for finding a campsite that allows campfires but no pesky caravans.</li>
<li>View only those campsites that are open during the month you&#8217;re planning on holidaying.</li>
</ul>
<p>There are one or two additional features hopefully to go live later this month, but for now please take a look and let me knnow if you have any feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://wheresrhys.co.uk/2011/05/find-that-campsite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two small but useful javascript facts</title>
		<link>http://wheresrhys.co.uk/2011/02/two-small-but-useful-javascript-facts/</link>
		<comments>http://wheresrhys.co.uk/2011/02/two-small-but-useful-javascript-facts/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 13:32:15 +0000</pubDate>
		<dc:creator>wheresrhys</dc:creator>
				<category><![CDATA[Computers and all that]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://wheresrhys.co.uk/?p=1476</guid>
		<description><![CDATA[Passing parameters into setTimeout callbacks setTimeout (and setInterval too perhaps?) accepts a third parameter, an array of parameters to pass in to your callback function, so setTimeout(function() { myFunction(need, to, pass, these, in); }, 200); Can far more efficiently be written setTimeout(myFunction, 200, [need,to,pass,these,in]); Firebug&#8217;s console still works when you&#8217;re at a breakpoint (and can [...]]]></description>
			<content:encoded><![CDATA[<h2><a href="http://www.flickr.com/photos/dragonblog/254318049/"><img class="alignright" src="http://farm1.static.flickr.com/89/254318049_758420677d_m.jpg" alt="Bees knees" width="214" height="240" /></a>Passing parameters into setTimeout callbacks</h2>
<p>setTimeout (and setInterval too perhaps?) accepts a third parameter, an array of parameters to pass in to your callback function, so</p>
<pre>setTimeout(function() {</pre>
<pre>myFunction(need, to, pass, these, in);</pre>
<pre>}, 200);</pre>
<p>Can far more efficiently be written</p>
<pre>setTimeout(myFunction, 200, [need,to,pass,these,in]);</pre>
<h2>Firebug&#8217;s console still works when you&#8217;re at a breakpoint (and can be very useful for debugging jQuery)</h2>
<p>When debugging using firebug  and you set a breakpoint, when your code stops at that breakpoint</p>
<ul>
<li>you can still use firebug&#8217;s console to run any code you like</li>
<li>&#8220;this&#8221; in firebug&#8217;s console is always set to what &#8220;this&#8221; is set to in your code</li>
</ul>
<p>This means that you can play around with your variables at will at any given point in your code. It may be that I was a dunce for not knowing this, but I&#8217;ve never seen anybody I work with take advantage of these facts, so maybe it&#8217;s news to more people than just me&#8230;. and it&#8217;s bloody useful so I feel no shame in shouting about it.</p>
<p>For instance jQuery, for all its benefits, can be a pain to debug due to the fact that so much work is done by a single string (your selector) and on a single line of code (using chaining), and that jQuery often doesn&#8217;t give very helpful error messages. This means if you wnat to debug a certain line you have to either a) keep stepping in and out of the murky world of jQuery&#8217;s inner methods in order to find out where and why the unexpected bug is happening; or b) add temporary lines to your code which carry out only part of the single jQuery line, then reload the page to observe if they succeed or fail.</p>
<p>Not so if you set a breakpoint and then use the console. For instance, say a fairly complex line of jQuery misfires.</p>
<pre>$("&gt;p input:focus", myContainer).css("height", adjustHeight).children(".shrinker").remove().end().wrapAll("&lt;div class=\"done\"&gt;");
</pre>
<p>By setting a breakpoint in my code on this line, and then copying the line into the console and running it, I can progressively remove/tweak bits until the error no longer appears; I never have to step through jQuery&#8217;s code and I never have to reload the page. Easy peasy.</p>
]]></content:encoded>
			<wfw:commentRss>http://wheresrhys.co.uk/2011/02/two-small-but-useful-javascript-facts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do, DOS</title>
		<link>http://wheresrhys.co.uk/2011/02/how-do-dos/</link>
		<comments>http://wheresrhys.co.uk/2011/02/how-do-dos/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 23:28:03 +0000</pubDate>
		<dc:creator>wheresrhys</dc:creator>
				<category><![CDATA[Computers and all that]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://wheresrhys.co.uk/?p=1473</guid>
		<description><![CDATA[Much like recent activity on this blog, my involvement with the windows command has been characterised by being entered into begrudgingly, generally taking a lot longer than I intend, and leaving me thinking that there&#8217;s something better I could be doing with my time. You see, I&#8217;m not really that much of a geek &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/wiless/3008597233/"><img class="alignright" src="http://farm4.static.flickr.com/3254/3008597233_ebe749c90d_m.jpg" alt="" width="240" height="180" /></a>Much like recent activity on this blog, my involvement with the windows command has been characterised by being entered into begrudgingly, generally taking a lot longer than I intend, and leaving me thinking that there&#8217;s something better I could be doing with my time.</p>
<p>You see, I&#8217;m not really that much of a geek &#8211; I own very few gadgets (quite possibly none, unless a mandolin counts) and find playing around with computers tedious (one reason I&#8217;m drawn to front-end development is it&#8217;s far removed from the confusing and arcane inner-workings of the computer). My family didn&#8217;t own a computer back in the 80s, when typing in commands at the prompt was the norm, so the whole experience is alien to me.</p>
<p>But, as of today, I&#8217;ve lost my fear&#8230; thanks to the humble batch file.</p>
<p>For anyone who doesn&#8217;t know what a batch file is, it&#8217;s a file which runs a series of command line statements. It has a .BAT file extension, and basic ones are very easy to write &#8211; the syntax is exactly the same as typing into the DOS command line itself&#8230; except you&#8217;re typing in a nice text editor so trivial things such as using ctrl+v to paste, using the cursor keys to move anywhere, and clicking and dragging to select text work. And, best of all, you only need type your commands once, into the batch file, and then just click on it (or a shortcut) next time you want to run it.</p>
<p>So, for example, every time I wanted to minify CSS and JS on one of my localhost sites before an upload to the live server I used to spend 5-10 minutes typing, making mistakes, swearing and crying. Now I just click an icon, and don&#8217;t feel the need to swear or cry half as much.</p>
<ul>
<li><a href="http://www.chebucto.ns.ca/~ak621/DOS/BatBasic.html#Basics">Basic batch file tutorial</a> (ignore the bit about autoexec &#8211; in modern windows you can run a batch file by just double clicking an icon)</li>
<li><a href="http://commandwindows.com/">More comprehensive guide to commands and syntax</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wheresrhys.co.uk/2011/02/how-do-dos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fonts are not quite the enemy</title>
		<link>http://wheresrhys.co.uk/2011/02/fonts-are-not-quite-the-enemy/</link>
		<comments>http://wheresrhys.co.uk/2011/02/fonts-are-not-quite-the-enemy/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 23:03:54 +0000</pubDate>
		<dc:creator>wheresrhys</dc:creator>
				<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://wheresrhys.co.uk/?p=1469</guid>
		<description><![CDATA[Today I learned that there&#8217;s a lot more to using fonts  in a website than just including them with the @font-face declaration, and that maybe typekit has its uses after all. I also learned that if I use a &#8220;Today I learned&#8230;&#8221;,  terse but link intensive format to write blog posts I&#8217;m more likely to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/39988507@N07/4938771649/"><img class="alignright" src="http://farm5.static.flickr.com/4114/4938771649_133579900f_m.jpg" alt="" width="170" height="240" /></a>Today I learned that there&#8217;s <a title="Typekit's blog posts on font rendering" href="http://blog.typekit.com/category/type-rendering/">a</a> <a title="Jeffrey Zeldman discussing font rendering in browsers" href="http://24ways.org/2009/real-fonts-and-rendering">lot</a> <a title="Forum on poor rendering of museo slab" href="http://getsatisfaction.com/typekit/topics/rendering_museo_slab">more</a> to using fonts  in a website than just including them with the <a title="Paul Irish's bulletproof ont-face declarations" href="http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/">@font-face </a>declaration, and that maybe<a href="http://blog.typekit.com/2011/01/20/new-and-updated-fonts-from-exljbris/"> typekit has its uses after all</a>.</p>
<p>I also learned that if I use a &#8220;Today I learned&#8230;&#8221;,  terse but <a title="Funny video from the early days of t'internet" href="http://www.youtube.com/watch?v=JUs7iG1mNjI&amp;feature=player_embedded">link intensive</a> format to write blog posts I&#8217;m more likely to bother to share something useful (at least this once). So more brief but bountiful posts to follow&#8230; maybe.</p>
]]></content:encoded>
			<wfw:commentRss>http://wheresrhys.co.uk/2011/02/fonts-are-not-quite-the-enemy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eventful times</title>
		<link>http://wheresrhys.co.uk/2010/10/eventful-stuff/</link>
		<comments>http://wheresrhys.co.uk/2010/10/eventful-stuff/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 08:45:09 +0000</pubDate>
		<dc:creator>wheresrhys</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://wheresrhys.co.uk/?p=1463</guid>
		<description><![CDATA[I&#8217;ve just started delving into using jQuery&#8217;s custom events. They&#8217;ve been around for a while, but I never really saw the point of using them before; I&#8217;d read one or two nice examples of how they can be used, but I kept hitting a mental block when trying to think of ways to use them [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/31420447@N04/2944088120/"><img class="alignright" title="An event (schematic)" src="http://farm4.static.flickr.com/3155/2944088120_65f106de36_m.jpg" alt="" width="160" height="240" /></a>I&#8217;ve just started delving into using <a href="http://api.jquery.com/trigger/">jQuery&#8217;s custom events</a>. They&#8217;ve been around for a while, but I never really saw the point of using them before; I&#8217;d read one or two nice examples of how they can be used, but I kept hitting a mental block when trying to think of ways to use them in my own work. I think, like the great leap forward you have to take when realising an object can be as abstract as you want (eg a process that exists only fleetingly, such as an ajax call, can be an object), programming using events as a central aspect of your style requires a big change in the way you think about problems.</p>
<p>As an example, previously I was always saving references to objects that a given object might need to interact with, e.g.</p>
<pre>function Obj1() {
   this.container = $("#container");
   this.child = new Obj2(this);

   this.method = function() {
         //do something
   }
}();

function Obj2(parent) {
   var that = this;
   this.parent = parent;
   this.container = $("#childContainer");
   $(this.container).click(function(){
       that.alter();
   });

   this.alter = function() {
      this.altered = true;
      this.parent.method();
   }
}

var obj1 = new Obj1();
</pre>
<p>So what&#8217;s wrong with this? It&#8217;s difficult to say, but it always jarred with me that you had to pass in &#8220;this&#8221; as a parameter in order to make it easy to track back to the parent. And there will be circumstances where you&#8217;re creating an object that has to interact with lots of other objects and you have to either pass in lots of parameters when creating the object or do some on the fly processing to find the objects that need to be affected.</p>
<p>Now, here&#8217;s the same thing achieved using custom events</p>
<pre>function Obj1() {
   var that = this;
   this.container = $("#container");
   this.child = new Obj2();
   $("#childContainer").altered(function(){
       that.method();
   });
   this.method = function() {
         //do something
   }
};

function Obj2() {
   var that = this;
   this.container = $("#childContainer");
   $(this.container).click(function(){
      that.alter();
   });

   this.alter = function() {
      this.altered = true;
      this.container.trigger("altered");
   }
}

var obj1 = new Obj1();
</pre>
<p>Ok, so what&#8217;s so good about this? It may even use more lines of code. But crucially it gets rid of having to store references to objects, freeing you up to create ever more complicated applications without having to create a web of dependencies that is difficult to maintain*. A good analogy I think is to think of an object triggering an event as a child shouting. If the child shouts when it needs something then it doesn&#8217;t have to constantly hold its parent&#8217;s hand; it&#8217;s parent comes to it on hearing the shout. And this gives the child freedom to explore the world on its own terms, and develop into a more rounded, unstifled human being&#8230; but I think I&#8217;m straying off the point.</p>
<p>So to sum up, javascript/jQuery custom events are a very useful feature.</p>
<p>And don&#8217;t smother your progeny.</p>
<p>*I&#8217;ve just re-read the <a href="http://api.jquery.com/trigger/">API</a> and found out that you can attach all manner of data to the event as extra parameters, which will also be very useful for this.</p>
]]></content:encoded>
			<wfw:commentRss>http://wheresrhys.co.uk/2010/10/eventful-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Batch including headscripts and links in Zend Framework</title>
		<link>http://wheresrhys.co.uk/2010/09/batch-including-headscripts-and-links-in-zend-framework/</link>
		<comments>http://wheresrhys.co.uk/2010/09/batch-including-headscripts-and-links-in-zend-framework/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 11:44:25 +0000</pubDate>
		<dc:creator>wheresrhys</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://wheresrhys.co.uk/?p=1459</guid>
		<description><![CDATA[A bit of a dull post to break my silence with, but after a summer away, it&#8217;s back to the grindstone of earning a living through programming. Fingers crossed I&#8217;ll be given the opportunity to work again on a website I finished ages ago, fixing all the things I did badly and adding some enhancements. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/rhysickle/4776734399/"><img class="alignright" title="bus stops here" src="http://farm5.static.flickr.com/4137/4776734399_5d5ff8ce40_m.jpg" alt="" width="240" height="160" /></a>A bit of a dull post to break my silence with, but after a summer away, it&#8217;s back to the grindstone of earning a living through programming. Fingers crossed I&#8217;ll be given the opportunity to work again on a website I finished ages ago, fixing all the things I did badly and adding some enhancements.</p>
<p>I used Zend framework for the back-end of the site and first time around I had a very rudimentary grasp of how to use it, but no real in depth understanding of its finer points. I&#8217;m now finding that I did a lot of things the long way round (eg typing out JSONs by hand  rather than using the Zend_JSON class to build them automatically). One major bugbear I had was that I was adding all my javascript and css files individually to the document head, and that the syntax for doing so in Zend wasn&#8217;t really any more concise than just hard coding &lt;link rel=&#8221;stylesheet&#8221; &#8230;.</p>
<p>So now I&#8217;m revisiting Zend the first thing I&#8217;ve done is write a couple of view helpers to batch add javascript and css files, which I thought I&#8217;d share here.</p>
<pre>&lt;?php

class Zend_View_Helper_IncludeStyles extends Zend_View_Helper_Abstract {

   public function includeStyles($folder)
   {
     $results = array();
     $handler = opendir(getenv("DOCUMENT_ROOT") . "/css/" . $folder);
     while ($file = readdir($handler)) {
       if ($file != "." &amp;&amp; $file != "..") {
         $this-&gt;view-&gt;headLink()-&gt;appendStylesheet('/css/' . $folder . '/' . $file);
       }
     }
     closedir($handler);
   }
}</pre>
<pre>&lt;?php

class Zend_View_Helper_IncludeScripts extends Zend_View_Helper_Abstract {

  public function includeScripts($folder)
  {
    $results = array();
    $handler = opendir(getenv("DOCUMENT_ROOT") . "/js/" . $folder);
    while ($file = readdir($handler)) {
      if ($file != "." &amp;&amp; $file != "..") {
        $this-&gt;view-&gt;headScript()-&gt;appendFile('/js/' . $folder . '/' . $file);
      }
    }
    closedir($handler);
  }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://wheresrhys.co.uk/2010/09/batch-including-headscripts-and-links-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cam****</title>
		<link>http://wheresrhys.co.uk/2010/05/cam/</link>
		<comments>http://wheresrhys.co.uk/2010/05/cam/#comments</comments>
		<pubDate>Fri, 07 May 2010 10:12:51 +0000</pubDate>
		<dc:creator>wheresrhys</dc:creator>
				<category><![CDATA[Life in general]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[camping]]></category>
		<category><![CDATA[campsite]]></category>
		<category><![CDATA[google map]]></category>
		<category><![CDATA[map]]></category>

		<guid isPermaLink="false">http://wheresrhys.co.uk/?p=1443</guid>
		<description><![CDATA[What a great day for the United Kingdom of Great Britain and Ireland. I think every man woman and child of this nation will wake this morning with new hope. Hope that the mistakes and missed opportunities of recent years will finally be undone. Hope that, from now on, we will all be armed with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.guardian.co.uk"><img class="alignright" src="http://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2010/5/2/1272831455373/samantha-cameron-and-davi-012.jpg" alt="" width="276" height="166" /></a>What a great day for the United Kingdom of Great Britain and Ireland. I think every man woman and child of this nation will wake this morning with new hope. Hope that the mistakes and missed opportunities of recent years will finally be undone. Hope that, from now on, we will all be armed with a new freedom, a new ease of living our lives without constraint by the petty failings of tired and out-of-date thinking.</p>
<p>I am of course talking about my new website, of which version 1 is now released</p>
<h2><a title="uk camping map" href="http://ukcampingmap.co.uk">ukcampingmap.co.uk</a></h2>
<p>It&#8217;s seems like an obvious idea, and I for one can&#8217;t believe no-one else has done it yet (particularly as I&#8217;ve been ruminating over it for the past two years): All the UK&#8217;s campsites plotted on a google map. So much easier than trawling through directories of campsites available elsewhere on the internet, that have only rudimentary or difficult to use tools for finding a campsite in the location you want one.</p>
<p>It has a <a title="campsites in and around cleethorpes" href="http://ukcampoingmap.co.uk/#search/cleethorpes">search</a> (for postcodes, towns, villages, tourist attractions) and also has easy navigation for viewing a single <a title="Campsites in south-west england" href="http://ukcampoingmap.co.uk/#region/southwestengland">region</a>, <a title="campsites in Lancashire" href="http://http://ukcampoingmap.co.uk/#county/lancashire">county</a> or <a title="Campsites in snowdonia" href="http://ukcampoingmap.co.uk/#destination/snowdonia">tourist area (eg Snowdonia)</a>.</p>
<p>There&#8217;s plenty more work to do on it, but for the first time, after a few weeks of intense work*, I have something fairly stable which is, while still very basic, still a lot easier to use than other campsite directories.</p>
<p>Enjoy.</p>
<p>Oh, and God help us now the  Tories are in!</p>
<p>*well, maybe an hour a day</p>
]]></content:encoded>
			<wfw:commentRss>http://wheresrhys.co.uk/2010/05/cam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s not what you say, it&#8217;s which font you say it in</title>
		<link>http://wheresrhys.co.uk/2010/03/process-for-choosing-font/</link>
		<comments>http://wheresrhys.co.uk/2010/03/process-for-choosing-font/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 22:36:21 +0000</pubDate>
		<dc:creator>wheresrhys</dc:creator>
				<category><![CDATA[Computers and all that]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[My resources]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[fonts]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[switcher]]></category>

		<guid isPermaLink="false">http://wheresrhys.co.uk/?p=1001</guid>
		<description><![CDATA[I&#8217;m redesigning this site at the moment and one thing I wanted to pay closer attention to this time around was choice of fonts. Notwithstanding the fact that web browsers were, until recently, pretty shoddy at allowing you to use the fonts you wanted to, the main reason I hadn&#8217;t paid much attention to fonts [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/russell-higgs/4397586937/"><img class="alignright" title="Suck my Goldman Sachs" src="http://farm5.static.flickr.com/4069/4397586937_9349cbc67c_m.jpg" alt="" width="240" height="180" /></a>I&#8217;m redesigning this site at the moment and one thing I wanted to pay closer attention to this time around was choice of fonts. Notwithstanding the fact that web browsers were, until recently, pretty shoddy at allowing you to use the fonts you wanted to, the main reason I hadn&#8217;t paid much attention to fonts in the past was that it&#8217;s so darn hard picking one, for a number of reasons:</p>
<ol>
<li>There&#8217;s so damn many of them</li>
<li>There&#8217;s no relation between names and appearance (as opposed to, say, #f60283 being guessable as a garish pink, closer to red than to mauve)</li>
<li>They&#8217;re difficult to preview and compare</li>
</ol>
<p>So in the interests of productivity, quality and, dare I say it, working smarter, not harder, I&#8217;ve devoted some time to sorting out how I choose fonts, reduced to the following four steps:</p>
<ol>
<li>Organise your fonts in themed folders</li>
<li>Find a good stand alone font previewer i.e. don&#8217;t rely on photoshop and windows&#8217; poor tools</li>
<li>Narrow down to a short list</li>
<li><a href="#the-javascript-bit">Use javascript to make quick comparisons easy</a></li>
</ol>
<p>Read on if your curiosity is piqued.</p>
<h3>1. Organising the fonts</h3>
<p>Windows&#8217;s default font collection (and, I imagine, Apple&#8217;s too) and the collection of 2000 fonts I also use are organised alphabetically which is rubbish. Unless you have web design OCD you&#8217;re unlikely to want to narrow down your choice of font by it&#8217;s first-letter. But, on the other hand, it is difficult to categorise fonts; I&#8217;m yet to see a website do it effectively, and I&#8217;m not entirely happy with my choice. But in the end I plumped for the following: serif, sans-serif, script, stylised, symbol, stencil.</p>
<p>Stencil could easily fall within stylised, and stylised could easily be split into subfolders (Art Deco, Gothic, Celtic &#8230;), and I realised part way through that I should have a subfolder within symbol for fonts depicting alphabets other than Roman, but I think a minimal folder system would be serif, sans-serif and other. In the serif and sans-serif folders I included only sensible fonts you could print a book not aimed at children in, which I think is a useful distinction to make; often the hardest task when picking fonts is to find the one which is subtly different to other ordinary fonts, but somehow suits the design better than almost indistinguishable alternatives. Cutting out all the fancy fonts makes this task a lot easier.</p>
<p>So once you have all these folders put a copy of each font you have in one of them, and you&#8217;re ready for the next step. You don&#8217;t need to bother with installing them yet.</p>
<h3>2. Previewing your fonts</h3>
<p>My criteria for a good font-previewer are:</p>
<ol>
<li>Choice of text to use for the preview</li>
<li>Choice of text-size and colour</li>
<li>Ability to organise fonts how you want them organised</li>
<li>Speed and ease of switching between one font and another</li>
<li>Ease of installing a font</li>
</ol>
<p>Windows&#8217; control panel fails to meet conditions 1 and 2, and Photoshop&#8217;s built-in font selector fails to meet 3 and 4, and they both force you to install a font before using it. The best free solution I&#8217;ve come across for Windows which meets all 5 conditions is <a href="http://www.lanmisoft.com/fastfontpreview.htm">Fast Font Preview</a>.</p>
<h3>3. Short-listing</h3>
<p>Once you&#8217;ve got Fast Font Preview installed you can start picking your shortlist. Simply browse to your organised font folders, click on settings to type in your sample text, adjust the font-size to what you want, and double click on any contenders. Once the font is opened you can install with one click. While the font is open you&#8217;ll also want to jot down its official font name.</p>
<h3 id="the-javascript-bit">4. Use javascript to make comparisons</h3>
<p>This is where I stop being pedantic and hopefully can be of some use. Insert the following script into the head of your web-page-in-need-of-a-font, substitute your list of font names and the id/tag name of the elements to be affected and, hey presto, a handy font-switcher should appear, making choosing exactly the right font much easier. If your web page already uses javascript then add the body of the function to your existing onload event. (NOTE: It tends to work better in Google Chrome than other browsers as Google Chrome seems to be a bit more forgiving when it comes to font names).</p>
<pre>window.onload = function() {
 var body = document.getElementsByTagName('body')[0];
 var id = '';
 var tagName = '';
 var fonts = 'Comma,separated,list,of font,names';
 fonts = fonts.split(',');
 var elements = (id)      ? [document.getElementById(id)] :
                (tagName) ? document.getElementsByTagName(tagName):
                            [body];
 var switcher = document.createElement('DIV');
 switcher.setAttribute('style','position:absolute;top:0;right:0;background:white;z-index:200;padding:10px;');
 for(var i=0, il = fonts.length;i&lt;il;i++){
   createButton(i);
 }
 body.appendChild(switcher);
 var buttons = switcher.childNodes
 loadFont(0);

 function createButton(pos) {
   var button = document.createElement('a');
   button.innerHTML = fonts[pos];
   button.setAttribute('style','display:block;padding:2px;');
   button.setAttribute('href','#');
   button.onclick = function() {loadFont(pos);};
   switcher.appendChild(button);
 }

 function loadFont(pos) {
   for (var i=0,il=elements.length;i&lt;il;i++)
   {
     elements[i].style.fontFamily = fonts[pos];
   }
   for (var j=0,jl=buttons.length;j&lt;jl;j++) {
     buttons[j].style.backgroundColor='';
   }
   buttons[pos].style.backgroundColor='yellow';
   return false;
 };
};</pre>
]]></content:encoded>
			<wfw:commentRss>http://wheresrhys.co.uk/2010/03/process-for-choosing-font/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cooking with SQL</title>
		<link>http://wheresrhys.co.uk/2010/02/cooking-with-sql/</link>
		<comments>http://wheresrhys.co.uk/2010/02/cooking-with-sql/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 08:49:45 +0000</pubDate>
		<dc:creator>wheresrhys</dc:creator>
				<category><![CDATA[Computers and all that]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[zend_db_select]]></category>
		<category><![CDATA[zen_db_table]]></category>

		<guid isPermaLink="false">http://wheresrhys.co.uk/?p=1395</guid>
		<description><![CDATA[SQL was the sight of my first forays into programming, back in the days when I managed records for an educational project and came to the heretic conclusion that MS Access was better suited to the task than Excel. But that&#8217;s more or less where my learning of SQL stopped, and even then it was [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/mthird3rd/4254032951/"><img class="alignright" title="Difficult to pick a table" src="http://farm3.static.flickr.com/2756/4254032951_e9648efabe_m.jpg" alt="" width="240" height="160" /></a>SQL was the sight of my first forays into programming, back in the days when I managed records for an educational project and came to the heretic conclusion that MS Access was better suited to the task than Excel. But that&#8217;s more or less where my learning of SQL stopped, and even then it was limited to SELECT, WHERE and ORDER BY statements (I let Microsoft&#8217;s wizards do all the hard work of building multiple table queries).</p>
<p>Fast forward to yesterday and I decided to finally bite the bull by the horns. The back-end of my latest educational endeavour was, I guessed, suffering in speed due to the fact that I made no use of JOIN on my MySQL tables; each time I wanted to get records related to records in another table I would use nested loops in php to get the related records for each row.</p>
<p>In my defence, I largely chose this approach due to another 3 major flaws in  <a href="http://wheresrhys.co.uk/2009/12/a-greasy-framework-2/">Zend Framework\&#8217;s documentation</a>:</p>
<ol>
<li>It doesn&#8217;t explicitly mention that when you build a Zend_Db_Select query based on a Zend_Db_Table class (ie a Model) the FROM clause of the query is automatically filled in. Attempting to fill it in yourself causes an error.</li>
<li>It doesn&#8217;t mention anywhere that in order to use JOIN within a Zend_Db_Select query based on a Zend_Db_Table class you need to use the -&gt;setIntegrityCheck(false) method. Without this all manner of confusing errors occur.</li>
<li>This wording: &#8220;You <em>can not</em> specify columns from a JOINed tabled to be                         returned in a row/rowset. Doing so will trigger a <acronym>PHP</acronym> error&#8221; , coupled with the fact I was getting lots of errors led me to believe that Zend had neglected to add JOIN functionality to its models, so I dropped that line of attack. (In fact, all that quote means is that you cannot change the default behaviour, which is to fetch all columns).</li>
</ol>
<p>But now I have of course overcome all this, and have managed to eg reduce about 30 lines of code (get a teacher&#8217;s classes, then get these classes&#8217; assignments, then get all the attempts at these assignments, and for each of these get the individual puzzle solutions submitted) to a single line using 3 RIGHT JOINs and one INNER JOIN. It&#8217;s much neater, and I can only guess at the vast improvements in speed it brings; my guess is &#8220;oodles&#8221;.</p>
<p>As well as improving my application, learning about Zend_Db_Select (the documentation to this is remarkably well written, <a href="http://wheresrhys.co.uk/2009/12/a-greasy-framework-2/">considering the surroundings</a>), via the __toString() method, has increased my understanding of the underlying SQL to the point where for the first time I can write non-trivial queries from scratch &#8211; eg updating a field based on a join with another table &#8211; , which is a great addition to my programming armoury.</p>
]]></content:encoded>
			<wfw:commentRss>http://wheresrhys.co.uk/2010/02/cooking-with-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

