<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>AceCoder's Programming Tips</title>
	<atom:link href="http://acecoder.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://acecoder.wordpress.com</link>
	<description>Programing in Perl, PHP, Javascript, Ajax, CSS, XHTML</description>
	<lastBuildDate>Mon, 19 Nov 2007 06:56:20 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='acecoder.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/3b58919b73659b4f4bbf9c912668c0ab?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>AceCoder's Programming Tips</title>
		<link>http://acecoder.wordpress.com</link>
	</image>
			<item>
		<title>PHP &#8211; Pass by Reference or Pass by Value</title>
		<link>http://acecoder.wordpress.com/2007/11/19/php-pass-by-reference-or-pass-by-value/</link>
		<comments>http://acecoder.wordpress.com/2007/11/19/php-pass-by-reference-or-pass-by-value/#comments</comments>
		<pubDate>Mon, 19 Nov 2007 06:56:20 +0000</pubDate>
		<dc:creator>tribesman</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[reverence]]></category>
		<category><![CDATA[value]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://acecoder.wordpress.com/2007/11/19/php-pass-by-reference-or-pass-by-value/</guid>
		<description><![CDATA[Passing a variable by reference or by value to a function is a very useful concept for PHP programmers. Normally, when you are passing a variable to a functon, you are passing &#8220;by value&#8221; which meand the PHP procesor will make a duplicate variable to work on. When you pass a variable to a function [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=acecoder.wordpress.com&blog=1975797&post=6&subd=acecoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Passing a variable by reference or by value to a function is a very useful concept for PHP programmers. Normally, when you are passing a variable to a functon, you are passing &#8220;by value&#8221; which meand the PHP procesor will make a duplicate variable to work on. When you pass a variable to a function &#8220;by reference&#8221; you passing the actual variable and all work done on that variable will be done directly on it.</p>
<p><code><br />
&lt;?<br />
function pass_by_value($param) {<br />
  push_array($param, 4, 5);<br />
}</p>
<p>$ar = array(1,2,3);</p>
<p>pass_by_value($ar);</p>
<p>foreach ($ar as $elem) {<br />
  print "<br />$elem";<br />
}<br />
?&gt;</p>
<p></code> </p>
<p>The code above prints 1, 2, 3. This is because the array is passed as value.</p>
<p><code><br />
?<br />
function pass_by_reference(&amp;$param) {<br />
  push_array($param, 4, 5);<br />
}</p>
<p>$ar = array(1,2,3);</p>
<p>pass_by_reference($ar);</p>
<p>foreach ($ar as $elem) {<br />
  print "<br />$elem";<br />
}<br />
?&gt;<br />
</code></p>
<p>The code above prints 1, 2, 3, 4, 5. This is because the array is passed as reference, meaning that the function (pass_by_reference) doesn&#8217;t manipulate a copy of the variable passed, but the actual variable itself.</p>
<p>In order to make a variable be passed by reference, it must be declared with a preceeding ampersand (&amp;) in the function&#8217;s declaration. </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/acecoder.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/acecoder.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/acecoder.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/acecoder.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/acecoder.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/acecoder.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/acecoder.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/acecoder.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/acecoder.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/acecoder.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/acecoder.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/acecoder.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=acecoder.wordpress.com&blog=1975797&post=6&subd=acecoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://acecoder.wordpress.com/2007/11/19/php-pass-by-reference-or-pass-by-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfd8b491e1c33440fa73a7b7783b7dbb?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tribesman</media:title>
		</media:content>
	</item>
		<item>
		<title>Using The Ternary Operator Instead of &#8220;If&#8221; Statements</title>
		<link>http://acecoder.wordpress.com/2007/11/17/using-the-ternary-operator-instead-of-if-statements/</link>
		<comments>http://acecoder.wordpress.com/2007/11/17/using-the-ternary-operator-instead-of-if-statements/#comments</comments>
		<pubDate>Sat, 17 Nov 2007 18:56:50 +0000</pubDate>
		<dc:creator>tribesman</dc:creator>
				<category><![CDATA[Coding Basics]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://acecoder.wordpress.com/2007/11/17/using-the-ternary-operator-instead-of-if-statements/</guid>
		<description><![CDATA[The ternary operator is available in PHP and most other programming languages and usually it causes much confusion for novice programmers because of it&#8217;s unusual syntax. If you are going to write, modify or debug code, the ternary operator is invaluable because it allows you to simplify more complex conditionals into one line statements.
The basic [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=acecoder.wordpress.com&blog=1975797&post=5&subd=acecoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The ternary operator is available in PHP and most other programming languages and usually it causes much confusion for novice programmers because of it&#8217;s unusual syntax. If you are going to write, modify or debug code, the ternary operator is invaluable because it allows you to simplify more complex conditionals into one line statements.</p>
<p>The basic syntax of the ternary operator is:</p>
<p>(condition) ? &#8216;true&#8217; : &#8216;false&#8217;;</p>
<p>What the statement above evaluates to is &#8220;If the condition is true, the first value (after the question mark) is returned. If the condition is false, the second value (after the colon) is returned. The trick to using the ternary operator is understanding that a value is returned by the expression and that the value must be handled as you would handle a valuereturned by a function or subroutine. A simple PHP example using the ternary operator is as follows :</p>
<p><code> &lt;?Php<br />
echo isDrinkingAge(24);</code></p>
<p>function isDrinkingAge($age)<br />
{<br />
return ($age &gt; 21 ) ? &#8220;allowed to buy alcohol&#8221; : underage drinker;</p>
<p>}</p>
<p>In the example above, the output would be <em>allowed to buy alcohol</em> because the function isDrinkingAge() takes a number as an argument and uses the ternary operator to return one of two strings (&#8220;underage drinker&#8221; or &#8220;allowed to buy alcohol&#8221;) based on the condition ( $age &lt; 21 ).</p>
<p>The code same isDrinkingAge() function could be written like this :</p>
<p><code><br />
&lt;?Php<br />
echo isDrinkingAge(24);</code><br />
<code><br />
function isDrinkingAge($age)<br />
{<br />
if  ( $age &gt; 21 ){<br />
return "allowed to buy alcohol"<br />
}else{<br />
return "underage drinker";<br />
}<br />
</code></p>
<p>While both examples are correct and proper, most experienced programmers will tend to use the ternary operator for code optimization reasons. This practice goes back to the early days of programming where a developer had to be careful and watch how many bytes they were using in their code because resources were limited. In todays modern computers, the conservation of bytes is not necessary, however, in terms of speed of execution the first example using the ternary operator will evaluate much faster than the second. While bytes are not necessary to conserve, if you are writing a web application in PHP that will be used simultaneously by thousands of web visitors (such as a forum or blog), the extra milliseconds of processing time can add up to a lot of CPU usage in the end.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/acecoder.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/acecoder.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/acecoder.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/acecoder.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/acecoder.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/acecoder.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/acecoder.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/acecoder.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/acecoder.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/acecoder.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/acecoder.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/acecoder.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=acecoder.wordpress.com&blog=1975797&post=5&subd=acecoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://acecoder.wordpress.com/2007/11/17/using-the-ternary-operator-instead-of-if-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfd8b491e1c33440fa73a7b7783b7dbb?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tribesman</media:title>
		</media:content>
	</item>
		<item>
		<title>Basic MySql Connect and Select in Perl</title>
		<link>http://acecoder.wordpress.com/2007/10/23/basic-mysql-connect-and-select-in-perl/</link>
		<comments>http://acecoder.wordpress.com/2007/10/23/basic-mysql-connect-and-select-in-perl/#comments</comments>
		<pubDate>Tue, 23 Oct 2007 21:30:26 +0000</pubDate>
		<dc:creator>tribesman</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://acecoder.wordpress.com/2007/10/23/basic-mysql-connect-and-select-in-perl/</guid>
		<description><![CDATA[Here is an example of connecting to a mysql database and issuing a simple SELECT statement that returns more than one row. Make sure you have the Perl DBI package istalled on your system (you will get an error when you try o run the code if you don&#8217;t). 

#!/usr/bin/perl
use DBI;
$&#124;=1;
# change mydatabase to your [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=acecoder.wordpress.com&blog=1975797&post=4&subd=acecoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Here is an example of connecting to a mysql database and issuing a simple SELECT statement that returns more than one row. Make sure you have the Perl DBI package istalled on your system (you will get an error when you try o run the code if you don&#8217;t). </p>
<p><code><br />
#!/usr/bin/perl<br />
use DBI;<br />
$|=1;</p>
<p># change mydatabase to your database name<br />
# change username to your mysql username<br />
# change password to your mysql password<br />
$dsn = "DBI:mysql:mydatabase;localhost";<br />
$dbh = DBI-&gt;connect($dsn, 'username', 'password');</p>
<p>if ( !defined $dbh ) {<br />
    exit;<br />
}</p>
<p># use the four lines below if the query results<br />
# in many rows or if you get 'out of memory' errors</p>
<p>$SQL_QUERY=&lt;prepare( "$SQL_QUERY" );<br />
$cursor-&gt;execute;                     </p>
<p>while ( @row = $cursor-&gt;fetchrow ) {<br />
    print "@row\n";<br />
}<br />
$cursor-&gt;finish;<br />
$dbh-&gt;disconnect;</p>
<p></code></p>
<p>If you need to install DBI, you can do it easily by running the following command from any shell as root :</p>
<p>perl -MCPAN -e &#8216;install Bundle::DBI&#8217;</p>
<p>Documentation on the DBI module is available at CPAN :</p>
<p>http://search.cpan.org/~timb/DBI/</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/acecoder.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/acecoder.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/acecoder.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/acecoder.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/acecoder.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/acecoder.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/acecoder.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/acecoder.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/acecoder.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/acecoder.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/acecoder.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/acecoder.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=acecoder.wordpress.com&blog=1975797&post=4&subd=acecoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://acecoder.wordpress.com/2007/10/23/basic-mysql-connect-and-select-in-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfd8b491e1c33440fa73a7b7783b7dbb?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tribesman</media:title>
		</media:content>
	</item>
		<item>
		<title>Welcome to AceCoder&#8217;s Blog</title>
		<link>http://acecoder.wordpress.com/2007/10/23/welcome-to-acecoders-blog/</link>
		<comments>http://acecoder.wordpress.com/2007/10/23/welcome-to-acecoders-blog/#comments</comments>
		<pubDate>Tue, 23 Oct 2007 21:17:36 +0000</pubDate>
		<dc:creator>tribesman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://acecoder.wordpress.com/2007/10/23/welcome-to-acecoders-blog/</guid>
		<description><![CDATA[Hello World,
My name is Jessee, I&#8217;m a freelance programmer who has been working in the business for over 5 years now. I started this blog to share my tips, tricks and techniques I&#8217;ve learned as a professional programmer. Most of the stuff you&#8217;ll find here will be snippets of code I&#8217;ve found useful and added [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=acecoder.wordpress.com&blog=1975797&post=3&subd=acecoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hello World,</p>
<p>My name is Jessee, I&#8217;m a freelance programmer who has been working in the business for over 5 years now. I started this blog to share my tips, tricks and techniques I&#8217;ve learned as a professional programmer. Most of the stuff you&#8217;ll find here will be snippets of code I&#8217;ve found useful and added to my bag of tricks. I needed a place to keep my snippets organized and a friend recommended a blog as a way to accomplish this, so here we go with my programming blog !!</p>
<p>Jessee</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/acecoder.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/acecoder.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/acecoder.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/acecoder.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/acecoder.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/acecoder.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/acecoder.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/acecoder.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/acecoder.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/acecoder.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/acecoder.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/acecoder.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=acecoder.wordpress.com&blog=1975797&post=3&subd=acecoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://acecoder.wordpress.com/2007/10/23/welcome-to-acecoders-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfd8b491e1c33440fa73a7b7783b7dbb?s=96&#38;d=identicon" medium="image">
			<media:title type="html">tribesman</media:title>
		</media:content>
	</item>
	</channel>
</rss>