<?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>Kelvin Jones – Freelance PHP &#38; MySQL web developer from London &#187; Blog</title>
	<atom:link href="http://kelvinjones.co.uk/my/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://kelvinjones.co.uk</link>
	<description>Gravity sucks</description>
	<lastBuildDate>Mon, 14 Dec 2009 09:33:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unblock The Tubes</title>
		<link>http://kelvinjones.co.uk/unblock-the-tubes</link>
		<comments>http://kelvinjones.co.uk/unblock-the-tubes#comments</comments>
		<pubDate>Mon, 14 Dec 2009 00:20:47 +0000</pubDate>
		<dc:creator>Kelvin Jones</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://kelvinjones.co.uk/?p=90</guid>
		<description><![CDATA[Most websites built today use JavaScript. It is an essential building block of the web along with HTML &#38; CSS. However, when it comes to performance JavaScript has one problem… it Blocks The Tubes™!
When CSS and images are included in your HTML, they are loaded asynchronously. This is not the case with JavaScript. When a [...]]]></description>
			<content:encoded><![CDATA[<p>Most websites built today use JavaScript. It is an essential building block of the web along with HTML &amp; CSS. However, when it comes to performance JavaScript has one problem… it Blocks The Tubes™!</p>
<p>When CSS and images are included in your HTML, they are loaded <a href="http://en.wikipedia.org/wiki/Asynchrony">asynchronously</a>. This is not the case with JavaScript. When a JavaScript file is loaded, no other resources will be downloaded.</p>
<p><span id="more-90"></span></p>
<p>In terms of performance, most developers right now follow this rule: CSS at the top, JavaScript at the bottom. This allows all CSS &amp; images to be loaded asynchronously, before it hits the roadblock of JavaScript, but at least by that point you have all your resources, so as soon as JavaScript is finished your page will be displayed.</p>
<p>However, there are alternatives available that allow JavaScript to be loaded asynchronously. <a href="http://www.stevesouders.com/blog/2009/04/27/loading-scripts-without-blocking/">These methods are documented here by Steve Soulders</a>, but the main problem with this is it means a fair amount of work to implement… a developer must architect his or her code specifically to allow it to be loaded in this manner.</p>
<p>Over the last few weeks, there has been some progress in bringing one of the techniques (Script DOM Element) to the masses.</p>
<h2>Analyze This!</h2>
<p>First off, and probably the easiest way for a developer to get into asynchronous JavaScript loading, <a href="http://googlecode.blogspot.com/2009/12/google-analytics-launches-asynchronous.html">Google launched asynchronous tracking code</a> for Google Analytics.</p>
<p>As Google Analytics uses JavaScript to collect usage data, it usually adds more load time to each page it is installed on, and can potentially cause pages to hang, if there are issues with Google&#8217;s servers. But with the following code, this issue goes away:</p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;&gt;
var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXX-X']);
  _gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script');
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
        'http://www') + '.google-analytics.com/ga.js';
    ga.setAttribute('async', 'true');
    document.documentElement.firstChild.appendChild(ga);
  })();
&lt;/script&gt;
</pre>
<p>Just replace the <code>UA-XXXXX-X</code> with your own identfier.</p>
<p>To see an example of this, just have a look at the source code of <a href="http://kelvinjones.co.uk">this site</a>.</p>
<h2>Straight From The Lab</h2>
<p>Another project that has been emerging to tackle this same issue is <a href="http://labjs.com">LABjs</a>.</p>
<p>From the <a href="http://labjs.com/documentation.php">LABjs documentation</a>, the following code shows how one might use it:</p>
<pre class="brush: jscript;">
$LAB
.script(&quot;framework.js&quot;).wait()
.script(&quot;plugin.framework.js&quot;)
.script(&quot;myplugin.framework.js&quot;).wait()
.script(&quot;init.js&quot;);
</pre>
<p>The wait() bit would be where you want the browser to block, everything else would be loaded asynchronously.</p>
<p>I&#8217;m sure the LABjs project will evolve a lot over the next few months, but it&#8217;s an interesting start… one to keep your eye on.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://stereonaut.net/yahoo-yslow-for-firebug/">Yahoo! YSlow for Firebug</a> (stereonaut.net)</li>
<li class="zemanta-article-ul-li"><a href="http://www.bruceclay.com.au/blog/archives/2009/11/google-on-speed.html">Google on Speed</a> (bruceclay.com.au)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/6a8b9d54-2430-4bbe-9dae-52ce54024c22/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=6a8b9d54-2430-4bbe-9dae-52ce54024c22" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://kelvinjones.co.uk/unblock-the-tubes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Time to make a change</title>
		<link>http://kelvinjones.co.uk/time-to-make-a-change</link>
		<comments>http://kelvinjones.co.uk/time-to-make-a-change#comments</comments>
		<pubDate>Tue, 01 Dec 2009 20:40:48 +0000</pubDate>
		<dc:creator>Kelvin Jones</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://kelvinjones.co.uk/?p=1</guid>
		<description><![CDATA[Two weeks ago I met with my boss at A7 Creative to let him know that I was planning to leave as of 18th December. Although I&#8217;ve enjoyed myself at A7, with the diversity of work and the flexibility that they&#8217;ve offered me, there are a few reasons that I have now chosen to freelance.
Firstly, [...]]]></description>
			<content:encoded><![CDATA[<p>Two weeks ago I met with my boss at A7 Creative to let him know that I was planning to leave as of 18th December. Although I&#8217;ve enjoyed myself at A7, with the diversity of work and the flexibility that they&#8217;ve offered me, there are a few reasons that I have now chosen to freelance.</p>
<p>Firstly, there&#8217;s the new addition to the family that is coming along right around the corner. To make it work, I&#8217;m just gonna have to have complete control over how &amp; when I work, more than I would be willing to ask of any employer.</p>
<p><span id="more-1"></span></p>
<p>Secondly, I&#8217;ve been wanting to run a business for a few years now. Although I didn&#8217;t envisage it being in a freelancing/consulting capacity, it made sense when I thought about it. Why jump in trying to do something new? Surely it would be sensible to do the thing that I&#8217;ve been doing for…</p>
<p><strong>10 years</strong>. That&#8217;s the third reason, or at least part of the third reason. As well as my second child, 2010 will bring with it my 30th birthday (oy vey) and my 10th year in full-time employment as a web developer. The long and short of it is, it&#8217;s time for me to do this for myself.</p>
<p>So, there you have it. 2010 here I come. It&#8217;s gonna be HUGE.</p>
]]></content:encoded>
			<wfw:commentRss>http://kelvinjones.co.uk/time-to-make-a-change/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
