<?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>Christian Grobmeier - JEE, EAI, PHP &#187; Open Source</title>
	<atom:link href="http://www.grobmeier.de/category/open-source/feed" rel="self" type="application/rss+xml" />
	<link>http://www.grobmeier.de</link>
	<description>A Blog about technical thoughts</description>
	<lastBuildDate>Wed, 02 Jun 2010 12:32:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Welcome Zeta Components!</title>
		<link>http://www.grobmeier.de/2010/06/02/welcome-zeta-components.html</link>
		<comments>http://www.grobmeier.de/2010/06/02/welcome-zeta-components.html#comments</comments>
		<pubDate>Wed, 02 Jun 2010 12:32:00 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PIWI]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Incubator]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zeta Components]]></category>

		<guid isPermaLink="false">http://www.grobmeier.de/?p=423</guid>
		<description><![CDATA[Zeta Components is a component based PHP library and it joined the Apache Incubator before short time. It's pretty good to have another PHP project on Board - additionally I expect good effects on the PIWI framework.]]></description>
			<content:encoded><![CDATA[<p>Before a while, there was a very promising Proposal called <a href="http://wiki.apache.org/incubator/ZetaComponentsProposal" target="_blank">Zeta Components</a> at the Apache Incubator list. It described a set of PHP components similar which eases the life of us all. It has already progressed very good before developers decided to switch to Apache. In the past days this library has been developed under the name <a href="http://ezcomponents.org/" target="_blank">eZ Components</a> and was wellknown to the community.</p>
<p>In my opinion this new project will be very important to the ASF. Apache only hosts two other PHP projects, Log4PHP and Shindig. Since PHP is becoming more and more popular for big business (think on Facebook) I think its necessary to attract more developers and bring them into the Apache community. Many PHP projects out there use the GPL license, and that is sometimes very difficult to combine with commerical work. Good that we now have a component framework under ASL! Together with Log4PHP it&#8217;s a good start for much proprietary work.</p>
<p>More in future, I think that even the <a href="http://code.google.com/p/piwi/" target="_blank">PIWI Framework</a> will benefit of this change. I already had some trouble with dependent GPL code in it and hopefully Zeta can address most of my wishes. PIWI built upon Log4PHP and Zeta would be charming. But as already said, this will need a while.</p>
<p>At the moment, Zeta Components do already have a mailinglists and <a href="http://incubator.apache.org/projects/zetacomponents.html" target="_blank">status page</a> on the incubator. Jira will follow and after finally the CLAs of the initial developers have been processed, work can begin. However, if you are interest in helping this project subscribe to the user and to the dev list mentioned in the status page.</p>
<p>Lucky me I have been elected into the Apache Incubator PMC and can now serve as a mentor to this project. It&#8217;s not only honour to me, it&#8217;s also a good chance to work with obviously very nice people and excellent technicians. Also it makes it easy to me to step into this project and learn all I need.</p>
<p>So, welcome Zeta Components!! I am glad you arrived at the Apache Software Foundation!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2010/06/02/welcome-zeta-components.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to localize WordPress pages</title>
		<link>http://www.grobmeier.de/2010/03/12/how-to-localize-wordpress-pages.html</link>
		<comments>http://www.grobmeier.de/2010/03/12/how-to-localize-wordpress-pages.html#comments</comments>
		<pubDate>Fri, 12 Mar 2010 10:26:34 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.grobmeier.de/?p=363</guid>
		<description><![CDATA[A short article how to localize pages in wordpress.]]></description>
			<content:encoded><![CDATA[<p>Sometimes I am surprised by the power of WordPress. To be honest, I don&#8217;t like the style of coding done in WordPress. All that global functions&#8230; bwah. But on the other hand, people managed it somehow to create a flexible and extensible product. I don&#8217;t know how it is to make huge projects with WordPress, but for my little own blog it gave me everything I need so far. This time I wanted to create localized pages, which have been served by <a href="http://www.piwiframework.de" target="_blank">PIWI</a> before. In order to reduce the overhead for my website, I decided to use WordPress as one and only the system. It is updated in regular periods and PIWI is not. It has tons of plugins and PIWI not. However, PIWI is more to my taste of professional software and I will continue to use it on more enterprise developments.</p>
<p>Localization does not work out of the box in WordPress. But the concepts in WordPress allow to use a combination of custom fields and themes to make this work. I refused to translate all my blogposts and for only pages it is very straightforward.</p>
<p>First I created my pages in the wordpress pages section. In the Custom fields I used a new meta key named &#8220;language&#8221; and put as value &#8220;de&#8221; or &#8220;en&#8221; for german or english.</p>
<p><a href="http://www.grobmeier.de/wp-content/uploads/2010/03/Bildschirmfoto-2010-03-12-um-11.14.17.jpg"><img class="alignleft size-medium wp-image-368" title="Custom fields for localization" src="http://www.grobmeier.de/wp-content/uploads/2010/03/Bildschirmfoto-2010-03-12-um-11.14.17-300x164.jpg" alt="Custom fields for localization" width="300" height="164" /></a></p>
<p>I couldn&#8217;t use the Pages Widget, because I need to generate my navigation out of the selected language. Not to conflict with my current implementation I duplicated my current theme and used the preview function to work on it (on a live system, which is a really great feature <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  for prime time programming). I should mention that I created two pages, one for each language, only stating that the language has been changed.</p>
<p>Next step was to include the language flags in my theme (header.php in my case). I linked the flags to my newly created &#8220;language switched&#8221; pages. Additionally I have added the param language=de (or en for english) to the link. My complete link for the german language is as follows:</p>
<pre>http://www.grobmeier.de/deine-sprache-wurde-umgestellt?language=de</pre>
<p>Ok, I am now able to link between the languages. In my header.php I wrote this:</p>
<pre>session_start();</pre>
<pre>include(TEMPLATEPATH . '/grobmeier-session.functions.php');</pre>
<p>I started the session myself &#8211; it seems WordPress frontend doesn&#8217;t use session at all. In the included new php grobmeier-session.functions.php I create a function for storing my language key. This function has been stolen and modified from PIWI:</p>
<pre>function grobmeier_getUserLanguage() {
    $supported[] = 'de';
    $supported[] = 'en';

   if (isset ($_GET['language'])) {
       if (in_array($_GET['language'], $supported)) {
            $_SESSION['language'] = $_GET['language'];
       }
    }

    if (!isset ($_SESSION['language'])) {
        $_SESSION['language'] = 'en';
    }
    return $_SESSION['language'];
}</pre>
<p>Now I just need to generate the navigation. I&#8217;ll do this with a prepared function of wordpress. On the correct place in my header.php I wrote:</p>
<pre>
<div>$args = array(</div>
<div><span style="white-space: pre;">	</span>'meta_key' =&gt; 'language',</div>
<div><span style="white-space: pre;">	</span>'meta_value' =&gt;  grobmeier_getUserLanguage());</div>
<div>wp_list_pages( $args );</div>
</pre>
<p>As you might see, the navigation is build on the user language setting. And that&#8217;s all &#8211; you&#8217;ll deliver localized versions of your pages from now on. I should mention this works with 2.9.2 and I think earlier versions too. You just need to create pages with the correct custom field setting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2010/03/12/how-to-localize-wordpress-pages.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Log4PHP graduated!</title>
		<link>http://www.grobmeier.de/2010/03/11/log4php-graduated.html</link>
		<comments>http://www.grobmeier.de/2010/03/11/log4php-graduated.html#comments</comments>
		<pubDate>Thu, 11 Mar 2010 18:13:58 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.grobmeier.de/?p=359</guid>
		<description><![CDATA[Log4PHP graduated as subproject to the Apache Logging project. ]]></description>
			<content:encoded><![CDATA[<p>Good news! The Apache Incubator Log4PHP project graduated as subproject to the Apache Logging project. This is really a big step forward! The next days I will try to push the real work behind a graduation forward, moving webpages and svn and such. After that move we&#8217;ll continue with a new small release. Cheers all!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2010/03/11/log4php-graduated.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Log4PHP tries to graduate to Apache Logging</title>
		<link>http://www.grobmeier.de/2010/03/02/log4php-tries-to-graduate-to-apache-logging.html</link>
		<comments>http://www.grobmeier.de/2010/03/02/log4php-tries-to-graduate-to-apache-logging.html#comments</comments>
		<pubDate>Tue, 02 Mar 2010 08:09:07 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=302</guid>
		<description><![CDATA[Log4PHP is about graduating to Apache Logging Services.]]></description>
			<content:encoded><![CDATA[<p>The past year has been very well for Log4PHP. As you might have noticed, the <a href="http://incubator.apache.org/log4php/download.html" target="_blank">Log4PHP 2.0.0</a> release is out. There has been some good feedback so far. Some users even contributed smaller bugfixes or the trace level which wasn&#8217;t in the API before. Besides that, there is a good activity on the mailinglist and there are at least 3 active committers. In other terms: time to graduate an bring out Log4PHP from the temporary incubator project <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Now Log4PHP needs to succeed 3 votes. One for the Log4PHP team to vote for graduating; one for Apache Logging to accept the podling as a subproject. And finally &#8211; after the first two have succeeded &#8211; a vote on the incubator list to release the podling to its final destination.</p>
<p>The first two votes are already running and it looks very good so far. Votes need to be open another day then the next step can be done. For those who are interested &#8211; there is a <a href="http://incubator.apache.org/guides/graduation.html" target="_blank">detailed document about graduation available</a>.</p>
<p>Let&#8217;s see how it works out &#8211; I think everything could be in place in quite less time, maybe the next two or three weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2010/03/02/log4php-tries-to-graduate-to-apache-logging.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wavediver: An Adobe Wave API</title>
		<link>http://www.grobmeier.de/2010/01/08/wavediver-an-adobe-wave-api.html</link>
		<comments>http://www.grobmeier.de/2010/01/08/wavediver-an-adobe-wave-api.html#comments</comments>
		<pubDate>Fri, 08 Jan 2010 07:01:53 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Adobe Wave]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wavediver]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=289</guid>
		<description><![CDATA[Adobe Wave google code project founded with the name: Wavediver.]]></description>
			<content:encoded><![CDATA[<p>Readers of my blog maybe have already noticed it: <a href="http://blog.grobmeier.de/2009/08/04/adobe-wave-wordpress-plugin-finished.html" target="_self">Jason found out</a>, that somebody has taken my code, removed the copyright stuff and uploaded it to the WordPress directory. I was quite surprised &#8211; the content-thief is telling on his blog that he had two weeks holiday while he came across Wave and implemented this plugin. I mean, what the f***? Are people really thinking that nobody will notice that theft in the case of beta software? I just can say: don&#8217;t use tecinfor-wave. This is outdated code and the distributor didn&#8217;t write it &#8211; I doubt he can help in error cases.</p>
<p>But everything has its good sides. I decided to put my development on that plugin more into public and created a new google code project: <a href="http://code.google.com/p/wavediver/" target="_blank">Wavediver</a>. You can find the original WordPress plugin there. I will try to update the API and make it more usable. At the moment it&#8217;s a little bit, well, ugly <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Let&#8217;s hope that it will reach the status to be included in the PIWI framework later.</p>
<p>Already included is a cli.php file, which enables you to send Adobe Wave message from the command line, just with: php -f cli.php. That can help testing.</p>
<p>If there is anybody who wants to join up &#8211; don&#8217;t hesitate.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2010/01/08/wavediver-an-adobe-wave-api.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Log4PHP 2.0.0 released</title>
		<link>http://www.grobmeier.de/2009/12/14/apache-log4php-2-0-0-released.html</link>
		<comments>http://www.grobmeier.de/2009/12/14/apache-log4php-2-0-0-released.html#comments</comments>
		<pubDate>Mon, 14 Dec 2009 06:29:11 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=282</guid>
		<description><![CDATA[Apache Log4PHP 2.0.0 has been released]]></description>
			<content:encoded><![CDATA[<p>After long work, I sent out the announcement for the first Log4PHP release this morning. Let&#8217;s see how this one works out &#8211; first reports from DBpedia users were promising. <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>It&#8217;s an exciting time for all involved, and is the result of a culmination of many like-minded individuals. Everyone&#8217;s worked hard and as the initial test community seem to have responded positively and in such detail they could test anything from Word to Think Bingo (<a href="http://www.thinkbingo.com/" target="_blank">http://www.thinkbingo.com/</a>) with their eyes closed. The people behind the development had a few words on the announcement of the first Log4PHP.</p>
<p>Here is the original statement:</p>
<p>The Log4PHP community is pleased to introduce the Apache Log4PHP 2.0.0 (Incubating) release [1]. It&#8217;s the first Log4PHP release since 2004 and tons of changes have been done. Finally Log4PHP has become a well tested framework made for PHP 5. Many thanks to all the contributors who made this release possible. Please download [2] Log4PHP and enjoy <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The Log4PHP team</p>
<p>[1] <a href="http://incubator.apache.org/log4php/changes-report.html" target="_blank">http://incubator.apache.org/log4php/changes-report.html</a><br />
[2] <a href="http://incubator.apache.org/log4php/download.html">http://incubator.apache.org/log4php/download.html </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2009/12/14/apache-log4php-2-0-0-released.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Book review: Apache Geronimo Quick Reference</title>
		<link>http://www.grobmeier.de/2009/12/09/apache_geronimo_quick_reference_review.html</link>
		<comments>http://www.grobmeier.de/2009/12/09/apache_geronimo_quick_reference_review.html#comments</comments>
		<pubDate>Wed, 09 Dec 2009 13:19:12 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Bookreview]]></category>
		<category><![CDATA[Geronimo]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=275</guid>
		<description><![CDATA[Apache Geronimo book. A real quick reference, sometimes to quick]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-271" title="Apache Geronimo Book" src="http://blog.grobmeier.de/wp-content/uploads/2009/11/1847196942-243x300.jpg" alt="Apache Geronimo Book" width="243" height="300" />I recently got a copy of <a href="http://www.amazon.de/gp/product/1847196942?ie=UTF8&amp;tag=neoteccde-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=1847196942">Apache Geronimo 2.1: Quick Reference</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.de/e/ir?t=neoteccde-21&amp;l=as2&amp;o=3&amp;a=1847196942" border="0" alt="" width="1" height="1" />. This book should help me with my first steps with this container. Here is a little review for this brand new release of Packt publishing.</p>
<p>My first impression was: wow, is that really a quick reference? The book has a good format and comes with roundabout 370 pages. I hoped for a short book in these times I don&#8217;t have too much time for huge novels in the kind of &#8220;Gone with the wind&#8221;. However, I jumped through the content and figured out that this is actually a quick reference  - very good for the impatient developers like me!</p>
<p>In fact, this book covers all relevant topics I can imagine: it starts with an introduction and a description of Geronimos architecture, which gives an brief (sometimes a bit short) overview of how Geronimo works with its plugins and its deployment strategy. I would have loved to read a bit more about the &#8220;hot deployment&#8221; feature of Geronimo. In JBoss world, this has brought me some headache. In this book it&#8217;s only covered with roundabout one page, just saying that it exists, were you need to place your files and how you can monitor that activity. Even later it&#8217;s not mentioned in special. Well, but that&#8217;s ok for a Quick Reference.</p>
<p>After this, one gets in touch with the most important knowledge of JMS, Database connectivity and JPA. Then there is an extraordinary good chapter about Security. Its one of the biggest chapters in this book and one can feel quite well how expierenced these guys are. Topics are handled in some kind of How-To way, like &#8220;Creating a new keystore&#8221; or &#8220;Changing a private key password&#8221;. These guys know what they speak about, probably the best chapter in this book.</p>
<p>Then it comes to CORBA, which I found also interesting, but to short in general. JNDI was reduced to the most important &#8220;put your hands there&#8221; information. Then it comes to Geronimo Plugins. This one was very interesting too and I wished to read more about it, but well, again, it&#8217;s short reference.  You can find much Listings in this chapter, but I cannot say that they helped me too much without digging in the containers documentation.</p>
<p>In the administration chapter, the authors show the different portlets Geronimo provides for monitoring actions. It&#8217;s basically a walk through of the different pages of the Geronimo console. I think, this chapter could have been improved much more. For example, the Thread Pools Portlet is described with just one sentence: &#8220;&#8230;lists the thread pools defined in the server, and lets you monitor the thread pools.&#8221;. Ok, I don&#8217;t need a book for that information. Some other portlets are described a bit more in detail, but nothing which makes me to a Geronimo Guru.</p>
<p>Later you will have a How-To use the Geronimo Eclipse Plugin. It contains lots of screenshots which helps you to create a project specifically for the Geronimo. More impressive was the Cluster chapter. Clustering is a difficult topic and I would use this section for doing the job. It&#8217;s a good mix between explanation and reference.</p>
<p>Last chapter I was eager to see was the one with the Geronimo Internals. At some parts it reads like a smaller version of an API. It should help to develop own GBeans and it does, but not so much that I would have a huge benefit compared to the docs.</p>
<p>Final words: this one is really a reference and not a teaching book. If you would like to buy it, you should have some knowledge about JEE and about Containers in general. This book will not help you to understand the technologies behind. It&#8217;s more a collection of How-Tos, and that is what I expected from a Quick Reference. The authors made this point clear on the cover, were they are stating that you need to know about JEE5 concepts. At some points I would have preferred some more information. Sometimes I would have wished that they put not so much unnecessary listings (I don&#8217;t need import statements in java listing nor do I need XML-Comments in a 10 line XML file). I think, if you are developing an application, this book is a nice to have. If you are more an administrator and need to develop, package or cluster Geronimo, this book will probably give you some benefits. Especially the security chapter is well done.</p>
<p>However, thanks for this book, I like it, but it&#8217;s not one of my all-time faves.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2009/12/09/apache_geronimo_quick_reference_review.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First steps into Apache Geronimo</title>
		<link>http://www.grobmeier.de/2009/11/18/first-steps-into-apache-geronimo.html</link>
		<comments>http://www.grobmeier.de/2009/11/18/first-steps-into-apache-geronimo.html#comments</comments>
		<pubDate>Wed, 18 Nov 2009 07:04:45 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Geronimo]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=270</guid>
		<description><![CDATA[Apache Geronimo Book on Packt Publishing.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-271" title="Apache Geronimo Book" src="http://blog.grobmeier.de/wp-content/uploads/2009/11/1847196942-243x300.jpg" alt="Apache Geronimo Book" width="243" height="300" />The last weeks I struggled with JavaScript. I hated it quite soon, but with knowledge came some comfort and finally I am now able to use jQuery without too much pain. Let&#8217;s hope that I don&#8217;t have requirements which need a deep knowledge of that stuff <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  However, that brought me to the idea (as odd as it sounds) to try out some server side javascript. It was exactly the right time when Packt Pub. contacted me about <a href="http://www.packtpub.com/apache-geronimo-2-2-quick-reference/book" target="_blank">their new book on Apache Geronimo</a>.</p>
<p>I wanted to step into Geronimo before a few years, but JBoss, Weblogic and even Websphere were used on my projects. No time for playing with Geronimo. Well, but with this book I will start finally and check out whats possible with this little beast <img src='http://www.grobmeier.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>From the table of contents, server side javascript seems not to be on the list. But thats not to bad &#8211; I think I have a new idea for a blog post.</p>
<p>However, I am looking forward to this book. Packt already informed that it&#8217;s on the way to me. So far a very good impression of this publisher. Polite people, quick delivery. Let&#8217;s see how good the book is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2009/11/18/first-steps-into-apache-geronimo.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaMagazin publishes Compress article online</title>
		<link>http://www.grobmeier.de/2009/10/28/javamagazin-publishes-compress-article-online.html</link>
		<comments>http://www.grobmeier.de/2009/10/28/javamagazin-publishes-compress-article-online.html#comments</comments>
		<pubDate>Wed, 28 Oct 2009 07:05:18 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Authoring & Publishing]]></category>
		<category><![CDATA[Commons Compress]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Authoring]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=266</guid>
		<description><![CDATA[The JavaMagazin decided to put the little Commons Compress article online]]></description>
			<content:encoded><![CDATA[<p>The JavaMagazin decided to put the little Commons Compress article <a href="http://it-republik.de/jaxenter/artikel/Commons-Compress-2640.html" target="_blank">online</a>. Originally it has been published in the JavaMagazin 08/2009. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2009/10/28/javamagazin-publishes-compress-article-online.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performance of nonblocking writes to files via PHP</title>
		<link>http://www.grobmeier.de/2009/08/21/performance-ofnonblocking-write-to-files-via-php.html</link>
		<comments>http://www.grobmeier.de/2009/08/21/performance-ofnonblocking-write-to-files-via-php.html#comments</comments>
		<pubDate>Fri, 21 Aug 2009 16:21:03 +0000</pubDate>
		<dc:creator>Christian Grobmeier</dc:creator>
				<category><![CDATA[Apache Log4PHP]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.grobmeier.de/?p=254</guid>
		<description><![CDATA[Comparision of performance between the different options to write to a logfile (nonblocking) within PHP]]></description>
			<content:encoded><![CDATA[<p>This is not too easy. At <a href="http://incubator.apache.org/log4php/" target="_blank">Log4PHP</a> we have exactly that problem right now. Somebody is using the FileAppender and figured out, that one Apache process was waiting looong time before it could write. Reason: the logger locked the Logfile for the whole time of the request. If you have lots of requests, you can think what it means. Performance is past, in the case.</p>
<p>Time for me to think about the different options to write to log files.</p>
<p>I figured out, that I have to compare the following options:</p>
<p>1) Not closing the file while the whole request is running. This is not an option in a live system, but will give me a good idea whats currently the case</p>
<pre>$fp = fopen($file, 'a+');
while($count &lt; $loop) {
   fwrite($fp, $text);
}
fclose($fp);</pre>
<p>2) Closing the file directly after fwrite is called</p>
<pre>while($count &lt; $loop) {
   $fp = fopen($file, 'a+');
   fwrite($fp, $text);
   fclose($fp);
}</pre>
<p>3) Use file_put_contents, which is known as an alias to fopen, fwrite and fclose</p>
<pre>while($count &lt; $loop) {
   file_put_contents($file, $text, FILE_APPEND);
}</pre>
<p>4) Leave the file open while the whole request, but unlock it with flock and flock it again, when the next log event occurs</p>
<pre>$fp = fopen($file, 'a+');
flock($fp, LOCK_UN);
while($count &lt; $loop) {
   if (flock($fp, LOCK_EX)) {
      fwrite($fp, $text);
   }
   flock($fp, LOCK_UN);
}
fclose($fp);</pre>
<p>5) Use a nonblocking stream for this and flock</p>
<pre>$fp = fopen($file, 'a+');
stream_set_blocking($fp, 0);

while($count &lt; $loop) {
   if (flock($fp, LOCK_EX)) {
       fwrite($fp, $text);
   }
   flock($fp, LOCK_UN);
}
fclose($fp);</pre>
<p>6) Use the error_log method, which my friend <a href="http://blog.kevinhorst.de/" target="_blank">Kevin Horst</a> brought up</p>
<pre>while($count &lt; $loop) {
   error_log($text, 3, $file);
}</pre>
<p>For each of this options I wrote a simple function which wrote 10000 times 100 characters in  a freshly created log file. I measured before opening and after closing. Additionally I tried out with 2 seperated threads if the write access is nonblocking. Good thing is, option 2 to 6 are actually nonblocking. And here are the timing results:</p>
<p>1) Execution with NOT closing the log file took 0.0668561458588 seconds<br />
2) Execution with CLOSING the log after each write file took 30.1630220413 seconds<br />
3) Execution with file_put_content took 30.153963089 seconds<br />
4) Execution with leaving the file open, but LOCKING and UNLOCKING it took 0.148998975754 seconds<br />
5) Execution with nonblocking stream took 0.149605989456 seconds<br />
6) Execution with the error_log method took 30.069578886 seconds</p>
<p>Let&#8217;s see what it means.</p>
<p>Not closing the file until the 10000 fwrite calls are handled as actually the fastest. No surprise. It just took 0.0668 seconds but this one is not really an option, cause other threads have to wait until this request has been finished.</p>
<p>If you close the file after each fwrite and make it available to other threads and then reopen it, is hell. For 10000 calls of this kind I needed 30 seconds! It&#8217;s insane to have this in a productive system. The same goes with file_put_contents. Well, I allready knew (its in the php docs) that this method is nothing else then a wrapper for fopen, fwrite and fclose. Times are so similar that I say it&#8217;s exactly the same. Sometimes the one is some millis faster, sometimes the other.</p>
<p>If you open the file, unlock it with flock and flock it again it works very well. Just 0.14 ms for the 10000 fwrite calls. Thats the double amount of option 1, but yeah, here we do some more stuff. The interpreter cares about who is allowed to write, together with the OS. flock works that way, that a call to this function blocks until the requestor gets the actual lock. You can be sure that only one thread is actually writing.</p>
<p>Same goes to the nonblocking stream. This works with  stream_set_blocking($fp, 0);. The file stream is nonblocking, means each thread could write at it the same time. That no mess happens, we need an flock here too. That brings us to the nearly same results as fopen, flock, fwrite, flock, fclose option above. But looking at the logfiles of this one and option 4, this one looks more nice to me. This is just subjective, but it looks like the lock is shared more nicely between both threads.</p>
<p>Last one is the error_log method. It didn&#8217;t had any idea what to expect, but&#8230; 30 seconds! This one behaviours like a wrapper for fopen, fwrite and fclose, like file_put_content. No guys, this is not really a method enabled for logging! If one would use this in a framework like Log4PHP, that would be hell to performance. I would think that this should better removed out. The name suggests a good logging method, but this is not the case.</p>
<p>Having that all said, Log4PHP will get the lock and unlock option number 4. I feel good with it, since it&#8217;s quite straightforward. I don&#8217;t have too much expierence with the non blocking stream and don&#8217;t want to have this in a framework like log4php is.</p>
<p>However, Logging must be used carefully at all. I thnk on a system with 10000 request a second. Enabling logging into one file could bring the system down. I think a live system should have the option to log exactly one request. Maybe triggered by an url param. Think carefully what you log and how you configure your live system.</p>
<p>The complete script can be found <a href="http://blog.grobmeier.de/wp-content/uploads/2009/08/benchmark.php.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grobmeier.de/2009/08/21/performance-ofnonblocking-write-to-files-via-php.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
