<?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>Full On Design &#187; Coding</title>
	<atom:link href="http://www.fullondesign.co.uk/coding/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fullondesign.co.uk</link>
	<description>Design &#38; Web Technologies</description>
	<lastBuildDate>Sun, 30 Oct 2011 21:37:16 +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>10 Brilliant Web Development &amp; Technology Podcasts</title>
		<link>http://www.fullondesign.co.uk/coding/2143-10-brilliant-web-development-technology-podcasts.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/2143-10-brilliant-web-development-technology-podcasts.htm#comments</comments>
		<pubDate>Sun, 30 Oct 2011 20:12:19 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=2143</guid>
		<description><![CDATA[I am a big fan of podcasts, here is a handful of really good podcasts that I&#8217;ve been listening to over the last month on my commute to work. If you use Google Reader (With Google Listen), you can quickly subscribe to this via the bundle I created. 1. Founders Talk Founders talk is a [...]]]></description>
			<content:encoded><![CDATA[<p>I am a big fan of podcasts, here is a handful of really good podcasts that I&#8217;ve been listening to over the last month on my commute to work. If you use Google Reader (With Google Listen), you can quickly subscribe to this <a href="https://www.google.com/reader/bundle/user%2F12400831042212741612%2Fbundle%2FWeb%20Development%20Podcasts">via the bundle I created</a>.</p>
<p><strong>1. <a href="http://5by5.tv/founderstalk">Founders Talk</a></strong></p>
<p>Founders talk is a really good because it interviews really interesting and influential people from the world of the web. Some of the notable people interveiwed include Drew Wilson (the guy who made Pictos &amp; Screeny) &amp; Vitalty Friedman (The editor-in-cheif of smashing magazine).</p>
<p><em>Average Duration</em>: ~ 60 minutes<br />
<em>Release Schedule</em>: Weekly</p>
<p><strong>2. <a href="http://javascriptshow.com/">The Javascript Show</a></strong></p>
<p>The Javascript show is a great round up of all the newest Javascript goings on in the Javascript world. It&#8217;s a great source to find out about new libraries &amp; Javascript news. The key reason I love this show is because they cover a wide variety of useful tools &amp; I always start using the libraries and tools they mention.</p>
<p><em>Average Duration</em>: ~45 minutes<br />
<em>Release Schedule</em>: Weekly</p>
<p><strong>3. <a href="http://ee-podcast.com/">The ExpressionEngine Podcast</a></strong></p>
<p>I&#8217;m not a massive fan of ExpressionEngine (I am a much bigger fan of CMS&#8217;s such as Perch or WordPress), however their podcast is really well put together &amp; really high quality. While it does have a big focus on creating websites in EE, most the stuff they talk about can be applied to working with any website.</p>
<p><em>Average Duration</em>: ~35 minutes<br />
<em>Release Schedule</em>: Weekly</p>
<p><strong>4. <a href="http://thechangelog.com/tagged/episode">The Changelog</a></strong></p>
<p>The Changelog podcast is great , it covers web and desktop development &amp; the hosts appears to be quite well connected (So they interview some pretty interesting folk).</p>
<p><em>Average Duration</em>: ~30 minutes<br />
<em>Release Schedule</em>: Weekly</p>
<p><span id="more-2143"></span></p>
<p><strong>5. <a href="http://www.sitepoint.com/category/podcast/">SitePoint</a></strong></p>
<p>SitePoint is a really great resource of materials to get stared in the world of web development. Their podcast is really well put together &amp; really informative.</p>
<p><em>Average Duration</em>: ~40 minutes<br />
<em>Release Schedule</em>: Weekly</p>
<p><strong>6. <a href="http://thinkvitamin.com/podcast/">Think Vitamin</a></strong></p>
<p>Think Vitamin is well known as a sound information on web development. Their podcast does not disappoint.</p>
<p><em>Average Duration</em>: ~40 minutes<br />
<em>Release Schedule</em>: Weekly</p>
<p><strong>7. <a href="http://www.wired.co.uk/podcast">Wired.co.uk</a></strong></p>
<p>Wired is fairly well known technology &amp; geek culture magazine, their podcast is a 40 or so minute summary of the weeks technology going ons with an in-depth interview. It&#8217;s really well edited, they stick to their release schedule &amp; the quality is fantastic.</p>
<p><em>Average Duration</em>: ~30 minutes<br />
<em>Release Schedule</em>: Weekly</p>
<p><strong>8. <a href="http://atxwebshow.com/">The ATX Web Show!</a></strong></p>
<p>While this podcast is mostly based around the going ons in Austin, Texas, it&#8217;s a really good for finding out some of the cool things happening in web development.</p>
<p><em>Average Duration</em>: ~45 minutes<br />
<em>Release Schedule</em>: Weekly</p>
<p><strong>9. <a href="http://www.bbc.co.uk/podcasts/series/digitalp">Click</a></strong></p>
<p>BBC Click is a really good TV show which has a excellent sister podcast which is really informative of the changes in the technology industry.</p>
<p><em>Average Duration</em>: ~30 minutes<br />
<em>Release Schedule</em>: Weekly</p>
<p><strong>10. <a href="http://pishposh.tv/forrst-podcast/">Forrst Podcast</a></strong></p>
<p>Forrst is pretty well known among most web designers, their podcast covers the going on in the forrest community &amp; also discusses whats happening in the rest of the web.</p>
<p><em>Average Duration</em>: ~45 minutes<br />
<em>Release Schedule</em>: Weekly</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/2143-10-brilliant-web-development-technology-podcasts.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL REPLACE function</title>
		<link>http://www.fullondesign.co.uk/coding/mysql/2120-mysql-replace-function.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/mysql/2120-mysql-replace-function.htm#comments</comments>
		<pubDate>Sat, 10 Sep 2011 22:55:33 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=2120</guid>
		<description><![CDATA[MySQL always surprises me in the sheer amount of stuff you can do in it. For example I recently found it has a bunch of String Functions. The main one I found to be useful was the REPLACE function, which works like this: So it can be used like: So if you wanted to go through a [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL always surprises me in the sheer amount of stuff you can do in it. For example I recently found it has a bunch of <a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html">String Functions</a>. The main one I found to be useful was the <a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace">REPLACE function</a>, which works like this:</p>
<pre class="brush: plain; title: ; notranslate">REPLACE(Original String, Find This, Replace with this)</pre>
<p>So it can be used like:</p>
<pre class="brush: plain; title: ; notranslate">SELECT REPLACE('My Original String', 'Original', 'Modified');
# This will output: My Modified String</pre>
<p>So if you wanted to go through a full  table and replace a bunch of strings, you could use it like this:</p>
<pre class="brush: plain; title: ; notranslate">UPDATE `table_name` SET `field_name` = REPLACE(`field_name`, 'Find Me', 'Replace with Me');</pre>
<p>Useful no?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/mysql/2120-mysql-replace-function.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Share or wait rageboxes (And how to bypass them)</title>
		<link>http://www.fullondesign.co.uk/coding/xhtml_and_css/2109-share-or-wait-rage-boxes-and-how-to-bypass-them.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/xhtml_and_css/2109-share-or-wait-rage-boxes-and-how-to-bypass-them.htm#comments</comments>
		<pubDate>Tue, 06 Sep 2011 12:20:53 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[XHTML & CSS]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=2109</guid>
		<description><![CDATA[I was recently shown (via Reddit) possibly one of the biggest crime against UX, a lightbox which asks you to share the website or wait 600 seconds. At first I thought it was fake, but if you visit the offending website, it&#8217;s unfortunately real. So yeah, after a short time of giggling and raging I [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently shown (via <a href="http://www.reddit.com/r/reddit.com/comments/k5pgj/share_or_wait_600_seconds_i_will_do_neither/">Reddit</a>) possibly one of the biggest crime against UX, a lightbox which asks you to share the website or wait 600 seconds.</p>
<p><img class="aligncenter size-full wp-image-2110" title="share or wait 600 seconds *facepalm*" src="http://files.fullondesign.co.uk/uploads/2011/09/share_or_wait_600_seconds.png" alt="share or wait 600 seconds *facepalm*" width="498" height="214" /></p>
<p>At first I thought it was fake, but if you visit the <a href="http://www.soccercaffe.com/hot-news/indonesia-turmenistan-4-3.html" rel="nofollow">offending website</a>, it&#8217;s unfortunately real. So yeah, after a short time of giggling and raging I worked on a way to bypass this.</p>
<h3>How to bypass it</h3>
<p>The easiest way, is to vote with your feet and not use the website. But in some cases, that isn&#8217;t always an option.</p>
<p>A working method I found (if you are using Google Chrome or Safari) is to hide the element.  With your mouse right click on the element and click &#8220;Inspect Element&#8221;, this will open the developer tools. Then under the &#8220;style&#8221; side menu just add the rule &#8220;display:none;&#8221; and it should disappear. In most cases, it might look a bit like the screenshot below.</p>
<p><a href="http://files.fullondesign.co.uk/uploads/2011/09/developer_tools.png"><img class="aligncenter size-medium wp-image-2113" title="developer tools - showing the rule in action." src="http://files.fullondesign.co.uk/uploads/2011/09/developer_tools-300x180.png" alt="developer tools - showing the rule in action" width="300" height="180" /></a></p>
<p>You can also right click on the element in the developer tools and click &#8220;delete node&#8221; on the html causing the ragebox. </p>
<p><span id="more-2109"></span></p>
<h3>Extra Notes</h3>
<ul>
<li>This is the same method using on my post labelled: <a href="http://www.fullondesign.co.uk/coding/xhtml_and_css/1406-bypass-facebooks-like-this-to-see-the-picture-pages-using-google-chrome.htm">Bypass Facebook’s “Like this to see the picture” pages using Google Chrome</a>.</li>
<li>You can also add a rule to your AdBlocker to stop these working on most websites, but that might affect sites which use lightboxes to look pretty.</li>
<li>We totally need to standardise the &lt;lightbox&gt; tag into HTML5, just to deal with crap like this</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/xhtml_and_css/2109-share-or-wait-rage-boxes-and-how-to-bypass-them.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using cookieless domains to improve a website performance</title>
		<link>http://www.fullondesign.co.uk/coding/1668-using-cookieless-domains-to-improve-a-website-performance.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/1668-using-cookieless-domains-to-improve-a-website-performance.htm#comments</comments>
		<pubDate>Fri, 01 Jul 2011 20:49:42 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Code Language]]></category>
		<category><![CDATA[Config]]></category>
		<category><![CDATA[Cookie Data]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Domains]]></category>
		<category><![CDATA[Improving Performance]]></category>
		<category><![CDATA[Kilobytes]]></category>
		<category><![CDATA[Loading Times]]></category>
		<category><![CDATA[Static Files]]></category>
		<category><![CDATA[Static Image]]></category>
		<category><![CDATA[Subdomain]]></category>
		<category><![CDATA[Unnecessary Data]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1668</guid>
		<description><![CDATA[Fast loading times are a really important factor when it comes to website ranking, so it&#8217;s important to remove as much unnecessary data as possible. A good method to do this is via cookieless domains. Cookieless domains are (as the name suggests) are domains, in which the user will not send cookies (Which can add quite a [...]]]></description>
			<content:encoded><![CDATA[<p>Fast loading times are a really important factor when it comes to website ranking, so it&#8217;s important to remove as much unnecessary data as possible. A good method to do this is via cookieless domains.</p>
<p>Cookieless domains are (as the name suggests) are domains, in which the user will not send cookies (Which can add quite a few kilobytes to a request). For example, say I want a user to load a static image it would be silly of them to also send me the cookie data. Luckily they are super easy to set up.</p>
<p><span id="more-1668"></span></p>
<h3>Set up a sub-domain</h3>
<p>Firstly, set up a subdomain on your website. For example static.yourdomain.com would be suitable, but it&#8217;s really up to you. Now point the domain to a path where you will keep your static files (Such as images and CSS files). For Full On Design, I set up <a href="http://files.fullondesign.co.uk/">http://files.fullondesign.co.uk/</a>.</p>
<h3>Stop cookies being set site wide</h3>
<p>Next, make sure your website does not set website wide cookies. The fastest way to do this is by amending the .htaccess file and adding a <a href="http://httpd.apache.org/docs/2.2/mod/mod_usertrack.html#CookieDomain">CookieDomain Directive</a>. For example: </p>
<pre class="brush: plain; title: ; notranslate">
CookieDomain www.fullondesign.co.uk
</pre>
<p>Alternatively in PHP&#8217;s <a href="http://php.net/manual/en/function.setcookie.php">setcookie()</a> function, I could just use something like:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;?php
setcookie(&quot;TestCookie&quot;, 'Some Value', time()+3600, &quot;/&quot;, &quot;www.fullondesign.co.uk&quot;, 1);
?&gt;
</pre>
<p>The key point to note is that the domain parameter is set to www.fullondesign.co.uk, not .fullondesign.co.uk. Thus the cookies will only be sent when the subdomain is www.fullondesign.co.uk. </p>
<p>Now start linking up to files in that directory and your pretty much done.</p>
<h3>Setting up cookieless domains in WordPress</h3>
<p>WordPress has a few neat built in functions to make this process easier. If you use wordpress pop the following code (just before the &#8220;That&#8217;s all, stop editing! Happy blogging.&#8221; comment) into your config.php file (amend as required):</p>
<pre class="brush: plain; title: ; notranslate">
define('COOKIE_DOMAIN', 'www.fullondesign.co.uk');
</pre>
<p>You can also change the uploads URL of your WordPress install to point to your cookieless domain. In the config.php file add the following(amend as required).: </p>
<pre class="brush: plain; title: ; notranslate">
define('WP_CONTENT_URL', 'http://files.fullondesign.co.uk');
</pre>
<h3>Useful Resources </h3>
<p>I&#8217;ve barely touched on the topic of cookieless domains aside from just saying &#8220;They making your website load faster&#8221;, here a two website which go a little more in depth.</p>
<ul>
<li><a href="http://code.google.com/speed/page-speed/docs/request.html">Google: Minimize request overhead</a></li>
<li><a href="http://www.ravelrumba.com/blog/static-cookieless-domain/">Ravelrumba: Serving Static Content from a Cookieless Domain</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/1668-using-cookieless-domains-to-improve-a-website-performance.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PDO (PHP Data Objects) &#8211; Starter Guide</title>
		<link>http://www.fullondesign.co.uk/coding/php/1907-pdo-php-data-objects-starter-guide.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/php/1907-pdo-php-data-objects-starter-guide.htm#comments</comments>
		<pubDate>Fri, 01 Jul 2011 20:14:19 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1907</guid>
		<description><![CDATA[It may surprise you to hear, that using the mysql_connect() function in PHP has recently be marked as &#8220;old hat&#8221; coding because it&#8217;s slow in comparison with newer methods. A better alternative is PDO (PHP Data Objects), a lightweight method for accessing databases. Here is a quick overview to help you get started with PDO. [...]]]></description>
			<content:encoded><![CDATA[<p>It may surprise you to hear, that using the <a href="http://php.net/manual/en/function.mysql-connect.php">mysql_connect()</a> function in PHP has recently be marked as &#8220;old hat&#8221; coding because it&#8217;s slow in comparison with newer methods. A better alternative is <a href="http://php.net/manual/en/book.pdo.php">PDO (PHP Data Objects)</a>, a lightweight method for accessing databases. Here is a quick overview to help you get started with PDO.</p>
<h3>Reasons to use PDO</h3>
<ul>
<li>It&#8217;s Fast - it talks to the database via a database specific PDO-driver.</li>
<li>It&#8217;s Object Oriented &#8211; The methods within the class are the same for each database driver, so you can easily change your database driver without lots of extra coding.</li>
<li>It&#8217;s Flexible-  You can easily change between such database drivers as PostgreSQL, MySQL or SQLite by pretty much just changing your construct statement.</li>
<li>It&#8217;s Safer &#8211; PDO encourages you to bind parameters to your SQL query&#8217;s, meaning that it&#8217;s significantly less likely your website will suffer from a SQL injection based attack.</li>
</ul>
<p><span id="more-1907"></span></p>
<h3>Connecting to a Database</h3>
<p>Connecting to a database is pretty simple. Here is how to connect to a MySQL Database.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;?php
// Define the parameters
$host = 'localhost';
$dbname = 'my_database';
$user = 'mysql_username';
$pass = 'mysql_password';

try {
	// Call the PDO class.
	$db= new PDO('mysql:host='.$host.';dbname='.$dbname, $user, $pass);
} catch(PDOException $e) {
	// If something goes wrong, PDO throws an exception with a nice error message.
	echo $e-&gt;getMessage();
}

?&gt;
</pre>
<h3>Doing A Query</h3>
<p>Again, doing a query is just as simple as:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;?php
$query = $db-&gt;query('SELECT * FROM `users` ORDER BY ID DESC;');
$result = $query-&gt;fetchAll(PDO::FETCH_ASSOC);

// $result will now contain an object of all the rows in the table 'Users'
?&gt;
</pre>
<p>However, if you are using user variables which may cause a SQL Injection you should bind the parameter to the query (see next example).</p>
<h3>Binding a parameter to a query</h3>
<pre class="brush: plain; title: ; notranslate">
&lt;?php
$query = $db-&gt;prepare('SELECT * FROM `users` WHERE `ID` = :ID: AND `email` = :email: ORDER BY ID DESC LIMIT 0,1;');
$query-&gt;execute(array(':ID:' =&gt; '3', ':email:' =&gt; 'me@email.com'));
$result = $query-&gt;fetchAll(PDO::FETCH_ASSOC);
?&gt;
</pre>
<p>If you bind a parameter to a request, it will sterilize the input so that it will not cause a SQL Injection.</p>
<h3>Useful Resources</h3>
<p><a href="http://php.net/manual/en/book.pdo.php">PHP Manual: PHP Data Objects</a></p>
<p><a href="http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/">Nettuts+: Why you Should be using PHP’s PDO for Database Access</a></p>
<p><a href="http://www.amazon.co.uk/gp/product/0596804377/ref=as_li_ss_tl?ie=UTF8&#038;tag=fulondes-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0596804377">PHP: The Good Parts</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=&#038;l=as2&#038;o=2&#038;a=0596804377" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<h3>Update:</h3>
<p><a href="http://news.php.net/php.internals/53799">As of PHP 5.4 the MySQL extension will be softly deprecated</a>. This means you really should start using PDO ASAP!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/php/1907-pdo-php-data-objects-starter-guide.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JavaScripts Selector Methods</title>
		<link>http://www.fullondesign.co.uk/coding/javascript-coding/1986-javascripts-selector-methods.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/javascript-coding/1986-javascripts-selector-methods.htm#comments</comments>
		<pubDate>Fri, 18 Mar 2011 21:57:19 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1986</guid>
		<description><![CDATA[I was recently introduced a group of really funky new HTML5 JavaScript methods, which make me seriously think we can avoid having to include the jQuery library in lots of small websites. These methods are querySelectorAll() and querySelector(). In a nutshell, these methods behave exactly the same as the jQuery selector but comes integrated into the browser, [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently introduced a group of really funky new HTML5 JavaScript methods, which make me seriously think we can avoid having to include the jQuery library in lots of small websites. These methods are querySelectorAll() and querySelector().</p>
<p>In a nutshell, these methods behave exactly the same as the <a href="http://api.jquery.com/category/selectors/">jQuery selector</a> but comes integrated into the browser, meaning you input the CSS selector (e.g. &#8220;#myDiv&#8221; or &#8220;.MyClass&#8221;) and out pops the first element in the tree, or a StaticNodeList of the elements (depending on whether you use the All part) .</p>
<p><span id="more-1986"></span></p>
<h3>querySelector() Example</h3>
<p>The querySelector() method takes the CSS selector input, then returns a single element.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;p id=&quot;myElem1&quot; class=&quot;classExample&quot;&gt;My First paragraph&lt;/p&gt;
&lt;p id=&quot;myElem2&quot; class=&quot;classExample&quot;&gt;My Second paragraph&lt;/p&gt;
&lt;form&gt;
	&lt;fieldset&gt;
		&lt;legend&gt;Input Field&lt;/legend&gt;
		&lt;label&gt;Check Me : &lt;input type=&quot;checkbox&quot; name=&quot;TickMe&quot; value=&quot;ticked&quot; /&gt;&lt;/label&gt;
		&lt;label&gt;Check Me : &lt;input type=&quot;checkbox&quot; name=&quot;TickMe&quot; value=&quot;ticked&quot; /&gt;&lt;/label&gt;
	&lt;/fieldset&gt;
&lt;/form&gt;
&lt;script&gt;
	document.querySelector('#myElem1').style.fontSize = &quot;1.2em&quot;; // Make the first paragraph 1.2em
	document.querySelector('p').style.color = &quot;#0D0&quot;; // This will only affect the first paragraph

	// You can also add event listeners...Again this will only affect the first checkbox.
	document.querySelector('input[type=checkbox]').addEventListener('click', function(e){alert(&quot;You Checked Me&quot;);});
&lt;/script&gt;
</pre>
<p><a href="http://fullondesign.co.uk/examples/JavaScripts_Selector_Methods/querySelector.html">View querySelector() Demo</a></p>
<h3>querySelectorAll() Example</h3>
<p>The querySelectorAll() method will return a StaticNodeList (Like an array) of elements in which you can cycle through.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;p id=&quot;myElem1&quot; class=&quot;classExample&quot;&gt;My First paragraph&lt;/p&gt;
&lt;p id=&quot;myElem2&quot; class=&quot;classExample&quot;&gt;My Second paragraph&lt;/p&gt;
&lt;form&gt;
	&lt;fieldset&gt;
		&lt;legend&gt;Input Field&lt;/legend&gt;
		&lt;label&gt;Check Me : &lt;input type=&quot;checkbox&quot; name=&quot;TickMe&quot; value=&quot;ticked&quot; /&gt;&lt;/label&gt;
		&lt;label&gt;Check Me : &lt;input type=&quot;checkbox&quot; name=&quot;TickMe&quot; value=&quot;ticked&quot; /&gt;&lt;/label&gt;
	&lt;/fieldset&gt;
&lt;/form&gt;
&lt;script&gt;
	var classExample = document.querySelectorAll('.classExample'); // Get all the elements with class &quot;classExample&quot;
	for(i=0; i&lt;classExample.length; i++) {// Cycle through them
		classExample[i].style.fontSize = &quot;1.2em&quot;; // Change the fontSize.
	}

	// Add an click listner to the element #myElem1 and #myElem2
	var idExample = document.querySelectorAll('input[type=checkbox]');
	for(i=0; i&lt;idExample.length; i++) {// Cycle through them
		idExample[i].addEventListener('click', function(e){alert(&quot;You Clicked me!&quot;);}); // Add the alert.
	}
&lt;/script&gt;
</pre>
<p><a href="http://fullondesign.co.uk/examples/JavaScripts_Selector_Methods/querySelectorAll.html">View querySelectorAll() Demo</a></p>
<h3>Current browser support level</h3>
<p>Selectors are currently a W3C Candidate Recommendation, so they work in most browsers updated after January 2010. Thus for the most part you can use the above code examples in your current website and only IE6 level users will have an issue (Though, they are probably use to that). </p>
<p>However, if you have to support older browsers you can make use of the getElementsByClassName() method. For example:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;p id=&quot;myElem1&quot; class=&quot;classExample&quot;&gt;My First paragraph&lt;/p&gt;
&lt;p id=&quot;myElem2&quot; class=&quot;classExample&quot;&gt;My Second paragraph&lt;/p&gt;
&lt;script&gt;
	if(!document.querySelectorAll){ // If the user does not have querySelectorAll()
		var classExample = document.getElementsByClassName('classExample'); // Get all the elements with class &quot;classExample&quot;
	}else{ // Otherwise do it the HTML5 way
		var classExample = document.querySelectorAll('.classExample');
	}

	for(i=0; i&lt;classExample.length; i++) {// Cycle through them
		classExample[i].style.fontSize = &quot;1.2em&quot;; // Change the fontSize.
	}
&lt;/script&gt;
</pre>
<p><a href="http://fullondesign.co.uk/examples/JavaScripts_Selector_Methods/getElementsByClassName.html">View Demo</a></p>
<h3>Further Reading</h3>
<p>I&#8217;ve only lightly covered this topic; here are a few pages which will give you much more information on the new HTML5 method.</p>
<ul>
<li><a href="http://ejohn.org/blog/thoughts-on-queryselectorall/">John Resig: Thoughts on querySelectorAll</a></li>
<li><a href="http://jclaes.blogspot.com/2010/11/html5-new-in-javascript-selector-api.html">Jef Claes: HTML5: New in the javascript Selector API</a></li>
<li><a href="http://www.w3.org/TR/selectors-api/">W3C: Selectors API Level 1</a></li>
<li><a href="http://www.amazon.co.uk/gp/product/0596805527/ref=as_li_ss_tl?ie=UTF8&#038;tag=fulondes-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0596805527">JavaScript: The Definitive Guide (Definitive Guides)</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=&#038;l=as2&#038;o=2&#038;a=0596805527" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/javascript-coding/1986-javascripts-selector-methods.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP&#8217;s Ctype Functions</title>
		<link>http://www.fullondesign.co.uk/coding/php/1953-phps-ctype-functions.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/php/1953-phps-ctype-functions.htm#comments</comments>
		<pubDate>Sat, 05 Mar 2011 13:00:48 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1953</guid>
		<description><![CDATA[A few days ago I was researching methods of validating alphanumeric strings and I was shown PHPs Ctype Functions by Sebastian Roming. In a nutshell they are a group of PHP functions why can be used to check strings to see if they are alphanumeric, numeric etc without using regex (So they are fast!). The [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I was researching methods of validating alphanumeric strings and I was shown PHPs <a href="http://www.php.net/manual/en/ref.ctype.php">Ctype Functions</a> by <a href="http://www.sebastianroming.de/">Sebastian Roming</a>.</p>
<p>In a nutshell they are a group of PHP functions why can be used to check strings to see if they are alphanumeric, numeric etc without using regex (So they are fast!). The key thing to remember is that they return TRUE or FALSE, unlike filter_var which returns FALSE or the string.<br />
Here is the code example:</p>
<pre class="brush: plain; title: ; notranslate">&lt;?php
// Check if input is alphanumeric (letters and numbers)
ctype_alnum('abcdef1234'); // This returns TRUE
ctype_alnum('£%^&amp;ab2'); // This on the otherhand returns FALSE

// check if input is alpha (letters)
ctype_alpha('dssfsdf'); // returns TRUE
ctype_alpha('12345dssfsdf'); // Returns FALSE

// Check if the input is numeric
ctype_digit('1234'); // TRUE
ctype_digit('1as2d34f'); // FALSE
?&gt;
</pre>
<p><span id="more-1953"></span></p>
<p>It also contains functions to check for just numeric strings, uppercase strings and lowercase strings.</p>
<pre class="brush: plain; title: ; notranslate">&lt;?php
// Uppercase
ctype_upper('HELLO'); // TRUE
ctype_upper('hElLo'); // FALSE

// Lowercase
ctype_lower('hello'); // TRUE
ctype_lower('HeLLo'); // FALSE
?&gt;</pre>
<p>Handy right? </p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/php/1953-phps-ctype-functions.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to validate an email address with PHP</title>
		<link>http://www.fullondesign.co.uk/coding/php/1948-how-to-validate-an-email-address-with-php.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/php/1948-how-to-validate-an-email-address-with-php.htm#comments</comments>
		<pubDate>Sat, 05 Mar 2011 12:09:12 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1948</guid>
		<description><![CDATA[Validating an email address is a great way to reduce spam on your website, but there are several methods to do it. You could use a messy regex approach or alternatively you could also use PHP built in functions, it&#8217;s really up to you. Here is the function I use: Free feel to copy/share.]]></description>
			<content:encoded><![CDATA[<p>Validating an email address is a great way to reduce spam on your website, but there are several methods to do it. You could use a messy regex approach or alternatively you could also use PHP built in functions, it&#8217;s really up to you. Here is the function I use:</p>
<pre class="brush: plain; title: ; notranslate">&lt;?php
function validEmail($email){
	// Check the formatting is correct
	if(filter_var($email, FILTER_VALIDATE_EMAIL) === false){
		return FALSE;
	}

	// Next check the domain is real.
	$domain = explode(&quot;@&quot;, $email, 2);
	return checkdnsrr($domain[1]); // returns TRUE/FALSE;
}

// Example
validEmail('real@hotmail.com'); // Returns TRUE
validEmail('fake@fakedomain.com'); // Returns FALSE
?&gt;</pre>
<p>Free feel to copy/share.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/php/1948-how-to-validate-an-email-address-with-php.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the Weather in PHP</title>
		<link>http://www.fullondesign.co.uk/coding/php/1917-getting-the-weather-in-php.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/php/1917-getting-the-weather-in-php.htm#comments</comments>
		<pubDate>Sun, 27 Feb 2011 22:43:32 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1917</guid>
		<description><![CDATA[A few months ago I made a small PHP class which can get the weather based on latitude and longitude. Anyway you can now download it and contribute to it over at Google Code. Here is a code example of how to get the weather: Enjoy!]]></description>
			<content:encoded><![CDATA[<p>A few months ago I made a small PHP class which can get the weather based on latitude and longitude. Anyway you can now <a href="http://code.google.com/p/weather-class/">download it and contribute to it</a> over at Google Code.</p>
<p>Here is a code example of how to get the weather:</p>
<pre class="brush: plain; title: ; notranslate">$w = new Weather('50.799995', '-1.065545'); // Input the Latitude and Longitude
echo $w-&gt;getLocation()-&gt;getWeather()-&gt;sayHuman();
// Ouput~: Portsmouth, England, PO4 8 | Partly Cloudy 4°C, Humidity: 93%, Wind: N at 8 mph</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/php/1917-getting-the-weather-in-php.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started with HTML5 Canvas</title>
		<link>http://www.fullondesign.co.uk/coding/xhtml_and_css/1905-getting-started-with-html5-canvas.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/xhtml_and_css/1905-getting-started-with-html5-canvas.htm#comments</comments>
		<pubDate>Sun, 27 Feb 2011 20:33:47 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[XHTML & CSS]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1905</guid>
		<description><![CDATA[The HTML5 canvas is a really neat new feature which allows you to draw shapes. It&#8217;s a little unknown of how it will be implemented in the mainstream web, however current forecasts suggests it can create really cool games such as Pirates Love Daisies, applications such as Sketchpad or even a new method of CAPTCHA. Here is a quick cookbook [...]]]></description>
			<content:encoded><![CDATA[<p>The HTML5 canvas is a really neat new feature which allows you to draw shapes. It&#8217;s a little unknown of how it will be implemented in the mainstream web, however current forecasts suggests it can create really cool games such as <a href="http://www.pirateslovedaisies.com/">Pirates Love Daisies</a>, applications such as <a href="http://mugtug.com/sketchpad/">Sketchpad</a> or even a new method of CAPTCHA.</p>
<p>Here is a quick cookbook on how to get started with Canvas where you will learn how to draw basic shapes and colours.</p>
<h3>Finding your Feet</h3>
<p>The first thing you need to start playing with the canvas tool is a browser which supports canvas. Currently most modern browsers do support canvas (This includes, IE9, Google Chrome and Firefox).</p>
<p>Next, set up the shell of your HTML5 page. To save you time I <a href="http://www.fullondesign.co.uk/examples/Getting_Started_with_HTML5_Canvas/html5_canvas_start.html">have made a basic example</a><a></a> you can copy.</p>
<p>The important thing to remember about adding the canvas tag to your page is:</p>
<ol>
<li>Your page has the html5 doctype, otherwise it might not work.</li>
<li>You add a width and height, otherwise your graphics may look cropped.</li>
<li>You add a &#8220;Your browser does not support the  HTML5 notice&#8221; notice in the canvas tag for older browsers.</li>
</ol>
<p><span id="more-1905"></span></p>
<h3>Making a Square</h3>
<p><img class="aligncenter size-full wp-image-1929" title="Making a Square" src="http://files.fullondesign.co.uk/uploads/2011/02/Making_a_Square.png" alt="Making a Square" width="108" height="81" /></p>
<p>Making a square is pretty simple; in a nutshell all you need to be able to do is understand how x/y coordinates work. I&#8217;ve <a href="http://www.fullondesign.co.uk/examples/Getting_Started_with_HTML5_Canvas/html_canvas_square.html">uploaded this demo</a>.</p>
<pre class="brush: plain; title: ; notranslate">// More canvas stuff  will go here.
context.moveTo(5, 10); // Move the start point to x = 5, y = 10
context.beginPath(); // Open the path i.e. Start drawing
context.lineTo(55, 10); // Draw the line to x = 55, y = 10 then continue
context.lineTo(55, 60);
context.lineTo(5, 60);
context.lineTo(5, 10);
context.closePath(); // Close the path, so that javascript knows the shape is done.

// Fill the shape.
context.fillStyle=&quot;#8ED6FF&quot;;
context.fill();

// Colour in the border of the shape.
context.strokeStyle=&quot;#0000ff&quot;;
context.stroke();</pre>
<h3>Building a Circle</h3>
<p><img class="aligncenter size-full wp-image-1928" title="Building a Circle" src="http://files.fullondesign.co.uk/uploads/2011/02/Building_a_Circle.png" alt="Building a Circle" width="194" height="153" /></p>
<p>Creating a circle is a little different, instead of just putting the x/y coordinates you also have to state the starting radius, ending radius and whether if you your arc to be anti-clockwise (Weird right?). Here <a href="http://www.fullondesign.co.uk/examples/Getting_Started_with_HTML5_Canvas/html_canvas_circle.html">is the code example</a>.</p>
<pre class="brush: plain; title: ; notranslate">context.arc(100,75,50,0,Math.PI*2,true); // arc(x coordinate, y coordinate, radius, startAngle, endAngle, anticlockwise)</pre>
<h3>Rotating your Canvas</h3>
<p><img class="aligncenter size-full wp-image-1930" title="Rotating your Canvas" src="http://files.fullondesign.co.uk/uploads/2011/02/Rotating_your_Canvas.png" alt="Rotating your Canvas" width="163" height="125" /></p>
<p>This is probably one of the most useful features for most web designers out there. Pretty much you can rotate the canvas. <a href="http://www.fullondesign.co.uk/examples/Getting_Started_with_HTML5_Canvas/html_canvas_rotating.html">Check out my example</a>.</p>
<pre class="brush: plain; title: ; notranslate">// Rotate the canvas 15%
context.rotate(0.15);</pre>
<h3>Further Reading</h3>
<ul>
<li><a href="https://developer.mozilla.org/En/Canvas_tutorial">MDN Canvas Tutorial</a></li>
<li><a href="http://thinkvitamin.com/code/how-to-draw-with-html-5-canvas/">How to Draw with HTML 5 Canvas by Think Vitamin</a></li>
<li><a href="http://simon.html5.org/dump/html5-canvas-cheat-sheet.html">HTML5 Canvas Cheat Sheet</a></li>
<li><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html">The canvas element &#8211; HTML Standard</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/xhtml_and_css/1905-getting-started-with-html5-canvas.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic
Database Caching 1/39 queries in 0.020 seconds using disk: basic
Object Caching 561/649 objects using disk: basic

Served from: www.fullondesign.co.uk @ 2012-02-04 08:47:41 -->
