<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>Matthew Rochow</title>
	
	<link>http://www.matthewrochow.com</link>
	<description>Australian HTML &amp; CSS Ninja, Fiance and Perfectionist</description>
	<lastBuildDate>Thu, 26 Feb 2009 01:58:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/rochow" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="rochow" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">rochow</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Matts AJAX Todo List!</title>
		<link>http://www.matthewrochow.com/tools-resources/ajax-todo-list/</link>
		<comments>http://www.matthewrochow.com/tools-resources/ajax-todo-list/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 01:52:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tools & Resources]]></category>

		<guid isPermaLink="false">http://www.matthewrochow.com/?p=155</guid>
		<description><![CDATA[One of the keys to succeeding in business is to be organised &#8211; and what better way to stay organised than with a todo list! This snazzy todo list is:
- AJAX so that it instantly updates
- Lightweight (sorry for the letdown Jquery fanboys)
- Very easy to setup and use (comes with an automated installer (my [...]]]></description>
			<content:encoded><![CDATA[<p>One of the keys to succeeding in business is to be organised &#8211; and what better way to stay organised than with a todo list! This snazzy todo list is:<br />
- AJAX so that it instantly updates<br />
- Lightweight (sorry for the letdown Jquery fanboys)<br />
- Very easy to setup and use (comes with an automated installer (my first one, so perhaps a little dodgy!))</p>
<p>Download <a href="http://www.matthewrochow.com/downloads/todo-v1.0.zip">AJAX Todo List</a> Version 1.0 (6kb)</p>
<p>Comments, suggestions and general feedback are welcomed <img src='http://www.matthewrochow.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' title="icon smile Matts AJAX Todo List!" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthewrochow.com/tools-resources/ajax-todo-list/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP Mobile Detection</title>
		<link>http://www.matthewrochow.com/php/php-mobile-detection/</link>
		<comments>http://www.matthewrochow.com/php/php-mobile-detection/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 10:09:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php mobile detection browser sniffer sniffing]]></category>

		<guid isPermaLink="false">http://www.matthewrochow.com/?p=53</guid>
		<description><![CDATA[Recently, I had a client request 2 versions of his website: one normal, and one for mobiles. Given that it was a &#8220;social&#8221; site that teenagers would probably access on their phone, it made sense. He wanted the content to be the same, just styled differently. While adding style=&#8221;handheld.css&#8221; came to mind, some phones help [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I had a client request 2 versions of his website: one normal, and one for mobiles. Given that it was a &#8220;social&#8221; site that teenagers would probably access on their phone, it made sense. He wanted the content to be the same, just styled differently. While adding style=&#8221;handheld.css&#8221; came to mind, some phones help themselves to the screen media type (does anyone know what standards mean anymore?) so the owner requested a combination of both browser sniffing (which by the way isn&#8217;t the best way of doing things, don&#8217;t get me wrong) and media types.</p>
<p>Here&#8217;s how I did it.</p>
<p><span id="more-53"></span></p>
<h2>The Core PHP</h2>
<p>I googled and found this PHP code courtesy of <a href="http://www.andymoore.info/php-to-detect-mobile-phones/">Andy</a>.</p>
<pre><code>
&lt;?php

$mobile_browser = '0';

if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i',
    strtolower($_SERVER['HTTP_USER_AGENT']))){
    $mobile_browser++;
    }

if((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')&gt;0) or
    ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))){
    $mobile_browser++;
    }

$mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4));
$mobile_agents = array(
    'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
    'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
    'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
    'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
    'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
    'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
    'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
    'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
    'wapr','webc','winw','winw','xda','xda-');

if(in_array($mobile_ua,$mobile_agents)){
    $mobile_browser++;
    }
if (strpos(strtolower($_SERVER['ALL_HTTP']),'operamini')&gt;0) {
    $mobile_browser++;
    }
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows')&gt;0) {
    $mobile_browser=0;
    }

if($mobile_browser&gt;0){
   // Do something if it's a mobile browser

   } else {
   // Do something if it's not a mobile browser

}

?&gt;
</code></pre>
<p>Basically, $mobile_browser is set to 0. If any mobile user agent is detected +1 is added. At the end, there is a simple if else statement &#8211; if $mobile_browser still equals 0 then it&#8217;s a not a mobile browser, else if a user agent has been detected it is a mobile browser.</p>
<h2>The Changes</h2>
<p>I saved this in mobile-detect.php and included it in every page. Mobile browsers got fed mobile-style.css while normal browsers got the default stylesheet. For extra protection, even if no mobile user agent was detected, a handheld media type was still added &#8211; so any mobiles slipping through the net *hopefully* still use the right stylesheet <img src='http://www.matthewrochow.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' title="icon biggrin PHP Mobile Detection" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthewrochow.com/php/php-mobile-detection/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Horizontal vs Vertical CSS</title>
		<link>http://www.matthewrochow.com/css/horizontal-vs-vertical-css/</link>
		<comments>http://www.matthewrochow.com/css/horizontal-vs-vertical-css/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 09:35:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[formatter]]></category>
		<category><![CDATA[horizontal]]></category>
		<category><![CDATA[styling]]></category>
		<category><![CDATA[vertical]]></category>

		<guid isPermaLink="false">http://www.matthewrochow.com/?p=48</guid>
		<description><![CDATA[There are two main ways of formatting a stylesheet: vertically and horizontally. One can argue that vertically is easier to read, because it is spaced nicely down the page. Conversely, horizontally is just as easy (I format horizontally, and yes it is easy to read – for all those who say it’s hard to read [...]]]></description>
			<content:encoded><![CDATA[<p>There are two main ways of formatting a stylesheet: vertically and horizontally. One can argue that vertically is easier to read, because it is spaced nicely down the page. Conversely, horizontally is just as easy (I format horizontally, and yes it is easy to read – for all those who say it’s hard to read across the page – in what direction are you reading right now? Exactly <img src='http://www.matthewrochow.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' title="icon wink Horizontal vs Vertical CSS" /> )</p>
<p>Does it really matter though, or is it simply personal preference? The answer depends on the amount of content in the stylesheet. However, there are 3 formatting issues that matter more than whether it’s horizontal and vertical.</p>
<p><span id="more-48"></span></p>
<h2>1) Sectioning</h2>
<p>It is crucial to divide your stylesheet up: header, sidebar, content, footer etc. This makes it easy for others to make changes to your stylesheet, and on big projects with thousand of lines of styles with multiple people working on it, clear sectioning is elementary.</p>
<p>I use good old:<br />
/* Header */</p>
<p>Simple, neat, does the trick. When working on big projects, the headings need to stand out a bit more then my everyday style, so I use this:</p>
<p>/* &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Header<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- */</p>
<p>Again: nice, simple, does the job. There is no need for excessive size, 10 lines of fancy characters or  ChAnGeDcAsE.</p>
<h2>2) Alphabetizing</h2>
<p>Imagine: You have to change the links in the header from white to black &#8211; which line is easier to edit:</p>
<p><code>#header a {background:#666;color:#FFF;display:block;padding:5px 10px}</code></p>
<p><code>#header a {display:block;background:#666;padding:5px 10px;color:#FFF}</code></p>
<p>Of course, the first one is easier – especially when there are lots of declarations. There are two ways to alphabetize:</p>
<ol>
<li>As you go – This involves simply writing the styles in order as you type them.</li>
<li>After completion – After the whole project is finished, simply run it through a CSS formatter which will not only alphabetize but make it look pretty!</li>
</ol>
<h2>3) Consistency</h2>
<p>Honestly, I would not think this needs to be said: Use the same formatting throughout!</p>
<p>There are stylesheets that look like this &#8211; I kid you not:</p>
<pre><code>#header {
	background:    #000 ;
     font-family: Arial;
color:#FFF;
	margin: 10px 0    0 0px;
}
#header h1 {  padding:  3px;font-size:1em; display:  inline  ;}</code></pre>
<p>Insane! A CSS formatter comes in handy here; just pop the CSS in and it not only spaces it all the same, it makes it easier to read and look damn nice (presentation, presentation, presentation!)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthewrochow.com/css/horizontal-vs-vertical-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Ultimate Guide to Image Optimisation</title>
		<link>http://www.matthewrochow.com/optimisation/image-optimisation/</link>
		<comments>http://www.matthewrochow.com/optimisation/image-optimisation/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 09:26:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Optimisation]]></category>
		<category><![CDATA[gif]]></category>
		<category><![CDATA[image optimisation]]></category>
		<category><![CDATA[jpg]]></category>
		<category><![CDATA[png]]></category>

		<guid isPermaLink="false">http://www.matthewrochow.com/?p=44</guid>
		<description><![CDATA[Naturally, the faster your page loads the better. Not getting into CSS sprites or any of the more complex techniques, I will show you the way to optimize your images so your site loads that quick it makes dialup users look like they are on cable!  

The 3 Main Formats
Before diving into it, first [...]]]></description>
			<content:encoded><![CDATA[<p>Naturally, the faster your page loads the better. Not getting into CSS sprites or any of the more complex techniques, I will show you the way to optimize your images so your site loads that quick it makes dialup users look like they are on cable! <img src='http://www.matthewrochow.com/wp-includes/images/smilies/icon_lol.gif' alt=':lol:' class='wp-smiley' title="icon lol The Ultimate Guide to Image Optimisation" /> </p>
<p><span id="more-44"></span></p>
<h2>The 3 Main Formats</h2>
<p>Before diving into it, first we&#8217;ll go through the main 3 image formats.</p>
<h3>GIF (Graphics Interchange Format)</h3>
<p>The most common graphics format, it supports a palette of up to 256 distinct colors. It also supports animations and allows a separate palette of 256 colors for each frame. The color limitation makes the GIF format unsuitable for photographs, but it is well-suited for more simple images such as graphics or logos with solid areas of color.</p>
<p>More detailed information on <a href="http://en.wikipedia.org/wiki/GIF">Wikipedia</a></p>
<h3>JPEG (Joint Photographic Experts Group &#8211; name of the committee that created the standard)</h3>
<p>JPEG is the most commonly used method of compression for photographic images. The degree of compression can be adjusted, allowing a balance between size and quality. JPEG is not recommended for any images other than photographs.</p>
<p>More detailed information on <a href="http://en.wikipedia.org/wiki/JPEG">Wikipedia</a></p>
<h3>PNG (Portable Network Graphics)</h3>
<p>PNG was created to improve upon and replace GIF&#8217;s. PNG&#8217;s come in a variety of flavours: 8bit (the same as GIF) up to 48bit. It also supports <a href="http://en.wikipedia.org/wiki/Alpha_channel">alpha transparency</a>. One feature of the PNG format is gamma correction. Gamma correction is the ability to correct for color differences between computer systems, allowing consistent color display across platforms. Embedded in every PNG file is a piece of metadata that specifies the gamma setting of the computer on which the image was created. The idea is that when the PNG is displayed on another computer, this gamma value can be extracted and used to compensate for color differences between the two systems, thereby displaying the PNG as the author intended. The problem is that this causes havoc as for instance there will be a #09C background colour, and a png with a solid #09C background. The browser will then &#8220;correct&#8221; the gamma, which changes it from #09C into whatever it &#8220;should&#8221; be &#8211; meaning the background and the image then become different colours even though they are the same! This is one of the reasons PNG never took off. Nowadays it&#8217;s not a problem as most browser ignore the gamma completely, and programs exist to remove the gamma metadata.</p>
<p>More detailed information on <a href="http://en.wikipedia.org/wiki/PNG">Wikipedia</a></p>
<h2>Which is best?</h2>
<p><strong>Rule of thumb:</strong> Photos make jpeg, the rest make png.</p>
<p>8-bit PNG is smaller than GIF for anything over ~100 bytes. The best way to compare the file size when saving the image is to select GIF format and see the file size, then select PNG format and see what its size is.</p>
<p>But, PNG has a gamma problem as you mentioned before! <strong>Thankfully</strong>, there is a solution to the PNG Gamma Problem. <a href="http://www.ardfry.com/pngoutwin/">PNGout</a> not only removes the gamma section fixing the problem, it also compresses the images another 10-30% with no loss of quality! There are a selection of similar programs around, many of which are command line and aren&#8217;t as simple.</p>
<h2>5 steps to optimising images</h2>
<p>Even though some people will be screaming &#8220;obvious!&#8221;, I will go through the steps to optimise your images in Photoshop for those who don&#8217;t know how to optimally save images (You can adapt these for other imaging software).</p>
<ol>
<li>With your selected image, go to &#8220;save for web and devices&#8221;</li>
<li>Select your image format</li>
<li>If GIF or PNG, pick the lowest amount of colours without visible loss of clarity. If JPEG, find a good quality/size balance (My personal preference is the 60-65 mark)</li>
<li>Repeat this process for all the images</li>
<li>Fire up PNGout. Simply drag+drop the all PNG images from Windows Explorer onto PNGout and it will work its magic. Alternatively, you can use the PNGout menu to open the folder containing the images.</li>
</ol>
<p>All done!</p>
<p>The program has a free 30 day trial, so you can give it a go before deciding whether or not to purchase it (it&#8217;s $15 or something cheap like that)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthewrochow.com/optimisation/image-optimisation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hasLayout</title>
		<link>http://www.matthewrochow.com/ie6/haslayout/</link>
		<comments>http://www.matthewrochow.com/ie6/haslayout/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 08:07:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[IE6]]></category>

		<guid isPermaLink="false">http://www.matthewrochow.com/?p=41</guid>
		<description><![CDATA[Something every CSS developer should know about is a &#8220;feature&#8221; in a certain browser called hasLayout that often gives developers grief &#8211; need I say the name of the browser?   Every developer will have come across it in their time, whether they know it or not. Heard of the height:1%; or zoom:1; hack? [...]]]></description>
			<content:encoded><![CDATA[<p>Something every CSS developer should know about is a &#8220;feature&#8221; in a certain browser called hasLayout that often gives developers grief &#8211; need I say the name of the browser? <img src='http://www.matthewrochow.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' title="icon wink hasLayout" />  Every developer will have come across it in their time, whether they know it or not. Heard of the height:1%; or zoom:1; hack? That&#8217;s what these are all about &#8211; triggering hasLayout.</p>
<p>The best way to beat your enemy is to understand how they work. A very detailed explanation can be found here: <a href="http://msdn.microsoft.com/en-us/library/bb250481(VS.85).aspx">http://msdn.microsoft.com/en-us/library/bb250481(VS.85).aspx</a> and a great site to bookmark for reference when the time comes is <a href="http://www.satzansatz.de/cssd/onhavinglayout.html">here</a>. That&#8217;s the end of this post folks &#8211; those articles are so comprehensive I&#8217;m not going to reinvent the wheel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthewrochow.com/ie6/haslayout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clearing &lt;div&gt;s,  &lt;br /&gt;s and  &lt;hr /&gt;s</title>
		<link>http://www.matthewrochow.com/tips-tricks/clearing-divs-brs-and-hrs/</link>
		<comments>http://www.matthewrochow.com/tips-tricks/clearing-divs-brs-and-hrs/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 07:03:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[clear]]></category>
		<category><![CDATA[clearing]]></category>

		<guid isPermaLink="false">http://www.matthewrochow.com/?p=34</guid>
		<description><![CDATA[A common practice nowadays is to clear using a div, br or hr. I am going to Jackie Chan the next person who uses one, serious. Not only does it violate the fundamental rule (HTML is for content, CSS is for presentation) but it is both ugly and unnecessary. I am going to show you [...]]]></description>
			<content:encoded><![CDATA[<p>A common practice nowadays is to clear using a div, br or hr. I am going to Jackie Chan the next person who uses one, serious. Not only does it violate the fundamental rule (HTML is for content, CSS is for presentation) but it is both ugly and <strong><em>unnecessary</em></strong>. I am going to show you how using just CSS, you can produce the same effect, without all the mess!</p>
<span id="more-34"></span>
<h2>The Theory</h2>
<p>Let&#8217;s say you have a logo and a menu contained in a div named header. The logo is floated left, and the menu is floated right, and the div has a background image. Due to the <a href="http://www.complexspiral.com/publications/containing-floats/">way browsers deal with floated objects</a> (great explanation, however poor solution) containers don&#8217;t &#8220;wrap&#8221; the floated elements inside it by default. So what you&#8217;ll notice is that in this example, the background image on the header will disappear!</p>

<h2>The Bad Solutions</h2>
<h3>Add a &lt;div style=&#8221;clear:both&#8221;&gt;, &lt;br clear&#8221;all&#8221; /&gt; or &lt;hr /&gt;</h3>
<p>A common solution to this has been to add a &#8220;clear:both&#8221; whether on a div, br, hr or some other wacky tag which is inserted at the bottom of the header div after all the content. This makes the container wrap it&#8217;s floated elements. The problem is an emtpy tag has to be brought into the HTML to deal with a styling issue, which is meant to be taken care of in the CSS.</p>

<h3>Add a clearfix class</h3>
<p>Let&#8217;s avoid adding a non-semantic empty tag by adding a non-semantic class, yay! I&#8217;d rate this the worst of the lot as it&#8217;s trying to be clever by avoiding non-semantic markup yet it adds non-semantic classes (which is just as bad).</p>

<pre><code>.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}</code></pre>

<p>Not only that, it doesn&#8217;t work in IE6 as it doesn&#8217;t support :after, so you have to use a * html hack or a conditional comment to feed it additional rubbish.</p>

<h2>The Good Solution</h2>
<p>You have an element you want to clear. Firstly, add “overflow:hidden” to the container in the CSS. This generally makes Firefox, Opera and Safari perfect. For IE 6, add a width:100% (or px width if you don&#8217;t want 100%) which trips hasLayout, and that does the trick in most cases. Alternatively, you can also float the container (though it&#8217;s not my preferred method, why float something if you don&#8217;t need to)</p>

<pre><code>#container {float:left;overflow:hidden;width:100%}</code></pre>]]></content:encoded>
			<wfw:commentRss>http://www.matthewrochow.com/tips-tricks/clearing-divs-brs-and-hrs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
