<?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>Josh Butts .com &#187; PHP</title>
	<atom:link href="http://www.joshbutts.com/topics/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joshbutts.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 15 Aug 2009 19:55:12 +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>Using PEAR to keep Zend Framework current in Zend Server CE</title>
		<link>http://www.joshbutts.com/posts/zend-server-pear-zf/</link>
		<comments>http://www.joshbutts.com/posts/zend-server-pear-zf/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 19:55:12 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Server Admin]]></category>

		<guid isPermaLink="false">http://www.joshbutts.com/?p=41</guid>
		<description><![CDATA[Let me preface this by saying that up until recently, I&#8217;ve been anti-Zend-Server for a somewhat silly reason.  I&#8217;m used to deploying PHP applications on custom compiled builds of PHP, MySQL and PHP, and the thought of not compiling my stack from source was just unbearable.  For some unknown reason, I decided to give [...]]]></description>
			<content:encoded><![CDATA[<p>Let me preface this by saying that up until recently, I&#8217;ve been anti-Zend-Server for a somewhat silly reason.  I&#8217;m used to deploying PHP applications on custom compiled builds of PHP, MySQL and PHP, and the thought of not compiling my stack from source was just unbearable.  For some unknown reason, I decided to give <a href="http://www.zend.com/en/products/server-ce/">Zend Server CE</a> another try.  I&#8217;ve been in the beta program for this product since the days when it was called Zend Zenith.  Back then, I couldn&#8217;t figure out why they weren&#8217;t doing a more XAMPP-style application, but I&#8217;ve since come to appreciate the the way Zend Server is set up.</p>
<p>Now, on to the more important bits, at least as far as I&#8217;m concerned.  I like Zend Framework.  I like it quite a bit.  What I don&#8217;t like is continually downloading numerous copies of it as the version numbers increase.  What I like even less is &#8220;pinning&#8221; applications to certain versions of ZF by using an SVN:External or similar technique.  What I do like is the Zend Framework PEAR channel that <a href="http://www.ralphschindler.com">Ralph Schindler</a> makes available on <a href="http://www.zfcampus.org">zfcampus.org</a>.  This allows me to have ZF downloaded, installed, and upgraded with one command, and because it&#8217;s installed as part of PEAR, the include paths just work without extra setup.</p>
<p>Zend Server comes with a &#8220;fixed&#8221; version of Zend Framework (the most current package comes with 1.9.0), and my goal was to take out the version it comes with and replace it with a PEAR-installed version.  I also wanted the Zend Server web application to still understand and report the correct version information for Zend Framework.  As Zend Server&#8217;s GUI is really just another ZF application, it was fairly straight forward to do a littler reverse-engineering, and the whole process took less than 10 minutes to complete.</p>
<p>The steps outlined below should work on Mac and Linux.  I doubt they would have any hope of working on Windows, as it required a symlink to trick Zend Server (in the future, I&#8217;m referring to this as ZS) into using a different copy of ZF.  You could do this on Windows fairly easily still, but you&#8217;d probably need to edit one of the controllers for the ZS management GUI.  Also, the some of the commands below assume you have <span class="pre">/usr/local/zend/bin</span> on your PATH, which I do.  If you don&#8217;t, you may be talking to the wrong PHP, especially on a Mac, so I&#8217;d recommend doing that first.</p>
<p>The first step was to find out where ZS keeps its copy of ZF.  Conveniently, the GUI reports this in the &#8220;Server Info&#8221; screen as <span class="pre">/usr/local/zend/share/ZendFramework</span>.</p>
<p><a href="http://www.joshbutts.com/wp-content/uploads/2009/08/picture-2.png"><img class="alignnone size-full wp-image-43" title="ZS Server Info Screen" src="http://www.joshbutts.com/wp-content/uploads/2009/08/picture-2.png" alt="ZS Server Info Screen" width="631" height="400" /></a></p>
<p>Next, we need to actually install the zfcampus.org PEAR channel and download ZF.  As of this writing, the channel is serving up ZF 1.9.1, and ZS comes with 1.9.0.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">deeporange:~ josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear channel-discover pear.zfcampus.org
Adding Channel <span style="color: #ff0000;">&quot;pear.zfcampus.org&quot;</span> succeeded
Discovery of channel <span style="color: #ff0000;">&quot;pear.zfcampus.org&quot;</span> succeeded
deeporange:~ josh$
&nbsp;
deeporange:~ josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear <span style="color: #c20cb9; font-weight: bold;">install</span> zfcampus<span style="color: #000000; font-weight: bold;">/</span>zf
downloading ZF-1.9.1.tgz ...
Starting to download ZF-1.9.1.tgz <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span>,<span style="color: #000000;">272</span>,<span style="color: #000000;">570</span> bytes<span style="color: #7a0874; font-weight: bold;">&#41;</span>
.............................done: <span style="color: #000000;">3</span>,<span style="color: #000000;">272</span>,<span style="color: #000000;">570</span> bytes
<span style="color: #c20cb9; font-weight: bold;">install</span> ok: channel:<span style="color: #000000; font-weight: bold;">//</span>pear.zfcampus.org<span style="color: #000000; font-weight: bold;">/</span>ZF-1.9.1
deeporange:~ josh$</pre></td></tr></table></div>

<p>Through a little casual directory snooping, we can learn that ZS has PEAR configured with a base path of <span class="pre">/usr/local/zend/share/pear</span>.  This means that ZF was just installed to <span class="pre">/usr/local/zend/share/pear/Zend</span>.  What we need to do now is get <span class="pre">/usr/local/zend/share/ZendFramework/library/Zend</span> (this is the path where ZS expects ZF to be) to really point to <span class="pre">/usr/local/zend/share/pear/Zend</span>.  On a Mac or Linux system, it&#8217;s simple enough to completely remove the ZS default ZF and create a symlink to our new install.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">deeporange:~ josh$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>zend<span style="color: #000000; font-weight: bold;">/</span>share
deeporange:share josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-fR</span> ZendFramework<span style="color: #000000; font-weight: bold;">/</span>
deeporange:share josh$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> ZendFramework
deeporange:share josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> ZendFramework
deeporange:share josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> ZendFramework<span style="color: #000000; font-weight: bold;">/</span>library
deeporange:share josh$ <span style="color: #7a0874; font-weight: bold;">cd</span> ZendFramework<span style="color: #000000; font-weight: bold;">/</span>library<span style="color: #000000; font-weight: bold;">/</span>
deeporange:library josh$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>zend<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>pear<span style="color: #000000; font-weight: bold;">/</span>Zend .
&nbsp;
deeporange:library josh$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-la</span>
total <span style="color: #000000;">8</span>
drwxr-xr-x  <span style="color: #000000;">3</span> root  wheel  <span style="color: #000000;">102</span> Aug <span style="color: #000000;">15</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">21</span> .
drwxr-xr-x  <span style="color: #000000;">3</span> root  wheel  <span style="color: #000000;">102</span> Aug <span style="color: #000000;">15</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">21</span> ..
lrwxr-xr-x  <span style="color: #000000;">1</span> root  wheel   <span style="color: #000000;">31</span> Aug <span style="color: #000000;">15</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">21</span> Zend -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>zend<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>pear<span style="color: #000000; font-weight: bold;">/</span>Zend
deeporange:library josh$</pre></td></tr></table></div>

<p>Now we can see by refreshing the Zend Server GUI screen that our Zend Framework version number is reported as 1.9.1.  An optional last step would be to modify the include path directive using the ZS admin screen to remove <span class="pre">/usr/local/zend/share/ZendFramework</span>, as this is merely a symlink to the PEAR base path at this point, which is already included in the include path.  Your new include path setting should look like the one below.</p>
<p><a href="http://www.joshbutts.com/wp-content/uploads/2009/08/picture-3.png"><img class="alignnone size-full wp-image-58" title="ZS Include Path" src="http://www.joshbutts.com/wp-content/uploads/2009/08/picture-3.png" alt="ZS Include Path" width="831" height="331" /></a></p>
<p>Now, the next time there is a new version of Zend Framework available on zfcampus.org, all you have to do to get everything upgraded is run the following command:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">deeporange:<span style="color: #000000; font-weight: bold;">!</span> josh$ pear upgrade zfcampus<span style="color: #000000; font-weight: bold;">/</span>zf</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.joshbutts.com/posts/zend-server-pear-zf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert GPS .loc files to .gpx files with PHP</title>
		<link>http://www.joshbutts.com/posts/loc2gpx-in-php/</link>
		<comments>http://www.joshbutts.com/posts/loc2gpx-in-php/#comments</comments>
		<pubDate>Mon, 25 May 2009 20:03:56 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.joshbutts.com/?p=29</guid>
		<description><![CDATA[I wrote a simple PHP5 script to convert LOC files to GPX files for use with various GPS software and units.  The script will take a folder full of .loc files and convert them to .gpx files, putting 1 GPX file for each in the same folder.]]></description>
			<content:encoded><![CDATA[<p>This is a simple PHP5 script I wrote to convert LOC files from geocaching.com into GPX files.  You have to be a paid member to get GPX files from geocaching.com, but both LOC and GPX files are xml, and are fairly trivial to convert.  I tested that the GPX files produced from this script correctly load into my Garmin desktop software as well as into the GPS.  The script is hard coded to set them to be geocache-type waypoints, but you could always change that as needed.  Of course, I provide no warranty of any sort, but it worked for me.   I called this file loc2gpx.php, but you can download the source and call it whatever you like.  The example command below assumes you agree with my name for it.</p>
<p><strong>Usage:</strong><br />
Pass the script a folder full of .loc files and it will create a single .gpx file for each one.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>~<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ php loc2gpx.php <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>.loc files</pre></div></div>

<p><a href="http://www.joshbutts.com/wp-content/uploads/2009/05/loc2gpxphp.zip">Download loc2gpx.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshbutts.com/posts/loc2gpx-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP is not a DSL</title>
		<link>http://www.joshbutts.com/posts/php-a-dsl/</link>
		<comments>http://www.joshbutts.com/posts/php-a-dsl/#comments</comments>
		<pubDate>Sun, 24 May 2009 20:27:24 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.joshbutts.com/?p=10</guid>
		<description><![CDATA[There's been more and more activity on the blogosphere about DSL's lately, and I'm not buying into it (partially because some of them are well-crafted trolls).  I believe that there's not many domain-specific languages out there, at least not "main stream" ones. ]]></description>
			<content:encoded><![CDATA[<p><strong>EDIT</strong> (5/25/09): Some how my Wikipedia link to Domain Specific Languages got lost in a draft somehwere, thanks Supermike for noticing it was missing.  <a href="http://en.wikipedia.org/wiki/Domain-specific_programming_language" target="_blank">http://en.wikipedia.org/wiki/Domain-specific_programming_language</a></p>
<p><em><strong>Disclaimer:</strong></em> I&#8217;m going to try my best to keep this post from turning into a rant comparing PHP to other trendy scripting languages.  Also, If you came here with a pre-disposed opinion that PHP sucks, I&#8217;m not likely to convince you otherwise, so I&#8217;ll concede now; that&#8217;s not the point anyway.</p>
<p>There&#8217;s been more and more activity on the blogosphere about DSL&#8217;s lately, and I&#8217;m not buying into it (partially because some of them are well-crafted trolls).  I believe that there&#8217;s not many domain-specific languages out there, at least not &#8220;main stream&#8221; ones.  When I think DSL, I think Lego LOGO and BASH; languages that literally solve one problem.  There are many other languages available that happen to be particularly good at doing one thing or the other, however that&#8217;s not to say they couldn&#8217;t do some other thing, albeit very poorly.</p>
<p>There&#8217;s a mile-long spectrum of language functionality to consider here.  You have C/C++ that can be made to do damn near anything from programming your refrigerator to serving web pages.  On the short end of that spectrum are DSL&#8217;s.  So where does PHP fit into a scheme like this?  I&#8217;m going to say it sits squarely in the middle, and that&#8217;s why the internet has such a love-hate relationship with it.  PHP is good at many things, great at a few things, and terrible at a few as well.  People who don&#8217;t solve problems with PHP all day every day aren&#8217;t fully aware of it&#8217;s extensive capabilities, and have been shown most likely to start flame wars about PHP&#8217;s inferiority to (Ruby|Python|Java|C#) by an incomprehensive study I just conducted in my head.</p>
<p>PHP, in it&#8217;s early stages, could definitely have been considered a DSL.  It existed solely to solve one problem: the web problem.  <em>(I&#8217;ll also argue that the folks over on 4Chan maybe creating the &#8220;web problem&#8221; as we speak.)</em> What is the web problem?  It&#8217;s the &#8220;D&#8221; in DSL.  The domain.  How do we create web pages programmatically?  That&#8217;s the web problem, and PHP came around and started solving it.  Really damn easily.</p>
<p>With PHP4 and especially PHP5, times have changed.  PHP&#8217;s runtime, if you include the vast extension library, is full-featured almost to a fault these days.  Now PHP solves lots of problems, from raw-socket TCP/IP problems, to XML parsing problems, to Database problems, and more.  I&#8217;ve even heard of someone writing a software compiler in PHP (purely acadamic, of course).  So is PHP <em>great</em> at solving these new and more complicated problems that the Internet has brought upon us?  Nah, it&#8217;s not great at them.  But it&#8217;s pretty good, and that&#8217;s good enough, especially considering that you can tackle almost any internet-related problem without a context swith to another language (because you&#8217;re already building web pages in PHP to start with right?).</p>
<p>So what does PHP suck at?  Well, there are some things it just can&#8217;t, in fact probably never will, do.  PHP can&#8217;t do threads.  In fact, it&#8217;s not happy when other things that touch it are doing threads.  If you must have threads, you should probably use (Ruby|Python|Java|C#).  PHP also sucks at running for a long time.  PHP scripts just aren&#8217;t meant to run for 10 days at a time.  Somehwere along the line they&#8217;re probably going to develop a memory leak and do something nasty.  That&#8217;s OK though.  PHP wasn&#8217;t design to run for a long time or to spin up multiple threads.  And this my friends, is where the gray area comes in.  I spent the last paragraph telling you about how PHP wasn&#8217;t a DSL because it could solve all these disparate problems (or at least implying it&#8230;spoiler alert), but now we have a problem.  I just told you two of PHP&#8217;s shortcomings were language design issues.  And why were they designed that way? Well, PHP is meant to be created and torn down in the context of a web request, because PHP was meant to solve the web problem.</p>
<p>So no, PHP isn&#8217;t a DSL, but it used to be.  Ironically though, what makes it so popular, is that it&#8217;s really good at that one thing:  it&#8217;s <strong><em>damn good at creating web pages.</em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshbutts.com/posts/php-a-dsl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keeping track of merges in SVN 1.5</title>
		<link>http://www.joshbutts.com/posts/keeping-track-of-merges-in-svn-15/</link>
		<comments>http://www.joshbutts.com/posts/keeping-track-of-merges-in-svn-15/#comments</comments>
		<pubDate>Mon, 18 May 2009 04:47:30 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.joshbutts.com/?p=3</guid>
		<description><![CDATA[I’ve finally migrated to Subversion 1.5 hoping to be completely wowed by the new merge tracking features.  While they may be great on paper, the Subversive/SVNKit connectors that come with Eclipse (rather, Zend Studio for Eclipse) are less than exciting.  If you’re expecting, “wow, new interface and features”, don’t be, it’s a mild change at best.  However, the merge tracking definitely works and it works automagically.]]></description>
			<content:encoded><![CDATA[<p>I’ve finally migrated to Subversion 1.5 hoping to be completely wowed by the new merge tracking features.  While they may be great on paper, the Subversive/SVNKit connectors that come with Eclipse (rather, Zend Studio for Eclipse) are less than exciting.  If you’re expecting, “wow, new interface and features”, don’t be, it’s a mild change at best.  However, the merge tracking definitely works and it works automagically.  The issue that I’ve run into with it is that while it may track what has been merged where just fine, someone still has to track all the things have haven’t been merged.  This especially true if you have a “stable” branch in your code.  As you bring features and updates from the trunk into that branch, SVN will happily track the revision numbers that you’ve merged.  But, what about all those ones that haven’t been merged yet?</p>
<p>Up until today, I’ve been going through a tedious process of reading the svn:mergeinfo field and comparing that against the commit logs from WebSVN or Fisheye, and then using the “whiteboard” method to keep tracking of that still needs to be looked at.  To solve this problem, I wrote a quickie PHP script that will read the svn:mergeinfo property as well as another property I’ve created called “minmerge” and spit out a list of revisions to look over.  The minmerge property is basically a number I set by hand that denotes how far back in to look.  Anything lower than that revision number is assumed to have already been processed and either merged or decided not to be merged.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #000088;">$mergedcmd</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;svnlook pg /svn/testrepo svn:mergeinfo /branches/stable&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$minmergecmd</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;svnlook pg /svn/testrepo minmerge /branches/stable&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$mergemsgcmd</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$merged</span> <span style="color: #339933;">=</span> <span style="color: #990000;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mergedcmd</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$minmerge</span> <span style="color: #339933;">=</span> <span style="color: #990000;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$minmergecmd</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$merged</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/trunk:&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$merged</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$revs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$merged</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;found &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$revs</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; merges <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$revs</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$rev</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rev</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$bounds</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rev</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$bounds</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #000088;">$bounds</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$c</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$rev</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #990000;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$min</span> <span style="color: #339933;">=</span> <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;found &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; revisions from <span style="color: #006699; font-weight: bold;">$min</span> to <span style="color: #006699; font-weight: bold;">$max</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;ignoring revs above <span style="color: #006699; font-weight: bold;">$minmerge</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$min</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #000088;">$max</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">,</span> <span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$minmerge</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$unmerged</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$c</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$unmerged</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;found &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$unmerged</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; unmerged revisions:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$unmerged</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$rev</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$rev</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.joshbutts.com/posts/keeping-track-of-merges-in-svn-15/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
