<?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>Daniel Skinner: News and Articles on Web Development &#187; php</title>
	<atom:link href="http://www.daniel-skinner.co.uk/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.daniel-skinner.co.uk</link>
	<description>Daniel Skinner&#039;s Blog: Web Development news and articles</description>
	<lastBuildDate>Wed, 18 Mar 2009 15:11:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>String.Capitalize in C# (PHP&#8217;s ucwords in C#)</title>
		<link>http://www.daniel-skinner.co.uk/php-ucwords-in-c/25/02/2009</link>
		<comments>http://www.daniel-skinner.co.uk/php-ucwords-in-c/25/02/2009#comments</comments>
		<pubDate>Wed, 25 Feb 2009 15:10:50 +0000</pubDate>
		<dc:creator>Daniel Skinner</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Aggeregate]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Extension Method]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ucwords]]></category>

		<guid isPermaLink="false">http://www.daniel-skinner.co.uk/?p=31</guid>
		<description><![CDATA[I have been playing around with C# recently and found the need for functionality similar to that provided by PHP&#8217;s ucwords() function. I dont think this exists in C# as standard so here is a simple extension method to achieve ucwords in C# using a little bit of LINQ (the extremely useful Aggregate extension method) [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing around with C# recently and found the need for functionality similar to that provided by PHP&#8217;s ucwords() function. I dont think this exists in C# as standard so here is a simple extension method to achieve ucwords in C# using a little bit of LINQ (the extremely useful Aggregate extension method) to achieve it:</p>
<pre>public static string Capitalize(this String s)
{
  return s.ToCharArray().Aggregate(String.Empty,
    (working, next) =>
      working.Length == 0 &#038;&#038; next != ' ' ? next.ToString().ToUpper() : (
        working.EndsWith(" ") ? working + next.ToString().ToUpper() :
          working + next.ToString()
    )
  );
}</pre>
<p>With this included in your name space, the extension method can be used on any String instance like:</p>
<pre>string myString = "this sentence needs capitalization!";
Console.WriteLine(myString.Capitalize());
//This Sentence Needs Capitalization!</pre>
<p>Short but sweet!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daniel-skinner.co.uk/php-ucwords-in-c/25/02/2009/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Install phpUnderControl on CentOS 5</title>
		<link>http://www.daniel-skinner.co.uk/php-under-control-svn-centos-5/12/06/2008</link>
		<comments>http://www.daniel-skinner.co.uk/php-under-control-svn-centos-5/12/06/2008#comments</comments>
		<pubDate>Thu, 12 Jun 2008 15:19:56 +0000</pubDate>
		<dc:creator>Daniel Skinner</dc:creator>
				<category><![CDATA[Guides]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpundercontrol]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.daniel-skinner.co.uk/?p=26</guid>
		<description><![CDATA[If you follow this guide you should start with a basic CentOS 5 installation with Subversion setup correctly and end up with a working installation of phpUnderControl.]]></description>
			<content:encoded><![CDATA[<p>A while back now I started setting up a server to use as a development machine. From a standard CentOS 5 installation I have installed <a title="CentOS SVN" href="http://www.daniel-skinner.co.uk/setup-subversion-and-trac-on-centos-5/06/01/2008">SubVersion and Trac</a>. Now I have finally got round to installing <a title="phpUnderControl" href="http://www.phpundercontrol.org/">phpUnderControl</a> for continuous integration and build management.</p>
<p>As usual, there are many great guides already on the net but getting everything to work usually requires a few of these references and a few additional changes. I will point out where I got the information from where applicable but the aim of this guide is to be complete and comprehensive.</p>
<p>If you follow this guide you should start with a basic <a title="CentOS 5 SVN and Trac" href="http://www.daniel-skinner.co.uk/setup-subversion-and-trac-on-centos-5/06/01/2008">CentOS 5 installation with Subversion</a> setup correctly and end up with a working installation of phpUnderControl.</p>
<p><span id="more-26"></span></p>
<h2>The Environment</h2>
<p>I am aiming for the following:</p>
<ul>
<li>CentOS 5 with SubVersion installed</li>
<li>PHP 5.2.X installed</li>
<li>CruiseControl binary installed, running on Sun JDK 6</li>
<li>phpUnderControl installed</li>
<li>A working build process for the example project</li>
</ul>
<h2>Here it is&#8230;</h2>
<h3>Upgrade CentOS 5 with PHP5.2</h3>
<p>To get PHP5.2 installed on CentOS 5 (required for phpUC) we need to add an additional repository that has it. I am going to use the <a href="http://www.jasonlitka.com/yum-repository/">Yum Repository</a> provided by <a href="http://www.jasonlitka.com/">Jason Litka</a>. Detailed instructions can be found at his site. In summary, for CentOS 5 this consists of:</p>
<pre>rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
vi /etc/yum.repos.d/utterramblings.repo</pre>
<p>Add the following lines:</p>
<pre>[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka</pre>
<p>Now Yum can update PHP to 5.2. We also need a few other dependencies for phpUC:</p>
<pre>yum install -y php php-pear php-xml</pre>
<p>And the latest version of pear:</p>
<pre>pear channel-update pear.php.net
pear upgrade pear</pre>
<h3>Get phpUnderControl</h3>
<p>Using pear to install phpUC:</p>
<pre>pear config-set preferred_state beta
pear channel-discover components.ez.no
pear channel-discover pear.phpunit.de
pear install --alldeps phpunit/phpUnderControl</pre>
<p>This will install phpUC and all required dependencies. It&#8217;s a good idea to set pear back to only installing stable (i.e. non beta) packages:</p>
<pre>pear config-set preferred_state stable</pre>
<h3>Sun Java JDK 6</h3>
<p>phpUC needs CruiseControl and CruiseControl needs Sun JDK. Again, a full guide for getting this done can be found on the <a title="Java on CentOS" href="http://www.jasonlitka.com/">CentOS wiki</a>. The steps I took are:</p>
<p>Set up rpmbuild:</p>
<pre>vi ~/.rpmmacros</pre>
<p>Make sure the file contents is:</p>
<pre>%_topdir /home/&lt;username&gt;/rpmbuild
%_tmppath %{_topdir}/tmp</pre>
<p>with &lt;username&gt; replaced with your logon name (if you are using root the path would be /root/rpmbuild).</p>
<pre>mkdir -p ~/rpmbuild/{SOURCES,SRPMS,SPECS,RPMS,tmp,BUILD}
yum install -y rpm-build gcc gcc-c++ redhat-rpm-config jpackage-utils</pre>
<p>Download JDK6 Update 6 (or the latest version) from <a href="http://java.sun.com">java.sun.com</a>. Get the .rpm.bin version. The file I got was called jdk-6u6-linux-i586-rpm.bin.</p>
<pre>chmod +x jdk-6u6-linux-i586-rpm.bin
./jdk-6u6-linux-i586-rpm.bin
wget http://mirrors.dotsrc.org/jpackage/1.7/generic/non-free/RPMS/java-1.6.0-sun-compat-1.6.0.06-1jpp.i586.rpm
rpm -Uvh jdk-6u1-linux-i586.rpm java-1.6.0-sun-compat-1.6.0.01-1jpp.i586.rpm</pre>
<p>With the JDK successfully installed (hopefully) we use Alternatives to select the Sun JDK:</p>
<p>/usr/sbin/alternatives &#8211;config java</p>
<p>Make sure the selected version is along the lines of /usr/lib/jvm/jre-1.6.0-sun/bin/java.</p>
<p>At this point java -version should give something like:</p>
<pre>java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)</pre>
<p>Now to add some environment variables:</p>
<pre>vi /etc/profile.d/java.sh</pre>
<p>Add the following:</p>
<pre>export JAVA_HOME="/usr/java/jdk1.6.0_06"
export JAVA_PATH="$JAVA_HOME"
export PATH="$PATH:$JAVA_HOME"</pre>
<p>Note that JAVA_HOME is not set to &#8220;/usr/java/jdk1.6.0_06/bin&#8221;. I don&#8217;t think this is the standard but it&#8217;s an easy way to get CruiseControl to work (<a href="http://www.centos.org/modules/newbb/viewtopic.php?viewmode=flat&amp;topic_id=5717&amp;forum=28">see here</a>).</p>
<p>You will also need to restart your session for these changes to take effect or just export the variables directly to the prompt.</p>
<h3>Get CruiseControl</h3>
<p>Download the latest <a title="CruiseControl" href="http://sourceforge.net/project/showfiles.php?group_id=23523&amp;package_id=16338">2.7.X CruiseControl binary</a>. My version is cruisecontrol-bin-2.7.2.zip.</p>
<pre>unzip cruisecontrol-bin-2.7.2.zip -d /opt
ln -s /opt/cruisecontrol-bin-2.7.2/ /opt/cruisecontrol</pre>
<p>CruiseControl is bow installed in /opt/cruisecontrol-bin-2.7.2/ which is symlinked by /opt/cruisecontrol/</p>
<h3>Setup phpUnderControl and CruiseControl</h3>
<p>A more thorough guide can be found in the <a title="phpUnderControl" href="http://www.phpundercontrol.org/documentation.html">phpUnderControl Documentation</a>.</p>
<p>To patch the CruiseControl installation you should be able to simply to:</p>
<pre>phpuc install /opt/cruisecontrol</pre>
<p>If not, try this:</p>
<pre>cd /opt/
<code>svn co svn://www.phpunit.de/browser/phpUnderControl/tags/0.4.2 phpundercontrol
phpundercontrol/bin/phpuc.php install /opt/cruisecontrol</code></pre>
<p>And that&#8217;s pretty much it! I&#8217;ll just set up the example project so you can see it all in action:</p>
<pre>phpuc example /opt/cruisecontrol</pre>
<p>And to start cruisecontrol:</p>
<pre>cd /opt/cruisecontrol/
./cruisecontrol.sh</pre>
<p>Give it a while to setup. Once it&#8217;s all done you should be able to access the interface at:</p>
<p>http://localhost:8080/</p>
<p>By now you should have a working phpUC setup on your CentOS 5 machine and the example project failing the build process. Setting up your own projects is a bit more involved &#8211; follow the guide in the documentation for more details. As for the best way to make use of phpUC and optimal project layouts etc. I will have to get back to you as I haven&#8217;t yet played around much.</p>
<p>Please let me know if this helped you. If you come across any problems I will be happy to try and help.</p>
<h2>Resources</h2>
<ul>
<li>Setting up <a title="CentOS 5 SVN and Trac" href="http://www.daniel-skinner.co.uk/setup-subversion-and-trac-on-centos-5/06/01/2008">S</a><a title="CentOS 5 SVN and Trac" href="http://www.daniel-skinner.co.uk/setup-subversion-and-trac-on-centos-5/06/01/2008">VN (and optionally Trac) on CentOS 5</a></li>
<li>Alternative <a title="Install PHPUnderControl on CentOS 5.1" href="http://f13o.blogspot.com/2008/06/install-phpundercontrol-on-centos-51.html">PHP5.2 and phpUC Setup</a></li>
<li><a title="Yum Repository" href="http://www.jasonlitka.com/yum-repository/">Jason Litka&#8217;s Yum Repository</a></li>
<li>Detailed guide to installing <a title="Java on CentOS" href="http://wiki.centos.org/HowTos/JavaOnCentOS">Java on CentOS</a></li>
<li><a href="http://www.phpundercontrol.org/documentation.html">phpUnderControl documentation</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.daniel-skinner.co.uk/php-under-control-svn-centos-5/12/06/2008/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Zend Certified Engineer!</title>
		<link>http://www.daniel-skinner.co.uk/zend-certified-engineer/31/01/2008</link>
		<comments>http://www.daniel-skinner.co.uk/zend-certified-engineer/31/01/2008#comments</comments>
		<pubDate>Thu, 31 Jan 2008 17:01:27 +0000</pubDate>
		<dc:creator>Daniel Skinner</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zce]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.daniel-skinner.co.uk/zend-certified-engineer/31/01/2008</guid>
		<description><![CDATA[I finally got round to booking the Zend PHP 5 Exam and successfully passed earlier this week!]]></description>
			<content:encoded><![CDATA[<p>I finally got round to booking the Zend PHP 5 Exam and successfully passed earlier this week!</p>
<p>I didn&#8217;t think that the exam was particularly hard but whilst revising I did learn about a few interesting features of the language.</p>
<p>I would recommend becoming a Zend Engineer to anyone who is serious about PHP software development. If anyone is interested I have a few online practice exams going spare.</p>
<p>For more information on Zend certification, see <a title="ZCE" rel="nofollow" href="http://en.wikipedia.org/wiki/ZCE">this article</a></p>
<p><a rel="nofollow external" href="http://www.zend.com/store/education/certification/authenticate.php?ClientCandidateID=ZEND006969&amp;RegistrationID=223910931"><img src="http://www.zend.com/images/training/php5_zce_logo.gif" title="Zend Certified Engineer" alt="Zend Certified Engineer" width="73" height="47" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.daniel-skinner.co.uk/zend-certified-engineer/31/01/2008/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend Framework 1.0.3 Released</title>
		<link>http://www.daniel-skinner.co.uk/zend-framework-103-released/30/11/2007</link>
		<comments>http://www.daniel-skinner.co.uk/zend-framework-103-released/30/11/2007#comments</comments>
		<pubDate>Fri, 30 Nov 2007 15:54:44 +0000</pubDate>
		<dc:creator>Daniel Skinner</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[openid]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://www.daniel-skinner.co.uk/zend-framework-103-released/30/11/2007</guid>
		<description><![CDATA[Zend Framework (ZF) 1.0.3 has been released. This is the third maintenance release since the launch of Zend Framework 1.0 at the beginning of July 2007, which goes to show how quickly the ZF community is growing.
Zend Framework is quickly becoming the most popular PHP5 framework, mostly due to the fact that it does not tie you [...]]]></description>
			<content:encoded><![CDATA[<p>Zend Framework (ZF) 1.0.3 has been released. This is the third maintenance release since the launch of Zend Framework 1.0 at the beginning of July 2007, which goes to show how quickly the ZF community is growing.</p>
<p>Zend Framework is quickly becoming the most popular PHP5 framework, mostly due to the fact that it does not tie you to coding in a specific way. You can use individual components or choose to use the entire Model-View-Controller (MVC) architecture. In a post written on the <a title="Zend Blog" rel="external" href="http://blogs.zend.com/2007/11/22/zend-framework-launch-zendcon-roadmap-and-zf-11/">Zend Blog</a>, the ZF team are expecting over 3 million downloads of the framework by the end of the year.</p>
<p>The near future roadmap for ZF includes adding support for even more web services and providing a standard solution for handling web forms. There will also be improvements in the online documentation (which is already an excellent reference) and tutorials as well as support for <a title="Open ID - An open and decentralized identity system" rel="external" href="http://openid.net/">OpenID.</a></p>
<p>We can expect some of these features to be ready for the upcoming 1.1.0 release which is expected in the first quarter of 2008.</p>
<p>For more information, see <a title="ZF Components" rel="external" href="http://framework.zend.com/manual/components">Zend Framework Components</a> and the <a title="ZF Roadmap" rel="external" href="http://framework.zend.com/whyzf/future/">Zend Framework roadmap</a>.</p>
<p><a title="Download ZF" rel="external" href="http://framework.zend.com/download">Download Zend Framework</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daniel-skinner.co.uk/zend-framework-103-released/30/11/2007/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
