<?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>LAMPlights</title>
	<atom:link href="http://www.hermanradtke.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.hermanradtke.com/blog</link>
	<description>Personal anecdotes from my experiences using the LAMP stack</description>
	<lastBuildDate>Fri, 25 Jan 2013 00:58:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>PHP: The Good Parts</title>
		<link>http://www.hermanradtke.com/blog/blog/php-the-good-parts</link>
		<comments>http://www.hermanradtke.com/blog/blog/php-the-good-parts#comments</comments>
		<pubDate>Tue, 17 Jul 2012 01:20:00 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/blog/?p=906</guid>
		<description><![CDATA[This blog post is inspired by Douglas Crockford's book JavaScript: The Good Parts. All programming languages have warts. That is, there were certain decisions made about a language that are less than ideal. Some people are driven to remove these warts from the language in an attempt to make the language better. I think this [...]]]></description>
				<content:encoded><![CDATA[<p>This blog post is inspired by Douglas Crockford's book <a href="http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742">JavaScript: The Good Parts</a>.</p>
<p>All programming languages have warts. That is, there were certain decisions made about a language that are less than ideal. Some people are driven to remove these warts from the language in an attempt to make the language better. I think this is done with the best intentions, but can often have negative consequences. JavaScript is a good example of a language that has a lot of warts. Despite all these warts, JavaScript is a very useful language and has seen a huge rise in popularity. I feel PHP is the same way. It has bad parts, but there are so many good parts that we need to celebrate those good parts. Here are a few things off the top of my head:</p>
<h2>Arrays</h2>
<p>I think the array is the single most powerful and useful part of PHP. The PHP array is the Swiss Amry knife in my programming toolkit. I have written applications in a number of other software languages and I have yet to find anything else more useful. The best part about arrays is that they just work. I don't have to decide ahead of time between a list or a map. The PHP array is to data structures as NoSQL is to SQL. Better still is that PHP core uses them all over the place. Results from the database: arrays. Parsing a json POST from the client: arrays. They are ubiquitous in PHP in both core and userland. I cannot say enough good things about PHP arrays.</p>
<h2>Web Ready</h2>
<p>PHP is web ready. I do not mean that PHP is easy to integrate into a webserver. PHP is easy to integrate, but I think a lot of languages do a good job of integrating to webservers now. I mean PHP is built for the web. It is so easy to create an HTML template and pass the data to it. I think Mustache and Twig are great. That being said, I do not have to decide on a templating language in order to get up and running. Everyone understands HTML.</p>
<p>I do think this is feature is getting less important as the web develops. I write a lot of API's and send almost everything to the client via json. However, they are still tons of websites out there are that are not platforms and need to serve up HTML.</p>
<h2>Streams</h2>
<p>Streams are the best kept secret in PHP. Most people do not even realize they are using streams when they are interacting with file systems or networks. I wrote a <a href="https://gist.github.com/1706840">plugin to push messages</a> to the Phergie IRC bot in less than an hour using streams. They are a really powerful abstraction that is used all over PHP.</p>
<h2>Type Juggling</h2>
<p>For the most part, a web application is just a bunch of strings. HTTP is all strings, most database adapters return strings and all output is strings. PHP handles all of this and removes all kinds of boilerplate code from my applications. I think PHP has the most sensible implementation of juggling too. Yes, they are some problems with large integers that are represented as strings. It is by no means perfect. However, I think the PHP zval has saved me orders of magnitude more hours than pain.</p>
<p>For all the warts, there is plenty of beauty in PHP. I still enjoy writing web applications using PHP and focus my time using the parts of PHP that work really well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/blog/php-the-good-parts/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Managing Gearman With Gearadmin Tool</title>
		<link>http://www.hermanradtke.com/blog/blog/managing-gearman-with-gearadmin-tool-2</link>
		<comments>http://www.hermanradtke.com/blog/blog/managing-gearman-with-gearadmin-tool-2#comments</comments>
		<pubDate>Tue, 24 Apr 2012 01:35:08 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gearman]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/?p=889</guid>
		<description><![CDATA[]]></description>
				<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/blog/managing-gearman-with-gearadmin-tool-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Managing Gearman With Gearadmin Tool</title>
		<link>http://www.hermanradtke.com/blog/blog/managing-gearman-with-gearadmin-tool</link>
		<comments>http://www.hermanradtke.com/blog/blog/managing-gearman-with-gearadmin-tool#comments</comments>
		<pubDate>Tue, 24 Apr 2012 01:34:47 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gearman]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/?p=890</guid>
		<description><![CDATA[The more jobs flowing through Gearman, the more likely something will happen. Queues can get backed up, workers can crash and performance can degrade. It is important to monitor the status of the Gearman ecosystem and be proactive about fixing problems. We can do this using the gearadmin tool.The gearadmin program is a relatively new program that [...]]]></description>
				<content:encoded><![CDATA[<p>The more jobs flowing through Gearman, the more likely something will happen. Queues can get backed up, workers can crash and performance can degrade. It is important to monitor the status of the Gearman ecosystem and be proactive about fixing problems. We can do this using the <em>gearadmin</em> tool.<span id="more-890"></span>The <em>gearadmin</em> program is a relatively new program that makes administration of Gearman easier. Before the release of gearman 0.19 the only way to query the gearman daemon was to use telnet. You still can use telnet and reference the Administrative Protocol section <a href="http://gearman.org/?id=protocol">http://gearman.org/?id=protocol</a> for a list of commands. While telnet is a still an option, the <em>gearadmin</em> tool saves a lot of boilerplate scripts from being written. The <em>gearadmin</em> tool is really nothing more than a wrapper around the telnet commands. It does make capturing the output a little easier and you don't have to memorize the commands.</p>
<p>I wish the <em>gearadmin</em> output was a little nicer to read. The raw dump of the telnet output leaves the data a little cryptic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/blog/managing-gearman-with-gearadmin-tool/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Evaluate multidimensional arrays using vim xdebug</title>
		<link>http://www.hermanradtke.com/blog/blog/evaluate-multidimensional-arrays-using-vim-xdebug</link>
		<comments>http://www.hermanradtke.com/blog/blog/evaluate-multidimensional-arrays-using-vim-xdebug#comments</comments>
		<pubDate>Wed, 28 Mar 2012 06:07:09 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[xdebug]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/?p=892</guid>
		<description><![CDATA[I love vim. I love XDebug. I need it to evaluate multidimensional (or nested) arrays though and it does not seem to do that. Chris Hartjes tweeted about his frustration with arrays too and I decided to fix the problem. Turns out there is nothing to fix. Turns out we need to tweak a default [...]]]></description>
				<content:encoded><![CDATA[<p>I love vim. I love XDebug. I need it to evaluate multidimensional (or nested) arrays though and it does not seem to do that. Chris Hartjes tweeted about his frustration with arrays too and I decided to fix the problem. Turns out there is nothing to fix.</p>
<p>Turns out we need to tweak a default configuration settings to get this all to work. Open up your .vimrc and add the following line:</p>
<p><code> let g:debuggerMaxDepth = 3<br />
</code></p>
<p>That depth means you will be able to view the contents of a triply-nested array. That seemed like a sensible default to me. Now you can evaluate or get the property of any variable like normal.</p>
<p>Once the depth is set there is no way to change it during a debug session. You have to close the existing XDebug session, update the value and start a new session. I plan on changing this in a future release of the plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/blog/evaluate-multidimensional-arrays-using-vim-xdebug/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the Gearman Tool For Rapid Development of Clients and Workers</title>
		<link>http://www.hermanradtke.com/blog/blog/using-gearman-tool-for-rapid-development-of-clients-and-workers</link>
		<comments>http://www.hermanradtke.com/blog/blog/using-gearman-tool-for-rapid-development-of-clients-and-workers#comments</comments>
		<pubDate>Wed, 25 Jan 2012 18:14:47 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gearman]]></category>
		<category><![CDATA[gearmand]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/?p=884</guid>
		<description><![CDATA[Gearman comes with a few tools that make development and testing easier. The gearman program creates boilerplate clients and workers. The gearman program comes default with the gearmand package. Do not confuse gearman with gearmand. The gearmand daemon is what manages the queue, clients and workers. The gearman program is a tool to quickly create simple clients and workers. The options [...]]]></description>
				<content:encoded><![CDATA[<p>Gearman comes with a few tools that make development and testing easier. The <em>gearman</em> program creates boilerplate clients and workers. The <em>gearman</em> program comes default with the gearmand package. Do not confuse <em>gearman</em> with <em>gearmand</em>. The <em>gearmand</em> daemon is what manages the queue, clients and workers. The <em>gearman</em> program is a tool to quickly create simple clients and workers. The options for <em>gearman</em> can be slightly confusing, so I will go through a set of examples on how to use them.<span id="more-884"></span></p>
<p>I find myself using the client functionality of the <em>gearman</em> tool most often. If I am tasked with creating or updating a gearman worker I want to test that the worker actually works. The code that sends a job to the worker is normally part of the web application and I don't want to dig through the application trying to figure out what I need to do send the job out. I could just create a simple php script that creates a client and sends the job over, but the <em>gearman</em> tool already does this.</p>
<p>Example of using <em>gearman </em>as a client:<br />
<script src="https://gist.github.com/1677655.js?file=client.sh"></script><br />
I use the <em>gearman</em> program as a worker less often. It is still useful for creating a simple worker to test my client code against. I can write my client code without a fully functional worker if the client code is not expecting a complex response.</p>
<p>Example of using <em>gearman</em> as a worker:<br />
<script src="https://gist.github.com/1677655.js?file=worker.sh"></script><br />
The <em>gearman</em> tool comes with the standard options for specifying a specific host and port. There are a number of other options that may be of use in specific circumstances. I encourage you to read them over by typing "gearman -H" on the command line.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/blog/using-gearman-tool-for-rapid-development-of-clients-and-workers/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Registering Functions With Gearman Workers</title>
		<link>http://www.hermanradtke.com/blog/blog/registering-functions-with-gearman-workers</link>
		<comments>http://www.hermanradtke.com/blog/blog/registering-functions-with-gearman-workers#comments</comments>
		<pubDate>Tue, 24 Jan 2012 23:44:11 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gearman]]></category>
		<category><![CDATA[lamba]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/?p=875</guid>
		<description><![CDATA[The Gearman examples on php.net are a great primer for groking how the Gearman client and worker interact with each other. One gripe I have is that the examples declare global functions for the worker to register. I feel this leads develpers down the wrong path. With PHP5.3, there is an easier solution though: anonymous functions. [...]]]></description>
				<content:encoded><![CDATA[<p>The Gearman <a href="php.net/manual/en/gearman.examples.php" target="_blank">examples on php.net</a> are a great primer for groking how the Gearman client and worker interact with each other. One gripe I have is that the examples declare global functions for the worker to register. I feel this leads develpers down the wrong path. With PHP5.3, there is an easier solution though: anonymous functions.<span id="more-875"></span></p>
<p>Declaring a global functions in a gearman worker script may not seem like a big deal, but these things have a way of catching up to you. I personally ran into this when I suggested that HauteLook start using GearmanManager to manage the gearman workers. A side affect of this is that all gearman worker scripts now run in the same instance of PHP. There were a number of occasions when workers would fail to load on production because of the global naming conflicts.</p>
<p>I prefer to use register anonymous functions with my gearman workers. This keeps them out of the global scope and puts the logic right next to the worker registration call. This makes hard to test the logic inside the anonymous function, but I never test that logic. I treat the functions I register with gearman as controllers. I pass the workload off to a model class that is fully unit tested.</p>
<p>Here is a nice example:</p>
<p><script src="https://gist.github.com/1673522.js?file=worker.php"></script></p>
<p>I would update the Gearman examples on php.net, but I think a lot of people are still using PHP 5.2 (or even earlier). Providing multiple ways of registering the workers may confuse people too. Maybe next year.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/blog/registering-functions-with-gearman-workers/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Painful Gearman Upgrade Path</title>
		<link>http://www.hermanradtke.com/blog/blog/the-painful-gearman-upgrade-path</link>
		<comments>http://www.hermanradtke.com/blog/blog/the-painful-gearman-upgrade-path#comments</comments>
		<pubDate>Tue, 24 Jan 2012 06:30:06 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gearman]]></category>
		<category><![CDATA[gearmand]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/?p=868</guid>
		<description><![CDATA[The Gearman project has been slowly migrating from C to C++. This migration has gone under the radar due to the popularity of Cent OS 5 and given gearmand version of 0.14. This version of gearmand worked with any version of pecl/gearman and there was never any compelling reason to upgrade gearmand. That changed with [...]]]></description>
				<content:encoded><![CDATA[<p>The Gearman project has been slowly migrating from C to C++. This migration has gone under the radar due to the popularity of Cent OS 5 and given gearmand version of 0.14. This version of gearmand worked with any version of pecl/gearman and there was never any compelling reason to upgrade gearmand. That changed with the release of pecl/gearman 1.0</p>
<p><span id="more-868"></span>The release of pecl/gearman 1.0 included a fix to the exception handling of gearman workers. An uncaught exception would go unnoticed by the gearmand server before pecl/gearman 1.0. The only way to work around this was to catch all exception and explicitly return a failure code to gearmand. I fixed this by making by detecting an exception with the pecl/gearman code and sending a special exception message to the gearmand server. Unfortunately, the API for sending the exception message was introduced in gearman 0.21.</p>
<p>I did not think much of the new gearmand requirement when fixing this bug. Since that time I have been introduced to the painful upgrade process of gearmand. I think this pain is mostly felt by those using Linux distributions with long term support. The first hurdle to get over is the fact that gearmand 0.21 requires the boost 1.41 libraries. A default Cent OS install only provides boost 1.39 libraries. There was a 3rd party that provided boost 1.41 libraries for Cent OS, but they used a non-standard installation directory. After some experimenting, I did find a fix: <a href="http://groups.google.com/group/gearman/msg/12bcc13691e132ae">http://groups.google.com/group/gearman/msg/12bcc13691e132ae</a>.</p>
<p>The good news is that upgrading to Cent OS 6 makes compiling gearman much easier with the inclusion of boost 1.41 libraries by default. The next problem comes when trying to submit a patch. Cent OS 5 comes with aclocal 1.9 and the gearman project requires aclocal 1.11. Again, upgrading to Cent OS 6 makes life easier as it comes with aclocal 1.11 by default. I learned the hard way that the gearman project also requires autoconf 2.64, but Cent OS 6 only provides autoconf 2.63. The 2.64 version of autoconf provides a macro named m4_ifnblank which is required to build the configure script used to compile gearman. You can see me answer my own question here: <a href="https://answers.launchpad.net/gearmand/+question/185592">https://answers.launchpad.net/gearmand/+question/185592</a> regarding the autoconf issue.</p>
<p>These build issues have made it tough for users to upgrade to the pecl/gearman 1.x line. I think I will be forced to maintain the pecl/gearman 0.8.x line for some time with bug fixes as users struggle to get gearmand 0.21 on their Cent OS 5 servers. I have definitely learned to do more research on migration paths before requiring a newer dependency version.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/blog/the-painful-gearman-upgrade-path/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SPL FilterIterator in the real world</title>
		<link>http://www.hermanradtke.com/blog/blog/spl-filteriterator-in-the-real-world</link>
		<comments>http://www.hermanradtke.com/blog/blog/spl-filteriterator-in-the-real-world#comments</comments>
		<pubDate>Thu, 15 Dec 2011 22:17:50 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[functional]]></category>
		<category><![CDATA[iterator]]></category>
		<category><![CDATA[oo]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[spl]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/?p=828</guid>
		<description><![CDATA[The Standard PHP Library (SPL) is a powerful set of tools that are often overlooked. It is very common to see an SPL talk at conferences, but those talks usually just introduce each SPL class to the audience without giving some real world examples. I am going to show you a real world example on [...]]]></description>
				<content:encoded><![CDATA[<p>The Standard PHP Library (SPL) is a powerful set of tools that are often overlooked. It is very common to see an SPL talk at conferences, but those talks usually just introduce each SPL class to the audience without giving some real world examples. I am going to show you a real world example on how to use SPL FilterIterator in an ecommerce website.<br />
<span id="more-828"></span><br />
This particular ecommerce website sells actual goods. One problem with selling actual goods, instead of virtual goods, is the supply can run out. I have a simple use-case where I don't want to display an item that is sold out. Consider the following example data:</p>
<p>&nbsp;<br />
<script src="https://gist.github.com/1483101.js?file=data.php"></script><br />
&nbsp;</p>
<p>This is a pretty common use case and I am sure most people would write the logic something like this:</p>
<p>&nbsp;<br />
<script src="https://gist.github.com/1483101.js?file=procedural.php"></script><br />
&nbsp;</p>
<p>There is nothing logically wrong with this code. It is a very readable and easy to understand way to write it. With the rise in popularity of JavaScript and other functional languages, some of us may take a different approach. Using the underscore framework (available for both PHP and JavaScript), you could also write it like this:</p>
<p>&nbsp;<br />
<script type="text/javascript" src="https://gist.github.com/1483101.js?file=functional.php"></script><br />
&nbsp;</p>
<p>The use of a callback function should be familiar to anyone with at least a basic knowledge of JavaScript. The callback function is evaluating each item in the iterator to true or false. The major drawback to both of the code snippets is that the logic for determining whether or not an item is sold out is not able to be re-used. The use of procedural code in the first example and the use of an anonymous function in the second example also make it hard to test. We can improve the second example by not using an anonymous callback:</p>
<p>&nbsp;<br />
<script type="text/javascript" src="https://gist.github.com/1483101.js?file=functional2.php"></script><br />
&nbsp;</p>
<p>Now I can re-use this function and easily test it. We can use SPL FilterIterator in a very similar way to the functional example:</p>
<p>&nbsp;<br />
<script src="https://gist.github.com/1483101.js?file=spl.php"></script><br />
&nbsp;</p>
<p>Now my logic for what constitutes a soldout item is isolated in a class. This coincides with the object oriented principle of "encapsulate what varies". I think the biggest stumbling block for using SPL is that it just seems too heavy. You might be wondering why you should go to the trouble of creating a new class to perform such a simple task. The procedural example above is faster to write. Some of us might be tempted to use the functional example with an anonymous function because it feels more "expressive". Now consider what happens when the ecommerce system introduces returns. The new formula for determining a soldout item is now:</p>
<p><code><br />
availability = (purchased - sold) + returned<br />
</code></p>
<p>This isn't some hypothetical example, it actually happened. It was real easy to update the logic to handle returns and make sure the tests passed.</p>
<p>The last decision you have to make is whether or not to put the logic in a database query. If there is a huge performance boost by writing the logic into the query, it may be worthwhile. A query is still testable, but you have to setup some test data in the database in order to test it (which means you probably won't do write the test for it). It is harder to re-use queries, so the business logic for determining sold out items may be duplicated over a number of queries too. You also might want to consider what happens if you decide to alleviate the database load by putting the list of items for sale in a cache (like APC or memcache).</p>
<p>The SPL classes, especially FilterIterator, really start to shine when dealing with a dataset outside of our control. More and more platforms are becoming service based and we have no control over how the data comes back. Especially when you consider something like the Twitter API timeline response and trying to filter out any tweet that starts with "RT".</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/blog/spl-filteriterator-in-the-real-world/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Gearman Bootstrap Script</title>
		<link>http://www.hermanradtke.com/blog/blog/php-gearman-bootstrap-script</link>
		<comments>http://www.hermanradtke.com/blog/blog/php-gearman-bootstrap-script#comments</comments>
		<pubDate>Sat, 10 Dec 2011 07:03:07 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gearman]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/?p=819</guid>
		<description><![CDATA[Writing the scaffolding for gearman workers is a pretty trivial task using the pecl/gearman extension. Keeping that scaffolding consistent between all the gearman workers in your application can get tough. I created a script that will remove the boilerplate gearman code and allow gearman worker scrips to simply be function definitions.The idea for gearboot first [...]]]></description>
				<content:encoded><![CDATA[<p>Writing the scaffolding for gearman workers is a pretty trivial task using the pecl/gearman extension. Keeping that scaffolding consistent between all the gearman workers in your application can get tough. I created a script that will remove the boilerplate gearman code and allow gearman worker scrips to simply be function definitions.<span id="more-819"></span>The idea for gearboot first came to me when I was using GearmanManager to manage production gearman workers. The GearmanManager code assumes that the workers are simply function definitions. This makes it easy to write and organize the workers, but it makes common tasks like debugging workers painful as all output is hidden</p>
<p>In order to make development of the gearman workers easier, I created a script to startup the gearman worker in a similar manner to the GearmanManager. The major benefit is that any sort of error or exception is shown right on the terminal screen. No digging through logs wasting time tying to figure out what happened. If you have logging already setup, it is now trivial to add a stdout writer to the logger when running php in cli mode.</p>
<p>One of the biggest complaints I heard from fellow developers was that they had a hard time trying to figure out if the worker actually received the job from the client. I added a logging to stdout that signals when a job is received and what a job is finished.</p>
<p>I setup a pear channel to make installation real easy. For installation instructions and some examples check out the github page page: <a href="https://github.com/hradtke/gearboot" target="_blank">https://github.com/hradtke/gearboot</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/blog/php-gearman-bootstrap-script/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PEAR channel created</title>
		<link>http://www.hermanradtke.com/blog/blog/pear-channel-created</link>
		<comments>http://www.hermanradtke.com/blog/blog/pear-channel-created#comments</comments>
		<pubDate>Fri, 09 Dec 2011 23:14:16 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gearman]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/?p=812</guid>
		<description><![CDATA[I finally got around to creating my own PEAR channel. I am hosting it on github using Pirum to manage the channel. The channel is located at http://hradtke.github.com/pear/. So far I have a single package in then channel: gearboot. I will be writing more about gearboot shortly.]]></description>
				<content:encoded><![CDATA[<p>I finally got around to creating my own PEAR channel. I am hosting it on github using <a title="The simple PEAR Channel Server Manager " href="http://pirum.sensiolabs.org/" target="_blank">Pirum</a> to manage the channel. The channel is located at <a title="hradtke PEAR channel" href="http://hradtke.github.com/pear/" target="_blank">http://hradtke.github.com/pear/</a>. So far I have a single package in then channel: <a title="gearboot PEAR download link" href="http://hradtke.github.com/pear/get/gearboot-1.0.0.tgz" target="_blank">gearboot</a>. I will be writing more about gearboot shortly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/blog/pear-channel-created/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
