<?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/"
	>

<channel>
	<title>SitePoint &#187; Tech</title>
	<atom:link href="http://www.sitepoint.com/blogs/category/tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs</link>
	<description>News, opinion, and fresh thinking for web developers and designers. The official podcast of sitepoint.com.</description>
	<pubDate>Sun, 05 Jul 2009 11:48:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ready for PHP &amp; MySQL Week at SitePoint?</title>
		<link>http://www.sitepoint.com/blogs/2009/07/03/ready-for-php-mysql-week-at-sitepoint/</link>
		<comments>http://www.sitepoint.com/blogs/2009/07/03/ready-for-php-mysql-week-at-sitepoint/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 04:35:02 +0000</pubDate>
		<dc:creator>Andrew Tetlaw</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=11891</guid>
		<description><![CDATA[To celebrate the release of the new edition of well-loved SitePoint book "Build Your Own Database Driven Web Site Using PHP &#038; MySQL, 4th Edition" — by Kevin Yank, we're publishing a chapter a day next week, beginning Tuesday the 7th of July. Check out what you'll be reading.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sitepoint.com/books/phpmysql4/"><img class="imgright alignright" title="Build Your Own Database Driven Web Site Using PHP &amp; MySQL, 4th Edition" src="http://www.sitepoint.com/images/books/phpmysql4/blocks.jpg" alt="" /></a>To celebrate the release of the new edition of well-loved SitePoint book <em><a href="http://www.sitepoint.com/books/phpmysql4/">Build Your Own Database Driven Web Site Using PHP &amp; MySQL, 4th Edition</a></em> — by Kevin Yank, we&#8217;re publishing a chapter a day next week, beginning Tuesday the 7th of July.</p>
<p>Today, we&#8217;ve published the beginning of the series: <a href="http://www.sitepoint.com/article/php-mysql-tutorial/">the Introduction</a> and directly from the book, <a href="http://www.sitepoint.com/article/php-amp-mysql-1-installation/">Chapter 1: Installation</a>. Over the weekend you can read chapter 1 and make sure your newly installed software is working properly, in readiness for next week&#8217;s chapters. At the end of the week you&#8217;ll have <strong>4 complete chapters from the book and one bonus article</strong>, comprising another book excerpt.</p>
<p>Here&#8217;s what you&#8217;ll be receiving:</p>
<p><strong>Chapter 2: Introducing MySQL</strong></p>
<div id="adz" class="vertical"></div><p>An introduction to databases in general, and the MySQL relational database management system in particular. If you&#8217;ve never worked with a relational database before, you&#8217;ll find this enlightening, whetting your appetite for what’s to come! In the process, you’ll build up a simple database to be used in later chapters.</p>
<p><strong>Chapter 3: Introducing PHP</strong></p>
<p>Here’s where the fun really starts. In this chapter, Kevin will introduce you to the PHP scripting language, which you can use to build dynamic web pages that present up-to-the-moment information to your visitors.</p>
<p><strong>Chapter 4: Publishing MySQL Data on the Web</strong></p>
<p>In this chapter you’ll bring together PHP and MySQL to create some of your first database driven web pages. You’ll explore the basic techniques of using PHP to retrieve information from a database and display it on the Web in real time. Kevin will also show you how to use PHP to create web-based forms for adding new entries to, and modifying existing information in, a MySQL database on the fly.</p>
<p><strong>Bonus: How to Handle File Uploads with PHP</strong><br />
In this bonus excerpt from Chapter 12, you&#8217;ll learn how to accept file uploads from your web site visitors securely and store them.</p>
<p><em><a href="http://www.sitepoint.com/books/phpmysql4/">Build Your Own Database Driven Web Site Using PHP &amp; MySQL, 4th Edition</a></em> is one of the most popular PHP books for beginners, and SitePoint&#8217;s first ever book. This shiny new 4th edition has been completely updated using only best-practice PHP. It&#8217;s essential reading for all budding PHP &amp; MySQL developers. For more information, see the <a href="http://www.sitepoint.com/books/phpmysql4/">book page</a>.</p>
<p>If you prefer to read the Adobe Acrobat PDF version of these first four chapters, you can <a href="http://www.sitepoint.com/books/phpmysql4/samplechapters.php">download the first four chapters FREE</a>.</p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=136&amp;did=adz&amp;adtype=vertical" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2009/07/03/ready-for-php-mysql-week-at-sitepoint/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to Pick the Perfect Programming Editor</title>
		<link>http://www.sitepoint.com/blogs/2009/07/03/pick-perfect-program-editor/</link>
		<comments>http://www.sitepoint.com/blogs/2009/07/03/pick-perfect-program-editor/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 14:46:35 +0000</pubDate>
		<dc:creator>Craig Buckler</dc:creator>
		
		<category><![CDATA[Web Tech]]></category>
<category>code</category><category>develop</category><category>developer</category><category>editor</category><category>ide</category>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=11857</guid>
		<description><![CDATA[Craig provides a list of essential features every web developer needs in their favorite code editor. He also suggests a number of features we could live without.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/07/101-editor.png" alt="code editor" title="code editor" width="260" height="260" class="imgright" />To the outside world, developers can have an unhealthy fixation with their code editor. It&#8217;s not surprising &#8212; most of us spend longer with our IDE than our families. Sean&#8217;s recently-posted <a href="http://www.sitepoint.com/blogs/2009/06/22/18-free-text-editors/">list of free editors</a> provoked a plethora of debate about what is and what&#8217;s not the best coding tool.</p>
<p>There are dozens of code editors to choose from and many are freeware or open source. Ultimately, the choice is yours, whether it&#8217;s Windows Notepad, VIM or VisualStudio. However, there are a number of key IDE features that I&#8217;d recommend to all web developers.</p>
<h2>Essential Features</h2>
<p>An editor won&#8217;t remain on my PC if it doesn&#8217;t provide the following:</p>
<div id="adz" class="vertical"></div><p><strong>Speed and stability</strong><br />
The editor must start quickly and remain responsive. Sorry Eclipse and Aptana.</p>
<p><strong>Multiple files / MDI interface</strong><br />
The days of opening a single source file are long gone. Tabs are my preferred choice of interface and they absolutely must support middle-click closing!</p>
<p><strong>Multiple language support</strong><br />
Even the most basic web projects require HTML and CSS. A simple application is likely to add JavaScript, SQL, XML, and a server-side development language such as PHP, C#, VB, Java, Perl, Ruby or Python. Your editor should be able to effortlessly handle every type of code you choose.</p>
<p><strong>Line wrapping and numbering</strong><br />
It may be bad practice, but long lines of code are sometimes necessary. The editor should let you view code without horizontal scrolling, so a line wrapping option is essential. When the inevitable error occurs at line 4321, you need to be able to find that bug quickly &#8212; so forget any editor that does not display line numbers.</p>
<p><strong>Configurable color-coding</strong><br />
Missing quotes or tags can cause havoc, but color-coding can dramatically reduce your error rate. Bonus points are awarded for any editor offering fully-customizable color schemes.</p>
<p><strong>Auto-complete</strong><br />
Microsoft VisualStudio sets the gold standard with IntelliSense. Few editors reach that level, but if I&#8217;m adding a <code>&lt;p&gt;</code> tag, you can guarantee I want a closing <code>&lt;/p&gt;</code>. Please don&#8217;t make me type it!</p>
<p><strong>Session store and restore</strong><br />
When the editor is restarted, it should restore the files you were working on, open them in the correct order and preferably at the last line you were editing.</p>
<p><strong>File explorer</strong><br />
The option to open other files in the current project can save time.</p>
<p><strong>Find and replace across files</strong><br />
How many times have you renamed a class or function? The editor should provide facilities to change all references quickly and easily.</p>
<h2>Desirable Features</h2>
<p>The following options are great if they&#8217;re available:</p>
<p><strong>Debugging tools</strong><br />
Debugging facilities range from absolutely essential (.NET or Java), to useful (PHP or Perl), to unnecessary (JavaScript &#8212; unless it&#8217;s better than Firebug!) Make sure your editor provides the debugging tools you need.</p>
<p><strong>Bookmarking</strong><br />
Jumping between functions in the same file is easier if you can bookmark individual lines.</p>
<p><strong>Multiple views</strong><br />
Similarly, it can be useful to &#8217;split&#8217; a file into multiple windows so different segments can be edited at the same time.</p>
<p><strong>Code-folding</strong><br />
The facility to collapse or expand segments allows you to concentrate on the important code.</p>
<p><strong>Code explorer</strong><br />
Again, VisualStudio sets the standard with class inspection windows showing details of all properties and methods. However, a simple list of method/function names in alphabetical or source order can be just as useful. Bonus points for any editor which handles the multiple types of function declaration in JavaScript!</p>
<p><strong>Good font support</strong><br />
In general, I prefer to code using a proportional font. I may be in the minority, but please don&#8217;t force me to use monospace! SciTE offers the best solution; you can switch between monospaced and proportional fonts using Ctrl+F11.</p>
<p><strong>Shortcuts, plugins, and macros</strong><br />
If you use particular keyboard combinations or functionality, configurable shortcuts, macros and plugins can help you migrate to another editor.</p>
<h2>And the Bad Features&#8230;</h2>
<p>Sometimes, editors offer dubious functionality that you really do not need.</p>
<p><strong>WYSIWYG design view</strong><br />
Whilst WYSIWYG can be useful for novice developers, you will soon discover that hand-coding HTML and CSS is quicker than any design package. It can also be essential if your application requires DOM manipulation. If a WYSIWYG view is provided, make sure it doesn&#8217;t refactor your carefully-crafted code when you accidentally hit the &#8216;design&#8217; button.</p>
<p><strong>Obtrusive project management</strong><br />
Sometimes, you just need to open a file and make a minor change &#8212; please don&#8217;t force us to create a new project!</p>
<p><strong>Dumb HTML-generation tools</strong><br />
I do not need a toolbar icon that uses valuable screen estate and inserts a <code>&lt;p&gt;</code> tag. And I certainly don&#8217;t need icons that insist on adding deprecated <code>&lt;b&gt;</code> tags!</p>
<p>What are the essential features you look for in a code editor? Are there any &#8220;features&#8221; that particularly annoy you?</p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=136&amp;did=adz&amp;adtype=vertical" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2009/07/03/pick-perfect-program-editor/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Learn PHP The Easy Way</title>
		<link>http://www.sitepoint.com/blogs/2009/07/02/learn-php-the-easy-way/</link>
		<comments>http://www.sitepoint.com/blogs/2009/07/02/learn-php-the-easy-way/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 10:48:44 +0000</pubDate>
		<dc:creator>ShayneTilley</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=11823</guid>
		<description><![CDATA[With over 40,000 copies sold of the three previous editions, I’m very pleased to announce the latest title hot off the SitePoint production line, <em>Build Your Own Database Driven Web Site Using PHP &#038; MySQL, 4th Edition</em>, by Kevin Yank.]]></description>
			<content:encoded><![CDATA[<p><img class="imgright" src="http://www.sitepoint.com/images/books/phpmysql4/cover.jpg" alt="PHPMYSQL4 Cover" /><br />
With over 40,000 copies sold of the three previous editions, I’m very pleased to announce the latest title hot off the SitePoint production line:</p>
<p><strong><a href="http://www.sitepoint.com/books/phpmysql4/">Build Your Own Database Driven Web Site Using PHP &#038; MySQL (4th Edition)</a></strong> &#8212; by Kevin Yank</p>
<p>One of the most popular PHP books for beginners, this shiny new 4th edition has been completely updated using only best-practice PHP.  </p>
<p>In this book you’ll learn how to:</p>
<div id="adz" class="vertical"></div><ul>
<li>install PHP 5 and MySQL 5 on Windows, Linux, or Mac OS X</li>
<li>gain a thorough understanding of PHP syntax</li>
<li>master database design principles and SQL</li>
<li>build a working content management system</li>
<li>add, edit, and delete web content without using HTML</li>
<li>create an ecommerce shopping cart</li>
<li>utilize sessions and cookies to track site visitors</li>
<li>craft SEO-friendly and memorable URLs</li>
</ul>
<p>And a whole lot more &#8230; </p>
<p>At around 480 pages, this book is an easy read. As you move through the book you’ll quickly notice that it’s written in a clear tutorial format that’s easy to understand, and illustrated with plenty of screenshots and diagrams, providing quick visual cues. If you hate wading through dry, academic-style “how to” texts, this book will be a breath of fresh air to you.</p>
<p>If you’ve never built a database driven web site and you’re looking to go beyond the limitations of a static site, this book will start you off in no time. </p>
<p>And if you have built database driven web sites before, the extensive PHP/MySQL reference guides included will ensure this book remains an extremely handy desk reference.</p>
<p>Check out the <a href="http://www.sitepoint.com/books/phpmysql4/samplechapters.php">free sample chapters</a> or <a href="https://sitepoint.com/bookstore/go/157">order a copy today</a>.</p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=136&amp;did=adz&amp;adtype=vertical" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2009/07/02/learn-php-the-easy-way/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Get a Free iPhone: Help SitePoint Recruit a PHP Developer</title>
		<link>http://www.sitepoint.com/blogs/2009/07/02/get-a-free-iphone-help-sitepoint-recruit-a-php-developer/</link>
		<comments>http://www.sitepoint.com/blogs/2009/07/02/get-a-free-iphone-help-sitepoint-recruit-a-php-developer/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 03:23:09 +0000</pubDate>
		<dc:creator>Kevin Yank</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=11845</guid>
		<description><![CDATA[SitePoint is looking for two experienced PHP developers (one with a sysadmin twist) to join the team here at SitePoint HQ in Melbourne, Australia. Help us find the right person for either of these positions, and we’ll buy you a shiny, new iPhone 3GS!]]></description>
			<content:encoded><![CDATA[<p><img src="http://i2.sitepoint.com/images/sitepointlogo150.png" alt="" class="imgright" /></p>
<p><strong>SitePoint is looking for two experienced PHP developers (one with a sysadmin twist) to join the team here at SitePoint HQ in Melbourne, Australia. Help us find the right person for either of these positions, and we’ll buy you a shiny, new iPhone 3GS!</strong></p>
<p>Know someone with “mad PHP skillz” who either lives in Melbourne or would move here for the opportunity to work on one of the Web’s major destination sites for web developers and designers? Drop me an email with the details at <strong>kevin(at)sitepoint.com</strong>.</p>
<p>Of course, if you would just like to apply for the position yourself, the complete position descriptions are in our <a href="http://www.sitepoint.com/about/jobs/">jobs section</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2009/07/02/get-a-free-iphone-help-sitepoint-recruit-a-php-developer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Announcing Updates to our Popular Add-ons for Firefox 3.5</title>
		<link>http://www.sitepoint.com/blogs/2009/07/02/announcing-updates-to-our-popular-add-ons-for-firefox-35/</link>
		<comments>http://www.sitepoint.com/blogs/2009/07/02/announcing-updates-to-our-popular-add-ons-for-firefox-35/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 01:26:12 +0000</pubDate>
		<dc:creator>brothercake</dc:creator>
		
		<category><![CDATA[JavaScript & CSS]]></category>

		<category><![CDATA[Web Tech]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=11824</guid>
		<description><![CDATA[If you've recently installed Firefox 3.5 you're probably itching to get hold of updates to our popular developer add-ons, Dust-Me Selectors, and CodeBurner for Firebug. And here they are &#8212; hot off the press!]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/07/firefox-refreshed.jpg" alt="The Refreshed Firefox Logo" width="200" height="200" class="size-full wp-image-11937 imgright" />
<p>
With the recent release of Firefox 3.5, we&#8217;re very pleased to announce the release of updates to our useful developer tools: <a href="http://www.sitepoint.com/dustmeselectors/">Dust-Me Selectors</a>, and <a href="http://tools.sitepoint.com/codeburner/">CodeBurner for Firebug</a>.
</p>
<p>
Dust-Me Selectors is a standalone extension that finds unused <abbr title="Cascading Style Sheets">CSS</abbr> selectors, and is particularly useful for updating legacy sites, allowing you to throw away all those redundant rules without worrying that something, somewhere might be using them.
</p>
<p>
CodeBurner for Firebug, as its name suggests, is an extension to the popular developer tool, <a href="http://getfirebug.com/">Firebug</a>, and extends it with searchable reference material for <abbr title="HyperText Markup Language">HTML</abbr> and <abbr title="Cascading Style Sheets">CSS</abbr>.
</p>
<p>
We&#8217;ve been beavering away behind the scenes on updates to both these extensions, waiting for the final version of Firefox 3.5 &#8212; and now that it&#8217;s been released, here they are!
</p>
<div id="adz" class="vertical"></div><p>
Dust-Me Selectors in particular benefits from this browser update &#8212; thanks to improvements in Firefox&#8217;s JavaScript engine, it now performs significantly faster, with a typical &quot;find&#8230;&quot; operation around 50% quicker than in Firefox 3.0!
</p>
<p>
But that&#8217;s not nearly all! Both new versions also bring a host of improvements and new features:
</p>
<h4>New features in Dust-Me Selectors Version 2.2:</h4>
<ul>
<li>new tabbed preferences dialog that&#8217;s neater and more user-friendly</li>
<li>added a new spidering preference &quot;don&#8217;t spider external sites&quot;, which resricts the spider to pages on the same domain as the sitemap</li>
<li>bugfixes to make &quot;find&#8230;&quot; and &quot;spider&#8230;&quot; keyboard triggers more reliable cross-platform</li>
<li>improved error handling throughout</li>
<li>removed two unecessary preferences to streamline the spidering logic: &quot;ignore www difference&quot; and &quot;ignore fragment identifiers&quot; in URLs, both of which are now enabled all the time</li>
</ul>
<h4>New features in CodeBurner for Firebug 1.2:</h4>
<ul>
<li>improved search algorithm gives better results</li>
<li>special search now includes &quot;other attributes that are valid for this element&quot; as well as those which are actually defined for it</li>
<li>code examples for CSS properties now include direct links to <a href='http://reference.sitepoint.com/css/demos'>live examples</a> online</li>
<li>the original search term is now indicated in search results</li>
<li>slightly modified license clarifies the distinction between &quot;use&quot; and &quot;redistribution&quot;</li>
</ul>
<p>
Both of these updates have been uploaded to the <a href="https://addons.mozilla.org/">Mozilla Add-ons site</a>, however since all submissions are reviewed manually, it may be a day or so before they become available from there, or through the automatic updates channel. So if you can&#8217;t wait that long, you can grab them straight away from SitePoint:
</p>
<ul>
<li><a href="http://www.sitepoint.com/dustmeselectors/"><strong>Dust-Me Selectors v2.2</strong></a></li>
<li><a href="http://tools.sitepoint.com/codeburner/"><strong>CodeBurner for Firebug v1.2</strong></a></li>
</ul>
<p>
As always, we welcome your comments and feedback on both of these extensions &#8212; and if you&#8217;ve any ideas for features you&#8217;d like to see, please don&#8217;t hesitate to let us know!</p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=136&amp;did=adz&amp;adtype=vertical" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2009/07/02/announcing-updates-to-our-popular-add-ons-for-firefox-35/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Truthy and Falsy: When All is Not Equal in JavaScript</title>
		<link>http://www.sitepoint.com/blogs/2009/07/01/javascript-truthy-falsy/</link>
		<comments>http://www.sitepoint.com/blogs/2009/07/01/javascript-truthy-falsy/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 15:13:30 +0000</pubDate>
		<dc:creator>Craig Buckler</dc:creator>
		
		<category><![CDATA[JavaScript & CSS]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=11126</guid>
		<description><![CDATA[Anything in JavaScript can be considered to be either truthy or falsy. Craig provides a useful guide explaining what they are and the bizarre rules that apply when they're compared.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/06/095-js-truthy-falsy.png" alt="JavaScript-truthy-falsy" title="JavaScript-truthy-falsy" width="220" height="220" class="imgright" />Like most computer languages, JavaScript supports Boolean data types; values which can be set to true or false. In addition, everything in JavaScript has an inherent Boolean value, generally known as either <em>truthy</em> or <em>falsy</em>. Handling truthy and falsy values can be a little quirky, especially when comparing variables. Understanding some of the more bizarre rules can help when debugging complex client-side applications.</p>
<h2>Truthy and Falsy Values</h2>
<p>The following values are always falsy:</p>
<ul>
<li><strong>false</strong></li>
<li><strong>0</strong> (zero)</li>
<li><strong>&quot;&quot;</strong> (empty string)</li>
<li><strong>null</strong></li>
<li><strong>undefined</strong></li>
<li><strong>NaN</strong> (a special Number value meaning Not-a-Number!)</li>
</ul>
<div id="adz" class="horizontal"></div><p>All other values are truthy, including &quot;0&quot; (zero in quotes), &quot;false&quot; (false in quotes), empty functions, empty arrays, and empty objects.</p>
<pre><code class="javascript">
var a = !!(0); // variable is set to false
var b = !!("0"); // true
</code></pre>
<h2>Comparing Falsy Values</h2>
<p>Falsy values follow some slightly odd comparison rules which can lead to errors in program logic.</p>
<p>The falsy values <strong>false</strong>, <strong>0</strong> (zero), and <strong>&quot;&quot;</strong> (empty string) are all equivalent and can be compared against each other:</p>
<pre><code class="javascript">
var c = (false == 0); // true
var d = (false == ""); // true
var e = (0 == ""); // true
</code></pre>
<p>The falsy values <strong>null</strong> and <strong>undefined</strong> are not equivalent to anything except themselves:</p>
<pre><code class="javascript">
var f = (null == false); // false
var g = (null == null); // true
var h = (undefined == undefined); // true
var i = (undefined == null); // true
</code></pre>
<p>Finally, the falsy value <strong>NaN</strong> is not equivalent to anything &#8212; including NaN!</p>
<pre><code class="javascript">
var j = (NaN == null); // false
var k = (NaN == NaN); // false
</code></pre>
<p>You should also be aware that <code>typeof(NaN)</code> returns &quot;number&quot;. Fortunately, the core JavaScript function <code>isNaN()</code> can be used to evaluate whether a value is NaN or not.</p>
<p><strong>If in doubt&#8230;</strong><br />
Use strict equal (===) and strict not equal (!==) in situations where truthy or falsy values could lead to logic errors. These operators ensure that the objects are compared by type and by value.</p>
<pre><code class="javascript">
var l = (false == 0); // true
var m = (false === 0); // false
</code></pre>
<p>Has truthy or falsy logic ever caused you grief in JavaScript code?</p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&amp;did=adz&amp;adtype=horizontal" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2009/07/01/javascript-truthy-falsy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Write Better CSS with Less</title>
		<link>http://www.sitepoint.com/blogs/2009/06/30/write-better-css-with-less/</link>
		<comments>http://www.sitepoint.com/blogs/2009/06/30/write-better-css-with-less/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 07:30:24 +0000</pubDate>
		<dc:creator>raena</dc:creator>
		
		<category><![CDATA[JavaScript & CSS]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=11726</guid>
		<description><![CDATA[I have a confession: I think parts of CSS suck. It's repetitive, tedious, and ... well, kind of dumb. Less promises to make writing CSS a little smarter!]]></description>
			<content:encoded><![CDATA[<p><img class="imgright size-full wp-image-11728" title="Less" src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/06/picture-120.png" alt="Less" width="168" height="82" /> <strong>I have a confession: I think parts of CSS <em>suck. </em>It&#8217;s repetitive, tedious, and &#8230; well, kind of dumb. </strong></p>
<p>I for one find it quite counter-intuitive to specify descendants&#8217; styles like this:</p>
<pre><code>#banner { color: white; background: black; }
#banner a { color: yellow; }
#banner p { margin: 0; }
#banner ...
#banner ...
#banner ...</code></pre>
<p>&#8230; and on, and on, and on. Instead, this makes way more sense to me:</p>
<pre><code>#banner {
  color: white;
  background: black;
    a { color: yellow; }
    p { margin: 0em; }
    ...
}</code></pre>
<p>And how about variables? They&#8217;d be cool:</p>
<pre><code>@logo = #457301;

h3 { color: @logo; }
#sale { border: 1px solid @logo; }
.alert { background: @logo; }</code></pre>
<p>Are you with me? Well, <a href="http://lesscss.org/">Less</a> promises to make these daydreams and more a happy reality. You&#8217;d write a style sheet using the Less syntax, which is exceptionally easy to pick up &#8212; it&#8217;s just CSS with some added CSS-like extras. You then use the Less Ruby gem to convert it into regular CSS &#8212; run it on the command line, or incorporate it into an app.</p>
<p>Less permits you to use variables and nested selectors, as seen above, but also offers a way to include classes within classes, and some simple math operators. Sweet! Let&#8217;s put Less through its paces and see how it copes with a simpler style sheet.</p>
<p>Let&#8217;s say I&#8217;m making a style sheet for a reasonably common grid structure, like so:</p>
<p align="center"><img src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/06/less-grid.jpg" border="0" alt="Grid: three at the top, four in the centre, six at the bottom" align="middle" /></p>
<div id="adz" class="vertical"></div><p>Usually, I&#8217;d decide on a width for the entire page (let&#8217;s say 960 pixels &#8212; it&#8217;s a <a href="http://960.gs">popular</a> size) and construct various widths based on that, perhaps indeed using a grid system from a framework. I&#8217;d like the topmost boxes to occupy one third of the width of the container, the second set of boxes one quarter, and the footer boxes one sixth, so I&#8217;ll divide accordingly using my handy calculator. I have a particular favorite green, which I&#8217;d like to use as a heading color for some boxes, a border color for the secondary headings, and as a background for the footer. There&#8217;s an item that looks kind of like the footer, but with a different font. Oh, and I&#8217;d like to add some basic font specifications to each of the sections &#8212; the text should become smaller the further you go down. All groovy:</p>
<pre><code>#container {
  width: 960px;
}
.box {
  float: left;
}
#main .box {
  width: 320px;
}
#main .box h3 {
  background: #450;
}
#secondary {
  font-size: 90%;
}
#secondary .box {
  width: 240px;
  border-bottom: 1px solid #450;
}
#footer {
  font-size: 80%;
}
#footer, #super {
  background: #450;
  color: #fff;
}
#footer .box {
  width: 160px;
}
#super {
  font-family: cursive;
}</code></pre>
<p>All groovy, that is, until I decide I&#8217;d like to change the width of the container. Now I have to go back and edit the widths of <code>container</code> and each of the descendent boxes on <code>main</code>, <code>secondary</code>, and <code>footer</code>. Then, I decide I&#8217;d like to use purple instead of green, so I then have to change the color of the main boxes&#8217; headings, the secondary boxes&#8217; borders, <em>and</em> the footer boxes&#8217; backgrounds. Annoying!</p>
<p>Let&#8217;s imagine that I used Less for this task instead. First, of course, I&#8217;ll need to install Less, which is a quick job on the command line:</p>
<pre><code>sudo gem install less</code></pre>
<p>Now I&#8217;ll open a new text file and start writing Less. I&#8217;ll specify a<br />
base width in a variable, <code>@base</code>:</p>
<pre><code>@base: 960px;</code></pre>
<p>And my favorite color:</p>
<pre><code>@pretty: #450;</code></pre>
<p>I&#8217;ll then use the <code>@base</code> variable to specify the widths of the main, secondary, and footer boxes as a fraction of that overall width. To define each of the <code>box</code> children of each section, I&#8217;ll use nested selectors to define how I want the <code>box</code> children of each section to appear. The <code>@pretty</code> variable is used wherever I need to specify that color. Here is the rest of my Less file:</p>
<pre><code>#container {
  width: @base;
}
.box {
  float: left;
}

#main {
  .box {
    width: @base / 3;
      h3 {
        color: @pretty;
      }
  }
}

#secondary {
  font-size: 90%;
  .box {
    width: @base / 4;
    border-bottom: 1px solid @pretty;
  }
}

#footer {
  font-size: 80%;
  background: @pretty;
  color: #fff;
  .box {
    width: @base / 6;
  }
}</code></pre>
<p>Since <code>super</code> looks just like <code>footer</code>, but with a different font, I&#8217;ll use Less&#8217;s class inclusion technique (they call it a mixin) to tell it to include these declarations too:</p>
<pre><code>#super {
  #footer;
  font-family: cursive;
}</code></pre>
<p>I&#8217;ll cook up a CSS file using this simple statement on the command line:</p>
<pre><code>lessc mystylesheet.less</code></pre>
<p>Out pops a style sheet with much the same content as the one I made in the usual fashion above, with the exception of my <code>footer</code> and <code>super</code> declarations. Rather than being grouped, the common declarations are repeated:</p>
<pre><code>#footer {
  font-size: 80%;
  background: #450;
  color: #fff;
}
#super {
  font-size: 80%;
  background: #450;
  color: #fff;
  font-family: cursive;
}</code></pre>
<p>More on that small annoyance later.</p>
<p>Now, since Less created much the same style sheet, you might be wondering where I&#8217;m going with this. Well, here&#8217;s where we come to the part where it&#8217;s time to change my mind about the width and color, and this is where Less really comes into its own. This time, I only need to change <em>two lines</em> in my style sheet. First up, let&#8217;s adjust the value of the base variable, like this:</p>
<pre><code>@base: 720px;</code></pre>
<p>Now, let&#8217;s change the green to purple:</p>
<pre><code>@pretty: #619;</code></pre>
<p>Now, I can leave the rest of the declarations alone and generate a new CSS file. The boxes&#8217; width recalculations and color replacements are done for me:</p>
<pre><code>#container {
  width: 720px;
}
.box {
  float: left;
}
#main .box {
  width: 240px;
}
#main .box h3 {
  color: #619;
}
#secondary {
  font-size: 90%;
}
#secondary .box {
  border-bottom: 1px solid #619;
  width: 180px;
}
#footer {
  font-size: 80%;
  background: #619;
  color: #fff;
}
#footer .box {
  width: 120px;
}

#super {
  font-size: 80%;
  background: #619;
  color: #fff;
  font-family: cursive;
}</code></pre>
<p>Of course, this is a very simple example. In the real world, a complex grid-based template could contain dozens of declarations based on a single figure; a color scheme could revolve around two or three basic shades. Using Less, we can treat these base definitions as true variables, and spend less time maintaining them.</p>
<p>Less&#8217;s inclusion method could be tidier if it was clever enough to group the common elements of the mixed-in declarations. On the other hand, I kind of like the way it comes out here &#8212; I like to organize my style sheet into sections according to purpose:</p>
<pre><code>/* heading styles */
...
/* main content styles */
...
/* footer styles */
...</code></pre>
<p>If there&#8217;s a style I like the look of in the heading area, and I want an item in my footer to resemble it, I&#8217;d prefer to avoid storing that footer item in my headings section. If you want to be clever and use grouped selectors, you&#8217;ll have to put both those styles somewhere. The convenience of the feature outweighs this small nuisance for me, and of course using mixins is absolutely optional.</p>
<p>I love it when clever folk come up with great ways to save time on CSS, and I can see I&#8217;ll be making good use of this nifty tool in future. You can <a href="http://lesscss.org">check out Less at its web site.</a></p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=136&amp;did=adz&amp;adtype=vertical" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2009/06/30/write-better-css-with-less/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How Can Google Chrome Become More Popular?</title>
		<link>http://www.sitepoint.com/blogs/2009/06/29/google-chrome-more-popular/</link>
		<comments>http://www.sitepoint.com/blogs/2009/06/29/google-chrome-more-popular/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 08:45:53 +0000</pubDate>
		<dc:creator>Craig Buckler</dc:creator>
		
		<category><![CDATA[Web Tech]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=11522</guid>
		<description><![CDATA[Most techies agree that Chrome is a great browser, however, Google's recent survey proved that few people are aware of it. Craig suggests a number of ways to increase the browser's market share.]]></description>
			<content:encoded><![CDATA[<p><img class="imgright" title="Google Chrome" src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/06/098-chrome.jpg" alt="Google Chrome" width="220" height="220" />Google&#8217;s recent <a href="http://www.sitepoint.com/blogs/2009/06/24/what-is-a-web-browser/">survey in Times Square, New York</a>, revealed a number of interesting facts:</p>
<ol>
<li>Fewer than 8% of people know what a browser is. Many confuse it with a search engine or a company.</li>
<li>The majority of users do not know or care which browser they&#8217;re using. It&#8217;s simply an icon they click to access the web.</li>
<li>Hardly anyone had heard of Chrome.</li>
</ol>
<p>Chrome, the Google-branded web browser, has been available since September 2008. It&#8217;s known for its clean, minimalistic interface, quick rendering speed, anonymous browsing facilities, and high stability. Each tab is handled by a separate process, so a single page crash does not bring down the whole application.</p>
<p>It&#8217;s undoubtedly a great browser and has gained a 2 - 5% market share within its first year. However, it&#8217;s difficult to determine how many non-technical users have been attracted to Chrome. Web developers certainly use it, but Google&#8217;s survey suggests that it&#8217;s yet to achieve mainstream awareness.</p>
<div id="adz" class="vertical"></div><p>Google &#8212; if you&#8217;re listening &#8212; here are my suggestions to increase Chrome&#8217;s adoption rate.</p>
<p><strong>1. Change the name</strong><br />
<em>&#8220;Chrome&#8221;</em> is a clever and geeky name, but it means absolutely nothing to most people. I suspect few people in the IT industry understand the significance. Google has a history of naming applications after their function (docs, maps, email, etc.), and their browser should be no exception, e.g.</p>
<ul>
<li>Google Internet</li>
<li>Google Web</li>
<li>G-Internet</li>
<li>or even just &#8220;Google&#8221; since that&#8217;s the first page most users open.</li>
</ul>
<p><strong>2. Get it on user desktops</strong><br />
The vast majority of users will only use Chrome if it&#8217;s already installed for them. Google should therefore:</p>
<ol>
<li>Do deals with PC manufacturers and software producers.</li>
<li>Offer Chrome as an optional extra with related software, such as Google Desktop.</li>
<li>Promote the browser on Google-owned websites. A Chrome download link is already shown for IE6/7 visitors to Google.com <em>(not IE5/5.5 though?)</em>, so the program could be extended to sites such as YouTube. Google needs to be careful with heavy-handed advertising, but a single opt-out click could apply across every site.</li>
</ol>
<p><strong>3. Keep the browser simple</strong><br />
Let&#8217;s cut the pretense. Google has one primary objective: to beat Microsoft and Internet Explorer. Many users have no reason to switch from IE, so Google should concentrate on persuading them that Chrome is easy to install, simpler, and faster to use. Security and stability are a bonus but, since so few IE users knowingly experience problems, those factors should not be part of the main marketing message.</p>
<p>I&#8217;m not against Google improving the browser with features such as add-ons, but most users will never care about or use those facilities. If an option results in additional complexity (even an extra menu item), Google should seriously reconsider its implementation.</p>
<p>Developers and power users already have Firefox and Opera so matching the feature sets found in those browsers may convert a proportion of IT-literate users. However, perhaps it would be better if Google targeted Chrome at the 92% of people who do not know what a browser is.</p>
<p>See also: <a href="http://www.sitepoint.com/blogs/2009/06/24/what-is-a-web-browser/">What is a Web Browser? No One Knows!</a></p>
<p>Do you have any other ideas? Can Google persuade people to drop IE? Will Chrome just take market share from other browsers?</p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=136&amp;did=adz&amp;adtype=vertical" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2009/06/29/google-chrome-more-popular/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Web Directions South: Discount Tickets for SitePoint Readers</title>
		<link>http://www.sitepoint.com/blogs/2009/06/29/web-directions-south-discount-tickets-for-sitepoint-readers/</link>
		<comments>http://www.sitepoint.com/blogs/2009/06/29/web-directions-south-discount-tickets-for-sitepoint-readers/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 02:16:50 +0000</pubDate>
		<dc:creator>Matthew Magain</dc:creator>
		
		<category><![CDATA[Web Tech]]></category>

		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=11672</guid>
		<description><![CDATA[Early bird pricing for this year's Web Directions South conference has been extended—you have less than two weeks to register to save $200 off your ticket price. Combined with the exclusive SitePoint discount code, there are no excuses not to attend what is shaping up to be possibly the best Web Directions ever!]]></description>
			<content:encoded><![CDATA[<p><a href="https://secure.webdirections.org/wds09/register/billing"><img src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/06/wds-2009-logo.jpg" alt="wds-2009-logo" title="wds-2009-logo" width="220" height="81" class="alignright size-full wp-image-11673" /></a>Hot off the press this morning was the announcement that the Web Directions team have <a href="http://www.webdirections.org/blog/web-directions-south-2009-early-bird-pricing-extended-to-july-9/">extended the early bird pricing</a> for tickets to the Web Directions South 2009 conference until <strong>July 9</strong>. That&#8217;s a whopping <strong>$200 off the full price</strong>, so if you were thinking of attending one of Australia&#8217;s premier web-related events, now is the time to act. </p>
<p>Sure, $795 is a bargain for two days of presentations by <a href="http://south09.webdirections.org/">some of the most inspiring people on the Web (statement made based on personal experience).</a> But it gets better &#8212; if you use the discount code <strong>SITEPOINT</strong> when you register, then you&#8217;ll receive an <strong>additional $45 off the ticket price,</strong> taking the cost down to <strong>AUD $750</strong>. If you&#8217;ve been waiting on approval from your boss, telling them about this extra discount might be all the incentive to get him or her across the line. And if you&#8217;re paying your own way, then this extra saving will no doubt be appreciated!</p>
<p>Here&#8217;s the kicker: <strong>you don&#8217;t actually have to <em>pay</em> for your ticket yet!</strong> You just have to register to attend, and can sort out payment for your ticket at a later date.</p>
<p><strong>However, this offer is only good for two weeks, so be sure to act quickly!</strong></p>
<div id="adz" class="horizontal"></div><h2>So Why Should You Attend?</h2>
<p><img src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/06/speaker_k_yank.jpg" alt="speaker_k_yank" title="speaker_k_yank" width="65" height="65" class="alignright size-full wp-image-11681" /><img src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/06/speaker_c_adams.jpg" alt="speaker_c_adams" title="speaker_c_adams" width="65" height="65" class="alignright size-full wp-image-11683" />This year is looking like it will be bigger and better than ever. Personally I&#8217;m pretty excited about the fact that so many SitePoint authors are on the lineup to speak, but there are also some great new faces stepping up to talk about a range of exciting topics that will appeal to web professionals, regardless of whether you&#8217;re a designer, a developer or business-minded. Here&#8217;s just a sampling of some of the great speakers presenting at Web Directions South:</p>
<p><img src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/06/speaker_e_castledine.jpg" alt="speaker_e_castledine" title="speaker_e_castledine" width="65" height="65" class="alignright size-full wp-image-11684" />
<ul>
<li>SitePoint&#8217;s own Technical Director and <a href="http://www.sitepoint.com/books/csswrong1/">best</a>-<a href="http://www.sitepoint.com/books/javascript1/">selling</a> <a href="http://www.sitepoint.com/books/phpmysql4">author</a>, Kevin Yank, talking about CSS Frameworks</li>
<li>Author of <a href="http://www.sitepoint.com/books/sexy1/">Sexy Web Design,</a> Elliot Jay Stocks, talking about progressive enhancement <img src="http://www.sitepoint.com/blogs/wp-content/uploads/2009/06/speaker_e_stocks.jpg" alt="speaker_e_stocks" title="speaker_e_stocks" width="65" height="65" class="alignright size-full wp-image-11682" /></li>
<li>Author of <a href="http://www.sitepoint.com/books/javascript1/">several</a> <a href="http://www.sitepoint.com/books/jsdesign1/">SitePoint</a> <a href="http://www.sitepoint.com/books/jsant1/">books</a>, Cameron Adams, talking about his experience designing the interface for Google Wave</li>
<li>Author of the upcoming <a href="http://www.sitepoint.com/books/jquery1/">jQuery: Novice to Ninja</a>, Earle Castledine</li>
</ul>
<p>That&#8217;s just the tip of the iceberg &#8212; <a href="http://south09.webdirections.org/">check out the full speaker list</a> for more details.</p>
<p>Remember this low pricing is only available until July 9, so make sure you don&#8217;t miss out. Hope to see you there!</p>
<p><strong>Read SitePoint coverage of past Web Directions conferences:</strong></p>
<ul>
<li><a href="http://www.sitepoint.com/article/andy-budd-design-usability-css/">Andy Budd on Usability, Design, and the Death of CSS</a></li>
<li><a href="http://www.sitepoint.com/article/ie-standards-chris-wilson/">IE and Standards: Chris Wilson Talks</a></li>
<li><a href="http://www.sitepoint.com/blogs/2007/09/27/wds07-think-like-a-mountain/">Comic Book Inspiration and the CSS Eleven</a></li>
</ul>
<p><em>Disclaimer: SitePoint is a proud media partner of Web Directions South.</em></p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&amp;did=adz&amp;adtype=horizontal" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2009/06/29/web-directions-south-discount-tickets-for-sitepoint-readers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Note on Google&#8217;s So-called Best Practices</title>
		<link>http://www.sitepoint.com/blogs/2009/06/26/a-note-on-googles-so-called-best-practises/</link>
		<comments>http://www.sitepoint.com/blogs/2009/06/26/a-note-on-googles-so-called-best-practises/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 22:49:07 +0000</pubDate>
		<dc:creator>Troels Knak-Nielsen</dc:creator>
		
		<category><![CDATA[PHP]]></category>
<category>google</category><category>performance</category><category>php</category><category>profiling</category>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=11556</guid>
		<description><![CDATA[The advice for PHP developers in Google's recent "make the web faster" campaign are plain wrong. Troels tackles some of the tips and provides some words of wisdom on how to really optimise your site's performance.]]></description>
			<content:encoded><![CDATA[<p>Earlier this week, Google launched a campaign to <a href="http://code.google.com/speed/">make the web faster</a>. It appears to be a call for improving the quality of web sites in general, but with a focus on performance.</p>
<p>The project includes an article on <a href="http://code.google.com/speed/articles/optimizing-php.html">&#8220;PHP performance tips&#8221;</a>, which is bordering on being ridiculous. There are of course lots of blog posts with similar nonsense around the web, but since this is being endorsed by Google, it&#8217;s fair to assume that people might take it at face value. That&#8217;s unfortunate, as <strong>almost none of it is true.</strong> The PHP Team responded back with <a href="http://groups.google.com/group/make-the-web-faster/browse_thread/thread/ddfbe82dd80408cc">this message</a>, wherein they refute the unfounded nonsense.</p>
<p>What&#8217;s more troubling however, is the whole approach to performance optimisation as a matter of &#8220;knowing the secret handshake&#8221;. Optimisation is far more complex than that, and spending time on these &#8220;optimisation tricks&#8221; are rarely worthwhile and <a href="http://en.wikipedia.org/wiki/Optimization_(computer_science)#cite_note-0">might often lead to unmaintainable code, if applied too early</a>. It&#8217;s a fine line, because there <em>are</em> of course certain things that you shouldn&#8217;t do (such as hit the database within a tight loop, if you can send one query instead), but there are likewise lots of things that are a complete and utter waste of every body&#8217;s time. It&#8217;s a pity that this article failed to keep those two issues separate.</p>
<p>Performance optimisation is not magic. The real way to deal with it, is to measure and analyse. It is almost impossible &#8212; even for a highly skilled programmer &#8212; to anticipate exactly where there might be bottlenecks in a program. Using a profiler gives you real numbers to relate to, rather than wild guesses and superstition.</p>
<div id="adz" class="horizontal"></div><p>For PHP scripts, there is the freely available <a href="http://www.xdebug.org/docs/profiler">Xdebug extension</a>, which provides detailed information on both memory usage and execution time on a per-function basis. It&#8217;s easy to install and with the simple <a href="http://code.google.com/p/webgrind/">WebGrind</a> as a front-end, you&#8217;ll be up and running in no time.</p>
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&amp;did=adz&amp;adtype=horizontal" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/blogs/2009/06/26/a-note-on-googles-so-called-best-practises/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
