<?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>code-diesel &#187; programming</title>
	<atom:link href="http://www.codediesel.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codediesel.com</link>
	<description>/* PHP &#38; MySQL Journal */</description>
	<lastBuildDate>Thu, 02 Feb 2012 13:19:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Learning the Language of the Web</title>
		<link>http://www.codediesel.com/web/learning-the-language-of-the-web/</link>
		<comments>http://www.codediesel.com/web/learning-the-language-of-the-web/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 05:13:49 +0000</pubDate>
		<dc:creator>sameer</dc:creator>
				<category><![CDATA[design]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.codediesel.com/?p=2960</guid>
		<description><![CDATA[With the ever increasing presence of the Web, more people are interested in learning the language of the Web. Designers, artists, and newbie’s unfamiliar with Web development are eager to learn to code so that they can understand the Web better and create something original. Learning through books can take some time and can be [...]]]></description>
			<content:encoded><![CDATA[<p>With the ever increasing presence of the Web, more people are interested in learning the language of the Web. Designers, artists, and newbie’s unfamiliar with Web development are eager to learn to code so that they can understand the Web better and create something original.</p>
<p>Learning through books can take some time and can be a major hindrance for people who find the learn-by-the-book method dry an uninspiring. In a bid to make learning the language of the Web more interesting, some designers and developers have come together and created some interesting and useful web projects.<br />
<span id="more-2960"></span><br />
<a href="http://www.codediesel.com/wp-content/uploads/2011/12/dfti.jpg"><img src="http://www.codediesel.com/wp-content/uploads/2011/12/dfti.jpg" alt="" title="dfti" width="237" height="87" class="alignleft size-full wp-image-2963" /></a>The first of the lot is <a href="http://www.dontfeartheinternet.com/" title="dontfeartheinternet.com" target="_blank">dontfeartheinternet.com</a>. Created by designers Jessica Hische and Russ Maschmeyer; ‘dontfeartheinternet’ is a set of video lectures that teach you about html, css, and browsers, right from scratch. The lectures are mostly targeted towards print designers unfamiliar with the Web medium.</p>
<p><a href="http://www.codediesel.com/wp-content/uploads/2011/12/treehouse.gif"><img src="http://www.codediesel.com/wp-content/uploads/2011/12/treehouse.gif" alt="" title="treehouse" width="237" height="87" class="alignleft size-full wp-image-2961" /></a>The other is <a href="http://teamtreehouse.com/" title="teamtreehouse.com" target="_blank">teamtreehouse.com</a>. In the same league as the above site, teamtreehouse.com is a more comprehensive site, providing lectures in Web Design, Web Development and iOS development, and provides test questions after each video lecture. Although not free, teamtreehouse.com can help you quickly learn Web development fundamentals in a structured way.</p>
<p><a href="http://www.codediesel.com/wp-content/uploads/2011/12/code-acd.gif"><img src="http://www.codediesel.com/wp-content/uploads/2011/12/code-acd.gif" alt="" title="code-acd" width="237" height="87" class="alignleft size-full wp-image-2964" /></a>And the final site, <a href="http://www.codecademy.com" title="codecademy.com" target="_blank">codecademy.com</a>. This is more targeted for people wanting to learn JavaScript in an interactive way. The best part is that it is free.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codediesel.com/web/learning-the-language-of-the-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The forgotten PHP logical operator</title>
		<link>http://www.codediesel.com/php/the-forgotten-php-logical-operator/</link>
		<comments>http://www.codediesel.com/php/the-forgotten-php-logical-operator/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 13:55:53 +0000</pubDate>
		<dc:creator>sameer</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.codediesel.com/?p=2937</guid>
		<description><![CDATA[It is very rare that I have seen some code that employs the PHP XOR logical operator. It is not the case that it is not required or programmers are unfamiliar with it; it probably seems that most programmers have become comfortable with using the more common &#8216;&#038;&#038;&#8217; and &#8216;&#124;&#124;&#8217; operators to construct all logical [...]]]></description>
			<content:encoded><![CDATA[<p>It is very rare that I have seen some code that employs the PHP <strong>XOR</strong> logical operator. It is not the case that it is not required or programmers are unfamiliar with it; it probably seems that most programmers have become comfortable with using the more common &#8216;&#038;&#038;&#8217; and &#8216;||&#8217; operators to construct all logical comparisons; the XOR operator relegated to the subconscious black hole.<br />
<span id="more-2937"></span><br />
Take the following artificial example. We want to check if only one of the directories &#8211; either &#8216;$dir1&#8242; or &#8216;$dir2&#8242;, but not both exists. The code using only the logical &#8216;&#038;&#038;&#8217; , &#8216;||&#8217; and &#8216;!&#8217; operators is shown below.</p>

<div class="wp_codebox"><table><tr id="p29373"><td class="code" id="p2937code3"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$dir1</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'download_A'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dir2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'download_B'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">echo</span> <span style="color: #0000ff;">&quot;Only one Directory exists!&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>The code obviously looks confusing, which we could easily simplify using the &#8216;XOR&#8217; operator as given below. The code is concise, easier to understand, and the chances of introducing bugs is smaller than the previous version.</p>

<div class="wp_codebox"><table><tr id="p29374"><td class="code" id="p2937code4"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$dir1</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'download_A'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dir2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'download_B'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir1</span><span style="color: #009900;">&#41;</span> XOR <span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">echo</span> <span style="color: #0000ff;">&quot;Only one Directory exists!&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.codediesel.com/php/the-forgotten-php-logical-operator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Where did that bug come from?</title>
		<link>http://www.codediesel.com/software/where-did-that-bug-come-from/</link>
		<comments>http://www.codediesel.com/software/where-did-that-bug-come-from/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 15:44:25 +0000</pubDate>
		<dc:creator>sameer</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.codediesel.com/?p=1988</guid>
		<description><![CDATA[how small changes in code can introduce bugs]]></description>
			<content:encoded><![CDATA[<p>This is the second time this week that I encountered a annoying bug, introduced just by a small change in the code. Just when you think you can get away with minor changes without testing, you are in for a surprise.</p>
<p>The most common sense thing you can do is to test your code even for small changes; whether you are testing it yourself or sending it to the testing team. Seems simple, but how many times have you really done that. Its not that we are stupid, rather software was never so simple. Maybe we are careless sometimes. The moral is plain &#8211; treat even small changes important, and move it through a test before committing it to a version control.<br />
<span id="more-1988"></span><br />
The following figure from Steve Mcconnell&#8217;s <a href="http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670">Code Complete</a> shows the relation between lines of code changed and errors introduced.</p>
<p><a href="http://www.codediesel.com/wp-content/uploads/2009/11/bug_source.gif"><img src="http://www.codediesel.com/wp-content/uploads/2009/11/bug_source.gif" alt="bug_source" title="bug_source" width="430" height="235" class="aligncenter size-full wp-image-1990" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codediesel.com/software/where-did-that-bug-come-from/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

