<?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>Untitled &#187; programming</title>
	<atom:link href="http://ammonlauritzen.com/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://ammonlauritzen.com/blog</link>
	<description>and still for good reason.</description>
	<lastBuildDate>Wed, 05 May 2010 18:43:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>virtualbox rules</title>
		<link>http://ammonlauritzen.com/blog/2010/03/10/virtualbox-rules/</link>
		<comments>http://ammonlauritzen.com/blog/2010/03/10/virtualbox-rules/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 21:42:23 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=1111</guid>
		<description><![CDATA[Nothing much to say here, but with absolutely minimal pain and suffering, I have 64-bit linux virtual machines running on top of my 32-bit windows XP install. This pleases me.
The recipe:

Compatible CPU with VT-x/AMD-V enabled in the BIOS
Innotek/Oracle/Sun VirtualBox (a current version) with hardware virtualization enabled
Profit!

The one downside to this? 64-bit VM&#8217;s running on 32-bit [...]]]></description>
			<content:encoded><![CDATA[<p>Nothing much to say here, but with absolutely minimal pain and suffering, I have 64-bit linux virtual machines running on top of my 32-bit windows XP install. This pleases me.</p>
<p>The recipe:</p>
<ol>
<li>Compatible CPU with VT-x/AMD-V enabled in the BIOS</li>
<li>Innotek/Oracle/Sun VirtualBox (a current version) with hardware virtualization enabled</li>
<li>Profit!</li>
</ol>
<p>The one downside to this? 64-bit VM&#8217;s running on 32-bit host OS can&#8217;t see multiple cpu&#8217;s. Boo. Hoo. I&#8217;ll just run more VM&#8217;s!</p>
<p><a href="http://ammonlauritzen.com/blog/wp-content/uploads/2010/03/centos-installer-64-virtualbox.png"><img src="http://ammonlauritzen.com/blog/wp-content/uploads/2010/03/centos-installer-64-virtualbox-300x250.png" alt="64-bit centos installer" title="centos-installer-64-virtualbox" width="300" height="250" class="alignnone size-medium wp-image-1112" /></a> <a href="http://ammonlauritzen.com/blog/wp-content/uploads/2010/03/ubuntu-64-virtualbox.png"><img src="http://ammonlauritzen.com/blog/wp-content/uploads/2010/03/ubuntu-64-virtualbox-300x250.png" alt="64-bit ubuntu livecd" title="ubuntu-64-virtualbox" width="300" height="250" class="alignnone size-medium wp-image-1113" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2010/03/10/virtualbox-rules/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>dead simple traditional style rotation</title>
		<link>http://ammonlauritzen.com/blog/2010/02/05/dead-simple-traditional-style-rotation/</link>
		<comments>http://ammonlauritzen.com/blog/2010/02/05/dead-simple-traditional-style-rotation/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 17:51:26 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[logfiles]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=1105</guid>
		<description><![CDATA[In response to my two-step rotation post earlier this week, I figure I may as well share the logic I use for a more traditional logfile rotation scheme.
I think this is as simple as I can possibly make it:

&#60;?
define( 'MAX_COPIES', 3 );
$back_fname = &#34;/path/to/log/file/abc.log&#34;;

function trace( $msg ) {
    echo &#34;- $msg\n&#34;;
}

exec( &#34;ls [...]]]></description>
			<content:encoded><![CDATA[<p>In response to <a href='http://ammonlauritzen.com/blog/2010/02/03/simple-two-step-logfile-rotation/'>my two-step rotation post</a> earlier this week, I figure I may as well share the logic I use for a more traditional logfile rotation scheme.</p>
<p>I think this is as simple as I can possibly make it:</p>
<pre class="brush: php;">
&lt;?
define( 'MAX_COPIES', 3 );
$back_fname = &quot;/path/to/log/file/abc.log&quot;;

function trace( $msg ) {
    echo &quot;- $msg\n&quot;;
}

exec( &quot;ls -r ${back_fname}*&quot;, $copies, $succ );
while( count($copies) &gt;= MAX_COPIES ) {
    $fname = array_shift($copies);
    trace( &quot;deleting &quot;.$fname );
}
$next = count($copies);
while( $fname = array_shift($copies) ) {
    --$next;
    trace( &quot;rotating $fname -&gt; $next&quot; );
    rename( $fname, &quot;$back_fname.$next&quot; );
}

trace( &quot;creating $back_fname&quot; );
touch( $back_fname );
?&gt;
</pre>
<p>A sample series of executions might look like this:</p>
<pre class="brush: plain;">
ammon@wernstrom:/path/to/log/file$ touch abc.log
ammon@wernstrom:/path/to/log/file$ php rotate.php
- rotating /path/to/log/file/abc.log -&gt; 0
- creating /path/to/log/file/abc.log
ammon@wernstrom:/path/to/log/file$ php rotate.php
- rotating /path/to/log/file/abc.log.0 -&gt; 1
- rotating /path/to/log/file/abc.log -&gt; 0
- creating /path/to/log/file/abc.log
ammon@wernstrom:/path/to/log/file$ php rotate.php
- rotating /path/to/log/file/abc.log.1 -&gt; 2
- rotating /path/to/log/file/abc.log.0 -&gt; 1
- rotating /path/to/log/file/abc.log -&gt; 0
- creating /path/to/log/file/abc.log
ammon@wernstrom:/path/to/log/file$ php rotate.php
- deleting /path/to/log/file/abc.log.2
- rotating /path/to/log/file/abc.log.1 -&gt; 2
- rotating /path/to/log/file/abc.log.0 -&gt; 1
- rotating /path/to/log/file/abc.log -&gt; 0
- creating /path/to/log/file/abc.log
</pre>
<p>This doesn&#8217;t have any failsafes, doesn&#8217;t compress anything, depends on an external call to &#8216;ls&#8217;, and it actually deletes old files in stead of overwriting them&#8230; but it is the shortest, simplest method I&#8217;ve come up with to get the job done.</p>
<p>If I feel like making this a full-fledged series, I might actually post a more thorough implementation later <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2010/02/05/dead-simple-traditional-style-rotation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>simple two-step logfile rotation</title>
		<link>http://ammonlauritzen.com/blog/2010/02/03/simple-two-step-logfile-rotation/</link>
		<comments>http://ammonlauritzen.com/blog/2010/02/03/simple-two-step-logfile-rotation/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 19:23:08 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[logfiles]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=1103</guid>
		<description><![CDATA[This is the result of 10 minutes of pounding on the keyboard after yet another disappointing experience with trying to get logrotate to do something vaguely more flexible.
This simple script scans all normal files in a log directory, and if they are older than a certain cutoff, moves them into a holding directory for old [...]]]></description>
			<content:encoded><![CDATA[<p>This is the result of 10 minutes of pounding on the keyboard after yet another disappointing experience with trying to get logrotate to do something vaguely more flexible.</p>
<p>This simple script scans all normal files in a log directory, and if they are older than a certain cutoff, moves them into a holding directory for old logs. Future passes will check files in the old directory for another age setting and will delete them. That&#8217;s all there is to it.</p>
<p>Configure your cutoffs, directories of interest, and optionally plug in a better logging mechanism and you&#8217;re set. (Oh, and change the #! if necessary, of course).</p>
<pre class="brush: php;">
#!/usr/bin/php
&lt;?
$cutoff_rotate = &quot;3 days&quot;;
$cutoff_delete = &quot;7 days&quot;;
$dir_log = &quot;/logs&quot;;
$dir_old = &quot;/logs.old&quot;;

function trace( $msg, $debug = FALSE ) {
	// appropriate logging mechanism can be plugged in here
	echo &quot;[] $msg\n&quot;;
}

// scan old files for deletion
if( is_dir($dir_old) ) {
	$dh = opendir( $dir_old );
	if( $dh !== FALSE ) {
		chdir( $dir_old );
		trace( &quot;scanning $dir_old for logs more than $cutoff_delete old&quot; );
		$cutoff = strtotime( &quot;-$cutoff_delete&quot; );
		trace( &quot;cutoff is &quot;.date('r',$cutoff) );
		while( ($file = readdir($dh)) !== FALSE ) {
			if( is_dir($file) ) {
				trace( &quot;skipping $file&quot;, true );
				continue;
			} else {
				$ts = filemtime($file);
				if( $ts &lt; $cutoff ) {
					trace( &quot;deleting $file, &quot;.date('r',$ts) );
					$succ = @unlink($file);
					if( !$succ )
						trace( &quot;failed to unlink $file!&quot; );
				} else {
					trace( &quot;ignoring $file, &quot;.date('r',$ts), true );
				}
			}
		}
	}
	closedir( $dh );
} else {
	trace( &quot;no old log dir $dir_old to scan yet&quot; );
}

// scan current files for rotation
if( file_exists($dir_old) ) {
	trace( &quot;creating $dir_old&quot; );
	$succ = @mkdir( $dir_old, 0775, true );
	if( !$succ ) {
		trace( &quot;mkdir failed, aborting rotation&quot; );
		exit( 1 );
	}
}
if( is_dir($dir_log) ) {
	$dh = opendir( $dir_log );
	if( $dh !== FALSE ) {
		chdir( $dir_log );
		trace( &quot;scanning $dir_log for logs more than $cutoff_rotate old&quot; );
		$cutoff = strtotime( &quot;-$cutoff_delete&quot; );
		trace( &quot;cutoff is &quot;.date('r',$cutoff) );
		while( ($file = readdir($dh)) !== FALSE ) {
			if( is_dir($file) ) {
				trace( &quot;skipping $file&quot;, true );
				continue;
			} else {
				$ts = filemtime($file);
				if( $ts &lt; $cutoff ) {
					trace( &quot;rotating $file, &quot;.date('r',$ts), true );
					$succ = @rename( $file, $dir_old );
					if( !$succ )
						trace( &quot;failed to rotate $file!&quot; );
				} else {
					trace( &quot;ignoring $file, &quot;.date('r',$ts), true );
				}
			}
		}
	}
	closedir( $dh );
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2010/02/03/simple-two-step-logfile-rotation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>lazy php profiler</title>
		<link>http://ammonlauritzen.com/blog/2010/01/12/lazy-php-profiler/</link>
		<comments>http://ammonlauritzen.com/blog/2010/01/12/lazy-php-profiler/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 01:06:56 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=1096</guid>
		<description><![CDATA[Caveman profiling with a side of &#8220;where were you at 9pm on the night in question?&#8221; As always, season to taste.

&#60;?
$_profile_log = &#34;/tmp/php-profile.log&#34;;

function _profile() {
    static $fh;
    if( !isset($fh) ) {
        global $_profile_log;
        if( !file_exists($_profile_log) [...]]]></description>
			<content:encoded><![CDATA[<p>Caveman profiling with a side of &#8220;where were you at 9pm on the night in question?&#8221; As always, season to taste.</p>
<pre class="brush: php;">
&lt;?
$_profile_log = &quot;/tmp/php-profile.log&quot;;

function _profile() {
    static $fh;
    if( !isset($fh) ) {
        global $_profile_log;
        if( !file_exists($_profile_log) ) {
            @touch( $_profile_log );
            @chmod( $_profile_log, 0664 );
        }
        $fh = @fopen( $_profile_log, &quot;a&quot; );
    }
    if( !$fh )
        return false;

    $stack = debug_backtrace();
    if( $stack[1] )
        $base = $stack[1];
    else
        $base = $stack[0];
    $buf = $base['file'].&quot;:&quot;.$base['line'].&quot;, &quot;;
    if( $base['class'] )
        $buf .= $base['class'].$base['type'];
    $buf .= $base['function'];

    $buf = sprintf(&quot;[%s] %s\n&quot;,date(&quot;H:i:s&quot;),$buf);
    return @fwrite( $fh, $buf );
}
?&gt;
</pre>
<p><span id="more-1096"></span><br />
Sample use:</p>
<pre class="brush: php;">
&lt;?
require_once &quot;profiler.php&quot;;

// setup
function func() {
    _profile();
}

class obj {
    function method() {
        _profile();
    }
    function other_method() {
        func();
    }
    function indirect_method() {
        $this-&gt;method();
    }
}

$obj = new obj();

// actual invocation cases
_profile();
func();
obj::method();
$obj-&gt;method();
$obj-&gt;other_method();
$obj-&gt;indirect_method();
?&gt;
</pre>
<p>Output:</p>
<pre class="brush: plain;">
ammon@elzar:~$ cat /tmp/php-profile.log
[19:00:21] /home/ammon/test.php:20, _profile
[19:00:21] /home/ammon/test.php:21, func
[19:00:21] /home/ammon/test.php:22, obj::method
[19:00:21] /home/ammon/test.php:24, obj-&gt;method
[19:00:21] /home/ammon/test.php:13, func
[19:00:21] /home/ammon/test.php:16, obj-&gt;method
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2010/01/12/lazy-php-profiler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>report-storage.sh</title>
		<link>http://ammonlauritzen.com/blog/2009/10/14/report-storagesh/</link>
		<comments>http://ammonlauritzen.com/blog/2009/10/14/report-storagesh/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 20:55:13 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=552</guid>
		<description><![CDATA[In the grand tradition of my publishing little building-block shell scripts of interest, here goes another one. This is a simple cron job that I run daily on a number of hosts to generate storage usage growth. (This is in addition to Cacti and Nagios which poll some of this data already but for different [...]]]></description>
			<content:encoded><![CDATA[<p>In the grand tradition of my publishing little building-block shell scripts of interest, here goes another one. This is a simple cron job that I run daily on a number of hosts to generate storage usage growth. (This is in addition to Cacti and Nagios which poll some of this data already but for different reasons and with different granularity).</p>
<p>The FILES variable should be populated with a whitespace separated list of files, directories, and block devices to track.</p>
<p>The DB_ABCD variables should be populated with appropriate credentials to talk to a mysql server.</p>
<p>The actual script looks something like this:</p>
<pre class="brush: bash;">
#!/bin/bash

FILES='/var/lib/mysql/ibdata1 /var/lib/mysql/db/table.ibd /dev/sda1 /var/log/mysql'

LOCAL=`hostname -s`
DB_HOST='aaa'
DB_USER='bbb'
DB_PASS='ccc'

function insert {
    FILE=$1
    SIZE=$2
    QUERY=&quot;replace into metrics.storage_usage values( now(), '$LOCAL', '$FILE', $SIZE )&quot;
    mysql --host=${DB_HOST} --user=${DB_USER} --password=&quot;${DB_PASS}&quot; -e &quot;${QUERY}&quot;
}

for FILE in $FILES
do
    if [ -d $FILE ]; then
        BASE=$FILE
        SIZE=`du -ks $FILE/ | awk '{print $1}'`
    elif [ -b $FILE ]; then
        TMP=`df -k -P $FILE | tail -n1 | awk '{print $3 &quot; &quot; $6}'`
        SIZE=`echo $TMP | awk '{print $1}'`
        BASE=`echo $TMP | awk '{print $2}'`
    else
        BASE=`basename $FILE`
        SIZE=`du -k $FILE | awk '{print $1}'`
    fi

    echo &quot;$BASE = $SIZE&quot;
    insert $BASE $SIZE
done
</pre>
<p>I am putting my data into a table called &#8220;storage_usage&#8221; in a database called &#8220;metrics&#8221;:</p>
<pre class="brush: sql;">
CREATE TABLE `storage_usage` (
  `ts` date NOT NULL,
  `host` varchar(25) NOT NULL,
  `file` varchar(64) NOT NULL,
  `size` int(10) unsigned NOT NULL COMMENT 'in kbytes',
  PRIMARY KEY (`ts`,`host`,`file`)
)
</pre>
<p>Obviously, this could be tweaked in any different number of ways, based on your needs. One tweak you might want to consider if you&#8217;re running it in a daily cron is to remove the echo so you don&#8217;t get an email report of every run. Also, if you might want to record more than one snapshot per file per host per day &#8211; in the which case you probably need to change the type of the timestamp column to a datetime. Or there might be cases where you want to change the replace to an insert or&#8230; whatever <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2009/10/14/report-storagesh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>init.d template</title>
		<link>http://ammonlauritzen.com/blog/2009/06/18/initd-template/</link>
		<comments>http://ammonlauritzen.com/blog/2009/06/18/initd-template/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 17:29:31 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[init.d]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=512</guid>
		<description><![CDATA[This is a rudimentary template that I&#8217;ve been using for very quick and dirty /etc/init.d scripts recently.
It works under the assumption that your server daemon has a unique name and only ever runs a single instance &#8211; this also means that the binary and the init.d script cannot share a name &#8211; otherwise strange things [...]]]></description>
			<content:encoded><![CDATA[<p>This is a rudimentary template that I&#8217;ve been using for very quick and dirty /etc/init.d scripts recently.</p>
<p>It works under the assumption that your server daemon has a unique name and only ever runs a single instance &#8211; this also means that the binary and the init.d script cannot share a name &#8211; otherwise strange things happen <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Actual invocation logic may need to be updated on a per-service basis and chkconfig style headers would have to be added manually, but it works well for what it is.</p>
<pre class="brush: bash;">
#!/bin/bash

DIR=''	# path to the daemon executable
CMD=''	# name of the command itself
ARG=''	# optional. any arguments to pass when starting
NAM=''	# descriptive name of the daemon so it shows up pretty

function get_ps {
	ps --no-header -C${CMD}
}

function do_start {
	echo -n &quot;Starting ${NAM}... &quot;
	cd ${DIR}
	nohup ./${CMD} ${ARG} &amp;
	SUCC=`get_ps | wc -l`
	if [ &quot;1&quot; == &quot;$SUCC&quot; ]; then
		echo &quot;[SUCCESS]&quot;
	else
		echo &quot;[FAILURE]&quot;
	fi
}

function do_stop {
	echo -n &quot;Stopping ${NAM}... &quot;
	PID=`get_ps | awk '{print $1}'`
	kill $PID
	SUCC=`get_ps | wc -l`
	if [ &quot;0&quot; == &quot;$SUCC&quot; ]; then
		echo &quot;[SUCCESS]&quot;
	else
		echo &quot;[FAILURE]&quot;
	fi
}

case &quot;${1:-''}&quot; in
	'start')
		do_start
		;;
	'stop')
		do_stop
		;;
	'restart')
		do_stop
		do_start
		;;
	*)
		#echo &quot;Usage: $SELF start|stop|restart|reload|force-reload|status&quot;
		echo &quot;Usage: $SELF start|stop|restart&quot;
		exit 1
		;;
esac
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2009/06/18/initd-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gearman 0.3 php extension api</title>
		<link>http://ammonlauritzen.com/blog/2009/05/26/gearman-03-php-extension-api/</link>
		<comments>http://ammonlauritzen.com/blog/2009/05/26/gearman-03-php-extension-api/#comments</comments>
		<pubDate>Tue, 26 May 2009 21:10:17 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[gearman]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=500</guid>
		<description><![CDATA[No real preamble to be made here. Gearman is a distributed job queuing system by the fine folks who brought us memcached. It is nicer than anything else I&#8217;ve looked at. I am attempting to switch one of my projects over to it (replacing a crufty curl + unix sockets + memcached monstrosity that attempted [...]]]></description>
			<content:encoded><![CDATA[<p>No real preamble to be made here. <a href='http://gearman.org'>Gearman</a> is a distributed job queuing system by the <a href='http://danga.com/'>fine folks</a> who brought us <a href='http://danga.com/memcached/'>memcached</a>. It is nicer than anything else I&#8217;ve looked at. I am attempting to switch one of my projects over to it (replacing a crufty curl + unix sockets + memcached monstrosity that attempted to do the same job).</p>
<p>The documentation is lacking, but if the discussion group is any indication, real docs are a high priority for the project team. Today, I visited the IRC channel to ask for a status update on docs for the PHP extension api (as opposed to the PEAR all-script api, whose auto-generated docs are broken). Turns out my suspicions were right. Documentation is a high priority and none currently exists for the api in question. However&#8230; I was informed that the classes support reflection&#8230; so <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>A quick grep of the source for the extension tells me that I am looking at four classes: GearmanClient, GearmanWorker, GearmanJob, and GearmanTask. A ridiculously short php script later&#8230;</p>
<pre class="brush: php;">
&lt;?
Reflection::export( new ReflectionClass('GearmanWorker') );
Reflection::export( new ReflectionClass('GearmanClient') );
Reflection::export( new ReflectionClass('GearmanJob') );
Reflection::export( new ReflectionClass('GearmanTask') );
?&gt;
</pre>
<p>And I can at least try to make a human readable list of available methods.</p>
<h3>GearmanWorker</h3>
<ul>
<li>__construct()</li>
<li>clone()</li>
<li>error()</li>
<li>returnCode()</li>
<li>setOptions( $option, $data )</li>
<li>addServer( $host, $port ) &#8211; both args optional, examples say defaults are localhost on port 4730.</li>
<li>addFunction( $function_name, $function, $data, $timeout ) &#8211; data and timeout optional</li>
<li>work()</li>
</ul>
<h3>GearmanClient</h3>
<ul>
<li>__construct()</li>
<li>clone()</li>
<li>error()</li>
<li>setOptions( $option, $data )</li>
<li>addServer( $host, $port ) &#8211; reflection says REQUIRED, however the provided examples and personal experience says otherwise</li>
<li>do( $function_name, $workload, $unique ) &#8211; unique is optional</li>
<li>doHigh( $function_name, $workload, $unique ) &#8211; unique is optional</li>
<li>doLow( $function_name, $workload, $unique ) &#8211; unique is optional</li>
<li>doJobHandle()</li>
<li>doStatus()</li>
<li>doBackground( $function_name, $workload, $unique ) &#8211; unique is optional</li>
<li>doHighBackground( $function_name, $workload, $unique ) &#8211; unique is optional</li>
<li>doLowBackground( $function_name, $workload, $unique ) &#8211; unique is optional</li>
<li>jobStatus( $job_handle )</li>
<li>echo( $workload )</li>
<li>addTask( $function_name, $workload, $data, $unique ) &#8211; data and unique are optional</li>
<li>addTaskHigh( $function_name, $workload, $data, $unique ) &#8211; data and unique are optional</li>
<li>addTaskLow( $function_name, $workload, $data, $unique ) &#8211; data and unique are optional</li>
<li>addTaskBackground( $function_name, $workload, $data, $unique ) &#8211; data and unique are optional</li>
<li>addTaskHighBackground( $function_name, $workload, $data, $unique ) &#8211; data and unique are optional</li>
<li>addTaskLowBackground( $function_name, $workload, $data, $unique ) &#8211; data and unique are optional</li>
<li>addTaskStatus( $job_handle, $data ) &#8211; data is optional</li>
<li>setWorkloadCallback( $callback )</li>
<li>setCreatedCallback( $callback)</li>
<li>setClientCallback( $callback)</li>
<li>setWarningCallback( $callback)</li>
<li>setStatusCallback( $callback)</li>
<li>setCompleteCallback( $callback)</li>
<li>setExceptionCallback( $callback)</li>
<li>setFailCallback( $callback)</li>
<li>clearCallbacks()</li>
<li>data()</li>
<li>setData( $data )</li>
<li>runTasks()</li>
</ul>
<h3>GearmanJob</h3>
<ul>
<li>__construct()</li>
<li>returnCode()</li>
<li>workload()</li>
<li>workloadSize()</li>
<li>warning( $warning )</li>
<li>status( $numerator, $denominator )</li>
<li>handle()</li>
<li>unique()</li>
<li>data( $data )</li>
<li>complete( $result )</li>
<li>exception( $exception )</li>
<li>fail()</li>
<li>functionName()</li>
<li>setReturn( $gearman_return_t )</li>
</ul>
<h3>GearmanTask</h3>
<ul>
<li>__construct()</li>
<li>returnCode()</li>
<li>create()</li>
<li>free()</li>
<li>function()</li>
<li>uuid()</li>
<li>jobHandle()</li>
<li>isKnown()</li>
<li>isRunning()</li>
<li>taskNumerator()</li>
<li>taskDenominator()</li>
<li>data()</li>
<li>dataSize()</li>
<li>takeData( $task_object ) &#8211; optional</li>
<li>sendData( $data )</li>
<li>recvData( $data_len )</li>
</ul>
<p>The extension also appears to expose all constants defined in the C api.</p>
<p>I have since added this to the official <a href='http://www.gearman.org/doku.php?id=php_reflection'>wiki</a> &#8211; so there are at least SOME docs on the site now <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2009/05/26/gearman-03-php-extension-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php autoload</title>
		<link>http://ammonlauritzen.com/blog/2008/10/28/php-autoload/</link>
		<comments>http://ammonlauritzen.com/blog/2008/10/28/php-autoload/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 23:06:40 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[style]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=407</guid>
		<description><![CDATA[As of version 5.0, PHP has had the ability to dynamically include required classes as needed &#8211; without requiring the developer to manually include all possible dependencies beforehand. This means that in cases where your code execution never touches 39 of the 40 classes in the project, it loads, parses, and runs that much faster.
There [...]]]></description>
			<content:encoded><![CDATA[<p>As of version 5.0, PHP has had the ability to dynamically include required classes as needed &#8211; without requiring the developer to manually include all possible dependencies beforehand. This means that in cases where your code execution never touches 39 of the 40 classes in the project, it loads, parses, and runs that much faster.</p>
<p>There is a performance hit for actually having to call the <a href='http://php.net/autoload'>__autoload()</a> method, but if you&#8217;re in a situation where the hit for executing a few extra comparison calls is unacceptable&#8230; you probably aren&#8217;t developing in PHP in the first place <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Almost all of the php I&#8217;ve written in the last 2-3 years uses autoloading, and it has probably saved me hundreds of hours of aggravation.</p>
<p>In most of my projects, the first line of any script or class usually looks something like this:</p>
<pre class="brush: php;">
require_once &quot;/var/www/common/lib.php&quot;;
</pre>
<p>Then lib.php usually reads something like this:</p>
<pre class="brush: php;">
&lt;?
function __autoload( $class ) {
    include_once( &quot;$class.php&quot; );
}
?&gt;
</pre>
<p>And that is all that is strictly required to make the magic happen. It is fast, it is easy to understand, it is easy to use. You can use require_once() or include_once() and there is very little meaningful difference.</p>
<p>I&#8217;ve looked around the net and found several other attempts at improving on this simple mechanism. But they invariably overcomplicate things. They attempt to recurse source directories, cache filename->class differences to the filesystem, and otherwise turn what should be a simple filesystem operation that the php environment supports natively into a mess of exception handling and wheel reinvention.</p>
<p>There are obviously theoretical instances where you might want to have more than the one require_once/include_once line&#8230; but I&#8217;ve honestly never encountered one myself.</p>
<p>I mean, you could try to throw an exception if the file didn&#8217;t exist or otherwise failed to load&#8230; but nothing will happen. Failure to instantiate a nonexistant class is a fatal error in PHP, and will be handled as such with or without you &#8211; preempting any attempt at throwing an exception.</p>
<p>The only thing you can add is a bit of extra diagnostics or maybe logging to a separate location.</p>
<p>Assume that we have a file &#8216;test.php&#8217;:</p>
<pre class="brush: php;">
&lt;?
require_once &quot;autoload.php&quot;;
$frog = new Frog();
?&gt;
</pre>
<p>If autoload.php contains a simple simple autoload function that uses require_once(), and Frog.php doesn&#8217;t exist anywhere in your include path, the results will look something like this:</p>
<pre class="brush: plain;">
ammon@kif:~$ php test.php 

Warning: require_once(Frog.php): failed to open stream: No such file or directory in /home/ammon/autoload.php on line 3

Fatal error: require_once(): Failed opening required 'Frog.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/ammon/autoload.php on line 3
</pre>
<p>If we had used an include_once() call, the output is similar, but slightly more informative:</p>
<pre class="brush: plain;">
ammon@kif:~$ php test.php 

Warning: include_once(Frog.php): failed to open stream: No such file or directory in /home/ammon/autoload.php on line 3

Warning: include_once(): Failed opening 'Frog.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/ammon/autoload.php on line 3

Fatal error: Class 'Frog' not found in /home/ammon/test.php on line 4
</pre>
<p>So that&#8217;s probably a bit more useful in tracking down the error. Require calls don&#8217;t return anything &#8211; they throw a fatal error on failure. Include calls, however, return FALSE on failure and TRUE if the file is (or, in the case of include_once, has already been) successfully included. So you can include_once() and write to a separate logfile (or to the output stream&#8230;) if you need more information than the fatal error already provides you.</p>
<h3>&lt;rant&gt;</h3>
<p>To those who insist on giving your classes and their containing files different names&#8230; umm. Wow.</p>
<p>If I have a class called DatabaseConnection, I&#8217;m going to put it in a file called DatabaseConnection.php. If I&#8217;m working with strange people who somehow don&#8217;t think that is explicit enough, I might call it DatabaseConnection.class.php and tweak the autoload method ever so slightly to compensate. There&#8217;s no good reason to put it in a file called projx-database_connection.incl or something. No. There isn&#8217;t.</p>
<p>If you want to organize your classes into a meaningful directory structure&#8230; good for you. Use PHP&#8217;s built-in <a href='http://php.net/get_include_path'>include_path</a> ini option. Don&#8217;t waste time trying to cascade down a directory structure searching for the classes &#8211; just make sure your includes are all in a set of reliable locations. You don&#8217;t actually have to edit the php.ini file and bounce Apache or your php-cgi processes, just define the additional include paths in the same file where you define your autoloader:</p>
<pre class="brush: php;">
set_include_path(
    get_include_path() . PATH_SEPARATOR .
    &quot;/var/www/includes&quot; . PATH_SEPARATOR .
    &quot;/var/www/includes/apple&quot; . PATH_SEPARATOR .
    &quot;/var/www/includes/banana&quot;
);
</pre>
<p>Naturally, you could turn that into some function calls to dynamically register and unregister directories, etc&#8230; but at that point, you&#8217;re probably hurting yourself again. If your codebase is being reorganized enough to make maintenance of the list of include dirs onerous without full time intervention, something else has probably already gone very wrong. At best, the code probably doesn&#8217;t work anyway, so any brief delay in updating the list can&#8217;t hurt any more than whatever else is happening.</p>
<h3>&lt;/rant&gt;</h3>
<p>But seriously. __autoload() is your friend. It will help clean up your code if you let it. It can help enforce naming conventions. It can even improve performance&#8230; so long as you refrain from using it to shoot yourself in the foot. <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2008/10/28/php-autoload/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php signals while selecting</title>
		<link>http://ammonlauritzen.com/blog/2008/10/27/php-signals-while-selecting/</link>
		<comments>http://ammonlauritzen.com/blog/2008/10/27/php-signals-while-selecting/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 20:26:38 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[posix signals]]></category>
		<category><![CDATA[sockets]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=399</guid>
		<description><![CDATA[So a fairly longstanding gripe of mine has been that PHP fails to execute registered signal handlers when it receives a signal in the middle of a blocking select call. Today, I finally bumped into a situation where I couldn&#8217;t just change the spec to avoid the situation&#8230; and I&#8217;ve finally figured out how to [...]]]></description>
			<content:encoded><![CDATA[<p>So a fairly longstanding gripe of mine has been that PHP fails to execute registered signal handlers when it receives a signal in the middle of a blocking select call. Today, I finally bumped into a situation where I couldn&#8217;t just change the spec to avoid the situation&#8230; and I&#8217;ve finally figured out how to make it work.</p>
<p>The bug has been reported <a href='http://bugs.php.net/44614'>here</a>, where it was ignored for a few months before being shot down and ignored some more as per php dev team regulations.</p>
<p>Sample code given by the reporter of the bug is markedly similar to the situations I&#8217;ve encountered the problem:</p>
<pre class="brush: php;">
pcntl_signal(SIGINT, &quot;sig_handler&quot;);
$sock = socket_create_listen($port);
$read_socks = array($sock);
$n = NULL;
$foo = socket_select($read_socks, $n, $n, NULL);
</pre>
<p>By filling in his blanks, my first test case looks something like this:</p>
<pre class="brush: php;">
&lt;?
function sig_handler($signo) {
        echo &quot;received sig #$signo\\\n&quot;;
}
pcntl_signal( SIGINT, &quot;sig_handler&quot; );

$socket = socket_create_listen( 1234 );
$r = array( $socket );
$n = NULL;
while( true ) {
        $foo = socket_select( $r, $n, $n, NULL );
        echo &quot;select returned '$foo'\\\n&quot;;
}
?&gt;
</pre>
<p>When executing the script and pressing ^C (which sends SIGINT), the following occurs:</p>
<pre class="brush: plain;">
ammon@morbo:~$ php sigtest.php
PHP Warning:  socket_select(): unable to select [4]: Interrupted system call in /home/ammon/sigtest.php on line 13
select returned ''
</pre>
<p>Ok, so the warning is to be expected, and we can easily squelch that.</p>
<p>The real problem is that the signal handler never runs.</p>
<p>However&#8230; for the first time in my life, a response to a php bug report proves enlightening. The dev who answered this ticket provides his sample code and says he can&#8217;t duplicate the bug. Upon looking at the differences between their code, only one difference stands out:</p>
<pre class="brush: php;">
declare(ticks=1);
</pre>
<p>The <a href='http://php.net/declare'>declare(ticks)</a> directive is deprecated as of php 5.3 and will not be with us in php 6.0. Ticks are an unreliable, unpredictable, and generally bad thing in php. I&#8217;ve neither successfully used them nor seen a successful and justified use.</p>
<p>That being said&#8230; turning the tick on but not telling it to do anything appears to address the problem of discarded interrupts:</p>
<pre class="brush: php;">
&lt;?
declare(ticks=1);

function sig_handler($signo) {
        echo &quot;received sig #$signo\\\n&quot;;
}
pcntl_signal( SIGINT, &quot;sig_handler&quot; );

$socket = socket_create_listen( 1234 );
$r = array( $socket );
$n = NULL;
while( true ) {
        $foo = @socket_select( $r, $n, $n, NULL );
        echo &quot;select returned '$foo'\\\n&quot;;
}
?&gt;
</pre>
<p>And execution:</p>
<pre class="brush: plain;">
ammon@morbo:~$ php sigtest.php
received sig #2
select returned ''
</pre>
<p>Which is precisely the desired behavior.</p>
<p>I don&#8217;t know what the performance hit for turning ticks on is, I haven&#8217;t had time to research this. But I can confirm that by declaring ticks globally, it does work in an OO environment as well:</p>
<pre class="brush: php;">
&lt;?
declare(ticks=1);

class signal_tester {
    function __construct() {
        pcntl_signal( SIGINT, array(&amp;$this,&quot;sig_handler&quot;) );
        $this-&gt;start();
    }

    function sig_handler($signo) {
        echo &quot;received sig #$signo\\\n&quot;;
    }

    function start() {
        $socket = socket_create_listen( 1234 );
        $r = array( $socket );
        $n = NULL;
        while( true ) {
            $foo = @socket_select( $r, $n, $n, NULL );
            echo &quot;select returned '$foo'\\\n&quot;;
        }
    }
}

$test = new signal_tester();
?&gt;
</pre>
<p>Executing and hitting ^C:</p>
<pre class="brush: plain;">
ammon@morbo:~$ php sigtest.php
received sig #2
select returned ''
</pre>
<p>After a few minutes of largely unscientific testing, it appears that turning ticks on globally costs a whopping 4 bytes of ram and causes the script to occasionally consume more cpu than the top process I used to monitor it. So&#8230; at first glance the cost is pretty negligible and all I can say is that if you ever need to handle signals (SIGTERM, SIGHUP, etc&#8230;) from within a blocking select call in php, it looks like declare ticks is the only option for now.</p>
<p>I did the initial tests in 5.1.6, but can confirm the same behavior in 5.2.5. I don&#8217;t know how the behavior is going to be in 5.3, since I don&#8217;t run alpha releases on my servers but my gut likes to think that it will continue to work the same for now&#8230; and will hopefully not break until 6.0 (when everything else will explode for a few years). Shrug.</p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2008/10/27/php-signals-while-selecting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php tail</title>
		<link>http://ammonlauritzen.com/blog/2008/05/27/php-tail/</link>
		<comments>http://ammonlauritzen.com/blog/2008/05/27/php-tail/#comments</comments>
		<pubDate>Tue, 27 May 2008 19:08:21 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://ammonlauritzen.com/blog/?p=389</guid>
		<description><![CDATA[I have a php script that frequently needs to email me the last few lines of a log file. I can&#8217;t afford to exec() a binary tail process, so the solution has to be in pure php.
Originally, the files in question never exceeded more than a few thousand lines. Unfortunately, I am encountering cases now [...]]]></description>
			<content:encoded><![CDATA[<p>I have a php script that frequently needs to email me the last few lines of a log file. I can&#8217;t afford to exec() a binary tail process, so the solution has to be in pure php.</p>
<p>Originally, the files in question never exceeded more than a few thousand lines. Unfortunately, I am encountering cases now where the files are now occasionally 50,000 lines or longer. This causes PHP&#8217;s memory consumption to explode.</p>
<p><i>Note: Code snippets provided here are not fully functional standalone shell scripts. The scripts I ran to benchmark the algorithms contain some rudimentary setup logic that is not important here, so has not been included.</i></p>
<p>My original method:</p>
<pre class="brush: php;">
// tail-file.php
$arr = @file( $fname, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES );
$arr = array_slice($arr, -$lines);
$buf = implode(&quot;\\\n&quot;,$arr);
</pre>
<p>This is easy to understand and is pretty fast, all things considered. Unfortunately, the memory footprint for loading a file into an array is obscene. Loading a 4400 line log file with this method could consume more than 17mb of ram. 50,000 line files easily stressed the 256mb limit I am able to provide the process.</p>
<p>So, the obvious solution to the memory consumption is to avoid loading the entire file at once. What if we kept a rotating list of lines in the file?</p>
<pre class="brush: php;">
// tail-array.php
$arr = array_fill( 0, $lines+1, &quot;\\\n&quot; );

$fp = fopen($fname, &quot;r&quot;);
while( !feof($fp) ) {
    $line = fgets($fp, 4096);
    $arr[] = $line; // faster than array_push()
    array_shift($arr);
}
fclose($fp);
$buf = implode(&quot;&quot;,$arr);
</pre>
<p>This method works by keeping the $lines-many most recent lines of the file in an array. Memory consumption remains sane, but the performance hit for performing so many array pushes and shifts is bad. Really bad. With small files, I can&#8217;t notice any difference between this method and the file() method&#8230; but with longer files, it adds up quickly.</p>
<p>Given a 51 line, 4kb file, an average execution ($lines = 20) might look like this:</p>
<pre class="brush: plain;">
ammon@zapp:~$ time ./tail-file.php a.log &gt;/dev/null

real    0m0.015s
user    0m0.009s
sys     0m0.007s

ammon@zapp:~$ time ./tail-array.php a.log &gt;/dev/null

real    0m0.016s
user    0m0.010s
sys     0m0.006s
</pre>
<p>Comparable enough. But given a 50,004 line (3.3mb) log file:</p>
<pre>
ammon@zapp:~$ time ./tail-file.php b.log >/dev/null                  

real    0m0.079s
user    0m0.058s
sys     0m0.021s

ammon@zapp:~$ time ./tail-array.php b.log >/dev/null                 

real    0m0.119s
user    0m0.112s
sys     0m0.007s
</pre>
<p>The difference becomes quite clear. However&#8230; what if my log file grows obscenely large? I&#8217;ve got a 9 million line log file (1.6gb) lying around to test with&#8230;</p>
<pre>
ammon@zapp:~$ time ./tail-file.php c.log >/dev/null

real    0m0.015s
user    0m0.008s
sys     0m0.008s

ammon@zapp:~$ time ./tail-array.php c.log >/dev/null                 

real    0m19.351s
user    0m18.545s
sys     0m0.803s
</pre>
<p>The file() method crashes because it can&#8217;t allocate enough ram to hold a 9 million element array and the array method takes almost 20 seconds to execute. It&#8217;s slow&#8230; but at least it works.</p>
<p>Of course, there are other methods. The one I finally settled on is this:</p>
<pre class="brush: php;">
// tail-seek.php
$fp = fopen($fname, &quot;r&quot;);
$lines_read = 0;
if( $fp !== FALSE ) {
    fseek( $fp, 0, SEEK_END );
    $pos = $eof = ftell($fp);
    do {
        --$pos;
        fseek($fp, $pos);
        $c = fgetc($fp);
        if( $c == &quot;\\\n&quot; )
            $lines_read++;
    } while( $pos &gt; 0 &amp;&amp; $lines_read &lt;= $lines );
    $buf = fread($fp, $eof-$pos);
}
fclose($fp);
</pre>
<p>This method doesn&#8217;t waste time reading the bulk of the file. It jumps to the end and scans backward until enough newlines have been located. The only problem here is that your average filesystem isn&#8217;t optimized for reading backwards&#8230; but since we&#8217;re not really reading very much data, it doesn&#8217;t much matter.</p>
<pre>
ammon@zapp:~$ time ./tail-seek.php a.log >/dev/null

real    0m0.017s
user    0m0.009s
sys     0m0.008s

ammon@zapp:~$ time ./tail-seek.php b.log >/dev/null                  

real    0m0.017s
user    0m0.008s
sys     0m0.010s

ammon@zapp:~$ time ./tail-seek.php c.log >/dev/null                  

real    0m0.023s
user    0m0.015s
sys     0m0.008s
</pre>
<p>Performance is a trifle slower on small files, but it&#8217;s astronomically better on long ones. This is similar to the method used by most unix &#8216;tail&#8217; commands, and is the clear winner for actual use in my application.</p>
<p>Of course, it needs a bit of cleanup from the state I&#8217;ve provided it in, and isn&#8217;t appropriate for all environments&#8230; but it&#8217;s a trifle better than requiring 20 seconds and 20gb of ram to execute <img src='http://ammonlauritzen.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ammonlauritzen.com/blog/2008/05/27/php-tail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
