<?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>The Sheep &#187; Code</title>
	<atom:link href="http://www.thesheep.co.uk/category/blog/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thesheep.co.uk</link>
	<description>Ovine Perspectives On The Digital Age</description>
	<lastBuildDate>Fri, 22 Jul 2011 10:33:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A really simple font resizer using JQuery</title>
		<link>http://www.thesheep.co.uk/2010/02/02/a-really-simple-font-resizer-using-jquery/</link>
		<comments>http://www.thesheep.co.uk/2010/02/02/a-really-simple-font-resizer-using-jquery/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 22:55:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.thesheep.co.uk/?p=270</guid>
		<description><![CDATA[<p>Sometimes it&#8217;s useful to have links or buttons to increase the font size on a website. Even though browsers have built-in functions to resize content, not all users are aware of this, or can easily remember how to increase the&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s useful to have links or buttons to increase the font size on a website. Even though browsers have built-in functions to resize content, not all users are aware of this, or can easily remember how to increase the text size.</p>
<p>The general mechanism for resizing text is to have one link to increase the font size and one to reduce it. However, it can get tricky for the user to keep track of what the original size was, so sometimes people include a &#8216;reset font size&#8217; button.</p>
<p>At this point the UI is starting to get a tiny bit complicated, so I was looking for a way to create a dead-simple widget with just 2 options – small font or big font. Keep it simple.</p>
<p>I&#8217;m sure someone has done this before, but I couldn&#8217;t find a script on Google that did everything I wanted, including changing the styling of the currently selected font size to make it obvious, as well as a cookie to make the size selection persistent across pages in the site. So I hacked around with a couple of other scripts I found and created a solution using JQuery.</p>
<ul>
<li><a href="http://www.thesheep.co.uk/examples/font-resizer/"><strong>View the demo »</strong></a>.</li>
<li><a href="http://www.thesheep.co.uk/examples/font-resizer/font-resizer.zip">Download the source files</a></li>
</ul>
<p>The advantages of this solution are:</p>
<ul>
<li>The UI is really clear and simple (you could make buttons instead of links if you like)</li>
<li>A separate class is toggled for the currently selected size</li>
<li>The resize links are only displayed if the user has javascript enabled</li>
<li>The font size selection is persistent across pages</li>
<li>The resize affects the font-size as set on the HTML body element. So all text that you want to be resized needs to be sized in percentages or ems. If there are some elements you don&#8217;t want to be affected by the resizing, you can specify their size separately in pixels.</li>
<li>Unobtrusive Javascript</li>
</ul>
<p>A few notes:</p>
<ul>
<li>By loading the JQuery library from Google&#8217;s servers, it&#8217;s likely that the code will already be cached, thus saving download time</li>
<li>You need to include the <a href="http://plugins.jquery.com/project/cookie">JQuery Cookie plugin</a> separately</li>
<li>Font sizes for LARGE and SMALL need to be set in the JS file</li>
<li>The links need to be set to display: none within your stylesheet so they are hidden by default. They are then revealed for JS-capable browsers only</li>
</ul>
<p>I got the basic idea for how to approach this using JQuery from <a href="http://www.shopdev.co.uk/blog/text-resizing-with-jquery/">a post on ShopDev</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thesheep.co.uk/2010/02/02/a-really-simple-font-resizer-using-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Correct use of HTML headings on a homepage</title>
		<link>http://www.thesheep.co.uk/2009/06/11/correct-use-of-html-headings-on-a-homepage/</link>
		<comments>http://www.thesheep.co.uk/2009/06/11/correct-use-of-html-headings-on-a-homepage/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 16:20:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[wcag]]></category>
		<category><![CDATA[web standards]]></category>

		<guid isPermaLink="false">http://www.thesheep.co.uk/?p=148</guid>
		<description><![CDATA[<p>There&#8217;s been quite a lot of debate about the correct use of HTML headings (H1, H2, H3, etc) to define a document structure. <a href="http://www.w3.org/TR/WCAG20-TECHS/G141.html">WCAG 2.0 says</a> that we should create a correctly nested structure of headings, not least to&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s been quite a lot of debate about the correct use of HTML headings (H1, H2, H3, etc) to define a document structure. <a href="http://www.w3.org/TR/WCAG20-TECHS/G141.html">WCAG 2.0 says</a> that we should create a correctly nested structure of headings, not least to help users with screen readers browse through content on a page. Conventional standards-aware wisdom says that each page should have a single H1, followed by H2s, H3s, etc. This is fine for a web page that is structured like a Word document &#8211; we have an overall heading, and then sub-headings. But what about a homepage that consists of some branding, navigation, and then a grid of &#8216;teasers&#8217; for deeper content on the site? This is a different kind of page structure, and arguably not one that HTML was designed for, so there&#8217;s going to be some compromise.</p>
<ol>
<li>There&#8217;s a good case for saying that on the hompage (only) the logo or name of the site should be marked up as H1. I don&#8217;t think this should be applied as a general rule on other &#8216;content pages&#8217; because this is a waste of the H1 function both for screen readers and for search engine ranking. But we could make an exception for the homepage. It sort of makes sense. But then you have a slightly fussy situation where the HTML and CSS for your logo is different for the homepage than for all other pages.</li>
<li>Another alternative would be to allow multiple H1s on the page and markup all the teaser headings as H1. This feels instinctively wrong to me, because I think an H1 should define the overall, main content for a page. It probably also dilutes the effectiveness of the headings in search engines, and isn&#8217;t going to help screen readers if they&#8217;re expecting a single H1.</li>
<li>Alternatively, we could choose to miss out the H1 tag for the homepage. This makes sense from the perspective of the information architecture for the site. Afterall, those teaser headings are H1s on the content pages they link to, but shouldn&#8217;t be H1s on the index page. In terms of screen readers: if an H1 is not found, presumably a decent screen reader will try jumping to H2. It may not be totally &#8216;correct&#8217; but I doubt this is going to trip someone up in practice? On the other hand, you are wasting the power of that H1 for search engine ranking.</li>
<li>I suppose a further option is to put in a &#8216;phantom H1&#8242; and then hide it with CSS. But that also feels a bit messy.</li>
</ol>
<p>So anyway, I&#8217;m leaning towards options 3 at the moment in cases where an H1 tag doesn&#8217;t really &#8216;make sense&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thesheep.co.uk/2009/06/11/correct-use-of-html-headings-on-a-homepage/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Customised search scope in WordPress</title>
		<link>http://www.thesheep.co.uk/2009/05/01/customised-search-scope-in-wordpress/</link>
		<comments>http://www.thesheep.co.uk/2009/05/01/customised-search-scope-in-wordpress/#comments</comments>
		<pubDate>Fri, 01 May 2009 16:09:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.thesheep.co.uk/?p=169</guid>
		<description><![CDATA[<p>Sometimes in a WordPress site you might want to have the option to search within different types of content. For example, if one category contains blog posts and another one contains white papers, you might want to allow people to&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Sometimes in a WordPress site you might want to have the option to search within different types of content. For example, if one category contains blog posts and another one contains white papers, you might want to allow people to restrict their search query to blog posts only. Here is a slightly hacky way to achieve this.</p>
<p>Create a specific template for displaying search results &#8211; <strong>search.php</strong>. Then, by placing an extra field in your search forms, you can check for this value within search.php and display or hide certain categories depending on what you detect.</p>
<p>So for example on your homepage you might have a search form with a field like this:<br />
<code><br />
&lt;label&gt;Restrict search to blog: &lt;input name="scope" type="radio" value="blog" /&gt;&lt;/label&gt;<br />
</code></p>
<p>Then within <strong>search.php</strong> you would pick up that value like this:<br />
<code><br />
&lt;?php $scope = $_GET['scope']; ?&gt;<br />
</code></p>
<p>And then use that to skip certain categories within the loop:<br />
<code><br />
&lt;?php while (have_posts()) : the_post(); ?&gt;<br />
//Skip this result if it's out of scope:<br />
&lt;?php if($scope == 'blog' &amp;&amp; !in_category(1)) continue; ?&gt;<br />
....<br />
</code></p>
<p>Of course you can make this more complex by setting up multiple scopes and including more categories in each.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thesheep.co.uk/2009/05/01/customised-search-scope-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Adding a YouTube feed to a WordPress template</title>
		<link>http://www.thesheep.co.uk/2009/03/17/adding-a-youtube-feed-to-a-wordpress-template/</link>
		<comments>http://www.thesheep.co.uk/2009/03/17/adding-a-youtube-feed-to-a-wordpress-template/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 16:19:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://www.thesheep.co.uk/?p=151</guid>
		<description><![CDATA[<p>The built in WordPress function <a title="WordPress function reference for fetch_rss()" href="http://codex.wordpress.org/Function_Reference/fetch_rss" target="_blank">fetch_rss()</a> makes it easy to pull in an RSS feed from any other site and display it on your own blog.  The function gives you convenient access to&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>The built in WordPress function <a title="WordPress function reference for fetch_rss()" href="http://codex.wordpress.org/Function_Reference/fetch_rss" target="_blank">fetch_rss()</a> makes it easy to pull in an RSS feed from any other site and display it on your own blog.  The function gives you convenient access to the raw data from the feed, so you can parse it in any way you like. For example, you might want to pull in the feed from a particular YouTube user and display their most recent 3 videos in your sidebar.</p>
<p>The first thing we want to do is visit the user&#8217;s page on YouTube to grab the feed URL for that person. It might be your own account, of course, but there&#8217;s no need to log in, and feeds are publically available from anyone&#8217;s account. Once on a user&#8217;s page, your browser should display an RSS icon: click on it and copy the URL of the feed. It will look something like this:</p>
<p><code>http://gdata.youtube.com/feeds/base/users/MontyPython/uploads?alt=rss&amp;v=2&amp;orderby=published&amp;client=ytapi-youtube-profile<br />
</code><br />
In this case I&#8217;ve grabbed the feed from a channel.</p>
<p>Next open up the WordPress template file for the page you want to display the content on. It might be &#8217;sidebar.php&#8217;, for example. Wherever you want the videos to appear, you need to call the fetch_rss() function as described in the <a href="http://codex.wordpress.org/Function_Reference/fetch_rss" target="_blank">WordPress documentation</a>.</p>
<p><code class="prettyprint">&lt;?php<br />
// Get RSS Feed(s)<br />
include_once(ABSPATH . WPINC . '/rss.php');<br />
$rss = fetch_rss('http://gdata.youtube.com/feeds/base/users/MontyPython/uploads?alt=rss&amp;v=2&amp;orderby=published&amp;client=ytapi-youtube-profile');<br />
$maxitems = 3; //set number of items to display<br />
$items = array_slice($rss-&gt;items, 0, $maxitems);<br />
?&gt;<br />
</code></p>
<p>In order to embed a YouTube Flash movie we could use the <a href="http://www.alistapart.com/articles/flashembedcagematch/">nested objects method</a>, so we have valid HTML, and include some appropriate alternative content (in case the Flash fails to load for some reason). To set this up for each item, all we need from the feed is the ID of the video.</p>
<p>If we examine the RSS feed itself, we find that the video ID is contained in the final part of the &#8216;link&#8217; element. To extract it, we&#8217;ll need to use a tiny bit of PHP to break up the URL string.</p>
<p>Of course we need to repeat this for each item in the feed, so we set up a loop like this:</p>
<p><code class="prettyprint"><br />
&lt;ul&gt;<br />
&lt;?php if (empty($items)) echo '&lt;li&gt;No items&lt;/li&gt;';<br />
else foreach ( $items as $item ) : ?&gt;<br />
&lt;div&gt;<br />
&lt;?php<br />
      $youtubeid = strchr($item['link'],'='); //split off the final bit of the URL beginning with '='<br />
      $youtubeid = substr($youtubeid,1); //remove that equals sign to get the video ID<br />
      //Now embed the flash:<br />
      ?&gt;<br />
      &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="265"&gt;<br />
      &lt;param name="movie" value="http://www.youtube.com/v/&lt;?php echo $youtubeid ?&gt;&amp;hl=en&amp;fs=1" /&gt;<br />
      &lt;!--[if !IE]&gt;--&gt;<br />
      &lt;object type="application/x-shockwave-flash" data="http://www.youtube.com/v/&lt;?php echo $youtubeid  ?&gt;&amp;hl=en&amp;fs=1" width="320" height="265"&gt;<br />
      &lt;!--&lt;![endif]--&gt;<br />
      &lt;p&gt;&lt;a href="http://www.youtube.com/v/&lt;?php echo $youtubeid ?&gt;"&gt;View movie&amp;raquo;&lt;/a&gt;&lt;/p&gt;<br />
      &lt;!--[if !IE]&gt;--&gt;<br />
      &lt;/object&gt;<br />
      &lt;!--&lt;![endif]--&gt;<br />
      &lt;/object&gt;<br />
      &lt;/li&gt;<br />
&lt;?php endforeach; ?&gt;<br />
&lt;/ul&gt;</code></p>
<p>This method is pretty easy to adapt for any type of RSS feed you might want to use: Vimeo, Slideshare, Twitter, etc. Of course there are loads of WordPress plugins that can help you embed this stuff, but sometimes a plugin doesn&#8217;t give you exactly the output you need, and it&#8217;s helpful to be able to parse the feed yourself. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thesheep.co.uk/2009/03/17/adding-a-youtube-feed-to-a-wordpress-template/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>CSS typography: setting a vertical rhythm</title>
		<link>http://www.thesheep.co.uk/2009/01/14/css-typography-setting-a-vertical-rhythm/</link>
		<comments>http://www.thesheep.co.uk/2009/01/14/css-typography-setting-a-vertical-rhythm/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 12:31:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://www.thesheep.co.uk/?p=80</guid>
		<description><![CDATA[<p>An <a href="http://www.webtypography.net/Rhythm_and_Proportion/Vertical_Motion/2.2.2/">increasing</a> <a href="http://24ways.org/2006/compose-to-a-vertical-rhythm">number</a> <a href="http://www.alistapart.com/articles/settingtypeontheweb">of</a> <a href="http://www.markboulton.co.uk/journal/comments/incremental_leading/">people</a> are starting to think about vertical rhythm in their web typography, so I thought I&#8217;d share my CSS implementation, which uses <em>ems</em> (to allow for text resizing), a global <em>line-height</em> and&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>An <a href="http://www.webtypography.net/Rhythm_and_Proportion/Vertical_Motion/2.2.2/">increasing</a> <a href="http://24ways.org/2006/compose-to-a-vertical-rhythm">number</a> <a href="http://www.alistapart.com/articles/settingtypeontheweb">of</a> <a href="http://www.markboulton.co.uk/journal/comments/incremental_leading/">people</a> are starting to think about vertical rhythm in their web typography, so I thought I&#8217;d share my CSS implementation, which uses <em>ems</em> (to allow for text resizing), a global <em>line-height</em> and negative margins for headings.</p>
<p>The basic idea behind composing to a vertical rhythm is to keep text lined up on an imaginary grid of evenly spaced horizontal lines all the way down the page. The effect is unconscious to the average reader but helps to make the layout of the page feel harmonious and restful.</p>
<p>Handily, the CSS property <em>line-height</em> can be set globally on the BODY element and inherited down through every other element to form the basis of our invisible grid (which I&#8217;ve made visible on <a title="View example in a new window" href="http://www.thesheep.co.uk/examples/vertical-rhythm/" target="_blank">my example</a>). We also set a default font size in a similar way:</p>
<blockquote><p><code>body {<br />
font-family: Verdana, sans-serif;<br />
font-size: 0.875em; /* set default font size to 14px */<br />
line-height: 1.42857em; /* set global line height to 20px */<br />
}</code></p></blockquote>
<p>In order to maintain our grid, it is important that the margins relate to the line height rather than the font size. So we set margins on individual element types like this:</p>
<blockquote><p><code>p { margin: 1.42857em 0; /* Set margins on paragraphs to 1 x line-height */ }</code></p></blockquote>
<p>Of course, not all text on a page will be the same size, so we can vary this on individual element types (note that this doesn&#8217;t affect the line height, which retains its value as inherited from the body element). The important thing is to adjust the margins accordingly:</p>
<blockquote><p><code>#sidebar p {<br />
font-size: 0.85714em; /* reduce font-size to 12px for #sidebar */<br />
margin: 1.6667em 0; /* adjust margins accordingly */<br />
}</code></p></blockquote>
<p>You&#8217;ll see there&#8217;s a bit of maths going on here. To work out a new font size in ems, simply divide the target pixel size by the default pixel size. So if the default font size is 14px and we want a pixel size of 12px, we set it to 12/14 = 0.8571. Then, remembering that margins relate to the font size, we scale them so they match the global line height. In this case we want a margin of 20px (to match our line height) so the calculation is 20/12 = 1.6667.</p>
<p>So far so good. The only other tricky bit comes if we want to set the margins on our headings so that they are closer to the text below them, and have a bigger margin above. This helps re-inforce the relationship between a section of text and its heading, and helps create more appropriate spacing between sections.</p>
<p>One way to achive this is to double the top margin for headings, but that can make the spacing pretty large. So often I prefer to move the headings down by a fraction of the global line height. The important thing here is to keep the overall rhythm going, even though the rhythm is broken for a particular heading (maybe we should call this &#8217;syncopated headings&#8217;). To do this, just make sure that when you take something off the bottom margin, you add the same amount onto the top margin. That way the overall grid is maintained. We can use negative bottom margins to help with the interaction with the top margin on a following P element:</p>
<blockquote><p><code>h2 {<br />
font-size: 1.2857em; /* 18px */<br />
margin: 1.6666em 0 -0.5556em; /* top margin: 30px, bottom margin: 10px */<br />
}</code></p></blockquote>
<p>And that&#8217;s basically it. You can see a live demo of this technique <a title="View example in a new window" href="http://www.thesheep.co.uk/examples/vertical-rhythm/" target="_blank">here</a>. I&#8217;ve added the horizontal grid lines on with a background image, to help see how the spacing works.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thesheep.co.uk/2009/01/14/css-typography-setting-a-vertical-rhythm/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Speaking to other SSH users</title>
		<link>http://www.thesheep.co.uk/2008/12/19/speaking-to-other-ssh-users/</link>
		<comments>http://www.thesheep.co.uk/2008/12/19/speaking-to-other-ssh-users/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 11:51:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.thesheep.co.uk/?p=78</guid>
		<description><![CDATA[<p>A not very useful tip:</p>
<p>To check who may be on your machine, open the Terminal and type &#8216;who&#8217; (or to see who was on recently, type &#8216;last&#8217;).</p>
<p>To send everyone a message type:</p>
<p>echo &#8216;Stop sneaking around on my&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>A not very useful tip:</p>
<p>To check who may be on your machine, open the Terminal and type &#8216;who&#8217; (or to see who was on recently, type &#8216;last&#8217;).</p>
<p>To send everyone a message type:</p>
<p>echo &#8216;Stop sneaking around on my machine&#8217; | wall</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thesheep.co.uk/2008/12/19/speaking-to-other-ssh-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing del.icio.us bookmarks into Firefox 3</title>
		<link>http://www.thesheep.co.uk/2008/06/27/importing-delicious-bookmarks-into-firefox-3/</link>
		<comments>http://www.thesheep.co.uk/2008/06/27/importing-delicious-bookmarks-into-firefox-3/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 15:51:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[bookmarks]]></category>
		<category><![CDATA[delicious]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://www.thesheep.co.uk/?p=60</guid>
		<description><![CDATA[<p>I&#8217;ve been pretty impressed with <a href="http://www.mozilla.com/en-US/firefox/">Firefox 3</a>, the new version of the browser launched by Mozilla on June 17. It feels a lot snappier on OSX (it no longer lags behind Safari) and the new implementation of the address&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been pretty impressed with <a href="http://www.mozilla.com/en-US/firefox/">Firefox 3</a>, the new version of the browser launched by Mozilla on June 17. It feels a lot snappier on OSX (it no longer lags behind Safari) and the new implementation of the address bar is very usable. My favourite plugins were also immediately available (despite a few teething problems with the update system). So I finally took the plunge and switched my default browser to Firefox instead of Safari.</p>
<p>One of the new features I was glad to see was the ability to add tags to bookmarks. This is a much better way to organise bookmarks than a folder structure and it made me wonder about importing all my <a href="http://del.icio.us/">del.icio.us</a> bookmarks into Firefox. Although the <a href="https://addons.mozilla.org/en-US/firefox/addon/3615">del.icio.us plugin for Firefox 3</a> is actually very good, I thought it might be nice to be able to use the native browser system for adding new ones. (Sadly you can&#8217;t use both at the same time at the moment, because installing the del.icio.us extension seems to cripple the Firefox &#8216;add bookmark&#8217; function).</p>
<p>Annoyingly it turns out that, although you can export your bookmarks from del.icio.us with tags, importing them into Firefox strips off all the tag information. After some <a href="http://forums.mozillazine.org/viewtopic.php?f=23&amp;t=659182">discussion on the Mozilla forum</a>, someone came up with a ruby script for converting del.icio.us bookmarks into the required Firefox compatible format (including tags). And now my friend Zhang Xue from <a href="http://www.e-accent.com">e-accent</a> has helped me create a little online tool for doing the conversion, based on that original ruby script. Check it out at:</p>
<p><strong><a href="http://delicious.e-accent.com/">http://delicious.e-accent.com</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thesheep.co.uk/2008/06/27/importing-delicious-bookmarks-into-firefox-3/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Gfaster: faster iPhone searching over EDGE</title>
		<link>http://www.thesheep.co.uk/2008/03/11/gfaster-faster-iphone-searching-over-edge/</link>
		<comments>http://www.thesheep.co.uk/2008/03/11/gfaster-faster-iphone-searching-over-edge/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 11:50:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://www.thesheep.co.uk/?p=46</guid>
		<description><![CDATA[<p>After an idea I had <a href="http://www.thesheep.co.uk/2008/02/27/iphone-browsing-over-edge-with-images-turned-off">a couple of weeks ago</a>, I cobbled together <a href="http://gfaster.com">a little web app</a> for the iPhone that lets you search Google’s cached search results with images stripped out. <strong><a href="http://gfaster.com">Gfaster</a></strong> gives you a standard Google&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>After an idea I had <a href="http://www.thesheep.co.uk/2008/02/27/iphone-browsing-over-edge-with-images-turned-off">a couple of weeks ago</a>, I cobbled together <a href="http://gfaster.com">a little web app</a> for the iPhone that lets you search Google’s cached search results with images stripped out. <strong><a href="http://gfaster.com">Gfaster</a></strong> gives you a standard Google search, but adds ‘text-only’ links, allowing you to view a result quickly over <span class="caps">EDGE</span>. This can be useful if you’re stranded miles from a Wifi hotspot and wanting to some more serious reading or research over the 2G network. The page will load in a second or two and, although it won’t be very pretty, you get all the text in articles, reviews, forum posts, etc.</p>
<p><a title="Visit the app (works best on an iPhone)" href="http://gfaster.com"><img src="http://www.thesheep.co.uk/wp-content/uploads/gfaster-logo.gif" alt="GFaster - get Google search results faster over 2.5G network" /></a></p>
<p>The Gfaster search actually works well in practice. The only slight downside I’ve found is that many of the text-only pages are a little wide, resulting in quite small font-sizes on the iPhone, even in landscape orientation.</p>
<p>The app was built using <a href="http://code.google.com/apis/ajaxsearch/">Google’s Ajax Search API</a>, and I had some invaluable help from a couple of the guys at the <a href="http://groups.google.com/group/Google-AJAX-Search-API"><span class="caps">API</span> Google Group</a>. As usual, I was impressed by the community spirit of people willing to spend time to help each other out.</p>
<p>You can also find Gfaster listed on <a href="http://www.apple.com/webapps/searchtools/gfaster.html">Apple’s Web App Directory</a>.</p>
<p>For anyone giving this a try on their iPhone, let me know how you find it, and if you have any ideas for improving it. I should probably add pagination at the bottom, so when I get a moment I’ll do that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thesheep.co.uk/2008/03/11/gfaster-faster-iphone-searching-over-edge/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>iPhone browsing over EDGE with images turned off</title>
		<link>http://www.thesheep.co.uk/2008/02/27/iphone-browsing-over-edge-with-images-turned-off/</link>
		<comments>http://www.thesheep.co.uk/2008/02/27/iphone-browsing-over-edge-with-images-turned-off/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 09:33:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://www.thesheep.co.uk/2008/02/27/iphone-browsing-over-edge-with-images-turned-off/</guid>
		<description><![CDATA[<p>Generally, browsing the web on the iPhone over <span class="caps">EDGE</span> is slow, especially if you are loading pages with lots of graphics. What a shame, then, that there is no option available on the mobile version of Safari to turn&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Generally, browsing the web on the iPhone over <span class="caps">EDGE</span> is slow, especially if you are loading pages with lots of graphics. What a shame, then, that there is no option available on the mobile version of Safari to turn off images. This would be especially useful for those times when you need to do some proper research when out and about. Could there be a solution to this, using Google&#8217;s Search API</p>
<p>Last weekend I was in Bristol trying to buy a PS3 game as a present for my brother-in-law. Since I know almost nothing about video games, for each game I saw in the shop I used my iPhone to read through a bunch of reviews. But game review sites tend to have a lot of graphics on them, and loading each page over the <span class="caps">EDGE</span> network was painfully slow. It was taking me ages to load each page before I could read the review.</p>
<p>Then I realised that Google has a cached version of each search result and that there is a link at the top of each cached page allowing you to load a text-only version. For the research I was doing, I didn’t matter whether that the results were pages cached from a few days ago: the reviews available would be largely the same.</p>
<p>This started me thinking. It turns out that you can get directly to the cached, text-only version of any page by using the <strong>cache</strong> keyword and the <strong>strip</strong> setting on a Google search <span class="caps">URL</span>. So for example:</p>
<p><a href="http://google.com/search?q=cache:jackfruitdesign.com&amp;strip=1">http://google.com/search?q=cache:jackfruitdesign.com&amp;strip=1</a></p>
<p>Gives you the cached, text-only version of <a href="http://www.jackfruitdesign.com">my company homepage</a>. But this doesn’t help much with my iPhone browsing, because it requires typing in each <span class="caps">URL</span> via the keyboard.</p>
<p>However, looking at the <a href="http://code.google.com/apis/ajaxsearch/">Google <span class="caps">AJAX</span> Search API</a>, it turns out that each search result has a link to its cached version (obviously) and that it should be possible to simply add the <strong>strip=1</strong> setting to the end of that <span class="caps">URL</span>. So it is feasible to create my own search page that uses the Google Search <span class="caps">API</span>, and use it to browse search results with images turned off, thus saving a lot of time over <span class="caps">EDGE</span>.</p>
<p>The <a href="http://code.google.com/apis/ajaxsearch/terms.html">Terms of Use</a> for the <span class="caps">API</span> seem to be a bit restrictive when it comes to making any modifications of the results themselves, so legally this could be a slightly grey area. But this use does seem to be within the spirit of the Google Search <span class="caps">API</span>, so I can’t see there being too much of a problem. Seems like a nice project for a rainy day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thesheep.co.uk/2008/02/27/iphone-browsing-over-edge-with-images-turned-off/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Forcing vCard downloads on the web</title>
		<link>http://www.thesheep.co.uk/2007/06/15/forcing-vcard-downloads-on-the-web/</link>
		<comments>http://www.thesheep.co.uk/2007/06/15/forcing-vcard-downloads-on-the-web/#comments</comments>
		<pubDate>Fri, 15 Jun 2007 19:23:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.thesheep.co.uk/2007/06/15/forcing-vcard-downloads-on-the-web/</guid>
		<description><![CDATA[<p>A <a href="http://en.wikipedia.org/wiki/VCard">vCard</a> is like an electronic business card. VCards are often attached to emails, or placed on the contact page of a website (see <a href="http://www.jackfruitdesign.com/contact/">my contact page</a>, for example). VCards can be easily imported into Outlook, and clicking&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://en.wikipedia.org/wiki/VCard">vCard</a> is like an electronic business card. VCards are often attached to emails, or placed on the contact page of a website (see <a href="http://www.jackfruitdesign.com/contact/">my contact page</a>, for example). VCards can be easily imported into Outlook, and clicking a vCard link in <span class="caps">OSX</span> will automatically add the contact details to your Apple Address Book.</p>
<p>Putting a vCard on your website ought to be very straightforward: just place the file, with its .vcf extension, onto your web server and put a link to it on your contact page. But, like me, you may run into a problem here. When you click on the link in the web page, you may find that the browser opens the vCard file into the browser window, instead of starting a download</p>
<p>There are 2 different ways to solve this problem. The first one is to modify your web server so that it serves up the correct <span class="caps">MIME</span> type for the vCard file in the <span class="caps">HTTP</span> header. In Apache, for example, you could set this up in the main <span class="caps">MIME</span> type configuration file (if you have access to it) or you can set it in a local .htaccess file by adding the following line:</p>
<p><code>AddType text/x-vcard .vcf</code></p>
<p>See <a href="http://www.spartanicus.utvinternet.ie/file_extensions_and_mime_types_on_the_web.htm">this article</a> for more details.</p>
<p>The second way to approach the problem is to setup the <span class="caps">HTTP</span> headers dynamically. <span class="caps">HTTP</span> headers cannot be set on an <span class="caps">HTML</span> page of course: an <span class="caps">HTML</span> page will have its own headers. To manipulate the headers explicitly you will need to use a server-side scripting language such as <span class="caps">PHP</span> or <span class="caps">ASP</span>. A decent <span class="caps">PHP</span> script for doing this can be found at <a href="http://elouai.com/force-download.php">elouai.com/force-download.php</a>. Note that it is a good idea to hardcode your vCard filename into the script itself to prevent hackers from hijacking the script.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thesheep.co.uk/2007/06/15/forcing-vcard-downloads-on-the-web/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
	</channel>
</rss>

