<?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>High Fibre Programming &#187; subversion</title>
	<atom:link href="http://www.4pmp.com/tag/subversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.4pmp.com</link>
	<description>PHP, MySQL, C, Java, Linux and other great after dinner speech topics</description>
	<lastBuildDate>Tue, 17 Jan 2012 09:10:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Programmatically set environment for Symfony project</title>
		<link>http://www.4pmp.com/2010/10/programmatically-set-environment-for-symfony-project/</link>
		<comments>http://www.4pmp.com/2010/10/programmatically-set-environment-for-symfony-project/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 08:10:59 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://www.4pmp.com/?p=335</guid>
		<description><![CDATA[I have recently been working on a web project built on Symfony 1.4. There are a team of developers, each has their own installation and we had the problem whereby each needed their own particular configuration settings. Symfony allows for multiple configurations to be specified using “environments” but the problem is how to get each [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently been working on a web project built on Symfony 1.4.   There are a team of developers, each has their own installation and we had the problem whereby each needed their own particular configuration settings.   Symfony allows for multiple configurations to be specified using “environments” but the problem is how to get each installation to choose the correct environment without changing index.php &#8211; which of course would affect everyone else each time it was committed to Subversion.</p>
<p>The solution was to create a simple class that looks for the existence of a file, environment.cfg, in the configuration directory.   The contents of the file specify which environment to use.   This file is not committed to Subversion each developer can specify their own environment without affecting anything in Subversion.</p>
<p>We added a few lines to our index.php file like this:</p>
<pre class="brush: php;">
// Load the class which chooses the environment
require_once(dirname(__FILE__).'/../lib/helper/ApplicationEnvironment.class.php');

// Instantiate the class - specify the default environment to &quot;live&quot; (if there is no environment.cfg file)
$environment = new ApplicationEnvironment(&quot;live&quot;);

// Try and read environment.cfg
$environment-&gt;overrideFromFile(dirname(__FILE__).'/../config/environment.cfg');

// Create a configuration object using the chosen environment
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', $environment-&gt;getEnvironment(), $environment-&gt;getDebugMode());
</pre>
<p>Note that the debug mode option is also set by the ApplicationEnvironment object.   This is determined by the URL:</p>
<pre class="brush: php;">
// in ApplicationEnvironment.class.php
    public function getDebugMode()
    {
        $debugAddresses = array(&quot;debug.example.com&quot;);

        return in_array($_SERVER['SERVER_NAME'], $debugAddresses);
    }
</pre>
<p>We could have used the environment.cfg file to specify this, for example on another line, but we also needed to specify debug mode on our live server so that if the site is accessed at www.oursite.com it is not in debug mode, but if it is accessed via debug.oursite.com then it is in debug mode (of course debug.oursite.com is http password protected).</p>
<h2>CLI</h2>
<p>Next we had the problem of setting the environment.   We could of course rely on each developer to put <code>--env=my-environment</code> but it would be much nicer to have this done automatically.   The solution was to create a simple script that resides in the application root directory next to symfony.php that looks something like this:</p>
<pre class="brush: php;">
require_once(dirname(__FILE__).'/lib/helper/ApplicationEnvironment.class.php');

$environment = new ApplicationEnvironment(&quot;live&quot;);
$environment-&gt;overrideFromFile(dirname(__FILE__).'/config/environment.cfg');

$envSet = false;

foreach ($argv as $i =&gt; $arg)
{
    if (substr($arg, 0, 6) == &quot;--env=&quot;)
    {
        $envSet = true;
        break;
    }
}

if (!$envSet)
{
    $argv[] = sprintf(&quot;--env=%s&quot;, $environment-&gt;getEnvironment());
    $argc++;

    $_SERVER['argv'] = $argv;
    $_SERVER['argc'] = $argc;
}

chdir(dirname(__FILE__));
require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php');
include(sfCoreAutoload::getInstance()-&gt;getBaseDir().'/command/cli.php');
</pre>
<p>It&#8217;s a bit of a nasty mess, but it works at least.</p>
<h3>Download</h3>
<p><a href='http://www.4pmp.com/wp-content/uploads/2010/10/ApplicationEnvironment.class.php_.gz'>ApplicationEnvironment.class.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.4pmp.com/2010/10/programmatically-set-environment-for-symfony-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>svn: &#8216;http://subversion.tigris.org/xmlns/dav/md5-checksum&#8217; was not present on the resource</title>
		<link>http://www.4pmp.com/2010/10/svn-httpsubversion-tigris-orgxmlnsdavmd5-checksum-was-not-present-on-the-resource/</link>
		<comments>http://www.4pmp.com/2010/10/svn-httpsubversion-tigris-orgxmlnsdavmd5-checksum-was-not-present-on-the-resource/#comments</comments>
		<pubDate>Thu, 14 Oct 2010 21:53:34 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[checksum]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.4pmp.com/?p=331</guid>
		<description><![CDATA[I recently got this somewhat cryptic error message when trying to merge something in Subversion. In the root directory of my working copy, I ran svn merge, something along the lines of: svn merge -c 1234 http://svn.example.com/myproject/trunk ./ Only to get: svn: 'http://subversion.tigris.org/xmlns/dav/md5-checksum' was not present on the resource I had absolutely no idea what [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got this somewhat cryptic error message when trying to merge something in Subversion.   In the root directory of my working copy, I ran svn merge, something along the lines of:</p>
<p><code>svn merge -c 1234 http://svn.example.com/myproject/trunk ./</code></p>
<p>Only to get:<br />
<code>svn: 'http://subversion.tigris.org/xmlns/dav/md5-checksum' was not present on the resource</code></p>
<p>I had absolutely no idea what it was on about, and a fair bit of Googling turned up nothing.   Then, just for fun, I tried going one level up from my working copy and trying again:</p>
<p><code><br />
cd ../<br />
svn merge -c 1234 http://svn.example.com/myproject/trunk ./myworkingcopy/<br />
</code></p>
<p>And lo and behold &#8211; it worked.   I haven&#8217;t the foggiest idea why, but it does.   Any ideas anyone?</p>
<p><em>Using SVN v1.6.6</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.4pmp.com/2010/10/svn-httpsubversion-tigris-orgxmlnsdavmd5-checksum-was-not-present-on-the-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN: Entry has unexpectedly changed special status</title>
		<link>http://www.4pmp.com/2010/02/svn-entry-has-unexpectedly-changed-special-status/</link>
		<comments>http://www.4pmp.com/2010/02/svn-entry-has-unexpectedly-changed-special-status/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 12:46:19 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Uncategorised]]></category>
		<category><![CDATA[commit]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[symlink]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.4pmp.com/?p=249</guid>
		<description><![CDATA[I just tried to commit my Working Copy when I got the error message: svn: Entry 'jquery-latest.js' has unexpectedly changed special status It turns out that someone had created a symlink to whatever is the latest version of jQuery, which apart from being a somewhat dubious solution, should be fine.   However, it seems a Windows [...]]]></description>
			<content:encoded><![CDATA[<p>I just tried to commit my Working Copy when I got the error message:</p>
<p><code>svn: Entry 'jquery-latest.js' has unexpectedly changed special status</code></p>
<p>It turns out that someone had created a symlink to whatever is the latest version of jQuery, which apart from being a somewhat dubious solution, should be fine.   However, it seems a Windows user then checked out this file and somehow changed it; either directly or by some strange Windowsy magic.   Anyway, the changed file was then corrupted and the result is the rather cryptic message above.</p>
<p>I tried to remove the offending file:</p>
<p><code>svn remove jquery-latest.js</code></p>
<p>But that resulted in:</p>
<p><code>svn: 'jquery-latest.js' is in the way of the resource actually under version control</code></p>
<p>Which was simpy resolved by using the <code>--force</code> command:</p>
<p><code>svn remove --force jquery-latest.js</code></p>
<p>I recreated the symlink, committed it and it seems now to be ok.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.4pmp.com/2010/02/svn-entry-has-unexpectedly-changed-special-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

