<?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>Bugzappy&#039;s Blog &#187; php</title>
	<atom:link href="http://www.bugzappy.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bugzappy.com</link>
	<description>on building internet apps</description>
	<lastBuildDate>Mon, 25 Jan 2010 14:24:31 +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>A Programmer&#8217;s &#8220;Pre-Launch Checklist &#8221; in php&#124;architect</title>
		<link>http://www.bugzappy.com/2009/06/02/a-programmers-pre-launch-checklist-in-phparchitect/</link>
		<comments>http://www.bugzappy.com/2009/06/02/a-programmers-pre-launch-checklist-in-phparchitect/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 04:15:12 +0000</pubDate>
		<dc:creator>bugzappy</dc:creator>
				<category><![CDATA[misc]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[checklist]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web.application]]></category>

		<guid isPermaLink="false">http://www.bugzappy.com/?p=234</guid>
		<description><![CDATA[About 4 weeks ago I posted a blog entry with a long list of things to think about before exposing your code, data and CPU&#8217;s to the masses. My list is really written for people whose head is on the block if things go wrong, and is really concerned with &#8220;have you thought about all [...]]]></description>
			<content:encoded><![CDATA[<p>About 4 weeks ago I posted a <a href="http://www.bugzappy.com/2009/04/11/web-application-go-live-checklist/" target="_blank">blog entry</a> with a long list of things to think about before exposing your code, data and CPU&#8217;s to the masses. My list is really written for people whose head is on the block if things go wrong, and is really concerned with &#8220;have you thought about all the categories of things that can go wrong?&#8221;</p>
<p>In this month&#8217;s FREE <a href="http://www.phparch.com/" target="_blank">php|architect</a> issue (available only in PDF), <a href="http://phparch.com/c/magazine/author/227" target="_blank">Eric David Benari</a> provides a list of much more specific things to check on the implementation side. It almost sounds like &#8220;did you brush your teeth before going to bed?&#8221; (I say this in a good way), with things such as having your 404 and 403 pages set up properly, ensuring browser-side caching is specified correctly, serving data and files from RAM not from disk as much as possible, and more. It&#8217;s a useful list with good sample code, I recommend it to new web developers as an overview of what aspects of coding for performance deserve attention, and to more experienced coders as a handy cheat sheet.</p>
<p>Now for a bit of a critique. Some of these coding techniques will help a site&#8217;s quality a lot, but frankly, if you are testing, then you&#8217;ll find out about these issues earlier than at the time of going through the checklist. </p>
<p>Others will increase your site&#8217;s performance by a lot, but if you are benchmarking your app to meet a specific demand, then you&#8217;ll know there is a problem (or not) before you look at the checklist.</p>
<p>What really matters is that (a) the way you&#8217;ve coded your app and deployed it, it will provide the expected quality of service, and (b) when you need to improve performance, you have a solid idea of how to do so (improve the code, re-code, add hardware resources.) The techniques outlined in Eric&#8217;s article are key to both.</p>
<p>So I&#8217;m going to stay with my more abstract <em>checklists</em>, along which I have very concrete <em>toolboxes</em> such as the &#8220;coding checklist&#8221; in Eric&#8217;s php|architect article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugzappy.com/2009/06/02/a-programmers-pre-launch-checklist-in-phparchitect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Separate PHP Debug Output from HTML Page Content</title>
		<link>http://www.bugzappy.com/2009/04/23/separate-php-debug-output-from-html-page-content/</link>
		<comments>http://www.bugzappy.com/2009/04/23/separate-php-debug-output-from-html-page-content/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 09:21:15 +0000</pubDate>
		<dc:creator>bugzappy</dc:creator>
				<category><![CDATA[MVC]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://www.bugzappy.com/?p=172</guid>
		<description><![CDATA[I wrote a simple class today to help me organize my debug messages in PHP, while keeping the generated HTML intact (mostly). 
Personally, I like to output all the debug messages at the bottom of my html page (structurally speaking, and layout-wise). This way I can see how the output renders for real, and if something [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a simple class today to help me organize my debug messages in PHP, while keeping the generated HTML intact (mostly). </p>
<p>Personally, I like to output all the debug messages at the bottom of my html page (structurally speaking, and layout-wise). This way I can see how the output renders for real, and if something looks fishy I have the luxury of a potentially large set of debug messages that I can read through, looking for fishy stuff.</p>
<p>It&#8217;s just a glorified &#8216;echo&#8217; function; but one which lets you decide where to actually output the debug messages in your generated HTML. Or you can think of it as a mini-logging function, that lasts for the time of just one HTTP response; and as a programmer you can do whatever you want with the &#8216;log&#8217;, i.e. output it any way you like.</p>
<p>In fact it is similar to what placeholders do for you within the Zend_View system, i.e. prepare some output but defer when it is actually outputted. In this case, the output is generated from within the controllers, models, and helper classes though, so that&#8217;s why I had to, in some sense, duplicate what ZF already provides for views.</p>
<p>Here is a quick tutorial:</p>
<p>First, download the <a href="http://www.bugzappy.com/wp-content/uploads/2009/04/debugoutputphp.txt">DebugOutput class</a> and rename the file to DebugOutput.php</p>
<p>In a strategic place in your code (for instance the init method of your controller in Zend Framework), include the php file and set the type of debug output you would like (none, inlined within &lt;pre&gt; &#8230; &lt;/pre&gt;, inlined within &lt;!&#8211; &#8230; &#8211;&gt;, or deferred to your view):</p>
<pre>...
public function init()
{
        require_once '..../DebugOutput.php';

	if ( ... /* if in development mode */ ... )
		DebugOutput::setOutputType(DebugOutput::DEFERRED_OUTPUT );
	else
		DebugOutput::setOutputType(DebugOutput::NO_OUTPUT );
	}
...</pre>
<p> </p>
<p>Then in your code, you call the _debug() function as often as needed:</p>
<pre>...

_debug($thisVariable, 'this variable');

...

_debug($thatVariable, 'that variable');

...</pre>
<p> </p>
<p>Before you rendering engine / view engine / smarty / Zend_View takes over, you make the debug messages available to it in the following fashion (here assuming we are using a Zend Framework Action Controller, i.e. the Zend_Controller_Action class):</p>
<pre>...
public function postDispatch()
{
        ...
    	$this-&gt;view-&gt;debugOutput = DebugOutput::getDeferredOutput();
}
...</pre>
<p> </p>
<p>And finally, at the bottom of your layout / wrapper / main view (in this case my Zend Framework layout), the debug messages are in an array, available to your rendering engine, and so you can treat them like any other output, for instance like this:</p>
<pre>...
&lt;?php if (!empty($this-&gt;debugOutput)) { ?&gt;
&lt;div style="background-color: #ffe0e0;
	width: 96%; padding-left: 2%; padding-right: 2%; padding-top: 50px; padding-bottom: 50px; margin-bottm: 100px;
	border: 1px dotted red; overflow: auto; float: none"&gt;
&lt;p style="font-weight: bold; color: red; text-align: center"&gt;DEBUG INFO&lt;/p&gt;
&lt;pre&gt;
&lt;br /&gt;
&lt;?php     if (is_array($this-&gt;debugOutput))
                    foreach ($this-&gt;debugOutput as $debugElement) { ?&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;?= $debugElement['label'] ?&gt;:
&lt;?= print_r($debugElement['value'], true) ?&gt;
&lt;?php         } ?&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;?php     } ?&gt;
&lt;/body&gt;
...</pre>
<p> </p>
<p>I hope someone finds it useful or gets some better ideas from it. If so, please share :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugzappy.com/2009/04/23/separate-php-debug-output-from-html-page-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
