<?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>Fivetwelve</title>
	<atom:link href="http://www.five-twelve.co.uk/feed?cat=-3" rel="self" type="application/rss+xml" />
	<link>http://www.five-twelve.co.uk</link>
	<description>Expert Web Design Welshpool, Web Design Shropshire, Web Design Powys, CodeIgniter Developer, Herefordshire, Shrewsbury</description>
	<lastBuildDate>Mon, 23 Aug 2010 15:09:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Cool URL shortener from Fivetwelve &#8211; ftw.gd</title>
		<link>http://www.five-twelve.co.uk/computing/cool-url-shortener-from-fivetwelve-ftw-gd</link>
		<comments>http://www.five-twelve.co.uk/computing/cool-url-shortener-from-fivetwelve-ftw-gd#comments</comments>
		<pubDate>Mon, 23 Aug 2010 15:09:01 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Computing]]></category>

		<guid isPermaLink="false">http://www.five-twelve.co.uk/?p=398</guid>
		<description><![CDATA[For a fun new project, Fivetwelve have launched a brand new URL shortener. Introducing ftw.gd &#8211; the URL shortener with a fun twist. If you&#8217;re familiar with the technical babble of &#8220;leet speak&#8221;, with slang such as &#8220;ftw&#8221;, you will like ftw.gd. It&#8217;s a great new URL shortener that is free for everyone to use [...]]]></description>
			<content:encoded><![CDATA[<div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.five-twelve.co.uk%2Fcomputing%2Fcool-url-shortener-from-fivetwelve-ftw-gd&amp;text=Cool URL shortener from Fivetwelve &#8211; ftw.gd&amp;count=vertical&amp;via=512uk&amp;lang=en"><img src="http://www.five-twelve.co.uk/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>For a fun new project, Fivetwelve have launched a brand new URL shortener.</p>
<p>Introducing <a title="ftw.gd - The fun new l33t URL shortener" href="http://ftw.gd" target="_blank">ftw.gd &#8211; the URL shortener with a fun twist</a>.</p>
<p>If you&#8217;re familiar with the technical babble of &#8220;leet speak&#8221;, with slang such as &#8220;ftw&#8221;, you will like ftw.gd. It&#8217;s a great new URL shortener that is free for everyone to use for sharing short links on sites such as Facebook and Twitter. It also has a bit of a fun twist on it.</p>
<p>So the next time you need to shorten a URL for your tweets, <a title="ftw.gd - the l33t new URL shortener from Fivetwelve" href="http://ftw.gd">give ftw.gd a try</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.five-twelve.co.uk/computing/cool-url-shortener-from-fivetwelve-ftw-gd/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple jQuery Image Preloading</title>
		<link>http://www.five-twelve.co.uk/tutorials/javascript/simple-jquery-image-preloading</link>
		<comments>http://www.five-twelve.co.uk/tutorials/javascript/simple-jquery-image-preloading#comments</comments>
		<pubDate>Tue, 17 Aug 2010 14:14:36 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[notes]]></category>

		<guid isPermaLink="false">http://www.five-twelve.co.uk/?p=356</guid>
		<description><![CDATA[Again, this is more a note to myself, but I find the best function to preload images with jQuery is the following: jQuery.preloadImages = function() { for(var i = 0; i&#60;arguments.length; i++) { jQuery(&#34;&#60;img&#62;&#34;).attr(&#34;src&#34;, arguments[i]); } } This accepts X amount of arguments and can be called like the following: $.preloadImages(&#34;/static/img/loadinganimation.gif&#34;, &#34;/static/img/throbber.gif&#34;); Why would you [...]]]></description>
			<content:encoded><![CDATA[<div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.five-twelve.co.uk%2Ftutorials%2Fjavascript%2Fsimple-jquery-image-preloading&amp;text=Simple jQuery Image Preloading&amp;count=vertical&amp;via=512uk&amp;lang=en&amp;related=javascript,jquery,notes"><img src="http://www.five-twelve.co.uk/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>Again, this is more a note to myself, but I find the best function to preload images with jQuery is the following:</p>
<pre class="brush: jscript;">
jQuery.preloadImages = function() {
     for(var i = 0; i&lt;arguments.length; i++)
    {
          jQuery(&quot;&lt;img&gt;&quot;).attr(&quot;src&quot;, arguments[i]);
    }
}
</pre>
<p>This accepts X amount of arguments and can be called like the following:</p>
<pre class="brush: jscript;">
$.preloadImages(&quot;/static/img/loadinganimation.gif&quot;, &quot;/static/img/throbber.gif&quot;);
</pre>
<p>Why would you want to do this? Simple &#8211; if you&#8217;re using any &#8220;loading animations&#8221; on your site, with animated GIFs, you may find that on first activation on certain browsers the GIF is missing. If you preload it using a function like this one, your problem is solved.</p>
<p>Credit to this function goes to <a href="http://www.bloggingdeveloper.com/post/Image-Preloading-with-jQuery.aspx">bloggingdeveloper.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.five-twelve.co.uk/tutorials/javascript/simple-jquery-image-preloading/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Full UK Postcode Regular Expression Pattern (incl. London)</title>
		<link>http://www.five-twelve.co.uk/development/full-uk-postcode-regular-expression-pattern-incl-london</link>
		<comments>http://www.five-twelve.co.uk/development/full-uk-postcode-regular-expression-pattern-incl-london#comments</comments>
		<pubDate>Mon, 16 Aug 2010 16:39:01 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[postcodes]]></category>
		<category><![CDATA[regex]]></category>

		<guid isPermaLink="false">http://www.five-twelve.co.uk/?p=357</guid>
		<description><![CDATA[This is more a note to myself than anything, but I hope this can be a use of other developers looking to regex validate UK Postcodes. This validates all postcodes including London ones fine. Here&#8217;s the code: ^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}&#124;GIR 0AA)$ Here&#8217;s an example as a CodeIgniter form validation callback, which you could use by calling [...]]]></description>
			<content:encoded><![CDATA[<div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.five-twelve.co.uk%2Fdevelopment%2Ffull-uk-postcode-regular-expression-pattern-incl-london&amp;text=Full UK Postcode Regular Expression Pattern (incl. London)&amp;count=vertical&amp;via=512uk&amp;lang=en&amp;related=codeigniter,php,postcodes,regex"><img src="http://www.five-twelve.co.uk/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>This is more a note to myself than anything, but I hope this can be a use of other developers looking to regex validate UK Postcodes. This validates all postcodes including London ones fine.<span id="more-357"></span> Here&#8217;s the code:</p>
<p><code>^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$</code></p>
<p>Here&#8217;s an example as a CodeIgniter form validation callback, which you could use by calling <code>callback_is_valid_uk_postcode</code> in your form validation code. The logic is obviously transferable, though.</p>
<pre class="brush: php;">
		/**
		 * CALLBACK - determine if the provided postcode is valid.
		 *
		 * @param string $postcode
		 * @return bool TRUE if valid, FALSE otherwise
		 * @author George Edwards
		 */
		function is_valid_uk_postcode($postcode) {
			$pattern = &quot;/^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/&quot;

			if (preg_match($pattern, $postcode)) {
				return TRUE;
			}

			$this-&gt;validation-&gt;set_message('is_valid_uk_postcode', 'That is not a valid %s.');
			return FALSE;
		}
</pre>
<p>Credit to writing this material goes to <a href="http://regexlib.com/REDetails.aspx?regexp_id=260">regexlib.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.five-twelve.co.uk/development/full-uk-postcode-regular-expression-pattern-incl-london/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Best UK ISP for UK Broadband &#8211; Eclipse (A review)</title>
		<link>http://www.five-twelve.co.uk/computing/best-uk-isp-for-uk-broadband-eclipse-a-review</link>
		<comments>http://www.five-twelve.co.uk/computing/best-uk-isp-for-uk-broadband-eclipse-a-review#comments</comments>
		<pubDate>Thu, 12 Aug 2010 19:38:13 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[adsl]]></category>
		<category><![CDATA[eclipse internet]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[isp]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[sky broadband]]></category>

		<guid isPermaLink="false">http://www.five-twelve.co.uk/?p=349</guid>
		<description><![CDATA[So I thought I would break away from the usual &#8220;very technical&#8221; programming tutorials and today write something that bears a bit more relevance to the average UK household &#8211; broadband ISPs. This subject is something I feel quite strongly about, as I&#8217;m obviously just not an everyday Internet user. Occasionally I game online, I [...]]]></description>
			<content:encoded><![CDATA[<div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.five-twelve.co.uk%2Fcomputing%2Fbest-uk-isp-for-uk-broadband-eclipse-a-review&amp;text=Best UK ISP for UK Broadband &#8211; Eclipse (A review)&amp;count=vertical&amp;via=512uk&amp;lang=en&amp;related=adsl,eclipse+internet,internet,isp,review,sky+broadband"><img src="http://www.five-twelve.co.uk/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>So I thought I would break away from the usual &#8220;very technical&#8221; programming tutorials and today write something that bears a bit more relevance to the average UK household &#8211; broadband ISPs.</p>
<p>This subject is something I feel quite strongly about, as I&#8217;m obviously just not an everyday Internet user. Occasionally I game online, I regularly stream HD media via services such as iPlayer and I&#8217;m always browsing countless pages as well as maintaining websites via services such as FTP. Therefore I feel a reliable broadband service is pretty much the bread and butter for me &#8211; almost as important as something like running water and electricity. So forgive me if this article waffles on a bit.<span id="more-349"></span></p>
<p>Therefore I felt it appropriate that I draw peoples attention to a company that doesn&#8217;t always get brought to most peoples attention on the TV or in newspapers and so on. Admittedly, they aren&#8217;t as well known as the likes of BT, Virgin, Sky, Tiscali or TalkTalk, but what they lack in reputation they sure as hell do make up for in service. That company is <a title="Eclipse Internet, number one UK ISP and broadband/ADSL provider." href="http://www.eclipse.net.uk" target="_blank">Eclipse Internet &#8211; quite easily the UK&#8217;s best broadband supplier</a>. And here&#8217;s why.</p>
<h2>A Comparison</h2>
<p>Obviously I can&#8217;t spout off a claim as big as saying that Eclipse are #1 ISP in the UK without some circumstantial evidence, so I&#8217;ll do my best to back it up. Let&#8217;s compare them to another very well known ISP who sadly I have (very unpleasant and rubbish) dealings with &#8211; Sky. I&#8217;m not even going to link to them because quite frankly why would they deserve a back link from me? They are simply a shocking company. Let me explain.</p>
<p>I&#8217;m writing this blog post from home, and where I live I lodge with a great family who sadly use Sky broadband. Obviously, the choice of ISP isn&#8217;t up to me here. I have lodged here for a little over a year now and in that time I have noted just how pathetic Sky broadband are in the provision of their ADSL service. On the other hand, for a client of mine who&#8217;s network I manage I happily use Eclipse Internet for their Internet connection.</p>
<p>The first problem I had with Sky is the speed. Despite us living under a mile from the exchange, and apparently our line being capable of full 8mbps ADSL speeds, the router was only syncingat 2272kbps &#8211; which is around 2mb. Obviously, this is bad because if you&#8217;re paying for an 8mb service and getting 2mb, then you&#8217;re only getting a quarter of what you pay. So naturally at this point we got in touch with Sky and reported the problem to them. We got nowhere, beyond the arbitrary diagnosis process of the indian call centre personnel &#8211; which came down to the following:</p>
<ol>
<li>Checking the lights on the router</li>
<li>Turning the router off for (insert seconds here) and then back on</li>
<li>Plugging the router into your main BT socket</li>
<li>Switching around microfilters</li>
<li>Scanning for viruses/spyware/malware on your computer</li>
<li>Ensuring you have no P2P applications running on your computer.</li>
</ol>
<p>Once all this failed, it was just a case of ticket tennis &#8211; and bouncing between departments whilst racking up a ludicrous phone bill calling their stupid 0870 numbers. We&#8217;d even get the usual promises of phone calls back from various engineers &#8211; but still nothing. Obviously as I work in IT I knew this wasn&#8217;t good enough. It&#8217;s just laziness and lack of dedication to the customer. The problem wasn&#8217;t hard to fix. In the end, months went by until I managed to convince them that the line stabilisation process hadn&#8217;t originally completed successfully and we needed to undergo another one. This could be identified by looking up the SNR/noise margin and other stats off the router. Once I managed to convince Sky of this, an engineer instigated this immediately and within a week our router was syncing at the full 8mbps. Why should I have to do this? What kind of pathetic company relies on their customers to diagnose faults for them?</p>
<p>So now with a connection that is syncing at the full 8mbps, you&#8217;d think everything would be honky dory but sadly this isn&#8217;t the case, as some Sky customers would agree. The speed issues weren&#8217;t exactly improved because Sky seem to have a slight issue with overcrowding. Their contention must be something like 1000 customers fighting for 1 connection because anytime between the hours of 4pm and 12am, any day of the week, the Internet is literally unusable. This may sound like an exaggeration, but I kid you not. You can expect being a customer of Sky that in peak times, your download speeds will drop to about 0.30mbps, at best, with <strong><em>severe</em></strong> latency.</p>
<p>Forget online gaming &#8211; it will take about 3-5 seconds before your actions will register with other players &#8211; the lag is horrendous. Forget watching videos on YouTube or streaming TV shows on BBC iPlayer. Hell, forget even being able to browse normal Internet pages &#8211; as I can get that done ten times as fast on my iPhone with my O2 3G connection. It plainly and simply is &#8211; completely unusable at any time, unless you are nocturnal and are online in the middle of the night, or you don&#8217;t have a job and spend all day online gaming. But who is/does?</p>
<p>Admittedly, I&#8217;ll give Sky some credit. In the middle of the night you can expect some decent figures. You can download stuff at around 800-900KB/sec at 3am, but sadly in the real world only 0.05% of their users are awake at this time &#8211; so it&#8217;s going to be quicker.</p>
<p>To conclude on Sky, I&#8217;ll wrap up and give you one simple warning. Avoid. If you want to use your Internet connection at any normal hour of the day, don&#8217;t even bother with them. They are simply the worst company I have ever dealt with for service and support, and their broadband is completely unusable.</p>
<h3>So what about Eclipse?</h3>
<p>Now that&#8217;s over with, let me compare to Eclipse. I fear this section of the blog entry will be much much shorter as there is little to say about them, apart from they are simply staggering.</p>
<p>So what is so great? I think it mainly comes down to support. Compare Eclipse to the likes of Sky/AOL/BT &#8211; what stands out the most is <em>dedicated</em>, <em>friendly</em>, <em>helpful</em> support personnel who are in <em>UK based</em> call centres. If you ring Eclipse, they will answer within literally a few seconds, and you&#8217;re straight away talking to someone who is willing to help you and you get that pleasant impression that they <strong><em>want </em></strong>to help you as much as they can. They are also incredibly knowledgeable.</p>
<p>For my previously mentioned client who&#8217;s network I manage, I occasionally have to ring up Eclipse because of little concerns on the line. A couple of weeks ago I noticed that peak speeds had dropped to around 300KB/sec downstream. Compared to Sky, you&#8217;d think that heaven! But with Eclipse I knew that this wasn&#8217;t the norm, as usually we&#8217;d expect to be getting around 600-800KB/sec all day long.</p>
<p>The support chap at the other end was as usual &#8211; completely amazing. The first thing he looked at was the status of the  local exchange, and he informed me that upgrades were currently being performed, so this may have temporary impact on the speed of the connection. He then looked at the stats of the line, including the SNR and noise margin and so on &#8211; where he looked at what Sky so crucially overlooked &#8211; whether the line needed to restabilise. He checked how long the connection from the router to the exchange had been up, and in what quantities. He politely explained to me that as the exchange upgrades would require another line stabilisation, that the router should be up as long as possible as any sustained drops in the connection would result in a slower overall sync speed. Ring any alarm bells? This is how ADSL support should work &#8211; knowledgeable, well trained and helpful staff. For pete&#8217;s sake &#8211; <strong>take note, Sky</strong>.</p>
<p>It didn&#8217;t really stop their, I went on to ask him that in the best interests of my client, what are the alternatives in their area for a faster Internet connection &#8211; such as ADSL2/21CN/SDSL and so on. I just wanted an answer in layman&#8217;s terms &#8211; is there a fast alternative without breaking the bank. To which he replied that he wasn&#8217;t sure, but would I mind holding as he&#8217;d go and check with his more experienced colleagues in the office for a definitive answer. Awesome! How many other support people would just leave it with a simple &#8220;no no no Mr Edwards you must pay us £xxxx&#8221; and so on. This is why with Eclipse you can be sure that the support people <em>want </em>to help you.</p>
<h3>Conclusion</h3>
<p>So I think I&#8217;ll sum it up &#8211; already at nearly 1500 words, this is quite a comprehensive comparison. So I&#8217;ll finish with a simple conclusion: If you want broadband that works at less than 4% of the speed you pay for the majority of the time, with rubbish, foreign, clueless and sometimes abusive support staff, use Sky Broadband.</p>
<p>On the other hand if you want broadband that just&#8230; &#8220;works&#8221;  with excellent, friendly, helpful and knowledgeable staff to help you out in the very rare event you have problems, go with Eclipse. I can categorically say that in my experience <a title="Eclipse Internet - the UKs best ADSL/broadband ISP" href="http://www.eclipse.net.uk" target="_blank">Eclipse Internet </a>are the best UK Broadband ISP by far.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.five-twelve.co.uk/computing/best-uk-isp-for-uk-broadband-eclipse-a-review/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Multiple CodeIgniter databases e.g. MSSQL and MySQL</title>
		<link>http://www.five-twelve.co.uk/tutorials/multiple-codeigniter-databases-e-g-mssql-and-mysql</link>
		<comments>http://www.five-twelve.co.uk/tutorials/multiple-codeigniter-databases-e-g-mssql-and-mysql#comments</comments>
		<pubDate>Wed, 04 Aug 2010 15:46:49 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.five-twelve.co.uk/?p=335</guid>
		<description><![CDATA[In a web app I&#8217;m developing at the moment, the primary database in use is an instance of Microsoft SQL Server 2005 Express. This works OK with the CodeIgniter/PHP front-end. Obviously, if I had the choice, I would be using MySQL but in the real world sometimes this isn&#8217;t possible. And MSSQL is working great [...]]]></description>
			<content:encoded><![CDATA[<div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.five-twelve.co.uk%2Ftutorials%2Fmultiple-codeigniter-databases-e-g-mssql-and-mysql&amp;text=Multiple CodeIgniter databases e.g. MSSQL and MySQL&amp;count=vertical&amp;via=512uk&amp;lang=en&amp;related=codeigniter,development,mssql,mysql,php"><img src="http://www.five-twelve.co.uk/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>In a web app I&#8217;m developing at the moment, the primary database in use is an instance of Microsoft SQL Server 2005 Express. This works OK with the CodeIgniter/PHP front-end. Obviously, if I had the choice, I would be using MySQL but in the real world sometimes this isn&#8217;t possible. And MSSQL is working great with simultaneous connections from the PHP app and MS Access.</p>
<p>I hit a point where I also wanted to access a MySQL database as well. This is easier than you think to configure, and worked first time with me without any stress or hair pulling.<span id="more-335"></span></p>
<p>To save you having to read through all the following detailed examples, the basic concept is as follows:</p>
<ol>
<li>Add a new config array to the $db array in <code>config/database.php</code>.</li>
<li>Name this array whatever you like, and configure it as normal with the usual CI elements/options. E.g. <code>$db['other_db']</code>.</li>
<li>Create a member variable in your models/wherever you want to access the new setup. Name it something like <code>var $other_db;</code>.</li>
<li>Load the database into the member variable, using <code>$this->other_db = $this->load->database('other_db', TRUE);</code>.</li>
<li>Reference the new member variable just like you would with CodeIgniter&#8217;s own <code>$this->db</code> object.</li>
</ol>
<h3>Configure database.php</h3>
<p>First thing you&#8217;ll need to do is let CodeIgniter know of your multiple database setup in the <code>config/database.php</code> file. Mine looks a bit like this.</p>
<pre class="brush: php;">
// $db['default'] config array will hold the default db settings - in my case, for the MSSQL server
$db['default']['hostname'] = &quot;SQLSERVERADDRESS\SQLEXPRESS&quot;;
$db['default']['username'] = &quot;sa&quot;; // or a different account
$db['default']['password'] = &quot;secr3tsqlpassw0rd&quot;;
$db['default']['database'] = &quot;yourdbname&quot;;
$db['default']['dbdriver'] = &quot;mssql&quot;; // obviously this is platform dependent
$db['default']['dbprefix'] = &quot;&quot;;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = &quot;&quot;;
$db['default']['char_set'] = &quot;utf8&quot;;
$db['default']['dbcollat'] = &quot;utf8_general_ci&quot;;

// for the secondary db server, $db['mysql'] will hold the config. you could name this anything you like, e.g. $db['secondary_db'], or however you see fit
$db['mysql']['hostname'] = &quot;localhost&quot;;
$db['mysql']['username'] = &quot;root&quot;;
$db['mysql']['password'] = &quot;secr3tmysqlpassw0rd&quot;;
$db['mysql']['database'] = &quot;other&quot;;
$db['mysql']['dbdriver'] = &quot;mysqli&quot;; // in this case, i'm using the MySQL Improved class to access the MySQL server
$db['mysql']['dbprefix'] = &quot;&quot;;
$db['mysql']['pconnect'] = TRUE;
$db['mysql']['db_debug'] = TRUE;
$db['mysql']['cache_on'] = FALSE;
$db['mysql']['cachedir'] = &quot;&quot;;
$db['mysql']['char_set'] = &quot;utf8&quot;;
$db['mysql']['dbcollat'] = &quot;utf8_general_ci&quot;;
</pre>
<h3>Load the non-default database config in your models</h3>
<p>So if you followed the above, you have two database configurations. You have <code>default</code> as per the first array, and <code>mysql</code>, as per the second (or whatever you chose to name it).</p>
<p>The next bit is simple. In your models, you can access the default database server just by using ordinary ActiveRecord calls such as <code>$this->db->get('users');</code>, but how do you access your secondary database?</p>
<p>Simple, just use the <code>$this->load->database();</code> method, and plug in the name of your additional database config from the <code>database.php</code> config file. This will load the driver to this database, so you&#8217;ll want to do this in your models, and assign it to a member variable.</p>
<p>Working through an example below, I created a brand new model to do this, with a member variable. This model was then used just for connecting to the MySQL database. So here&#8217;s an example that accesses a table of UK postcodes.</p>
<pre class="brush: php;">
&lt;?php

	class Mysql_model extends Model {

		// We'll access the MySQL db from this app which is primarily MSSQL based. Create the member variable.
		var $mysql;

		function Mysql_model() {
			parent::Model();

			$this-&gt;mysql = $this-&gt;load-&gt;database('mysql', TRUE); // Load the db, and assign to the member var.
		}

		/**
		 * Accepts an outfield/regional British postcode, and returns the data associated with it.
		 *
		 * @param string $postcode The outfield UK postcode. E.g. SY21, NW1, HR6, RG19, CF37, KT1, etc...
		 * @return array Of postcode data, bool FALSE otherwise
		 * @author George Edwards
		 */
		function get($postcode) {
                        // Now we can refer to this database server with $this-&gt;mysql.
			$this-&gt;mysql-&gt;select('town, county')-&gt;where('postcode', $postcode)-&gt;from('uk_postcodes')-&gt;limit(1);

			$query = $this-&gt;mysql-&gt;get();

			if ($query-&gt;num_rows() === 1) {
				// Do we have 1 result, as we expected? Return it as an array.
				return $query-&gt;row_array();
			}

			// Otherwise, we'll return FALSE.
			return FALSE;

		}
	}

/* End of file mysql_model.php */
/* Location: ./application/models/mysql_model.php */
</pre>
<p>Have fun with CodeIgniter! Any questions? Leave me a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.five-twelve.co.uk/tutorials/multiple-codeigniter-databases-e-g-mssql-and-mysql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Javascript pause/sleep functionality</title>
		<link>http://www.five-twelve.co.uk/tutorials/simple-javascript-pausesleep-functionality</link>
		<comments>http://www.five-twelve.co.uk/tutorials/simple-javascript-pausesleep-functionality#comments</comments>
		<pubDate>Wed, 28 Jul 2010 10:16:48 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.five-twelve.co.uk/?p=327</guid>
		<description><![CDATA[One thing that I&#8217;ve seen lots of people ask questions about is how to reliably pause or sleep execution of Javascript code. There are a variety of solutions, however none seem to be reliable as Javascript cannot really handle this functionality, except if you use setTimeout, which is no good if you just want to [...]]]></description>
			<content:encoded><![CDATA[<div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.five-twelve.co.uk%2Ftutorials%2Fsimple-javascript-pausesleep-functionality&amp;text=Simple Javascript pause/sleep functionality&amp;count=vertical&amp;via=512uk&amp;lang=en"><img src="http://www.five-twelve.co.uk/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>One thing that I&#8217;ve seen lots of people ask questions about is how to  reliably pause or sleep execution of Javascript code. There are a  variety of solutions, however none seem to be reliable as Javascript cannot really handle this functionality, except if you use <code>setTimeout</code>, which is no good if you just want to not consider any events, and you just want a bog standard sleep like PHP has.<span id="more-327"></span> With jQuery, the need is reduced a little bit because you can use event callbacks to delay  execution of the script until certain events have completed.</p>
<p>But what if you need to implement this and you need it to be reliable? What if you just have to delay execution for x number of seconds? Here&#8217;s a very simple way I came up with.</p>
<h2>Use PHP</h2>
<p>Think about it &#8211; PHP has the <code>sleep();</code> function which works like a charm for delaying execution. So why not just combine the two? If we create a PHP page to handle an incoming Javascript request, <code>sleep();</code> execution for a given number of seconds, then return output to Javascript, this pauses execution.</p>
<h2>PHP code</h2>
<p>OK so let&#8217;s first make a PHP page. Call it sleep.php and use the following code.</p>
<pre class="brush: php;">
&lt;?php

	// Do we have a duration time?
	if (isset($_GET['duration']) &amp;&amp; is_numeric($_GET['duration'])) {
		$duration = $_GET['duration'];
	} else {
		// If not, just say 1 second.
		$duration = 1;
	}

	sleep($duration);

	echo &quot;ok&quot;;

?&gt;
</pre>
<p>All we do here is expect a <code>GET</code> variable of duration. If it&#8217;s there, and it&#8217;s numeric, we&#8217;ll sleep to it&#8217;s value. Then when sleep is finished, we&#8217;ll echo back &#8220;ok&#8221; to the browser. You can test this functionality by just performing a direct request to it and passing <code>?duration=5</code> for a five second pause, for example.</p>
<h2>The Javascript</h2>
<p>Now we can just create an ordinary HTML page with our Javascript in. We can create a function called <code>js_sleep()</code> for example that handles our callback for us.</p>
<pre class="brush: jscript;">
// Our pause function.
function js_sleep(duration) {
	if (duration == undefined || isNaN(duration)) {
		duration = 1;
	}

	$.ajax({
		url: 'http://path-to/sleep.php',
		type: 'GET',
		data: {duration: duration},
		success: function(response) {
			if (response == &quot;ok&quot;) {
				alert('Timer finished');
			}
		}
	})
}
</pre>
<p>With that code there we can quite easily call it in our Javascript code as <code>js_sleep(3)</code> to create a pause of three seconds anywhere. Obviously you&#8217;d probably want to modify that code to <code>return true;</code> or nothing at all, rather than alert.</p>
<h2>Problems with this method</h2>
<p>Although this works great and isn&#8217;t too hard to implement, the biggest problem is that the request will usually be a little bit longer, as the user&#8217;s browser has to perform the callback to the server and wait for the response. Testing on Firebug, I discovered that it usually adds about 100-300ms to the request.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.five-twelve.co.uk/tutorials/simple-javascript-pausesleep-functionality/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extending Alen Grakalic&#8217;s EasySlider for mouseover pausing</title>
		<link>http://www.five-twelve.co.uk/tutorials/extending-alen-grakalics-easyslider-for-mouseover-pausing</link>
		<comments>http://www.five-twelve.co.uk/tutorials/extending-alen-grakalics-easyslider-for-mouseover-pausing#comments</comments>
		<pubDate>Sat, 24 Jul 2010 22:40:40 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.five-twelve.co.uk/?p=142</guid>
		<description><![CDATA[EasySlider is an awesome quick and easy jQuery plugin to get things sliding with ease. I&#8217;ve used it on a clients site and found it very easy and versatile. There are plenty of options and customisations such as varying speed, pause length, repetition and so on. There was one thing I noticed, however, that wasn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.five-twelve.co.uk%2Ftutorials%2Fextending-alen-grakalics-easyslider-for-mouseover-pausing&amp;text=Extending Alen Grakalic&#8217;s EasySlider for mouseover pausing&amp;count=vertical&amp;via=512uk&amp;lang=en"><img src="http://www.five-twelve.co.uk/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p><a href="http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding">EasySlider</a> is an awesome quick and easy jQuery plugin to get things sliding with ease. I&#8217;ve used it on a clients site and found it very easy and versatile. There are plenty of options and customisations such as varying speed, pause length, repetition and so on.</p>
<p>There was one thing I noticed, however, that wasn&#8217;t customisable. A simple pause facility when someone hovers their cursor over the EasySlider object. I know from experience that putting something on a continuous loop is great to add a bit of movement to the page, but is no good if the user can&#8217;t stop it while they&#8217;re reading the content of the slide.<span id="more-142"></span></p>
<p>After a quick look online, it seemed as though no-one else has done it. So I put on the wellies and began wading through the code to add this functionality myself.</p>
<h3>Adding the option</h3>
<p>The first thing I wanted to do, was make it optional. Some times people may not want to use this functionality, so it&#8217;s best to configure it as a boolean parameter passed on instantiation of the plugin class. We&#8217;ll configure a default to false, so that the out-of-box behaviour is continuous sliding. Find the EasySlider plugin file, locate the defaults object, and modify it as I have done here.</p>
<pre class="brush: jscript;">
// default configuration properties
var defaults = {
prevId: 		'prevBtn',
prevText: 		'Previous',
nextId: 		'nextBtn',
nextText: 		'Next',
controlsShow:	true,
controlsBefore:	'',
controlsAfter:	'',
controlsFade:	true,
firstId: 		'firstBtn',
firstText: 		'First',
firstShow:		false,
lastId: 		'lastBtn',
lastText: 		'Last',
lastShow:		false,
vertical:		false,
speed: 			800,
auto:			false,
pause:			2000,
continuous:		false,
numeric: 		false,
numericId: 		'controls',
allControls:	false,
// added by George Edwards. When user hovers over control, doesn't animate
hoverPause:		false
};
</pre>
<p>Now when people instantiate the plugin, the following code can be used to trigger the hoverPause functionality:</p>
<pre class="brush: jscript;">
$('#slider').easySlider({
    speed: 200,
    auto: true,
    continuous: true,
    pause: 4000,
    allControls: true,
    // Trigger the pause on hover functionality
    hoverPause: true
});
</pre>
<h3>Creating the functionality</h3>
<p>OK so now we have a configurable option, it&#8217;s time to build up the functionality. We need to detect when someone begins to hover over the object, and when their mouse stops hovering over the object. Fortunately, jQuery has the <code>.hover()</code> event that is fired when a DOM element is hovered over, along with a callback for when the element loses it&#8217;s hover state.</p>
<p>We can make use of this in this situation, but we&#8217;ll also need to keep track of the hover state when the plugin tries to begin the slide transition. So we just create an object property that stores a boolean value, and change it using the <code>.hover()</code> event. Take a look at the following code:</p>
<pre class="brush: jscript;">
		// We'll need this member variable to store a current hover state
		var mouseOver = false;

		// Handle mouse over of div
		obj.hover(function(){
			mouseOver = true;
		}, function(){
			mouseOver = false;
		});
</pre>
<p>So here we&#8217;ve got our member variable that is set depending on the hover state. We bind the <code>.hover()</code> event to the <code>obj</code> object, as the EasySlider code assigns this from the <code>$(this)</code> DOM element, being the slider div. Now our code is handling the hover state correctly.</p>
<p>The next stage is to delay the slide animation/transition. For this, find the <code>animate()</code> function in the plugin and insert the following to the top of the functon code:</p>
<pre class="brush: jscript;">
			function animate(dir,clicked){

				// If the mouse is over the object, bail animation.
				if (options.hoverPause == true &amp;&amp; mouseOver == true) {
					return;
				}
</pre>
<p>Pretty simple, or what? This simple if statement says &#8211; if we have enabled hoverPause functionality for this instance of the plugin (<code>options.hoverPause == true</code>), AND if the user is hovering over the slider element (<code>mouseOver == true</code>) then return out of the animate function without animating.</p>
<p>I hope this very simple improvement to this fantastic plugin can be of use to other developers looking to add pause/hover functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.five-twelve.co.uk/tutorials/extending-alen-grakalics-easyslider-for-mouseover-pausing/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
