<?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>Eric Bergen &#187; PHP</title>
	<atom:link href="http://ebergen.net/wordpress/category/geek/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://ebergen.net/wordpress</link>
	<description>You will probably want some waders, a pickaxe, and one of those hats with a light on it before you go in here.</description>
	<lastBuildDate>Thu, 29 Dec 2011 18:25:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Useless use of if award</title>
		<link>http://ebergen.net/wordpress/2006/07/21/useless-use-of-if-award/</link>
		<comments>http://ebergen.net/wordpress/2006/07/21/useless-use-of-if-award/#comments</comments>
		<pubDate>Fri, 21 Jul 2006 18:14:55 +0000</pubDate>
		<dc:creator>Eric Bergen</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ebergen.net/wordpress/2006/07/21/useless-use-of-if-award/</guid>
		<description><![CDATA[Similar to the useless use of cat award. The useless use of if award highlights code examples where people use the if function or ternary operator when the return of the expression does the exact same thing. I first noticed this with returning boolean values from php functions. To protect the innocent the winner of [...]]]></description>
			<content:encoded><![CDATA[<p>Similar to the useless use of cat award. The useless use of if award highlights code examples where people use the if function or ternary operator when the return of the expression does the exact same thing. I first noticed this with returning boolean values from php functions. To protect the innocent the winner of today&#8217;s award will remain anonymous.</p>
<blockquote><p>&lt;anonymous&gt; to my knowledge, youll have to SUM(IF(your_field <> &#8220;&#8221;, 1, 0)) as total_non_empty</p></blockquote>
<p>Ignoring that the whole query should be using where your_field != &#8221; and group by the non if() way to write this is:</p>
<blockquote><p>SUM(your_field <> &#8221;)</p></blockquote>
<p>These examples aren&#8217;t an award to a specific person since I&#8217;m digging them up from my memory. This pretty much applies to both C and PHP.</p>
<blockquote><p>< ?php</p>
<p>function foo()</p>
<p>{</p>
<p>$str = 'foo';</p>
<p>return $str == 'foo' ? TRUE :  FALSE;<br />
}</p>
<p>?></p></blockquote>
<p>Can be written as</p>
<blockquote><p>< ?php</p>
<p>function foo()</p>
<p>{</p>
<p>$str = 'foo';</p>
<p>return $str == 'foo';<br />
}</p>
<p>?></p></blockquote>
<p>I hope this helps you save a few keystrokes when writing code in the future.</p>
<blockquote />
]]></content:encoded>
			<wfw:commentRss>http://ebergen.net/wordpress/2006/07/21/useless-use-of-if-award/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to get your question answered on irc by example</title>
		<link>http://ebergen.net/wordpress/2005/05/29/how-to-get-your-question-answered-on-irc-by-example/</link>
		<comments>http://ebergen.net/wordpress/2005/05/29/how-to-get-your-question-answered-on-irc-by-example/#comments</comments>
		<pubDate>Sun, 29 May 2005 16:59:31 +0000</pubDate>
		<dc:creator>Eric Bergen</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ebergen.net/wordpress/?p=49</guid>
		<description><![CDATA[n0other: Hello, I have a field publish_to, I want to select only those entries, where publish_to is not older than today, publish_to contains for example &#8217;2005-05-30&#8242;, I do: SELECT * FROM table WHERE (publish_to &#8211; &#8220;&#8216;.date(&#8216;Y-m-d&#8217;) .&#8217;&#8221;) &#62; 0; (php date function), but that doesnt work, how should I implement this, I cannot change date [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>n0other: Hello, I have a field publish_to, I want to select only those entries, where publish_to is not older than today, publish_to contains for example &#8217;2005-05-30&#8242;, I do: SELECT * FROM table WHERE (publish_to &#8211; &#8220;&#8216;.date(&#8216;Y-m-d&#8217;) .&#8217;&#8221;) &gt; 0; (php date function), but that doesnt work, how should I implement this, I cannot change date structure
</p></blockquote>
<p>Notice the detailed question with example. This shows people exactly what the problem is and that you have taken the time to try to solve it yourself. </p>
<blockquote><p>
firewire: so you want where it&#8217;s today and newer?<br />
firewire: where publish_to >= curdate()
</p></blockquote>
<p>A quick response prior to testing</p>
<blockquote><p>
n0other: oh :}<br />
<n0other : thanks firewire
</p></blockquote>
<p>Now after a quick test a final response letting everyone know that the problem was solved</p>
<blockquote><p>
n0other: works perfectly, thanks again<br />
firewire: <img src='http://ebergen.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></blockquote>
<p></n0other></p></blockquote>
<p>It&#8217;s little times like these that make helping people on irc so much fun. </p>
]]></content:encoded>
			<wfw:commentRss>http://ebergen.net/wordpress/2005/05/29/how-to-get-your-question-answered-on-irc-by-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL Authentication Denial</title>
		<link>http://ebergen.net/wordpress/2005/03/29/mysql-authentication-denial/</link>
		<comments>http://ebergen.net/wordpress/2005/03/29/mysql-authentication-denial/#comments</comments>
		<pubDate>Tue, 29 Mar 2005 06:05:13 +0000</pubDate>
		<dc:creator>Eric Bergen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Rants]]></category>

		<guid isPermaLink="false">/?p=38</guid>
		<description><![CDATA[It seems to me that a lot of people have auth denial when trying to make connections to MySQL. They seem to ignore the text of the error message. &#8216;Access Denied&#8217; means access denied, nothing else. Remember three things have to match. The host as MySQL sees it, the username, and the password. When MySQL [...]]]></description>
			<content:encoded><![CDATA[<p>It seems to me that a lot of people have auth denial when trying to make connections to MySQL. They seem to ignore the text of the error message. &#8216;Access Denied&#8217; means access denied, nothing else. </p>
<p>Remember three things have to match. The host as MySQL sees it, the username, and the password. When MySQL returns access denied it&#8217;s not broken. One or more of those three things does not match. I don&#8217;t really need to reiterate what&#8217;s in the <a href="http://dev.mysql.com/doc/mysql/en/access-denied.html">manual</a>. Chang the lock or change the key to make it fit.</p>
]]></content:encoded>
			<wfw:commentRss>http://ebergen.net/wordpress/2005/03/29/mysql-authentication-denial/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Block Comments.</title>
		<link>http://ebergen.net/wordpress/2005/01/19/block-comments/</link>
		<comments>http://ebergen.net/wordpress/2005/01/19/block-comments/#comments</comments>
		<pubDate>Wed, 19 Jan 2005 19:31:45 +0000</pubDate>
		<dc:creator>Eric Bergen</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">/?p=12</guid>
		<description><![CDATA[Like many of the things I discover only to find out that somebody else thought of it first is a handy way of blocking out large portions of code for testing. code code /* code code */ code code Normall to enable the code that is commented you have to either delete or single line [...]]]></description>
			<content:encoded><![CDATA[<p>Like many of the things I discover only to find out that somebody else thought of it first is a handy way of blocking out large portions of code for testing.</p>
<p><span id="more-12"></span></p>
<blockquote><p>code<br />
code<br />
/*<br />
code<br />
code<br />
*/<br />
code<br />
code</p></blockquote>
<p>Normall to enable the code that is commented you have to either delete or single line comment both the start and end markers for the multi line comment. This gets old quick. My solution is to leave a line comment before the end marker like so: </p>
<blockquote><p>code<br />
code<br />
/*<br />
code<br />
code<br />
//*/<br />
code<br />
code</p></blockquote>
<p>Now to enable the block of code I simply comment out the start of the multi line comment. The end marker becomes it&#8217;s own single line comment. </p>
<blockquote><p>code<br />
code<br />
///*<br />
code<br />
code<br />
//*/<br />
code<br />
code</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://ebergen.net/wordpress/2005/01/19/block-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Links and the advent of tabbed browsers.</title>
		<link>http://ebergen.net/wordpress/2005/01/15/links-and-the-advent-of-tabbed-browsers/</link>
		<comments>http://ebergen.net/wordpress/2005/01/15/links-and-the-advent-of-tabbed-browsers/#comments</comments>
		<pubDate>Sat, 15 Jan 2005 19:09:12 +0000</pubDate>
		<dc:creator>Eric Bergen</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Rants]]></category>

		<guid isPermaLink="false">/?p=9</guid>
		<description><![CDATA[Tabbed browsers have made the target=_new _blank or _top style links annoying and useless. In the old days these links allowed visitors to easily return to your site after viewing a few pages of off site content. Now they are a sneaky surprise that shows up like a hand grenade for those of us that [...]]]></description>
			<content:encoded><![CDATA[<p>Tabbed browsers have made the target=_new _blank or _top style links annoying and useless. In the old days these links allowed visitors to easily return to your site after viewing a few pages of off site content. Now they are a sneaky surprise that shows up like a hand grenade for those of us that use modern tabbed browsers. There is nothing worse than a link that pops up a new window covering up my existing neatly organized tabs. After reading a few links in this new window I start creating new tabs in it. This leads to having my normal sites open multiple times. What a pain. A good link will give me enough information to decide if I want to choose to open it in a new tab or over the existing one. Having multiple browser windows open is a thing of the past. </p>
<p>Apologies to all of you IE users that have no clue what I&#8217;m talking about. <a href="http://www.spreadfirefox.com/?q=affiliates&amp;id=0&amp;t=85"><img border="0" alt="Get Firefox!" title="Get Firefox!" src="http://sfx-images.mozilla.org/affiliates/Buttons/80x15/firefox_80x15.png"/></a> It&#8217;s time.</p>
]]></content:encoded>
			<wfw:commentRss>http://ebergen.net/wordpress/2005/01/15/links-and-the-advent-of-tabbed-browsers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

