<?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>nooshu &#187; HTML Archives </title>
	<atom:link href="http://nooshu.com/category/html/feed" rel="self" type="application/rss+xml" />
	<link>http://nooshu.com</link>
	<description>Kneeling on the shoulders of giants</description>
	<lastBuildDate>Fri, 20 Jan 2012 11:38:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Remote Loading HTML5 Elements with jQuery</title>
		<link>http://nooshu.com/remote-loading-html5-elements-with-jquery?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=remote-loading-html5-elements-with-jquery</link>
		<comments>http://nooshu.com/remote-loading-html5-elements-with-jquery#comments</comments>
		<pubDate>Fri, 18 Nov 2011 10:31:28 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[ie]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1946</guid>
		<description><![CDATA[Working with Internet Explorer is never easy. jQuery takes some of the pain out of it, but not always!]]></description>
			<content:encoded><![CDATA[<p>I ran into a rather annoying problem a few months ago while developing my <a href="http://solostrightnow.com/">travel blog</a>; the problem of course was involving Internet Explorer. I&#8217;m used to working with WordPress as I use it all the time, but I wanted to get away from the standard pagination you find on a blog. So I decided to use jQuery 1.6.4 to pull in articles from other pages (blogname.com/page/2, blogname.com/page/3 etc). Now this is all fairly simple using the handy jQuery .load() method; point it to a URL, pull in the page, pick the bits you need and reinsert into the page. Simple! Unfortunately once I got a prototype working in &#8216;good&#8217; browsers, IE8 and below was having non of it!</p>
<p>After a little head scratching to work out what was failing, I worked out it was because I was using HTML5 elements such as &#8216;article&#8217;, &#8216;header&#8217; and &#8216;footer&#8217;. There was no problem displaying them on the page, as I&#8217;d used Remy Sharps excellent <a href="http://remysharp.com/2009/01/07/html5-enabling-script/">HTML5 Shiv script</a>. It only failed when trying to pull in these &#8216;new&#8217; elements via Ajax.</p>
<p><strong>Note</strong>: Before you read on you&#8217;ll be happy to hear that this issue no longer occurs in <a href="http://blog.jquery.com/2011/11/03/jquery-1-7-released/">jQuery 1.7.0</a>. Horray! </p>
<p>If you can&#8217;t upgrade, for whatever reason, I hashed together a <a href="http://dl.dropbox.com/u/7851949/html5-load-method/index.html">little work-around</a> for browsers IE8 and below, so read on. I admit the work around isn&#8217;t pretty, but it works. I tried for a few hours to get IE8- to recognise the &#8216;new&#8217; elements after an Ajax request, but to no avail. Eventually I had to wrap the HTML5 tags in a div using conditionals:</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!--[if lt IE 9]&gt;&lt;div id=&quot;ieHackContainer&quot;&gt;&lt;![endif]--&gt;</span><br />
<br />
<span style="color: #009900;">&lt;article <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;html5Content&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;header&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>H2 wrapped in a header element<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>header&gt;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- Other HTML here... --&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;footer&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>This is the footer element<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>footer&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>article&gt;</span><br />
<br />
<span style="color: #808080; font-style: italic;">&lt;!--[if lt IE 9]&gt;&lt;/div&gt;&lt;![endif]--&gt;</span></div></td></tr></tbody></table></div>
<p>The div is added for browsers IE8 and below, you can then use it as a hook to pull in the elements inside the div. I was hoping that wrapping the HTML5 elements in a standard div would be the end of it, I&#8217;m afraid not. The .load() method still didn&#8217;t work, IE just ignored the elements it didn&#8217;t recognise. I used jQuerys much more customisable .ajax() method to fix the issue in IE6, 7 and 8:</p>
<div class="codecolorer-container javascript default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006600; font-style: italic;">//IE8- work around to load HTML5 elements into a page</span><br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#loadHTML5LinkOld&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;page_to_load.html&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cache<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>html<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> HTML<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//Clear before load</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#html5LoadHolder&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//IE: Look for the hacky wrapper before insertion</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HTML <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>html<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">filter</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div#ieHackContainer&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//If HTML var is empty assume using newer browsers</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>HTML<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HTML <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>html<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">filter</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#html5Content&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//Append to page</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#html5LoadHolder&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>HTML<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>This method works in all browsers I&#8217;ve tested in as I&#8217;ve added a fall back (or should that be forward?) for newer browsers. The solution isn&#8217;t ideal (I really hate the conditional comments), but older versions of IE aren&#8217;t going away any time soon, and it works. Maybe there&#8217;s a more obvious solution that I missed? Leave a comment if there is, I&#8217;d love to know!</p>
<p>You can see a working example <a href="http://dl.dropbox.com/u/7851949/html5-load-method/index.html">here</a>. The page I&#8217;m loading from is <a href="http://dl.dropbox.com/u/7851949/html5-load-method/page_to_load.html">here</a> and the JavaScript in full <a href="http://dl.dropbox.com/u/7851949/html5-load-method/js/html5test.js">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/remote-loading-html5-elements-with-jquery/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Sieve of Eratosthenes</title>
		<link>http://nooshu.com/the-sieve-of-eratosthenes?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-sieve-of-eratosthenes</link>
		<comments>http://nooshu.com/the-sieve-of-eratosthenes#comments</comments>
		<pubDate>Thu, 12 May 2011 15:19:05 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1670</guid>
		<description><![CDATA[Having fun with a little bit of prime hunting and JavaScript. Maths geek for the win!]]></description>
			<content:encoded><![CDATA[<p>I recently read <a href="http://www.amazon.co.uk/Prime-Obsession-Bernhard-Greatest-Mathematics/dp/0452285259">Prime Obsession by John Derbyshire</a>; a book all about prime numbers and one of the worlds greatest Mathematicians: <a href="http://en.wikipedia.org/wiki/Bernhard_Riemann">Bernhard Riemann</a>. The books main focus is on the <a href="http://en.wikipedia.org/wiki/Riemann_hypothesis">Riemann Hypothesis</a> which states that:</p>
<blockquote><p>The real part of any non-trivial zero of the Riemann zeta function is 1/2.</p></blockquote>
<p>I&#8217;d love to say that after reading the book I understand the Maths behind it but alas I do not. That&#8217;s not surprising though as it&#8217;s a problem that has yet to be solved, 159 years after Riemann paper on &#8220;On the Number of Primes Less Than a Given Magnitude&#8221;. It doesn&#8217;t look like it&#8217;s going to be solved any time soon either! If you&#8217;re interested it&#8217;s one of the Clay Mathematics Institutes <a href="http://en.wikipedia.org/wiki/Millennium_Prize_Problems">Millennium Prize Problems</a> in which you can earn yourself US$1,000,000.</p>
<p>While reading Prime Obsession it mentioned an interesting method for finding prime numbers called &#8220;Sieve of Eratosthenes&#8221; (pronounced air-a-TAWS-the-nEEss). Eratosthenes was a librarian at the great library of Alexandria around 230 B.C.E. It&#8217;s quite obvious how the method works once you know it, and easy to see why it&#8217;s called a sieve. The method goes like this:</p>
<ol>
<li>Write a list of numbers in which you wish to identify the primes, say 2 &#8211; 100 (exclude 1 as it isn&#8217;t required)</li>
<li>Take the first number 2. Leaving 2 intact, remove every second number.</li>
<li>Move onto the next number 3. Leave 3 intact and remove every third number</li>
<li>Take the next number 5. Leave 5 intact and take away every fifth number</li>
<li>Repeat until you get to the end of your list</li>
</ol>
<p>The end result is the set of prime numbers up to your given number. Essentially all you are doing is removing any number that is divisible by the 1st, 2nd&#8230; Nth number. Clever stuff!</p>
<p>As a little side project I decided to implement this method using JavaScript, displaying the result in the browser. You can view the <a href="http://dl.dropbox.com/u/7851949/sieve/index.html">demo here</a>. For fun I created two implementations, one relying heavily on the DOM, the other only using arrays. As you&#8217;d expect the DOM method is slow; looping through large tables multiple times doesn&#8217;t make for a quick execution time. The second method using a single JavaScript array is much quicker. I&#8217;ve added a stats panel to the right hand side of the page so it&#8217;s possible to compare results from both methods over different input values.</p>
<p>I&#8217;ve added a limit to the number you can enter into the input box (5000), I don&#8217;t want anyone blaming me for crashing their browser by entering 10 million! :) Feel free to copy the demo if you want to see what happens at higher values.</p>
<div id="attachment_1672" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2011/05/sieve.gif"><img src="http://nooshu.com/wp-content/uploads/2011/05/sieve-518x255.gif" alt="Sieve of Eratosthenes using JavaScript" title="sieve" width="518" height="255" class="size-medium wp-image-1672" /></a><p class="wp-caption-text">The sieve in action showing prime numbers up to 500.</p></div>
<p>Thanks goes to John Resig for his very handy <a href="http://ejohn.org/blog/javascript-array-remove/">Array Remove method</a>.It made removing non-primes from the numbers array very simple indeed.</p>
<p>Prime Obsession is a superb book but a word of warning, it contains a lot of higher level Mathematics, so may not be to everyone&#8217;s taste. It certainly made my brain hurt at times; not always what you need on that 8am commute to work! <a href="http://dl.dropbox.com/u/7851949/sieve/index.html">View the demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/the-sieve-of-eratosthenes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitoring a value change on an input element</title>
		<link>http://nooshu.com/monitoring-a-value-change-on-an-input-element?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=monitoring-a-value-change-on-an-input-element</link>
		<comments>http://nooshu.com/monitoring-a-value-change-on-an-input-element#comments</comments>
		<pubDate>Sat, 15 Jan 2011 15:44:38 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1579</guid>
		<description><![CDATA[For a small project I was changing the value of a disabled input box programmatically and needed an event to fire if a value changed.]]></description>
			<content:encoded><![CDATA[<p>For a recent project I ran into a slight issue with the jQuery change event. It&#8217;s not an issue with jQuery, but I was quite surprised when it didn&#8217;t work as I expected. I&#8217;d set up a selection of form inputs that a user could change; once changed various calculations would be made and the values outputted to a second set of disabled input elements (<a href="http://nooshu.com/explore/monitoring-input-values/">demo</a>). The inputs are disabled as they are to be calculated rather than entered manually.</p>
<p>I&#8217;d attached the jQuery change event to the output elements like so:</p>
<div class="codecolorer-container javascript default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#outputs&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input:text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;change&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">highlightFade</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'red'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>So the plan was, once an input value had been changed using the jQuery().val() method the change event would fire and it would quickly colour in and out the element (using <a href="http://jquery.offput.ca/highlightFade/">highlightFade</a>) to notify the user that it&#8217;s value had changed. Unfortunately the change event wasn&#8217;t firing, so I had to find another way to monitor the output elements.</p>
<p>What I ended up doing was using an array to hold the previous values of the input elements then checking to see if they had changed in the calculation. If changed then fire the event:</p>
<div class="codecolorer-container javascript default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006600; font-style: italic;">//Array to store the old values</span><br />
<span style="color: #003366; font-weight: bold;">var</span> oldValues <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; <br />
<span style="color: #006600; font-style: italic;">//Push these values into an array which is checked on calculation</span><br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#valueOutput input:text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> thisValue <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #006600; font-style: italic;">//If the old value is different to the new, change the colour</span><br />
&nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>oldValues<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!==</span> thisValue<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">highlightFade</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'red'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<span style="color: #006600; font-style: italic;">//Push the new value into the array</span><br />
&nbsp; &nbsp;oldValues<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> thisValue<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>It&#8217;s quite hard to explain exactly what&#8217;s happening so I&#8217;ve put together a <a href="http://nooshu.com/explore/monitoring-input-values/">small demo</a>. Try changing one of the top input fields then tab (or click out) of the input element to recalculate. Is there an easier (or better) way to do this? Comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/monitoring-a-value-change-on-an-input-element/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Experimenting with Webkit form speech input</title>
		<link>http://nooshu.com/experimenting-with-webkit-form-speech-input?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=experimenting-with-webkit-form-speech-input</link>
		<comments>http://nooshu.com/experimenting-with-webkit-form-speech-input#comments</comments>
		<pubDate>Wed, 22 Dec 2010 20:46:06 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[speech]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1563</guid>
		<description><![CDATA[The HTML5 specifications are adding some very interesting new features. Here's one that's just landed in Google Chrome: speech input.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a few weeks now since I attended a <a href="http://nooshu.com/game-on-london-2010/">Web Gaming event hosted by Mozilla</a> and I&#8217;ve not yet had chance to write about one of the coolest features that was demonstrated: <a href="https://docs.google.com/View?id=dcfg79pz_5dhnp23f5">Speech input in forms</a>. Now I must admit, I had no idea this was even possible; so it was quite a surprise when I saw the demonstration. With a few extra attributes added to a standard input box you can enable speech input:</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;speech&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;speech&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> x-webkit-speech speech error onwebkitspeechchange<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;dosomething.coolhere(true);&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></div></td></tr></tbody></table></div>
<p>It really is that simple! You may notice the &#8220;x-webkit-speech&#8221; attribute so will have guessed it currently only works in Webkit; and as far as I&#8217;m aware only in very <a href="http://peter.sh/2010/12/crankshaft-the-chrome-web-store-and-html5s-figure-element/">recent versions of Google Chrome</a> (note: &#8220;The Input Speech API will now be available by default on Chrome’s dev-channel&#8221;). The Speech API seems very new and is still a draft, so it will be a while before it&#8217;s fully adopted by other browser vendors.</p>
<div id="attachment_1568" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/12/speak-to-santa-speech-api.gif"><img src="http://nooshu.com/wp-content/uploads/2010/12/speak-to-santa-speech-api.gif" alt="Demo of the new HTML5 Speech API" title="speak-to-santa-speech-api" width="518" height="180" class="size-full wp-image-1568" /></a><p class="wp-caption-text">A quick demonstration of the Speech API in action.</p></div>
<p>To demonstrate the speech input I&#8217;ve put together a very simple <strong>festive</strong> <a href="http://nooshu.com/explore/santa-speech-api/">demo</a> that queries the Flickr API looking for images related to a value entered. So if you have a microphone and the <a href="http://www.google.com/chrome/intl/en/eula_dev.html">dev channel of Chrome</a>, why not give it a try. Chrome records the input of the microphone before sending it off to an external server to be processed, where a value is then sent back to the browser. At first I thought it was all processed inside the browser but I guess that&#8217;s a little to much to expect! It isn&#8217;t 100% accurate and the demo accepts Googles first guess so you may get a few strange results. The server returns multiple guesses which a user can select from, but this hasn&#8217;t been added (to my demo at least).</p>
<p>Since the API is very new it took a little trial and error to work out how to detect if the Speech API was available in the browser; but with a little help from <a href="http://paulirish.com/">Paul Irish</a> I managed to crack it:</p>
<div class="codecolorer-container javascript default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">function</span> speechcapable<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> elem <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> support <span style="color: #339933;">=</span> <span style="color: #3366CC;">'onwebkitspeechchange'</span> <span style="color: #000066; font-weight: bold;">in</span> elem <span style="color: #339933;">||</span> <span style="color: #3366CC;">'speech'</span> <span style="color: #000066; font-weight: bold;">in</span> elem<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> support<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>This function will return true if the API is available. It&#8217;s worth noting that since it&#8217;s very new this function is likely to break in the future as the properties always seem to be changing. It works at the moment, so get thinking about what this brilliant new API can be used for! It&#8217;s a big plus for accessibility if used correctly and I can also see some cool applications in web gaming too. View the <a href="http://nooshu.com/explore/santa-speech-api/">demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/experimenting-with-webkit-form-speech-input/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Three.js images using the HTML5 File API</title>
		<link>http://nooshu.com/three-js-images-using-the-html5-file-api?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=three-js-images-using-the-html5-file-api</link>
		<comments>http://nooshu.com/three-js-images-using-the-html5-file-api#comments</comments>
		<pubDate>Tue, 14 Dec 2010 20:51:59 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Three.js]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[three.js]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1544</guid>
		<description><![CDATA[HTML5 has a great set of new APIs. One of my favourites is the file upload, no more Flash uploads or multiple 'browse' boxes. A bit of a mash up of three.js and the Drag and Drop API.]]></description>
			<content:encoded><![CDATA[<p>Anyone who&#8217;s read my latest blog posts will know that I&#8217;m a big fan of Mr doobs Three.js JavaScript 3D engine, so I won&#8217;t bang on about it any more than I have to. For my latest experiment I decided to mix the <a href="http://www.w3.org/TR/FileAPI/">HTML5 File API</a>, Three.js and a few images (<a href="http://nooshu.com/explore/threejs-and-the-fileapi/">demo here</a>).</p>
<div id="attachment_1548" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/12/mrdoob-image.jpg"><img src="http://nooshu.com/wp-content/uploads/2010/12/mrdoob-image-518x518.jpg" alt="mr doob Three.js with the File API " title="mrdoob-image" width="518" height="518" class="size-medium wp-image-1548" /></a><p class="wp-caption-text">Mr Doob and a little kitten sitting in a 3D tree.</p></div>
<p>The File API allows a user to upload a file (an image in this experiment) to a web application simply by dragging it onto a designated &#8220;droparea&#8221;. Once dropped, you can manipulate the data any way you like. The API is able to handle multiple files natively, so just select all the files and drop them onto the area. No need for Flash uploaders or multiple browse boxes. Of course not all browsers support it (IE) and there are a few <a href="http://www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html">inconsistencies in the specification</a>; but they will work themselves out over time.</p>
<p>So what does the experiment actually do? Well it allows a user to drag an image onto their browser window which is then &#8220;uploaded&#8221;; the data is then passed to a canvas element and then this data is passed to Three.js to be plotted in 3D space. The X and Z-axis is plotted in the usual manner to represent the default 2D image using particles; the fun bit comes when you add the Y-axis. This is calculated by taking an average of the RGB values (greyscale) and plotting it accordingly. When using an image of a human face it&#8217;s amazing how accurate the 3D plot looks.</p>
<p>Due to the amount of data involved it is recommended that you use small thumbnail images when you <a href="http://nooshu.com/explore/threejs-and-the-fileapi/">try the demo</a>, as larger images equal a larger number of particles. This is an initial version so I&#8217;m going to work on a way of dealing with larger images. This will probably mean ignoring a certain number of pixels when looping through the image data. Looking forward, since it can be done with a static image I see no reason why it can&#8217;t be <a href="http://craftymind.com/factory/html5video/CanvasVideo.html">done with a video</a>, but that&#8217;s a project for another day!</p>
<p><strong>Update</strong>: I&#8217;ve updated the demo slightly; as Mr.doob pointed out people may have tried to drag directly onto the render area which didn&#8217;t work. So now it does :)</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/three-js-images-using-the-html5-file-api/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Periodic Mashup</title>
		<link>http://nooshu.com/periodic-mashup?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=periodic-mashup</link>
		<comments>http://nooshu.com/periodic-mashup#comments</comments>
		<pubDate>Wed, 01 Dec 2010 09:22:58 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[cool]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1497</guid>
		<description><![CDATA[The web is becoming very exciting at the moment. Come up with an interesting idea and just build it. Open data is the future!]]></description>
			<content:encoded><![CDATA[<p>Every so often I stop work and stick my head above the parapet and see what the rest of the Web Developer community is doing, and every time I do I&#8217;m amazed by some of the ideas and applications that are being built. They aren&#8217;t always useful but who cares; the technology is available so why not try it and push the boundaries a little.</p>
<div id="attachment_1499" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/12/mashup-breakdown.gif"><img src="http://nooshu.com/wp-content/uploads/2010/12/mashup-breakdown-518x274.gif" alt="A visual breakdown of the new Girl Talk album." title="mashup-breakdown" width="518" height="274" class="size-medium wp-image-1499" /></a><p class="wp-caption-text">Want to see what samples were used in the new Girl Talk album?</p></div>
<p>The first application I really like is <a href="http://mashupbreakdown.com/">Mashupbreakdown</a> by developer <a href="http://twitter.com/brahn">Benjamin Rahn</a>. Mashupbreakdown is a visual representation of the samples used in the latest album by Girl Talk called &#8220;All Day&#8221;. That in itself is very cool, but where does it get the sample information from? Well that&#8217;s the really clever part; it gets it from <a href="http://en.wikipedia.org/wiki/All_Day#Track_listing">Wikipedia</a>. </p>
<p>Wikipedia has a page for the &#8220;All Day&#8221; album that contains all the sample information used in each track. Mashupbreakdown scrapes this page and and visualises it. Since Wikipedia can be edited by anyone, if you spot a mistake / new sample you can easily update the page information and the application with change accordingly!</p>
<p>At the moment it only shows one album but there&#8217;s no reason the application can&#8217;t be adapted to handle more albums. Benjamin has a post on <a href="http://blog.mashupbreakdown.com/making-more-breakdowns">his blog</a> appealing for more breakdowns so I&#8217;ll be checking back with the site now and then to see if any other breakdowns have appeared. Great work Benjamin.</p>
<div id="attachment_1502" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/12/periodic.jpg"><img src="http://nooshu.com/wp-content/uploads/2010/12/periodic-518x403.jpg" alt="The periodic table of HTML elements" title="periodic" width="518" height="403" class="size-medium wp-image-1502" /></a><p class="wp-caption-text">When chemistry and HTML combine you get the periodic table of HTML elements!</p></div>
<p>The second application that really caught by eye is the <a href="http://joshduck.com/periodic-table.html?url=nooshu.com">Periodic Table of Elements</a> by developer <a href="http://www.twitter.com/joshduck">Josh Duck</a>. When I find a site I like, I immediately do a &#8220;view source&#8221; (don&#8217;t all Web Develepers?) to see how it&#8217;s been built. The Periodic Table of Elements takes any URL you pass it and tells you what HTML elements were used on the page. It&#8217;s basically a prettified / simplified version of view source! The application may not be that useful but kudos to Josh for taking the time to build it. Definitely one of those ideas that I wish I&#8217;d thought of!</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/periodic-mashup/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN post-commit hook on Dreamhost</title>
		<link>http://nooshu.com/svn-post-commit-hook-on-dreamhost?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=svn-post-commit-hook-on-dreamhost</link>
		<comments>http://nooshu.com/svn-post-commit-hook-on-dreamhost#comments</comments>
		<pubDate>Sun, 24 Oct 2010 19:37:04 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1442</guid>
		<description><![CDATA[Using the post-commit hook with SVN makes updating a website dead simple... once you get it to work.]]></description>
			<content:encoded><![CDATA[<p>Over the past couple of days I decided to start using the SVN post-commit hook for deploying sites to my staging servers. Once you get it working it will save you a massive amount of time. Make changes on your local server, then, when you&#8217;re ready, commit your changes to the repository and the server will auto-update the staging site. Nice! For instructions on how to set this up on your Dreamhost server take a look <a href="http://wiki.dreamhost.com/Subversion#Automatic_Post-commit_Checkout">here</a>.</p>
<p>Unfortunately a slight over-site on my part didn&#8217;t make deployment easy. I followed the instructions to the letter (more than once!) but received the same error on commit:</p>
<div class="codecolorer-container text default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">post-commit hook failed (exit code 255) with no output.</div></td></tr></tbody></table></div>
<p>At first I thought this was a permissions issue but that turned out not to be the case. The solution in the end was because I was saving the do_update.cgi script in Windows format in Notepad++! Doh! Windows and UNIX new lines just don&#8217;t mix!</p>
<p>To save a file in UNIX compatibility mode in Notepad++ click &#8220;Edit&#8221; then &#8220;EOL Conversion&#8221;. Make sure UNIX Format is greyed out (why greyed out? no idea) when you save your CGI script. Upload to the server and you&#8217;re done. Won&#8217;t be forgetting to do that again any time soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/svn-post-commit-hook-on-dreamhost/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adding a custom header image to your WordPress theme</title>
		<link>http://nooshu.com/adding-a-custom-header-image-to-your-wordpress-theme?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=adding-a-custom-header-image-to-your-wordpress-theme</link>
		<comments>http://nooshu.com/adding-a-custom-header-image-to-your-wordpress-theme#comments</comments>
		<pubDate>Thu, 23 Sep 2010 07:54:45 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1379</guid>
		<description><![CDATA[Adding a custom header image to a Wordpress theme has never been so easy. Simply copy / paste and edit the code listed.]]></description>
			<content:encoded><![CDATA[<p>Every new iteration of WordPress (version 3.0.1 at the time of writing) brings a host of new features and bug fixes. One feature that I completely missed in 3.0 was the new custom header functionality. Before 3.0 it would be a case of hacking together your own solution using custom fields or using a separate plug-in. Thankfully the WordPress team have added this functionality directly to the core.</p>
<p>It just so happens that I&#8217;ve had a request for a customisable header image on an future project, so decided to have a play and see how difficult it is to implement. Well it isn&#8217;t difficult at all, very simple in fact.</p>
<p>First you will need to edit your functions.php located in your theme directory. Go ahead and create one if it isn&#8217;t in the directory. Now copy and paste the code below into the file. I&#8217;ve commented the code but it&#8217;s all quite self explanatory. Change the height and width of the image and change the directories where needed.</p>
<div class="codecolorer-container php default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:404px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #666666; font-style: italic;">//Check see if the customisetheme_setup exists</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'customisetheme_setup'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Any theme customisations contained in this function</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> customisetheme_setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Define default header image</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'HEADER_IMAGE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'%s/header/default.jpg'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Define the width and height of our header image</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'HEADER_IMAGE_WIDTH'</span><span style="color: #339933;">,</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'customisetheme_header_image_width'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">960</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'HEADER_IMAGE_HEIGHT'</span><span style="color: #339933;">,</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'customisetheme_header_image_height'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">220</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Turn off text inside the header image</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'NO_HEADER_TEXT'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Don't forget this, it adds the functionality to the admin menu</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; add_custom_image_header<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'customisetheme_admin_header_style'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Set some custom header images, add as many as you like</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//%s is a placeholder for your theme directory</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$customHeaders</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Image 1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'perfectbeach'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'url'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'%s/header/default.jpg'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'thumbnail_url'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'%s/header/thumbnails/pb-thumbnail.jpg'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'description'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Perfect Beach'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'customisetheme'</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Image 2</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'tiger'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'url'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'%s/header/tiger.jpg'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'thumbnail_url'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'%s/header/thumbnails/tiger-thumbnail.jpg'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'description'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Tiger'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'customisetheme'</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Image 3</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'lunar'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'url'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'%s/header/lunar.jpg'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'thumbnail_url'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'%s/header/thumbnails/lunar-thumbnail.jpg'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'description'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Lunar'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'customisetheme'</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Register the images with Wordpress</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; register_default_headers<span style="color: #009900;">&#40;</span><span style="color: #000088;">$customHeaders</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'customisetheme_admin_header_style'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Function fired and inline styles added to the admin panel</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Customise as required</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> customisetheme_admin_header_style<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;style type=&quot;text/css&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #wpbody-content #headimg {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height: <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> HEADER_IMAGE_HEIGHT<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width: <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> HEADER_IMAGE_WIDTH<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; border: 1px solid #333;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/style&gt;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//Execute our custom theme functionality</span><br />
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'after_setup_theme'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'customisetheme_setup'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>By adding the code above you will now see a new option under &#8220;Appearance&#8221; in the admin panel called &#8220;Header&#8221;. From there you should be able to see all the images and options we just set in the functions.php file. The only thing left to do now is add the header image to the theme.</p>
<p>Where you place the following code will be depend on your theme setup; I&#8217;ve decided to place it in the header.php file as I want the image to appear on every page. You may only want the image to appear on specific templates e.g. pages, archive, category (you could also use <a href="http://codex.wordpress.org/Conditional_Tags">WordPress conditional tags</a> to do this).</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;header&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- other header code here.... --&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- This line adds the header to the theme --&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;headerimg&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php header_image(); ?&gt;</span></span>&quot; width=&quot;<span style="color: #009900;">&lt;?php echo HEADER_IMAGE_WIDTH; ?&gt;</span>&quot; height=&quot;<span style="color: #009900;">&lt;?php echo HEADER_IMAGE_HEIGHT; ?&gt;</span>&quot; alt=&quot;Header image alt text&quot; /&gt;<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></div></td></tr></tbody></table></div>
<p>And there you have it, one header image that you can customise via the WordPress admin panel. An ID is attached to the image for CSS styling where needed.</p>
<p>The example above is quite a simplified version of the header image functionality. It is possible to place text over the image and even have a different image per blog post by using the custom thumbnail functionality, but these are beyond the scope of this blog post. Copy &#038; paste and enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/adding-a-custom-header-image-to-your-wordpress-theme/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Aloha Editor &#8211; Content editing the HTML5 way</title>
		<link>http://nooshu.com/aloha-editor-content-editing-the-html5-way?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=aloha-editor-content-editing-the-html5-way</link>
		<comments>http://nooshu.com/aloha-editor-content-editing-the-html5-way#comments</comments>
		<pubDate>Tue, 17 Aug 2010 20:25:05 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1358</guid>
		<description><![CDATA[There are many ways to edit and update content on a website, but none of them look quite a easy as Aloha Editor.]]></description>
			<content:encoded><![CDATA[<p>The number of times I&#8217;ve built a website based on a CMS only to have the client utter the words &#8220;Oh I&#8217;m confused, it&#8217;d be so much quicker if you made the changes&#8221;. Right, so the CMS was a bit of a waste of time then! But fingers crossed thanks to <a href="http://aloha-editor.com/">Aloha Editor</a> that may be a thing of the past. Often the problem clients have is actually finding the content that needs to be edited in the CMS; Aloha to the rescue!</p>
<p>What Aloha actually does is make the content editable right on the page; no need to jump into the CMS, find the page, make the changes then preview the result. Just click on the text you wish to edit and type away. Done! It&#8217;s hard to believe it actually works until you try it. Why not give it a go on their <a href="http://aloha-editor.com/demos/aloha-world-example/">demo page</a>. It incorporates a few HTML5 technologies which could cause issues with older IE versions, but the demo page seems to work (with a few quirks).</p>
<div id="attachment_1360" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/08/aloha-editor-demo.gif"><img src="http://nooshu.com/wp-content/uploads/2010/08/aloha-editor-demo-518x308.gif" alt="An example of Aloha Editor in action" title="aloha-editor-demo" width="518" height="308" class="size-medium wp-image-1360" /></a><p class="wp-caption-text">Quickly and easily edit the demo webpage.</p></div>
<p>The core has been written to be very small and streamlined, with additional functionality being added by the way of user contributed plug-ins. There&#8217;s already an <a href="http://www.aloha-editor.com/api/">extensive API</a> for developers to play with so I&#8217;m sure many of the missing features will be plugged very soon.</p>
<p>There are alternatives about such as <a href="http://tinymce.moxiecode.com/">TinyMCE</a> and <a href="http://ckeditor.com/">CKEditor</a>, but they&#8217;re integrated directly into a CMS&#8217; administration pages rather than as an inline editor like Aloha. Now before you get too excited there are a few cons:</p>
<ul>
<li>It isn&#8217;t as simple as just dropping the scripts into a page, it needs to be integrated into a backend system for the changes to be saved.</li>
<li>Still in early development so could be quite buggy.</li>
<li>Doesn&#8217;t work with Opera Browser at the moment but this is being worked on.</li>
<li>Some features aren&#8217;t available yet, like image / media insertion. But I&#8217;m sure these will be developed as it matures.</li>
</ul>
<p>So there are still a few issues to iron out but it all looks very promising! There were even murmurs on Twitter today about a WordPress plug-in and a Drupal v7 module (not 6 though I presume) in development. So it won&#8217;t be long before we&#8217;ll be able to try it out on a live site; hopefully it&#8217;s also simple enough for clients to use too!</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/aloha-editor-content-editing-the-html5-way/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nooshu.com now with added HTML5 goodness</title>
		<link>http://nooshu.com/nooshu-com-now-with-added-html5-goodness?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nooshu-com-now-with-added-html5-goodness</link>
		<comments>http://nooshu.com/nooshu-com-now-with-added-html5-goodness#comments</comments>
		<pubDate>Sat, 17 Jul 2010 14:05:50 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[semantics]]></category>
		<category><![CDATA[site]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1279</guid>
		<description><![CDATA[Finally got round to HTML5ing my Wordpress theme. Lots to learn with the (ongoing) HTML5 specifications.]]></description>
			<content:encoded><![CDATA[<p>So I finally pulled my finger out and took the HTML5 plunge over the past day or so; the Nooshu WordPress theme now has a sprinkling of HTML5. Mmmm I have that warm fuzzy feeling of completeness! In all honesty it&#8217;s been an easy way to learn about the new <a href="http://dev.w3.org/html5/spec/Overview.html">HTML5 specifications</a> (although they aren&#8217;t complete and won&#8217;t become a W3C recommendation until 2022&#8230; no that isn&#8217;t a typo!).</p>
<p>HTML5 has added a host of new tags which have much more semantic meaning. So instead of using &#8216;divs&#8217; to section off areas of your page layout, you can now use:</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!-- Some of the new HTML5 Tags --&gt;</span><br />
<span style="color: #009900;">&lt;header&gt;&lt;<span style="color: #66cc66;">/</span>header&gt;</span><br />
<span style="color: #009900;">&lt;footer&gt;&lt;<span style="color: #66cc66;">/</span>footer&gt;</span><br />
<span style="color: #009900;">&lt;article&gt;&lt;<span style="color: #66cc66;">/</span>article&gt;</span><br />
<span style="color: #009900;">&lt;section&gt;&lt;<span style="color: #66cc66;">/</span>section&gt;</span><br />
<span style="color: #009900;">&lt;nav&gt;&lt;<span style="color: #66cc66;">/</span>nav&gt;</span></div></td></tr></tbody></table></div>
<p>It&#8217;s certainly a welcome addition to the modern web. My favourite part of HTML5 has to be the doctype (other than the canvas element):</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!-- No more --&gt;</span><br />
<span style="color: #00bbdd;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span><br />
<br />
<span style="color: #808080; font-style: italic;">&lt;!-- Much better! --&gt;</span><br />
<span style="color: #00bbdd;">&lt;!DOCTYPE html&gt;</span></div></td></tr></tbody></table></div>
<p>Look how simple it is! No more copy / paste from a previous project for this doctype.</p>
<p>My main concern when converting the theme to HTML5 was how it would work in IE; as IE8 supports parts of HTML5 but IE6 and IE7 not at all. When IE comes across a tag it doesn&#8217;t recognise it just ignores it. Since the tags aren&#8217;t recognised you won&#8217;t be able to style your lovely new HTML5 template in IE6 &#038; IE7. Lucky you can patch this missing functionality using JavaScript. Remy Sharp has created a script called <a href="http://remysharp.com/2009/01/07/html5-enabling-script/">html5shim</a>, that adds the missing tags to IE. Just add the following code to your header and you will now be able to style your HTML5 tags:</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!--[if lt IE 9]&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &lt;script src=&quot;http://html5shim.googlecode.com/svn/trunk/html5.js&quot;&gt;&lt;/script&gt;</span><br />
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span></div></td></tr></tbody></table></div>
<p>The script must be in the header and must fire before the DOM is created. The script simply creates all the new HTML5 elements using the document method &#8216;createElement&#8217;, you don&#8217;t even need to attach the created elements to the DOM! Now IE will recognise the tags and you can get on with your page styling. Yay!</p>
<p>Those who use WordPress 3.0 may have noticed that the default Kubric theme is no more and it&#8217;s been replaced with a new theme called twenty ten. The theme uses the HTML5 doctype but it doesn&#8217;t use any of the new tags. I guess because of the IE issues. Maybe this will be changed in future releases.</p>
<p>The Nooshu theme is still a work in progress, and I&#8217;ll modify areas as I learn more about the new HTML5 features. Here are a selection of links that I found incredibly useful while working on the theme:</p>
<ul>
<li><strong><a href="http://diveintohtml5.org/">Dive into HTML5</a></strong>: Read through this article and you will be well on your way to learning HTML5. It delves into the history of HTML and progresses forward right up to implementing the new specifications.</li>
<li><strong><a href="http://html5doctor.com/">HTML5 Doctor</a></strong>: Looking for HTML5 related news or need some clarification of a new tag? Look no further than HTML5 Doctor. Lots of articles available for you to read and there&#8217;s even the option to ask a question if you don&#8217;t find the answers you are looking for.</li>
<li><strong><a href="http://gsnedders.html5.org/outliner/">HTML 5 Outliner</a></strong>: So you&#8217;ve created your shiny new HTML5 template; why not check it with the outliner to see if it makes sense to a user / search engine.</li>
<li><strong><a href="http://validator.w3.org/">W3C Markup Validator</a></strong>: It&#8217;s been a while since I&#8217;ve used a validator since I have one <a href="https://addons.mozilla.org/firefox/addon/249">built into Firefox</a>, but the W3C validator was very handy for pointing out attributes and tags that are no longer supported in the specifications. It also gives you a quick benchmark to aim at.</li>
</ul>
<p>If you have any other useful HTML5 tips and links let me know below.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/nooshu-com-now-with-added-html5-goodness/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

