<?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>PHP and tips</title>
	<atom:link href="http://www.phpntips.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpntips.com</link>
	<description>PHP blog: Zend framework, SVN, code snippets, dev notes, tutorials</description>
	<lastBuildDate>Tue, 07 Feb 2012 00:58:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>DNS glue record</title>
		<link>http://www.phpntips.com/dns-glue-record-2012-02/</link>
		<comments>http://www.phpntips.com/dns-glue-record-2012-02/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 00:58:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.phpntips.com/dns-glue-record-2012-02/</guid>
		<description><![CDATA[What Is A Glue Record &#8211; Domainmonster FAQ Glue records are required when you wish to set the name servers of a domain name to a hostname under the domain name itself.]]></description>
			<content:encoded><![CDATA[<p><a rel="nofollow" href="http://faq.domainmonster.com/dns/glue_record/" target="_blank">What Is A Glue Record &#8211; Domainmonster FAQ</a></p>
<blockquote><p>Glue records are required when you wish to set the name servers of a domain name to a hostname under the domain name itself.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.phpntips.com/dns-glue-record-2012-02/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MongoDB</title>
		<link>http://www.phpntips.com/mongodb-2012-02/</link>
		<comments>http://www.phpntips.com/mongodb-2012-02/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 23:42:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.phpntips.com/mongodb-2012-02/</guid>
		<description><![CDATA[Just had a really interesting and exaustive discussion about MongoDB with Dereck at the PHP London meetup. It seems like a candidate for the next db refactor of the activity stream I&#8217;m working on for bravenewtalent.com. I didn&#8217;t know that many websites&#160;(fuorsquare, github, craiglist) were already using it and interesting talk about unicode by richard [...]]]></description>
			<content:encoded><![CDATA[<p>Just had a really interesting and exaustive discussion about MongoDB with <a href="http://derickrethans.nl/" target="_blank">Dereck </a>at the <a href="http://www.phplondon.org/" target="_blank">PHP London</a> meetup.</p>
<p>It seems like a candidate for the next db refactor of the activity stream I&#8217;m working on for bravenewtalent.com.</p>
<p>I didn&#8217;t know that <a href="http://www.mongodb.org/display/DOCS/Production+Deployments" target="_blank">many websites</a>&nbsp;(fuorsquare, github, craiglist) were already using it</p>
<p>and interesting talk about unicode by richard Johnson, with a bit of history and some example of what happens when the the encoding is wrongly set. I was already aware of those problems and solutions, but good to see some other working example, history and clarifications.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpntips.com/mongodb-2012-02/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find Out Linux Distribution Name and Version</title>
		<link>http://www.phpntips.com/find-out-linux-distribution-name-and-version-2012-02/</link>
		<comments>http://www.phpntips.com/find-out-linux-distribution-name-and-version-2012-02/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 01:30:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.phpntips.com/find-out-linux-distribution-name-and-version-2012-02/</guid>
		<description><![CDATA[To find out what version of Linux (distro) you are running, enter the following command at the shell prompt: $ cat /etc/*-release]]></description>
			<content:encoded><![CDATA[<blockquote><p>To find out what version of Linux (distro) you are running, enter the following command at the shell prompt:<br />
<em>$ cat /etc/*-release</em></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.phpntips.com/find-out-linux-distribution-name-and-version-2012-02/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install GIT on CentOS server</title>
		<link>http://www.phpntips.com/mysql-uncorrelated-subqueries-poor-performances-2-2012-02/</link>
		<comments>http://www.phpntips.com/mysql-uncorrelated-subqueries-poor-performances-2-2012-02/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 01:29:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.phpntips.com/mysql-uncorrelated-subqueries-poor-performances-2-2012-02/</guid>
		<description><![CDATA[Git 1.7.6.1 on CentOS 5.6 &#124; Webtatic.com If you haven&#8217;t set up the Webtatic repository in yum, then add it in the command-line as following: rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm Now install git: yum install &#8211;enablerepo=webtatic git-all]]></description>
			<content:encoded><![CDATA[<p><a rel="nofollow" href="http://www.webtatic.com/packages/git17/" target="_blank">Git 1.7.6.1 on CentOS 5.6 | Webtatic.com</a></p>
<blockquote><p>If you haven&rsquo;t set up the Webtatic repository in yum, then add it in the command-line as following:</p></blockquote>
<blockquote><p><em>rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm </em><br />
Now install git:<br />
 <em>yum install &#8211;enablerepo=webtatic git-all</em></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.phpntips.com/mysql-uncorrelated-subqueries-poor-performances-2-2012-02/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netbeans Codesniffer plugin</title>
		<link>http://www.phpntips.com/netbeans-codesniffer-plugin-2012-02/</link>
		<comments>http://www.phpntips.com/netbeans-codesniffer-plugin-2012-02/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 19:54:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.phpntips.com/netbeans-codesniffer-plugin-2012-02/</guid>
		<description><![CDATA[Just found an article explaing how to use a Netbeans plugin for Code sniffer The github repository is here]]></description>
			<content:encoded><![CDATA[<p>Just found an article explaing how to use a <a href="http://www.amaxus.com/cms-blog/coding-standards-netbeans-php-codesniffer"  rel="nofollow">Netbeans plugin for Code sniffer</a></p>
<p>The github repository is <a href="https://github.com/beberlei/netbeans-php-enhancements/downloads" target="_blank" rel="nofollow">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpntips.com/netbeans-codesniffer-plugin-2012-02/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Formatting/coloring  log files on the fly with tail and sed</title>
		<link>http://www.phpntips.com/formattingcoloring-log-files-on-the-fly-with-tail-and-sed-2012-01/</link>
		<comments>http://www.phpntips.com/formattingcoloring-log-files-on-the-fly-with-tail-and-sed-2012-01/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 19:01:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.phpntips.com/formattingcoloring-log-files-on-the-fly-with-tail-and-sed-2012-01/</guid>
		<description><![CDATA[I often monitor MySQL queries for some complex application components that use an ORM (Doctrine). I&#8217;ve just made a special logger that re-runs all the quries with an EXPLAIN and log the &#8220;Extra&#8221; column of the explain query, in order to spot queries that can be improved. From the log, I pipe the result to [...]]]></description>
			<content:encoded><![CDATA[<div>I often monitor MySQL queries for some complex application components that use an ORM (Doctrine).</div>
<div>I&#8217;ve just made a special logger that re-runs all the quries with an EXPLAIN and log the &#8220;Extra&#8221; column of the explain query, in order to spot queries that can be improved. From the log, I pipe the result to &#8220;sed&#8221; with a regular expression, and colouring some text.</div>
<div>I&#8217;m sure you are not interesting in this post. I just write some posts in order to find them easily in the future when I need them, and possibly helpting somebody else googling the same need.</div>
<div>Here the lines I&#8217;ve added to my ~/.bashrc</div>
<pre>
COLOR_RED=`echo -en '\e[31m'`
COLOR_YELLOW=`echo -en '\e[93m'`
COLOR_RESET=`echo -en '\e[00m'`
alias querylog="tail -f /var/www/bnt/Public/application/logs/queries.log | sed -E \
's/(where|intersect|temp|filesort)/$COLOR_RED\1$COLOR_RESET/g'"
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.phpntips.com/formattingcoloring-log-files-on-the-fly-with-tail-and-sed-2012-01/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When NOT to use a mysql subqueries</title>
		<link>http://www.phpntips.com/mysql-uncorrelated-subqueries-poor-performances-2012-01/</link>
		<comments>http://www.phpntips.com/mysql-uncorrelated-subqueries-poor-performances-2012-01/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 16:46:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.phpntips.com/mysql-uncorrelated-subqueries-poor-performances-2012-01/</guid>
		<description><![CDATA[MySQL optimizer rewrites uncorrelated subqueries (when the inner query does NOT use fields of the outer query) as correlated query, with perrformances of quadratic order rather than linear. If the inner query does not use a WHERE with fields on the outer query, rewrite it as a JOIN Source:&#160;MySQL :: MySQL 5.5 Reference Manual :: [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL optimizer rewrites uncorrelated subqueries (when the inner query does NOT use fields of the outer query) as correlated query, with perrformances of quadratic order rather than linear.</p>
<p>If the inner query does not use a WHERE with fields on the outer query, rewrite it as a JOIN</p>
<p>Source:&nbsp;<a rel="nofollow" href="http://dev.mysql.com/doc/refman/5.5/en/subquery-restrictions.html" target="_blank">MySQL :: MySQL 5.5 Reference Manual :: E.4 Restrictions on Subqueries</a></p>
<blockquote><p>The problem is that, for a statement that uses an IN subquery, the optimizer rewrites it as a correlated subquery. Consider the following statement that uses an uncorrelated subquery:<br />
<em>SELECT &#8230; FROM <span style="color: #ff0000;"><strong>t1 </strong></span>WHERE <span style="color: #ff0000;"><strong>t1</strong></span>.a IN (SELECT b FROM <span style="color: #0000ff;"><strong>t2</strong></span>); </em><br />
The optimizer rewrites the statement to a correlated subquery:<br />
<em>SELECT &#8230; FROM <span style="color: #ff0000;"><strong>t1 </strong></span>WHERE EXISTS (SELECT 1 FROM <strong><span style="color: #0000ff;">t2</span></strong> WHERE <span style="color: #0000ff;"><strong>t2</strong></span>.b = <span style="color: #ff0000;"><strong>t1</strong></span>.a);</em><br />
 If the <span style="color: #0000ff;">inner </span>and <span style="color: #ff0000;">outer </span>queries return <span style="color: #0000ff;">M</span> and <span style="color: #ff0000;">N</span> rows, respectively, the execution time becomes on the order of O(M&times;N), rather than O(M+N) as it would be for an uncorrelated subquery.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.phpntips.com/mysql-uncorrelated-subqueries-poor-performances-2012-01/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Markdown, markup language</title>
		<link>http://www.phpntips.com/markdown-markup-language-2012-01/</link>
		<comments>http://www.phpntips.com/markdown-markup-language-2012-01/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 16:30:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.phpntips.com/markdown-markup-language-2012-01/</guid>
		<description><![CDATA[Markdown &#8211; Wikipedia, the free encyclopedia Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz allowing people &#8220;to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)&#8221;.[1] The language takes many cues from existing conventions for marking up plain text in email.]]></description>
			<content:encoded><![CDATA[<p><a rel="nofollow" href="http://en.wikipedia.org/wiki/Markdown" target="_blank">Markdown &#8211; Wikipedia, the free encyclopedia</a></p>
<blockquote><p>Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz allowing people &#8220;to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)&#8221;.[1] The language takes many cues from existing conventions for marking up plain text in email.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.phpntips.com/markdown-markup-language-2012-01/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Usage statistics and market share data of PHP on the web</title>
		<link>http://www.phpntips.com/usage-statistics-and-market-share-data-of-php-on-the-web-2012-01/</link>
		<comments>http://www.phpntips.com/usage-statistics-and-market-share-data-of-php-on-the-web-2012-01/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 16:28:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.phpntips.com/usage-statistics-and-market-share-data-of-php-on-the-web-2012-01/</guid>
		<description><![CDATA[Usage Statistics and Market Share of PHP for Websites, January 2012 This report shows the usage statistics and market share data of PHP on the web]]></description>
			<content:encoded><![CDATA[<p><a rel="nofollow" href="http://w3techs.com/technologies/details/pl-php/all/all?dm_i=P1J,NMD2,48CON0,1Z3TR,1" target="_blank">Usage Statistics and Market Share of PHP for Websites, January 2012</a></p>
<blockquote><p>This report shows the usage statistics and market share data of PHP on the web</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.phpntips.com/usage-statistics-and-market-share-data-of-php-on-the-web-2012-01/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPUnit mock object, returnValueMap for methods with optional parameters</title>
		<link>http://www.phpntips.com/phpunit-mock-object-returnvaluemap-for-methods-with-optional-parameters-2012-01/</link>
		<comments>http://www.phpntips.com/phpunit-mock-object-returnvaluemap-for-methods-with-optional-parameters-2012-01/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 00:05:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHPUnit]]></category>

		<guid isPermaLink="false">http://www.phpntips.com/phpunit-mock-object-returnvaluemap-for-methods-with-optional-parameters-2012-01/</guid>
		<description><![CDATA[thanks to this post I figured out that the stub PHPUnit_Framework_MockObject_Stub_ReturnValueMap counts the number of ALL the parameters of the function (including the optional ones). So the map must be array( &#160;array(inputParam, &#8230;inputParamN, optionalParam1, &#8230;optionalParam2, return value ) )]]></description>
			<content:encoded><![CDATA[<div>thanks to <a href="https://github.com/sebastianbergmann/phpunit/issues/404" target="_blank">this </a>post I figured out that the stub</div>
<div>PHPUnit_Framework_MockObject_Stub_ReturnValueMap</div>
<div>counts the number of ALL the parameters of the function (including the optional ones).</div>
<div></div>
<div>So the map must be</div>
<div>array(</div>
<div>&nbsp;array(inputParam, &#8230;inputParamN, optionalParam1, &#8230;optionalParam2, return value )</div>
<div>)</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpntips.com/phpunit-mock-object-returnvaluemap-for-methods-with-optional-parameters-2012-01/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
