<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Float Left » Notebook</title>
	
	<link>http://floatleft.com</link>
	<description>Web design &amp; development in Teddington, London</description>
	<lastBuildDate>Sun, 08 Jan 2012 15:19:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/floatleft_notebook" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="floatleft_notebook" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Bootstrap</title>
		<link>http://floatleft.com/notebook/bootstrap</link>
		<comments>http://floatleft.com/notebook/bootstrap#comments</comments>
		<pubDate>Sun, 08 Jan 2012 15:19:17 +0000</pubDate>
		<dc:creator>Andrew Appleton</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://floatleft.com/?p=417</guid>
		<description><![CDATA[Starting a website from scratch can involve a lot of repetitive setup each time and most developers tend to keep a barebones folder to be used as a start point. I decided to clean mine up and make it available on Github in two flavours. First, there&#8217;s website bootstrap, containing the files and folders I [...]]]></description>
			<content:encoded><![CDATA[<p>Starting a website from scratch can involve a lot of repetitive setup each time and most developers tend to keep a barebones folder to be used as a start point.</p>
<p>I decided to clean mine up and make it available on Github in two flavours. First, there&#8217;s <a href="https://github.com/mrappleton/website-bootstrap">website bootstrap</a>, containing the files and folders I tend to use for every project. This is just flat HTML, CSS and JavaScript.</p>
<p>Second there&#8217;s <a href="https://github.com/mrappleton/perch-bootstrap">Perch bootstrap</a> which is similar except that it is designed to be used in a PHP environment and is what I use when I&#8217;m building a site with <a href="http://grabaperch.com">Perch</a>.</p>
<p>It&#8217;s called Perch bootstrap because that&#8217;s what I use it for, but there&#8217;s no reason it couldn&#8217;t be adapted for use with any PHP application.</p>
<p>There&#8217;s no kind of license on either so feel free to download, fork, redistribute or do whatever else makes you happy!</p>
]]></content:encoded>
			<wfw:commentRss>http://floatleft.com/notebook/bootstrap/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Archiving an Old WordPress Site</title>
		<link>http://floatleft.com/notebook/archiving-an-old-wordpress-site</link>
		<comments>http://floatleft.com/notebook/archiving-an-old-wordpress-site#comments</comments>
		<pubDate>Thu, 24 Mar 2011 10:31:55 +0000</pubDate>
		<dc:creator>Andrew Appleton</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://floatleft.com/?p=386</guid>
		<description><![CDATA[I recently retired the crappy old neglected blog which had been festering on my personal domain,]]></description>
			<content:encoded><![CDATA[<p>I recently retired the <a href="http://old.appleton.me">crappy old neglected blog</a> which had been festering on my personal domain, <a rel="me" href=http://appleton.me">appleton.me</a> and replaced it with a shiny new one page site. Whilst I don&#8217;t think many people will miss the old content, I was keen not to just let it disappear (what would <a href="http://adactio.com/journal/4336/">Jeremy Keith</a> say&#8230;).</p>
<p>The proper thing to do would be to move the old site to a subdomain and set up 301 redirects. This would mean that the (few) links to the old site would not die and the three people who ever cared would still be able to get to the content.</p>
<h3>Static Content</h3>
<aside>(Shut up, I know that nobody cares now let alone in 50 years but it&#8217;s the principle&#8230;)</aside>
<p>The old site ran on WordPress, but there is really no need for a CMS when the site is never going to be updated again. It is also a good idea to archive information in the simplest file format available &#8212; who knows if PHP &#038; MySQL will be available in 50 years and if they will be able to run a 50 year old weblog? The simplest format here would be plain HTML and CSS files. This also offers the benefit of reduced server load and improved page load times because we aren&#8217;t waiting for PHP and SQL queries to execute.</p>
<h3>A Plan</h3>
<p>So the idea seems simple:</p>
<ol>
<li>Create a static HTML &#038; CSS version of the old site.</li>
<li>Set it up on a subdomain</li>
<li>Configure 301 redirects to all of the old content</li>
</ol>
<p>And it turns out is was simple. Here&#8217;s how:</p>
<h3>Staticification</h3>
<aside><a href="http://twitter.com/teabass/status/32137375249334272">Andrew Nesbitt</a> also pointed me towards <a href="http://www.sitesucker.us/home.html">Site Sucker</a>, a Mac app which looks like it would do the same for any site.</aside>
<p>I played around with <a href="http://www.gnu.org/software/wget/">wget</a> for a while and learned that I am not really suited to command line tools. Then I found the <a href="http://wordpress.org/extend/plugins/really-static/">Really Static</a> plugin for WordPress which will scrape the entire site and produce a static version all nicely arranged into files and folders. This static version will directly mimic the URL structure of the dynamic site and is exactly what I was after.</p>
<p>I added a big old red banner to the top of the dynamic site (to let people know they&#8217;re looking at out of date content) and then set the plugin scraping. One thing to remember here is that all links will now be hard coded into the site &#8212; that means that you need to tell Really Static what subdomain you will be using (in my case old.appleton.me) before you start the process.</p>
<p>Now I have a plain HTML version of the site which I can configure on a subdomain. The second step is to redirect incoming links to the new (old) subdomain.</p>
<h3>.htaccess and 301 redirects</h3>
<p>I&#8217;m on an Apache web server so I need to configure a set of rewrite rules for all the old pages. Since the new site is only one page I can create a rule which says &#8220;Redirect everything at http://appleton.me/* to http://old.appleton.me/* except for the site root&#8221;.</p>
<p>If only .htaccess files we as easy as that. I needed a bit of help with this part, but fortunately <a href="http://stackoverflow.com/questions/4854256/htaccess-redirects">Stack Overflow is awesome</a>.</p>
<p>Here is the rewrite rule which got the job done:</p>
<pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
&lt;/IfModule&gt;

RewriteCond %{HTTP_HOST} ^appleton[.]me$ [NC]
RewriteCond %{REQUEST_URI} !^(/(index[.](html|php))?)?$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://old.appleton.me/%1$1 [R=301,QSA,L]</code></pre>
<p>Let&#8217;s step through it.</p>
<p>The first block tells Apache to enable URL rewriting:</p>
<pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
&lt;/IfModule&gt;</code></pre>
<p>Next we tell it to rewrite all URLs unless they are the site root (or /index.html or /index.php):</p>
<pre><code>RewriteCond %{HTTP_HOST} ^appleton[.]me$ [NC]
RewriteCond %{REQUEST_URI} !^(/(index[.](html|php))?)?$</code></pre>
<p>Tell it to also ignore direct requests for files (so that the CSS and JavaScript requests for the new index.html don&#8217;t get rewritten):</p>
<pre><code>RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d</code></pre>
<p>And finally tell it to return a 301 header and redirect to http://old.appleton.me/</p>
<pre><code>RewriteRule ^(.*)$ http://old.appleton.me/%1$1 [R=301,QSA,L]</code></pre>
<p>That just about covers it. I now have a new single page on <a href="http://appleton.me">appleton.me</a> and the old site archived at <a href="http://old.appleton.me">old.appleton.me</a>. There&#8217;s one last thing to consider though&#8230;</p>
<h3>404 Errors</h3>
<p>It is good practice to serve a 404 page when someone requests a page which doesn&#8217;t exist. The redirect rules we have set up will send any URL (real or non-existent) to the old.appleton.me subdomain. What I really want is for these 404 errors to be sent to my nice custom 404 page at <a href="http://appleton.me/404.html">appleton.me/404.html</a>.</p>
<p>To do this I set up another redirect, this time in the old.appleton.me domain root:</p>
<pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
&lt;/IfModule&gt;

ErrorDocument 404 http://appleton.me/404.html</code></pre>
<p>This little rule just tells Apache to enable the rewrite engine and send all 404 errors to appleton.me/404.html.</p>
<p>So there it is, a fully static archive of my old WordPress site complete with 301 redirects to all old content &#8212; no link rot and no reliance on databases and PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://floatleft.com/notebook/archiving-an-old-wordpress-site/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Minted</title>
		<link>http://floatleft.com/notebook/minted</link>
		<comments>http://floatleft.com/notebook/minted#comments</comments>
		<pubDate>Wed, 23 Mar 2011 16:32:55 +0000</pubDate>
		<dc:creator>Andrew Appleton</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://floatleft.com/?p=374</guid>
		<description><![CDATA[Today, I left my job as a Mechanical Engineer with Laing O&#8217;Rourke. Tomorrow and Friday, I will stock up on plaid shirts and ironic t-shirts (which are, I understand, compulsory attire). On the 28th March I will start my new job as a front end developer at Mint Digital. To say I am excited would [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I left my job as a Mechanical Engineer with <a href="http://laingorourke.com">Laing O&#8217;Rourke</a>. Tomorrow and Friday, I will stock up on plaid shirts and ironic t-shirts (which are, I understand, compulsory attire). On the 28<sup>th</sup> March I will start my new job as a front end developer at <a href="http://mintdigital.com">Mint Digital</a>.</p>
<p>To say I am excited would be an understatement. I am delighted that I will be making a living from something which I really love doing and am looking forward to learning a million new things.</p>
<p>I will still be available for some freelance work, but will need to reduce my workload and be careful not to conflict with anything I&#8217;m doing at Mint.</p>
<p>I&#8217;m excited for this new adventure in my life and can&#8217;t wait to get started!</p>
]]></content:encoded>
			<wfw:commentRss>http://floatleft.com/notebook/minted/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Up On My Perch</title>
		<link>http://floatleft.com/notebook/up-on-my-perch</link>
		<comments>http://floatleft.com/notebook/up-on-my-perch#comments</comments>
		<pubDate>Sun, 30 Jan 2011 15:31:36 +0000</pubDate>
		<dc:creator>Andrew Appleton</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://floatleft.com/?p=324</guid>
		<description><![CDATA[This is a post about a content management system, but first&#8230; A Story Last year we moved house and for the first time had fireplace. I brought logs and kindling and I tried to light a fire. It didn&#8217;t go too well because the logs were too big. They needed to be chopped and I [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post about a content management system, but first&hellip;</p>
<h3>A Story</h3>
<p>Last year we moved house and for the first time had fireplace. I brought logs and kindling and I tried to light a fire. It didn&#8217;t go too well because the logs were too big. They needed to be chopped and I didn&#8217;t have an axe so I used a saw. It went badly and I cut a large chunk out of my thumb.</p>
<h3>I thought this was about a CMS?</h3>
<p>I&#8217;m getting to that. The story has a moral. Ready?</p>
<blockquote><p>Something, something, right tool for the job.</p></blockquote>
<p>Deep.</p>
<p>I have tended to use <a href="http://wordpress.org/">WordPress</a> to build client sites and if I am honest it is because it is the tool I know best. But it is just a tool and just because it will do the job does not necessarily mean it is appropriate.</p>
<p>I have just launched a small site for <a href="http://danielstock.co.uk">Daniel Stock</a>, a freelance translator (check him out, he&#8217;s good). The requirements were simple &#8211; he needed a site where he could show his skills and qualifications and keep a testimonial section up to date.</p>
<p>I could have built this in good ol&#8217; WordPress &mdash; <a href="http://codex.wordpress.org/Pages">pages</a> for pages (well duh) and <a href="http://codex.wordpress.org/Post_Types">custom post type</a> or two for repeating information, in this case a <a href="http://danielstock.co.uk/services">history timeline</a> and <a href="http://danielstock.co.uk">testimonials</a>. This approach would have worked just fine, but it would also have ignored a lot of unneeded WordPress functionality. What would happen when the client tried to add a blog post or a link or a comment from the CMS? None of these would be used, but they would all accept content on the back end.</p>
<h3>Get to the Point</h3>
<p>Oh, right. So I looked around and found <a href="http://grabaperch.com">Perch</a>. Perch is a tiny CMS which is designed for small sites. It does not try to be everything to everyone and that&#8217;s perfect. It lets you define editable regions within a page and then update them from the admin interface. That&#8217;s all.</p>
<aside>The admin interface for the <a href="http://signup.perchdemo.com">demo site</a>.</aside>
<p style="float:right"><img src="http://floatleft.com/wp-content/uploads/perch_admin.png" alt="Perch Admin Interface" width="600" height="481" /></p>
<p>Well it&#8217;s not quite all &mdash; in fact you can get pretty advanced if you want to, but the point is that you don&#8217;t have to. The admin interface shows a list of pages, and nested beneath each page are lists of the editable regions on those pages. This is great because whilst we designers and developers might think of a site as repeating sets of data, the person updating the site likely thinks in terms of pages. After all that&#8217;s how the information is presented on a website.</p>
<p>What is even better is that I did not need to tell Daniel anything more than the admin interface URL, his username and his password. He was able to log in and enter all of the content with literally no instruction &mdash; that&#8217;s absolutely priceless.</p>
<h3>Well, not quite priceless</h3>
<p>Perch costs £35 for a license. That is £35 more than WordPress and £35 more than Drupal. If that bothers you then consider these two points:</p>
<ol>
<li>You will probably spend more than £35 worth of your time training your client on another CMS</li>
<li>Perch is clearly the product of  an enormous amount of time and effort. You get paid for your work right? Well so do <a href="http://edgeofmyseat.com">other people</a>. Just add £35 to your estimates and forget about it.</li>
</ol>
<h3>But what about building the site?</h3>
<p>The admin interface is dead simple and so is developing a site. Build a static site as you usually would and then replace areas which you need to be editable with a simple tag:</p>
<pre><code>&lt;?php perch_content('Tag Name Here'); ?&gt;</code></pre>
<p>Refresh the page and then hit the admin section. Pick the content type (text, text block, image etc) and you&#8217;re away. You can <a href="http://grabaperch.com/support/tutorial/creating-perch-templates">build your own content templates</a> if the included set does not meet your needs.</p>
<p>This workflow highlights another nice thing about Perch. It does not seek to control every aspect of the site. It lives in its folder and outputs chunks of HTML into your pages whenever you ask it to. It doesn&#8217;t add anything unwanted to the markup and it is super easy to retrofit to a static site.</p>
<h3>In Summary&hellip;</h3>
<p>I hope this has encouraged you to <a href="http://perchdemo.com">give Perch a try</a>. It is not right for every project, but it is appropriate for a lot of the simple functionality required by small sites. It has excellent <a href="http://docs.grabaperch.com/">documentation</a> and is maintained and developed by super smart people who update it regularly.</p>
<p>It has a plugin architecture which allows for extended functionality (think blogs, events and pages) and costs very little compared to some CMSs. More than anything though it is often exactly the right tool for the job. I won&#8217;t be using it for every site I build, but I will be using it whenever it is appropriate to do so.</p>
<p>(Did I mention that I designed and built the site you see when you sign up for a demo? No? Well <a href="http://floatleft.com/portfolio/perch-demo">I did</a>.)</p>
]]></content:encoded>
			<wfw:commentRss>http://floatleft.com/notebook/up-on-my-perch/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress Year/Month Archives</title>
		<link>http://floatleft.com/notebook/wordpress-year-month-archives</link>
		<comments>http://floatleft.com/notebook/wordpress-year-month-archives#comments</comments>
		<pubDate>Sat, 30 Oct 2010 11:54:25 +0000</pubDate>
		<dc:creator>Andrew Appleton</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://floatleft.com/?p=215</guid>
		<description><![CDATA[This post falls squarely in the &#8220;probably only useful to me&#8221; category, but I wanted to archive it somewhere for posterity. I have recently built a new site for Matizmo using Wordpres as the CMS. The blog section of the site includes sidebar links to monthly archives with a post count, arranged by year &#8212; [...]]]></description>
			<content:encoded><![CDATA[<p>This post falls squarely in the &#8220;probably only useful to me&#8221; category, but I wanted to archive it somewhere for posterity.</p>
<p>I have recently built a new site for <a href="http://matizmo.co.uk">Matizmo</a> using Wordpres as the CMS. The <a href="http://matizmo.co.uk/journal">blog</a> section of the site includes sidebar links to monthly archives with a post count, arranged by year &mdash; much like a table of contents.
<p><img src="http://floatleft.com/wp-content/uploads/2010/10/matizmo-archives.png" alt="Matizmo Archives Screengrab" title="matizmo-archives" width="250" height="197" class="alignnone size-full wp-image-248" /></p>
<p>This was remarkably easy to mock up in Photoshop but remarkably tricky to achieve with the <a href="http://codex.wordpress.org/Template_Tags/wp_get_archives"><code>wp_get_archives()</code></a> function. You might have noticed that I did manage it &mdash; this is how:</p>
<pre><code>&lt;?php
$year_prev = null;
$months = $wpdb-&gt;get_results(	&quot;SELECT DISTINCT MONTH( post_date ) AS month ,
								YEAR( post_date ) AS year,
								COUNT( id ) as post_count FROM $wpdb-&gt;posts
								WHERE post_status = 'publish' and post_date &lt;= now( )
								and post_type = 'post'
								GROUP BY month , year
								ORDER BY post_date DESC&quot;);
foreach($months as $month) :
	$year_current = $month-&gt;year;
	if ($year_current != $year_prev){
		if ($year_prev != null){?&gt;
		&lt;/ul&gt;
		&lt;?php } ?&gt;
	&lt;h3&gt;&lt;?php echo $month-&gt;year; ?&gt;&lt;/h3&gt;
	&lt;ul class=&quot;archive-list&quot;&gt;
	&lt;?php } ?&gt;
	&lt;li&gt;
		&lt;a href=&quot;&lt;?php bloginfo('url') ?&gt;/&lt;?php echo $month-&gt;year; ?&gt;/&lt;?php echo date(&quot;m&quot;, mktime(0, 0, 0, $month-&gt;month, 1, $month-&gt;year)) ?&gt;&quot;&gt;
			&lt;span class=&quot;archive-month&quot;&gt;&lt;?php echo date(&quot;F&quot;, mktime(0, 0, 0, $month-&gt;month, 1, $month-&gt;year)) ?&gt;&lt;/span&gt;
			&lt;span class=&quot;archive-count&quot;&gt;&lt;?php echo $month-&gt;post_count; ?&gt;&lt;/span&gt;
		&lt;/a&gt;
	&lt;/li&gt;
&lt;?php $year_prev = $year_current;
endforeach; ?&gt;
&lt;/ul&gt;
</code></pre>
<p>This will output HTML in the following format:</p>
<pre><code>&lt;h3&gt;2010&lt;/h3&gt;
&lt;ul class="archive-list"&gt;
	&lt;li&gt;&lt;a href="http://www.matizmo.co.uk/2010/10"&gt;&lt;span class="archive-month"&gt;October&lt;/span&gt;&lt;span class="archive-count"&gt;5&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.matizmo.co.uk/2010/09"&gt;&lt;span class="archive-month"&gt;September&lt;/span&gt;&lt;span class="archive-count"&gt;3&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.matizmo.co.uk/2010/08"&gt;&lt;span class="archive-month"&gt;August&lt;/span&gt;&lt;span class="archive-count"&gt;6&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.matizmo.co.uk/2010/07"&gt;&lt;span class="archive-month"&gt;July&lt;/span&gt;&lt;span class="archive-count"&gt;6&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</code></pre>
<p>A bit of CSS to get everything aligned and apply a bit of <a href="http://www.theleagueofmoveabletype.com/fonts/7-league-gothic">League Gothic</a> to the year heading:</p>
<pre><code>h3				{ clear:left; font:normal normal 5.14em LeagueGothicRegular; margin:0; float:left; width:100px;}
.archive-list			{ margin:2px 0 3em 0; padding:5px 0 0 0; left:0; float:right; width:100px;}
.archive-list a			{ border-bottom:1px dotted #918f8f; color:#4c4c4c; display:block; width:100px; line-height:1; height:14px;}
.archive-list li		{ height:21px; list-style:none; margin:0 0 2px 0;}
.archive-list span		{ background:#fdfdfd; padding:0 2px 1px 0;}
.archive-list .archive-month	{ float:left;}
.archive-list .archive-count	{ float:right;}</code></pre>
<p>Not quite as straightforward as <code>&lt;?php wp_get_archives(); ?&gt;</code>, but it gets the job done. If you have a less offensively inelegant solution to this I&#8217;d love to hear it!</p>
<p><strong>Edit:</strong> Thanks to <a href="#comment-177">Keith</a> in the comments for pointing out that the PHP code above totally didn&#8217;t work&#8230; It should be fixed now!</p>
]]></content:encoded>
			<wfw:commentRss>http://floatleft.com/notebook/wordpress-year-month-archives/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>O2′s New iPhone Tarrifs</title>
		<link>http://floatleft.com/notebook/o2s-new-iphone-tarrifs</link>
		<comments>http://floatleft.com/notebook/o2s-new-iphone-tarrifs#comments</comments>
		<pubDate>Fri, 11 Jun 2010 10:45:38 +0000</pubDate>
		<dc:creator>Andrew Appleton</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://floatleft.com/?p=201</guid>
		<description><![CDATA[O2 have announced their iPhone 4 tariffs, and have introduced a 500MB data cap on the cheaper contracts. The Web Standardistas perfectly describe my feelings about this: Sadly, the removal of the unlimited data option creates an increased awareness of data usage as far as the average Joe is concerned, leading, in many cases, to [...]]]></description>
			<content:encoded><![CDATA[<p>O2 have announced their <a href="http://shop.o2.co.uk/new-iphone/tariffs.html">iPhone 4 tariffs</a>, and have introduced a 500MB data cap on the cheaper contracts.</p>
<p>The <a href="http://www.webstandardistas.com/2010/06/on-placing-unnecessary-limits-on-idevice-data-plans.php">Web Standardistas</a> perfectly describe my feelings about this:</p>
<blockquote><p>Sadly, the removal of the unlimited data option creates an increased awareness of data usage as far as the average Joe is concerned, leading, in many cases, to a hesitation in using this data, as it’s counting towards a &#8211; now defined &#8211; total allowance. This, in turn, only increases the guilt and diminishes the enjoyment you might get out of using your shiny, new iDevice.
</p></blockquote>
<p>It isn&#8217;t that I expect to ever use 500MB in a month &#8212; my last month&#8217;s usage was about 70MB &#8212; I just don&#8217;t want to be worrying about it each time I open Safari or Mail.</p>
<p>I have been with O2 since way before the iPhone was released, but it looks like they will be losing me (and no doubt others like me) for a seemingly petty and avoidable reason.</p>
<p>(NB. No other carriers have announced their iPhone 4 plans in the UK, but Vodafone currently offer 1GB of data on their 18 Month, £35 plan and Orange offer 750MB.)</p>
]]></content:encoded>
			<wfw:commentRss>http://floatleft.com/notebook/o2s-new-iphone-tarrifs/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Helvetireader Tweaked</title>
		<link>http://floatleft.com/notebook/helvetireader-tweaked</link>
		<comments>http://floatleft.com/notebook/helvetireader-tweaked#comments</comments>
		<pubDate>Wed, 28 Apr 2010 13:39:03 +0000</pubDate>
		<dc:creator>Andrew Appleton</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://floatleft.com/?p=182</guid>
		<description><![CDATA[I love John Hicks&#8217; Helvetireader user script for Google Reader. And I love it even more now that I have discovered that Google Reader includes a keyboard short cut to hide the feeds sidebar. Tapping &#8216;u&#8217; hides the sidebar and gives a more unobstructed reading view. Generally I will hide the sidebar and just tap [...]]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://twitter.com/mrappleton/status/11820912049">love</a> John Hicks&#8217; <a href="http://helvetireader.com/">Helvetireader</a> user script for Google Reader.</p>
<p>And I love it even more now that I have discovered that Google Reader includes a keyboard short cut to hide the feeds sidebar. Tapping &#8216;u&#8217; hides the sidebar and gives a more unobstructed reading view.</p>
<p>Generally I will hide the sidebar and just tap &#8216;space&#8217; to flick through all new feed items. The only problem with this is that Helvetireader hides the feed title at the top of the viewing pane, making it difficult to keep track of which site&#8217;s feed you are reading.</p>
<p><a href="http://floatleft.com/wp-content/uploads/2010/04/helvetireader-original.jpg"><img class="alignnone size-full wp-image-184" title="helvetireader-original" src="http://floatleft.com/wp-content/uploads/2010/04/helvetireader-original.jpg" alt="" width="440" height="168" /></a></p>
<p>I have put together a really small modification to the script to add the feed title back in.</p>
<p><a href="http://floatleft.com/wp-content/uploads/2010/04/helvetireader-modified.jpg"><img class="alignnone size-full wp-image-185" title="helvetireader-modified" src="http://floatleft.com/wp-content/uploads/2010/04/helvetireader-modified.jpg" alt="" width="440" height="168" /></a></p>
<p>Applying this tweak is pretty straightforward:</p>
<ol>
<li>Navigate to the Google Chrome extension folder <code>\Documents and Settings\[user]\Local Settings\Application Data\Google\Chrome\User Data\Default\Extensions\</code> (for Windows) and find the Helvetireader folder. For me this is called <code>/gkkhfigkhgiogdobmgcdnankjlbhilaa/</code> I&#8217;m not sure if this ID is unique to my computer (and will be different for you) or to the extension (and will be the same for you).</li>
<li>Once you&#8217;re in the correct folder, open the file <code>script.js</code> in your favourite text editor, and add the following to the bottom:
<pre><code>var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = 'http://appleton.me/helvetireader/helvetireader_mods.css';
cssNode.media = 'screen';
cssNode.title = 'dynamicLoadedSheet';
document.getElementsByTagName("head")[0].appendChild(cssNode);</code></pre>
</li>
<li>Clear your browser cache and re-launch it and you&#8217;re done! This stylesheet is served from my own domain, <a href="http://appleton.me">appleton.me</a>, but it is also <a href="http://code.google.com/p/helvetireader-tweaked/">hosted on Google Code</a>, so you&#8217;re free to fork it and add your own edits if you feel so inclined.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://floatleft.com/notebook/helvetireader-tweaked/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Better Best Ampersand</title>
		<link>http://floatleft.com/notebook/a-better-best-ampersand</link>
		<comments>http://floatleft.com/notebook/a-better-best-ampersand#comments</comments>
		<pubDate>Sun, 07 Mar 2010 11:53:01 +0000</pubDate>
		<dc:creator>Andrew Appleton</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://floatleft.com/?p=105</guid>
		<description><![CDATA[Dan Cederholm&#8217;s best available ampersand technique is by now prety well known and is in use all over the place &#8212; including in the footer of this very site. But when I was implementing it, I wanted to make a small change to the font stack. So this: span.amp { font-family:Baskerville,'Goudy Old Style',Palatino,'Book Antiqua',serif; font-style:italic; [...]]]></description>
			<content:encoded><![CDATA[<p>Dan Cederholm&#8217;s <a href="http://simplebits.com/notebook/2008/08/14/ampersands-2/">best available ampersand</a> technique is by now prety well known and is in use all over the place &#8212; including in the footer of this very site.</p>
<p><a href="http://floatleft.com/wp-content/uploads/2010/03/footer.png"><img src="http://floatleft.com/wp-content/uploads/2010/03/footer.png" alt="" title="footer image" width="318" height="82" class="alignnone size-full wp-image-121" /></a></p>
<p>But when I was implementing it, I wanted to make a small change to the font stack. So this:</p>
<pre><code>span.amp {
  font-family:Baskerville,'Goudy Old Style',Palatino,'Book Antiqua',serif;
  font-style:italic;
}</code></pre>
<p>Became this:</p>
<pre><code>span.amp {
  font-family:Baskerville,GoudyBookletter1911,'Goudy Old Style',Palatino,'Book Antiqua',serif;
  font-style:italic;
}</code></pre>
<aside>The subset and the <code>@font-face</code> code used were created using Font Squirrel&#8217;s excellent <a href="http://www.fontsquirrel.com/fontface/generator">@font-face kit generator</a>. </aside>
<p>My plan was to include the ampersand from the free font <a href="http://www.theleagueofmoveabletype.com/fonts/8-goudy-bookletter-1911">Goudy Bookletter 1911</a> (by the <a href="http://www.theleagueofmoveabletype.com/">League of Movable Type</a>) as the first fallback for those without Baskerville installed. This font could be served using the CSS3 <code>@font-face</code> rule to allow pretty much all users to see my second choice ampersand. I also created a custom subset of the font containing just the ampersand, to reduce bandwidth requirements and load time.</p>
<p>This all worked nicely except for the fact that I was specifying the <em>italic</em> version be used for each, and the Goudy Bookletter 1911 ampersand belongs to the Roman letterset. This forces the browser to render the Roman glyph as an ugly slanted faux-italc.</p>
<p><a href="http://floatleft.com/wp-content/uploads/2010/03/amp-comaprison.png"><img src="http://floatleft.com/wp-content/uploads/2010/03/amp-comaprison.png" alt="" title="Ampersand comparison" width="412" height="163" class="alignnone size-full wp-image-134" /></a></p>
<p>This may not seem like too much of an issue, but if the whole point of the exercise is to present the very best ampersand available then it kind of defeats the object to serve up a distorted version.</p>
<p>So how can we fix this? There is no way in CSS to specify italics for one font in a font stack and roman for another, so we need something a little bit more clever&#8230;</p>
<h3>The Solution</h3>
<p>My solution to this little puzzler relies on JavaScript, and works like this:</p>
<ol>
<li>Detect whether the user has Baskerville installed.</li>
<li>Assign a  class to the <code>&lt;body&gt;</code> element (either <code>.baskerville</code> or <code>.no-baskerville</code>.</li>
<li>Detect whether the user has a <code>@font-face</code> compatible browser.</li>
<li> Assign a  class to the <code>&lt;body&gt;</code> element (either <code>.fontface</code> or <code>.no-fontface</code>.</li>
<li>Define different CSS properties depending on which classes are set on the <code>&lt;body&gt;</code> element.</li>
</ul>
<h3>Implementation</h3>
<ol>
<li>
<p>To detect whether Baskerville is installed, I am using <a href="http://remysharp.com/2008/07/08/how-to-detect-if-a-font-is-installed-only-using-javascript/">a jQuery script from Remy Sharp</a>.</p>
<blockquote><p>What makes this important is that: Comic Sans, in all it&#8217;s glory, is actually unique.</p>
<p>From there it&#8217;s a simple case of comparing the font in question against Comic Sans and if they match, it&#8217;s not installed.</p>
</blockquote>
<p>Implementation is as simple as including Remy&#8217;s script in the page, and running the following jQuery function:</p>
<pre><code>function fontDetect() {
	font.setup();
	if (font.isInstalled('Baskerville')) {
		$('html').addClass('baskerville');
	}
	else {
		$('html').addClass('no-baskerville');
	}
}

$(document).ready(function() {
	fontDetect();
});</code></pre>
</li>
<li>
<p>Now we have a class assigned to the <code>&lt;body&gt;</code> element telling us if we have Baskerville installed, we can move on to <code>@font-face</code> detection.</p>
<p>For me, this was even easier as I was already using <a href="http://www.modernizr.com/">Modernizr</a> to allow HTML5 elements. By including the <code>modernizr.js</code> script on a page, you automatically get a number of classes assigned to the <code>&lt;body&gt;</code> element telling you which CSS3 features are supported by the user&#8217;s browser &#8212; including <code>.fontface</code> or <code>.no-fontface</code>.</p>
</li>
<li>
<p>All that remains then is to craft a bit of CSS to properly take advantage of these new classes:</p>
<pre><code>span.amp { /*To take care of those with JavaScript disabled*/
	font-family: Baskerville,GoudyBookletter1911Regular,'Goudy Old Style',Palatino,'Book Antiqua',serif;
	font-style: italic;
}

.baskerville span.amp { /*For those with Baskerville installed*/
	font-family: Baskerville;
	font-style: italic;
}

.no-baskerville.fontface span.amp { /*For those without Baskerville but with @font-face support*/
	font-family: GoudyBookletter1911Regular;
	font-style: normal;
}

.no-baskerville.no-fontface span.amp { /*For those without Baskeriville or @font-face support*/
	font-family: 'Goudy Old Style',Palatino,'Book Antiqua',serif;
	font-style:italic;
}</code></pre>
</li>
<h3>Summary</h3>
<p>You may feel that this is all a bit much just to avoid a slopey ampersand, and you might be right. But isn&#8217;t it the small details which separate good design and great design? I know I love to see sites where the author has clearly sweated every single detail, and I want others to see that in my work too.</p>
]]></content:encoded>
			<wfw:commentRss>http://floatleft.com/notebook/a-better-best-ampersand/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>An Introduction</title>
		<link>http://floatleft.com/notebook/an-introduction</link>
		<comments>http://floatleft.com/notebook/an-introduction#comments</comments>
		<pubDate>Tue, 02 Mar 2010 15:43:09 +0000</pubDate>
		<dc:creator>Andrew Appleton</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://localhost:8888/floatleft/?p=67</guid>
		<description><![CDATA[My name is Andrew Appleton and I spend my days working as a Mechanical Engineer. I have started this site because I am passionate about web design and want to be able to work on small scale client projects during the weekend and evenings.]]></description>
			<content:encoded><![CDATA[<p>My name is Andrew Appleton and I spend my days working as a Mechanical Engineer. I have started this site because I am passionate about web design and want to be able to work on small scale client projects during the weekend and evenings.</p>
<p>I suppose you could call this a side project for me &#8212; something I am doing for the love of it rather than being driven by any sort of financial need. I hope to be able to bring that love to my designs and to produce carefully crafted work which people will be proud of.</p>
<p>This little project  has been in the works since last August. I have been working on it when I can, and it has been through five full redesigns before it was even launched. I hope the design of this site reflects my preference for a well structured layout which relies on strong typography and information hierachy rather than loud imagery or flashy gimmicks.</p>
<p>I plan to update the notebook section exactly as often as I feel I need to &#8212; it will serve as an outlet for my thoughts on web design and as a record of the small tips, tricks and hints which I may pick up along the way. This is as much for my own benefit as for that of anyone reading, but obviously if anyone finds it interesting I would be delighted!</p>
<aside>Sooner or later I will remove the blog from <a href="http://appleton.me/" rel="me">http://appleton.me/</a> entirely and build some kind of single page business card site, but that is for another day.</aside>
<p>I had been running a little blog &#8212; <a href="http://appleton.me/" rel="me">http://appleton.me/</a> and I have imported a few posts from there to get the ball rolling.</p>
<p>I will also post links which I find useful, interesting or amusing &#8212; again this is as much as a personal record as it is for anyone to follow, but feel free to subscribe and keep up with what I&#8217;m looking at!</p>
<p>If all of this paints me as the kind of chap you would like to work with then please drop me a line. I am currently accepting new work and would love to help you build something wonderful!</p>
]]></content:encoded>
			<wfw:commentRss>http://floatleft.com/notebook/an-introduction/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IE6 Double Margin: A Simple jQuery Fix</title>
		<link>http://floatleft.com/notebook/ie6-double-margin-a-simple-jquery-fix</link>
		<comments>http://floatleft.com/notebook/ie6-double-margin-a-simple-jquery-fix#comments</comments>
		<pubDate>Tue, 02 Mar 2010 15:41:54 +0000</pubDate>
		<dc:creator>Andrew Appleton</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://localhost:8888/floatleft/?p=65</guid>
		<description><![CDATA[Among the many small irritations we have to contend with when developing a website for IE6 is the so called double margin bug.This bug causes floated elements to render with a double left margin. This is a simple way to overcome the problem using jQuery.]]></description>
			<content:encoded><![CDATA[<p>
Among the many small irritations we have to contend with when developing a website for IE6 is the so called double margin bug.This bug causes floated elements to render with a double left margin. The bug is described <a href="http://www.positioniseverything.net/explorer/doubled-margin.html">here</a>, and a solution <a href="http://www.positioniseverything.net/explorer/floatIndent.html">here</a>. Essentially the element must be forced to a state known as &#8220;has layout&#8221;.
</p>
<h3>The Original Solution</h3>
<p>The solution recommended is as follows:</p>
<blockquote><p>The work around for this bug is preposterously simple, counter-intuitive and utterly in violation of the W3C recommendations—simply change the style of the floated element to &#8220;display: inline&#8221; and the problem disappears.</p>
<p>
So do this&#8211;
</p>
<pre><code>&lt;div class="box"&gt;
   &lt;div class="sidebar" style="display: inline"&gt;content
   &lt;/div&gt;
   content
&lt;/div&gt;</code></pre>
</blockquote>
<p>A slightly cleaner way to achieve this is to create a separate <code>ie.css</code> stylesheet, and add a declaration looking something like this:</p>
<pre><code>.myclass1, .myclass2 {display:inline;}</code></pre>
<p>Cleaner still would be to enclose this <code>ie.css</code> stylesheet in a conditional comment so that it is only served to IE6:</p>
<pre><code>&lt;!--[if lte IE 7]&gt;
&lt;link rel="stylesheet" href="ie.css" type="text/css" media="screen" /&gt;
&lt;![endif]--&gt;</code></pre>
<p>We can now add all of the elements which exhibit this behaviour to the CSS declaration, safe in the knowledge that it will only be seen by IE versions 6 and below.</p>
<h3>A Simpler Way</h3>
<p>This solution is good, but it does leave us with the problem of having to maintain a long list of id and class names in the <code>ie.css</code> file. A more straightforward way to deal with the issue would be to write a rule stating that all floated elements should also have <code>display:inline;</code> applied. Unfortunately this is not possible in CSS, but we can use a little JavaScript and RegEx trickery to achieve the same thing.</p>
<ol>
<li>
<p>This example uses the excellent and extremely easy to use <a href="http://jquery.com/">jQuery</a> JavaScript library, so the first step is to link to it in your page&#8217;s <code>&lt;head&gt;</code> element:</p>
<pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
<p><em>Note: I am linking to the Google hosted version of the library, you may prefer to host your own copy and link to that.</em></p>
</li>
<li>
<p>Next we will create a separate <code>ie.js</code> file, and link to that in the <code>&lt;head&gt;</code> section of the page:</p>
<pre><code>&lt;!--[if lte IE 7]&gt;
&lt;script src="ie.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</code></pre>
<p>Be sure to place this <em>after</em> the link to the core jQuery library.</p>
</li>
<li>
<p>Into the <code>ie.js</code> file, we will add the following:</p>
<pre><code>// Initialise jQuery Regex...
jQuery.expr[':'].regex = function(elem, index, match) {
    var matchParams = match[3].split(','),
        validLabels = /^(data|css):/,
        attr = {
            method: matchParams[0].match(validLabels) ?
                        matchParams[0].split(':')[0] : 'attr',
            property: matchParams.shift().replace(validLabels,'')
        },
        regexFlags = 'ig',
        regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
    return regex.test(jQuery(elem)[attr.method](attr.property));
}

// ...and use it to overcome the 'double margin' bug. Add display:inline to all floated elements
function double_margin() {
	$(':regex(css:float, left|right)').css('display', 'inline');
}

// Let's go!
$(document).ready(function() {
	double_margin();
});</code></pre>
<p>What we are doing here is:</p>
<ol>
<li>Telling jQuery that we plan to use regular expressions.</li>
<li>Defining a jQuery function (<code>double_margin()</code>) which will search for every element which has <code>float:left;</code> or <code>float:right;</code> applied, and add an inline style of <code>display:inline;</code> to each</li>
<li>Telling this function to fire when the document loads.</li>
</ol>
</li>
</ol>
<p>There we have it. A simple way to overcome the double margin bug by assigning <code>display:inline;</code> to all floated elements. It should be noted that this method will only work for users who have JavaScript turned on. For this reason it is probably wise to check your web stats before implementing this on a site.</p>
]]></content:encoded>
			<wfw:commentRss>http://floatleft.com/notebook/ie6-double-margin-a-simple-jquery-fix/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 0.622 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-01-08 17:20:35 -->

