<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Cormac's php blog</title>
	<atom:link href="http://cormacscode.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://cormacscode.wordpress.com</link>
	<description>Web / internet development, mostly using php / mysql</description>
	<lastBuildDate>Fri, 04 Sep 2009 16:24:47 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='cormacscode.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/e1ba374db634d515eb34bb5ebd155481?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Cormac's php blog</title>
		<link>http://cormacscode.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://cormacscode.wordpress.com/osd.xml" title="Cormac&#8217;s php blog" />
		<item>
		<title>Last resort debugging</title>
		<link>http://cormacscode.wordpress.com/2009/09/04/last-resort-debugging/</link>
		<comments>http://cormacscode.wordpress.com/2009/09/04/last-resort-debugging/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 16:24:47 +0000</pubDate>
		<dc:creator>cormacscode</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cormacscode.wordpress.com/?p=138</guid>
		<description><![CDATA[When all else fails, I use The Scientific Method:

comment out half the code
see if I still get the bug
if no then uncomment half the commented-out code and go to step 2
if yes then comment out half the un-commented-out code and go to step 2

It&#8217;s fairly rare I need to do this in php, but currently [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=138&subd=cormacscode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When all else fails, I use The Scientific Method:</p>
<ol>
<li>comment out half the code</li>
<li>see if I still get the bug</li>
<li>if no then uncomment half the commented-out code and go to step 2</li>
<li>if yes then comment out half the <strong>un</strong>-commented-out code and go to step 2</li>
</ol>
<p>It&#8217;s fairly rare I need to do this in php, but currently hacking in vbscript which I don&#8217;t know at all &#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cormacscode.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cormacscode.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cormacscode.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cormacscode.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cormacscode.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cormacscode.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cormacscode.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cormacscode.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cormacscode.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cormacscode.wordpress.com/138/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=138&subd=cormacscode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cormacscode.wordpress.com/2009/09/04/last-resort-debugging/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24d53324159d712ea30f0cbe6e2f3bf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cormacscode</media:title>
		</media:content>
	</item>
		<item>
		<title>phpunit bootstrap not working in windows</title>
		<link>http://cormacscode.wordpress.com/2009/07/08/phpunit-bootstrap-not-working-in-windows/</link>
		<comments>http://cormacscode.wordpress.com/2009/07/08/phpunit-bootstrap-not-working-in-windows/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 15:21:01 +0000</pubDate>
		<dc:creator>cormacscode</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cormacscode.wordpress.com/?p=133</guid>
		<description><![CDATA[While following this tutorial and trying to set up phpunit to work with the Zend Framework, I couldn&#8217;t for the life of me figure out why my phpunit bootstrap seemed to be having no effect whatsoever. When I did figure it out, the problem was an old version of phpunit (3.3.2 instead of 3.3.17) &#8211; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=133&subd=cormacscode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>While following <a title="Unit testing the zend framework" href="http://www.zendcasts.com/unit-testing-with-the-zend-framework-with-zend_test-and-phpunit/2009/06/" target="_blank">this tutorial</a> and trying to set up phpunit to work with the Zend Framework, I couldn&#8217;t for the life of me figure out why my phpunit bootstrap seemed to be having no effect whatsoever. When I did figure it out, the problem was an old version of phpunit (3.3.2 instead of 3.3.17) &#8211; to update it I had to type (on the windows command line)</p>
<pre>pear upgrade pear</pre>
<p>and then</p>
<pre>pear uninstall phpunit/PHPUnit</pre>
<p>and then</p>
<pre>pear install --alldeps phpunit/PHPUnit</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cormacscode.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cormacscode.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cormacscode.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cormacscode.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cormacscode.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cormacscode.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cormacscode.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cormacscode.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cormacscode.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cormacscode.wordpress.com/133/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=133&subd=cormacscode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cormacscode.wordpress.com/2009/07/08/phpunit-bootstrap-not-working-in-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24d53324159d712ea30f0cbe6e2f3bf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cormacscode</media:title>
		</media:content>
	</item>
		<item>
		<title>Enhancing wordpress themes with regular expressions</title>
		<link>http://cormacscode.wordpress.com/2009/06/22/enhancing-wordpress-themes-with-regular-expressions/</link>
		<comments>http://cormacscode.wordpress.com/2009/06/22/enhancing-wordpress-themes-with-regular-expressions/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 12:51:37 +0000</pubDate>
		<dc:creator>cormacscode</dc:creator>
				<category><![CDATA[Open source products]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cormacscode.wordpress.com/?p=131</guid>
		<description><![CDATA[I&#8217;ve been using wordpress quite a bit lately, and didn&#8217;t seem to be able to do something I wanted within the confines of a regular wordpress theme. Regular expressions came to the rescue &#8211; you can just use them in your theme and plugin files to do more-or-less anything you want with the content.
Here&#8217;s how [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=131&subd=cormacscode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve been using <a href="http://www.wordpress.org" target="_blank">wordpress </a>quite a bit lately, and didn&#8217;t seem to be able to do something I wanted within the confines of a regular wordpress theme. Regular expressions came to the rescue &#8211; you can just use them in your theme and plugin files to do more-or-less anything you want with the content.</p>
<p>Here&#8217;s how I extracted the images so that they weren&#8217;t displayed within the post but instead in another div separate from the post text:</p>
<pre>$images = ""; $matches = array();
if (preg_match_all("/(&lt;img[^&gt;]*&gt;)/iUs",$content,$matches)) {
    $images = implode(" ",$matches[1]);
    $content = preg_replace("/&lt;img[^&gt;]*&gt;/iUs","",$content);
}
$content = "&lt;div class=\"text\"&gt;$content&lt;/div&gt;".
           "&lt;div class=\"images\"&gt;$images&lt;/div&gt;\n";</pre>
<p>See what I did? I grabbed all the image tags out of $content with preg_match_all(), put them all into the variable $images, and then got rid of them all in $content using preg_replace(). Then I displayed $content and $images in separate divs.</p>
<p>You can use it on a page level too &#8211; on the index.php page of a theme, say, you can do an ob_start() to buffer the content, then ob_get_clean() it into a variable and manipulate the variable with regular expressions before echoing it out. So, for example, you could extract all the images or links (or whatever) from the content and display them somewhere else on the page.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cormacscode.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cormacscode.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cormacscode.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cormacscode.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cormacscode.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cormacscode.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cormacscode.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cormacscode.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cormacscode.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cormacscode.wordpress.com/131/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=131&subd=cormacscode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cormacscode.wordpress.com/2009/06/22/enhancing-wordpress-themes-with-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24d53324159d712ea30f0cbe6e2f3bf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cormacscode</media:title>
		</media:content>
	</item>
		<item>
		<title>jpg not displaying in nokia browser</title>
		<link>http://cormacscode.wordpress.com/2009/03/30/jpg-not-displaying-in-nokia-browser/</link>
		<comments>http://cormacscode.wordpress.com/2009/03/30/jpg-not-displaying-in-nokia-browser/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 16:57:42 +0000</pubDate>
		<dc:creator>cormacscode</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cormacscode.wordpress.com/?p=126</guid>
		<description><![CDATA[Ok so I&#8217;m doing a mobile website. When my application receives a GET request for an image, it uses wurfl to check the User-Agent header and figure out what phone the user has, then resizes the image accordingly (with caching, obviously).
It seemed to work fine on every phone in the office except my own &#8211; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=126&subd=cormacscode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Ok so I&#8217;m doing a mobile website. When my application receives a GET request for an image, it uses <a href="http://wurfl.sourceforge.net/" target="_blank">wurfl</a> to check the User-Agent header and figure out what phone the user has, then resizes the image accordingly (with caching, obviously).</p>
<p>It seemed to work fine on every phone in the office except my own &#8211; on mine (a basic nokia 2600) the image seemed to download, but just wouldn&#8217;t display (I was left with a correctly-sized blank instead). I could see the image was being generated and cached, and I could even save it on the phone, but when I tried to look at it it wouldn&#8217;t display.</p>
<p>Discovered it worked ok for gifs, and eventually I figured out the problem was jpeg image interlacing. The phone doesn&#8217;t seem to support it &#8211; turned it off and it works fine.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cormacscode.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cormacscode.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cormacscode.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cormacscode.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cormacscode.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cormacscode.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cormacscode.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cormacscode.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cormacscode.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cormacscode.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=126&subd=cormacscode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cormacscode.wordpress.com/2009/03/30/jpg-not-displaying-in-nokia-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24d53324159d712ea30f0cbe6e2f3bf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cormacscode</media:title>
		</media:content>
	</item>
		<item>
		<title>li bullets displaying in wrong place in IE</title>
		<link>http://cormacscode.wordpress.com/2009/03/13/li-bullets-displaying-in-wrong-place-in-ie/</link>
		<comments>http://cormacscode.wordpress.com/2009/03/13/li-bullets-displaying-in-wrong-place-in-ie/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 14:14:27 +0000</pubDate>
		<dc:creator>cormacscode</dc:creator>
				<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://cormacscode.wordpress.com/?p=122</guid>
		<description><![CDATA[If the bullets are showing at the bottom rather than the top of your list items in Internet Explorer and ok in Firefox, then most likely your &#60;li&#62; items have a property called &#8220;layout&#8221;. The hasLayout property gets set by IE depending on the css and can&#8217;t be changed directly &#8211; the few times it&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=122&subd=cormacscode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If the bullets are showing at the bottom rather than the top of your list items in Internet Explorer and ok in Firefox, then most likely your &lt;li&gt; items have a property called &#8220;layout&#8221;. The hasLayout property gets set by IE depending on the css and can&#8217;t be changed directly &#8211; the few times it&#8217;s happened to me (with css written by someone else), I&#8217;ve fixed it by removing &#8220;li { display: inline-block; }&#8221; from the css.</p>
<p>You can find a detailed explanation of the hasLayout property on <a class="moz-txt-link-freetext" href="http://www.satzansatz.de/cssd/onhavinglayout.html">http://www.satzansatz.de/cssd/onhavinglayout.html</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cormacscode.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cormacscode.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cormacscode.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cormacscode.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cormacscode.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cormacscode.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cormacscode.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cormacscode.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cormacscode.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cormacscode.wordpress.com/122/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=122&subd=cormacscode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cormacscode.wordpress.com/2009/03/13/li-bullets-displaying-in-wrong-place-in-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24d53324159d712ea30f0cbe6e2f3bf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cormacscode</media:title>
		</media:content>
	</item>
		<item>
		<title>Triggers within php objects using the __set() magic method</title>
		<link>http://cormacscode.wordpress.com/2009/02/03/triggers-within-php-objects-using-the-__set-magic-method/</link>
		<comments>http://cormacscode.wordpress.com/2009/02/03/triggers-within-php-objects-using-the-__set-magic-method/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 13:24:19 +0000</pubDate>
		<dc:creator>cormacscode</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cormacscode.wordpress.com/?p=80</guid>
		<description><![CDATA[I don&#8217;t know if &#8220;trigger&#8221; is the right word for this behaviour, but if you want to automatically cause something to happen when an object variable is updated you can do so like this:
&#60;?php
class classWithTrigger
{
    private $varOne = 0;
    private $varTwo = 0;

    public function __set($varName,$varValue)
 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=80&subd=cormacscode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I don&#8217;t know if &#8220;trigger&#8221; is the right word for this behaviour, but if you want to automatically cause something to happen when an object variable is updated you can do so like this:</p>
<pre>&lt;?php
class classWithTrigger
{
    private $varOne = 0;
    private $varTwo = 0;

    public function __set($varName,$varValue)
    {
        $this-&gt;$varName = $varValue;
        if ($varName == "varOne") {
            $this-&gt;varTwo = $this-&gt;varOne * 9;
        }
    }

    public function __get($varValue)
    {
        return $this-&gt;$varValue;
    }
}

$test = new classWithTrigger;

echo $test-&gt;varOne; // Outputs 0
echo $test-&gt;varTwo; // Outputs 0

$test-&gt;varOne = 1;

echo $test-&gt;varOne; // Outputs 1
echo $test-&gt;varTwo; // Outputs 9</pre>
<p>The __get() method gets called whenever an attempt is made (from outside the class) to get the value of an undefined or inaccessible (private or protected) variable &#8211; in this case it just returns the value as it would if the variable was public. Similarly, the __set() method gets called whenever an attempt is made (from outside the class) to <strong>set</strong> the value of an undefined or inaccessible variable. As you can see, you can use the fact that this gets called to trigger something, whether it&#8217;s an update to another object variable like here, or a DB update, or anything else you can think of.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cormacscode.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cormacscode.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cormacscode.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cormacscode.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cormacscode.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cormacscode.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cormacscode.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cormacscode.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cormacscode.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cormacscode.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=80&subd=cormacscode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cormacscode.wordpress.com/2009/02/03/triggers-within-php-objects-using-the-__set-magic-method/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24d53324159d712ea30f0cbe6e2f3bf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cormacscode</media:title>
		</media:content>
	</item>
		<item>
		<title>Read-only object variables in php using magic methods</title>
		<link>http://cormacscode.wordpress.com/2009/01/22/read-only-object-variables-in-php-using-magic-methods/</link>
		<comments>http://cormacscode.wordpress.com/2009/01/22/read-only-object-variables-in-php-using-magic-methods/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 14:03:24 +0000</pubDate>
		<dc:creator>cormacscode</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cormacscode.wordpress.com/?p=78</guid>
		<description><![CDATA[You can create read-only object variables by using the &#8220;private&#8221; keyword and the __get() and __set() magic methods like this:
&#60;?php
class classWithReadOnlyVar
{
    private $readOnlyVar;

    public function __get($varName)
    {
        return $this-&#62;$varName;
    }

    public function __set($varName,$varValue)
 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=78&subd=cormacscode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>You can create read-only object variables by using the &#8220;private&#8221; keyword and the __get() and __set() magic methods like this:</p>
<pre>&lt;?php
class classWithReadOnlyVar
{
    private $readOnlyVar;

    public function __get($varName)
    {
        return $this-&gt;$varName;
    }

    public function __set($varName,$varValue)
    {
    }
}</pre>
<p>So now classWithReadOnlyVar::readOnlyVar is only settable from inside the class, but you can read it from anywhere. For example, if you add the above constructor to the code above:</p>
<pre>    public function __construct()
    {
        $this-&gt;readOnlyVar = "foo";
    }</pre>
<p>Then the following code:</p>
<pre>$test = new classWithReadOnlyVar();
echo $test-&gt;readOnlyVar;

$test-&gt;readOnlyVar = "bar";
echo $test-&gt;readOnlyVar;</pre>
<p>has this output:</p>
<pre>foo
foo</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cormacscode.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cormacscode.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cormacscode.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cormacscode.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cormacscode.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cormacscode.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cormacscode.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cormacscode.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cormacscode.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cormacscode.wordpress.com/78/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=78&subd=cormacscode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cormacscode.wordpress.com/2009/01/22/read-only-object-variables-in-php-using-magic-methods/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24d53324159d712ea30f0cbe6e2f3bf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cormacscode</media:title>
		</media:content>
	</item>
		<item>
		<title>Create a select option using javascript with the euro symbol in the text</title>
		<link>http://cormacscode.wordpress.com/2008/12/05/create-a-select-option-usin-javascript-with-the-euro-symbol-in-the-text/</link>
		<comments>http://cormacscode.wordpress.com/2008/12/05/create-a-select-option-usin-javascript-with-the-euro-symbol-in-the-text/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 15:49:59 +0000</pubDate>
		<dc:creator>cormacscode</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://cormacscode.wordpress.com/?p=75</guid>
		<description><![CDATA[This didn&#8217;t work:
new Option("€"+value,value);
Neither did this:
new Option("&#38;euro;"+value,value);
But this did:
new Option("\u20AC"+value,value);
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=75&subd=cormacscode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This didn&#8217;t work:</p>
<pre>new Option("€"+value,value);</pre>
<p>Neither did this:</p>
<pre>new Option("&amp;euro;"+value,value);</pre>
<p>But this did:</p>
<pre>new Option("\u20AC"+value,value);</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cormacscode.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cormacscode.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cormacscode.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cormacscode.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cormacscode.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cormacscode.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cormacscode.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cormacscode.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cormacscode.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cormacscode.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=75&subd=cormacscode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cormacscode.wordpress.com/2008/12/05/create-a-select-option-usin-javascript-with-the-euro-symbol-in-the-text/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24d53324159d712ea30f0cbe6e2f3bf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cormacscode</media:title>
		</media:content>
	</item>
		<item>
		<title>Zend_Db_Adapter::update() returns number of rows in which values have been changed</title>
		<link>http://cormacscode.wordpress.com/2008/12/05/zend_db_adapterupdate-returns-number-of-rows-in-which-values-have-been-changed/</link>
		<comments>http://cormacscode.wordpress.com/2008/12/05/zend_db_adapterupdate-returns-number-of-rows-in-which-values-have-been-changed/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 11:10:54 +0000</pubDate>
		<dc:creator>cormacscode</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cormacscode.wordpress.com/?p=70</guid>
		<description><![CDATA[&#8230; and not the number of rows that match the conditions.
Just so you know. Caught me out for a while there &#8211; I was using the return value from update() to check that certain values (including a timestamp) were set correctly while at the same time updating the timestamp, but if the method got called [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=70&subd=cormacscode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&#8230; and not the number of rows that match the conditions.</p>
<p>Just so you know. Caught me out for a while there &#8211; I was using the return value from update() to check that certain values (including a timestamp) were set correctly while at the same time updating the timestamp, but if the method got called twice in a second I&#8217;d get zero as a return value the 2nd time because the timestamp was the same and so no values were being changed.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cormacscode.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cormacscode.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cormacscode.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cormacscode.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cormacscode.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cormacscode.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cormacscode.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cormacscode.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cormacscode.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cormacscode.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=70&subd=cormacscode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cormacscode.wordpress.com/2008/12/05/zend_db_adapterupdate-returns-number-of-rows-in-which-values-have-been-changed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24d53324159d712ea30f0cbe6e2f3bf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cormacscode</media:title>
		</media:content>
	</item>
		<item>
		<title>Show / hide table row in Firefox versus IE</title>
		<link>http://cormacscode.wordpress.com/2008/11/28/show-hide-table-row-in-firefox-versus-ie/</link>
		<comments>http://cormacscode.wordpress.com/2008/11/28/show-hide-table-row-in-firefox-versus-ie/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 16:08:20 +0000</pubDate>
		<dc:creator>cormacscode</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://cormacscode.wordpress.com/?p=68</guid>
		<description><![CDATA[Hiding a table row is fine, just set document.getElementById(&#8216;theRow&#8217;).style.display = &#8216;none&#8217;
When you&#8217;re trying to show it though, it can get confusing &#8211; for it to display properly, you&#8217;ve to set display=&#8217;table-row&#8217; for Firefox and display=&#8217;block&#8217; for IE.
The solution? Set display=&#8221; and the display property for the element gets set to its default (&#8216;table-row&#8217; for FF [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=68&subd=cormacscode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hiding a table row is fine, just set document.getElementById(&#8216;theRow&#8217;).style.display = &#8216;none&#8217;</p>
<p>When you&#8217;re trying to show it though, it can get confusing &#8211; for it to display properly, you&#8217;ve to set display=&#8217;table-row&#8217; for Firefox and display=&#8217;block&#8217; for IE.</p>
<p>The solution? Set display=&#8221; and the display property for the element gets set to its default (&#8216;table-row&#8217; for FF and &#8216;block&#8217; for Explorer).</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cormacscode.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cormacscode.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cormacscode.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cormacscode.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cormacscode.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cormacscode.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cormacscode.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cormacscode.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cormacscode.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cormacscode.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cormacscode.wordpress.com&blog=2020920&post=68&subd=cormacscode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cormacscode.wordpress.com/2008/11/28/show-hide-table-row-in-firefox-versus-ie/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/24d53324159d712ea30f0cbe6e2f3bf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cormacscode</media:title>
		</media:content>
	</item>
	</channel>
</rss>