<?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>shock horror &#187; Web Development</title>
	<atom:link href="http://shock-horror.com/sh/category/all-posts/geeky-stuff/web-development/feed" rel="self" type="application/rss+xml" />
	<link>http://shock-horror.com/sh</link>
	<description></description>
	<lastBuildDate>Fri, 11 May 2007 09:47:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress vs. Luke</title>
		<link>http://shock-horror.com/sh/2006/07/wordpress-vs-luke</link>
		<comments>http://shock-horror.com/sh/2006/07/wordpress-vs-luke#comments</comments>
		<pubDate>Sat, 15 Jul 2006 13:33:50 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Geeky Stuff]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://shock-horror.com/sh/2006/07/wordpress-vs-luke</guid>
		<description><![CDATA[This blog runs the excellent WordPress blogging software. In addition, to be nicer to the system it&#8217;s hosted on (at Dreamhost), I&#8217;ve got the WP-Cache plugin installed (which caches pages so that they don&#8217;t have to be regenerated on every page load.) At the moment I&#8217;ve got things running under CGI, which isn&#8217;t the most [...]]]></description>
			<content:encoded><![CDATA[<p>This blog runs the excellent <a href="http://wordpress.org/" title="Wordpress">WordPress</a> blogging software. In addition, to be nicer to the system it&#8217;s hosted on (at <a href="http://www.dreamhost.com/r.cgi?100504/shared/comparison.html">Dreamhost</a>), I&#8217;ve got the WP-Cache plugin installed (which caches pages so that they don&#8217;t have to be regenerated on every page load.)</p>
<p>At the moment I&#8217;ve got things running under CGI, which isn&#8217;t the most efficient way of doing things (but it&#8217;s easy.)</p>
<p>In order to satisfy my own curiosity, as well as squeeze a little bit more performance out, I tried the other day to get this WordPress install to play nice with PHP running through FastCGI, with the <a href="http://php.net/APC" title="Alternative PHP Cache">APC</a> PHP opcode cache. I say &#8216;tried&#8217; because it was a complete and utter failure. APC and WP-Cache definitely don&#8217;t like each other one little bit.</p>
]]></content:encoded>
			<wfw:commentRss>http://shock-horror.com/sh/2006/07/wordpress-vs-luke/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exceptions &gt; Errors</title>
		<link>http://shock-horror.com/sh/2006/07/exceptions-errors</link>
		<comments>http://shock-horror.com/sh/2006/07/exceptions-errors#comments</comments>
		<pubDate>Fri, 07 Jul 2006 07:01:20 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Geeky Stuff]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://shock-horror.com/sh/2006/07/exceptions-errors</guid>
		<description><![CDATA[Today, whilst working with some PHP code, I wanted to catch an error like an exception. PHP&#8217;s errors are a kludgey solution left-over from before PHP had objects. When PHP 5 introduced proper Exception support, I was overjoyed &#8211; until I learned that all the existing inbuilt PHP functions would continue to trigger errors rather [...]]]></description>
			<content:encoded><![CDATA[<p>Today, whilst working with some PHP code, I wanted to catch an error like an exception.</p>
<p>PHP&#8217;s errors are a kludgey solution left-over from before PHP had objects. When PHP 5 introduced proper Exception support, I was overjoyed &#8211; until I learned that all the existing inbuilt PHP functions would continue to trigger errors rather than throwing exceptions. I understand that it&#8217;s necessary for backwards-compatibility, but it still really,  really sucks when you want to write clean code.</p>
<p>So, today I was writing my own code to convert errors into exceptions when I hit a frustrating roadblock: the PHP Exception class doesn&#8217;t allow you to alter the stack trace. This is a Bad Thing in this case because you must throw the exception inside your error handler &#8211; which means that the stack trace starts at your error handling function, making the entire stack trace bloody useless.</p>
<p>Whilst Googling around I happened upon a few snippets here and there about the existence of an ErrorException in the SPL extension of PHP 5.1+. It is a wonderful thing &#8211; it&#8217;s basically an exception, with the added ability to pass in the stuff passed to a custom error handler, which is then put in the stack trace. It is truly a godsend for debugging.</p>
<p>Anyway, because I have a memory like a sieve and mentions of ErrorException are scarce, here&#8217;s the minimal code to use it:</p>
<p>
<pre style="overflow: auto; font-size: small;">function errorToExeption($errno, $errstr, $errfile, $errline) {
    throw new ErrorException($errstr,0,$errno,$errfile,$errline);
}
set_error_handler('errorToException');</pre>
</p>
<p>That&#8217;s it &#8211; now you can treat any function that triggers errors like it throws exceptions instead. You might like to create a couple of subclasses of ErrorException for errors, warnings, etc. and then throw the appropriate exception inside your error handler. Don&#8217;t forget that a custom error handler can&#8217;t catch every type of error, such as those that might leave PHP in an unstable state, or those that occur inside the Zend Engine before your script is executed.</p>
]]></content:encoded>
			<wfw:commentRss>http://shock-horror.com/sh/2006/07/exceptions-errors/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Doing too many things at once</title>
		<link>http://shock-horror.com/sh/2006/02/doing-too-many-things-at-once</link>
		<comments>http://shock-horror.com/sh/2006/02/doing-too-many-things-at-once#comments</comments>
		<pubDate>Mon, 20 Feb 2006 20:11:38 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Geeky Stuff]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://shock-horror.com/sh/2006/02/doing-too-many-things-at-once</guid>
		<description><![CDATA[Why oh why do I persist in trying to do waaay too many things at once? At the moment I&#8217;ve got three web sites under development. Only one of those (freewebhosters.info) is currently online, and as it is it&#8217;s terrible and doesn&#8217;t get any traffic because of that. Practical Pupil, my student organiser site, is [...]]]></description>
			<content:encoded><![CDATA[<p>Why oh why do I persist in trying to do waaay too many things at once?</p>
<p>At the moment I&#8217;ve got three web sites under development. Only one of those (freewebhosters.info) is currently online, and as it is it&#8217;s terrible and doesn&#8217;t get any traffic because of that. Practical Pupil, my student organiser site, is taking a long time mainly because I can&#8217;t make up my mind as to how to do things.</p>
<p>And to top it all off, I&#8217;m forever suffering from attacks of procrastination and indecision. Gah.</p>
]]></content:encoded>
			<wfw:commentRss>http://shock-horror.com/sh/2006/02/doing-too-many-things-at-once/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.198 seconds -->
