<?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>Chris Sedlmayr</title>
	<atom:link href="http://chris.sedlmayr.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://chris.sedlmayr.co.uk</link>
	<description>Real World Development</description>
	<lastBuildDate>Wed, 07 Jul 2010 08:38:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Textmate tip: Automatic PHP spl_autoload class name from file path</title>
		<link>http://chris.sedlmayr.co.uk/archives/134-textmate-tip-automatic-php-spl_autoload-class-name-from-file-path/</link>
		<comments>http://chris.sedlmayr.co.uk/archives/134-textmate-tip-automatic-php-spl_autoload-class-name-from-file-path/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 18:42:35 +0000</pubDate>
		<dc:creator>Chris Sedlmayr</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[spl_autoload]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://chris.sedlmayr.co.uk/?p=134</guid>
		<description><![CDATA[Create a new textmate command, and set the output to 'Insert as snippet'
Paste in the following.

#!/usr/bin/php
&#60;?php
$path = $_ENV&#91;'TM_FILEPATH'&#93;;
$path = trim&#40;$path, '/'&#41;;
$path = trim&#40;$path, '.php'&#41;;
$parts = explode&#40;'/', $path&#41;;
$lastPart = end&#40;$parts&#41;;
echo 'class ';
foreach &#40;$parts as $id =&#62; $part&#41; &#123;
    // textmate placeholders start at 1
    $id = $id+1;
    [...]]]></description>
			<content:encoded><![CDATA[<p>Create a new textmate command, and set the output to 'Insert as snippet'<br />
Paste in the following.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">#!/usr/bin/php
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_ENV</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_FILEPATH'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$parts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$lastPart</span> <span style="color: #339933;">=</span> <span style="color: #990000;">end</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'class '</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$parts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$part</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// textmate placeholders start at 1</span>
    <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$id</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$lastPart</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$part</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'${'</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$part</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'}'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'${'</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$part</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_}'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>And bind to a tab trigger.<br />
When you execute from within a file it performs the following.</p>
<p>Retrieves the full path of the file you are in.<br />
Removes any forward slashes from the beginning and end of the path.<br />
Removes the .php extension from the end of the file.<br />
Explodes each part of the path, seperated by a slash (/) into an array.<br />
Gets the pointer for the last item in the array.<br />
echo's 'class'<br />
Then iterates through the array, creating a textmate snippet placeholder for each one, all of which have the required underscore (_) apart from the last one.</p>
<p>So for a file that is in the path /The/Full/Path/Filename.php<br />
We end up with the resulting snippet of<br />
${1:The_}${2:Full_}${3:Path_}${4:Filename}</p>
<p>Which then enables you to tab through them and remove those from the start that you don't need.<br />
You could go a step further and only spit out the last 3 parts as that is generally how many are needed for a class name. But it really depends on your app structure so I've left it as is for now.</p>
<p>Check out the image for the options.<br />
<a href="http://chris.sedlmayr.co.uk/wp-content/uploads/2010/06/textmateCommand.jpg"><img src="http://chris.sedlmayr.co.uk/wp-content/uploads/2010/06/textmateCommand-300x205.jpg" alt="" title="textmateCommand" width="300" height="205" class="size-medium wp-image-146" /></a></p>
<p><strong>Update:</strong><br />
I've made a version that gives you just the last 3 parts of the path as mentioned above. I have both running on the 'class' tab command so can choose between them as required.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">#!/usr/bin/php
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_ENV</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'TM_FILEPATH'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$parts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'class '</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// do this 3 times</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$varName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'part_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$part</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_pop</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$$varName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'${'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #339933;">.</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$part</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'}'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$$varName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'${'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #339933;">.</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$part</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_}'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// pass the snippet to the file</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$part_3</span><span style="color: #339933;">.</span><span style="color: #000088;">$part_2</span><span style="color: #339933;">.</span><span style="color: #000088;">$part_1</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://chris.sedlmayr.co.uk/archives/134-textmate-tip-automatic-php-spl_autoload-class-name-from-file-path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slides from Symfony Live 2010</title>
		<link>http://chris.sedlmayr.co.uk/archives/113-slides-from-symfony-live-2010/</link>
		<comments>http://chris.sedlmayr.co.uk/archives/113-slides-from-symfony-live-2010/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 08:00:13 +0000</pubDate>
		<dc:creator>Chris Sedlmayr</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[editorial]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[hub]]></category>
		<category><![CDATA[sflive2010]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://chris.sedlmayr.co.uk/?p=113</guid>
		<description><![CDATA[
Just going to post links to all the slides I can find from #sflive2010 yesterday.
Fabien Potencier - News of the Symfony2 World
Fabien Potencier - Unit and Functional Testing with Symfony2
Fabien Potencier - Caching on the Edge with Symfony2
Francois Zaninotto - Symfony2 meets propel 1.5
Jonathan Wage - Symfony2 and Doctrine2 Integration
Bernhard Schussek - The new form [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>Just going to post links to all the slides I can find from #sflive2010 yesterday.</p>
<p><a title="News of the Symfony 2 World" href="http://www.slideshare.net/fabpot/news-of-the-symfony2-world">Fabien Potencier - News of the Symfony2 World</a></p>
<p><a href="http://www.slideshare.net/fabpot/unit-and-functional-testing-with-symfony2">Fabien Potencier - Unit and Functional Testing with Symfony2</a></p>
<p><a href="http://www.slideshare.net/fabpot/caching-on-the-edge-with-symfony2">Fabien Potencier - Caching on the Edge with Symfony2</a></p>
<p><a href="http://www.slideshare.net/francoisz/symfony2-meets-propel-15-4">Francois Zaninotto - Symfony2 meets propel 1.5</a></p>
<p><a href="http://www.slideshare.net/jwage/symfony2-and-doctrine2-integration">Jonathan Wage - Symfony2 and Doctrine2 Integration</a></p>
<p><a href="http://www.slideshare.net/bschussek/the-new-form-framework">Bernhard Schussek - The new form framework</a></p>
<p>They are also all embedded on the <a href="http://www.symfony-project.org/blog/2010/06/24/symfony2-online-conference">new blog post</a> on the official symfony site</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://chris.sedlmayr.co.uk/archives/113-slides-from-symfony-live-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git pull and git merge between developers</title>
		<link>http://chris.sedlmayr.co.uk/archives/86-git-pull-and-git-merge-between-developers/</link>
		<comments>http://chris.sedlmayr.co.uk/archives/86-git-pull-and-git-merge-between-developers/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 20:29:02 +0000</pubDate>
		<dc:creator>Chris Sedlmayr</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[pull]]></category>
		<category><![CDATA[repo]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://chris.sedlmayr.co.uk/?p=86</guid>
		<description><![CDATA[I use git locally, but the main upstream repo is an SVN one, there are also a couple of other devs that also use git locally.
We are using git svn as the bridge between these 2.
If we want to share code or update each other it was generally the case that we would have to [...]]]></description>
			<content:encoded><![CDATA[<p>I use git locally, but the main upstream repo is an SVN one, there are also a couple of other devs that also use git locally.<br />
We are using git svn as the bridge between these 2.</p>
<p>If we want to share code or update each other it was generally the case that we would have to commit everything back to svn (git svn dcommit), then the others would have to rebase. It felt like I was abusing git and not making the most of it.</p>
<h2>Enter git pull</h2>
<p>Git pull allows you to grab code from another git repo and store it in your local repo.</p>
<h3>Git pull</h3>
<p>I'll presume you already have a git repo locally, and that there is another git repo somewhere you have access to.</p>
<p>First of all we add the remote location.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">git remote add mp git.user@mpdevbox:/www/cm/</pre></div></div>

<p>Let me break that command down</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">git remote add = The git command
mp = A friendly name you use for this remote location
git.user@mpdevbox = the remote user and the remote location
:/www/cm = The path to the remote git repo, (note the colon)</pre></div></div>

<p>Having completed that command you now have a reference to a remote git repo, If you want to pull the code down from it, it's simple (you may want to create and checkout a branch before you do so, depending on your needs. I won't so will just pull)</p>
<p>git pull mp master<br />
Where master is the name of your local branch you want to pull into.</p>
<p>This will pull down the code from the remote branch and merge it into your branch, if that all goes OK it will then perform a commit, if you don't wan the commit then just add --no-commit to the end of the pull command</p>
<p>If there are conflicts that git fails to resolve automatically then you will need to resolve them manually.<br />
This can be easily done using mergetool<br />
just run</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">git mergetool</pre></div></div>

<p>and follow the instructions, on Mac this will open a merge/diff client which lets you easily choose from your local and the pulled down repo. Once done you can commit if you want, there is even a pre-filled commit message for you about the merge.</p>
<p>It's as simple as that really, this approach also makes it much easier to develop on multiple machines, without having to get rid of SVN as your main repo (which depending on circumstances, requirements, or the people that make those decisions, may not be an easy sell).</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.sedlmayr.co.uk/archives/86-git-pull-and-git-merge-between-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git manuals, docs and handy links</title>
		<link>http://chris.sedlmayr.co.uk/archives/66-git-manuals-docs-and-handy-links/</link>
		<comments>http://chris.sedlmayr.co.uk/archives/66-git-manuals-docs-and-handy-links/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 13:51:51 +0000</pubDate>
		<dc:creator>Chris Sedlmayr</dc:creator>
				<category><![CDATA[resource]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://chris.sedlmayr.co.uk/?p=66</guid>
		<description><![CDATA[As i am a recent git convert I find myself reading a lot of guides etc on the best way to use git and how my workflow can change now i'm using a DVCS.
This is an attempt to collate my more useful findings, partly for myself, but it may prove useful for you too.
Git Books
http://book.git-scm.com/index.html
http://progit.org/book/
Git-SVN [...]]]></description>
			<content:encoded><![CDATA[<p>As i am a recent git convert I find myself reading a lot of guides etc on the best way to use git and how my workflow can change now i'm using a DVCS.</p>
<p>This is an attempt to collate my more useful findings, partly for myself, but it may prove useful for you too.</p>
<h4>Git Books</h4>
<p><a href="http://book.git-scm.com/index.html">http://book.git-scm.com/index.html</a></p>
<p><a href="http://progit.org/book/">http://progit.org/book/</a></p>
<h4>Git-SVN Resources</h4>
<p><a href="http://orestis.gr/blog/2008/08/23/git-svn-tutorial/">http://orestis.gr/blog/2008/08/23/git-svn-tutorial/</a></p>
<h4>Full Git online manual</h4>
<p><a href="http://www.kernel.org/pub/software/scm/git/docs/v1.7.0.4/git.html">http://www.kernel.org/pub/software/scm/git/docs/v1.7.0.4/git.html</a></p>
<h4>Combining multiple git commits into 1 SVN commit</h4>
<p>In some cases I use git as a local repo, but the main repo upstream is SVN. This sample enables me to combine multiple local git commits into a single commit back to SVN.<br />
This was taken from http://stackoverflow.com/questions/1408381/combine-local-git-commits-into-one-commit-with-git-svn.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">git tag local # create a temporary tag
git reset --hard trunk
git merge --squash local
git commit # write your single commit message here
git svn dcommit
git tag -d local # delete the temporary tag named local&lt;/code&gt;</pre></div></div>

<h4>Delicious</h4>
<p>I also tend to boo0kmark a lot of stuff over at Delicious so you can check out my git stuff there too. <a href="http://delicious.com/catchamonkee/git">Items tagged 'Git' at my Delicious</a></p>
]]></content:encoded>
			<wfw:commentRss>http://chris.sedlmayr.co.uk/archives/66-git-manuals-docs-and-handy-links/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Renaming multiple files by rule</title>
		<link>http://chris.sedlmayr.co.uk/archives/17-renaming-multiple-files-by-rule/</link>
		<comments>http://chris.sedlmayr.co.uk/archives/17-renaming-multiple-files-by-rule/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 20:27:18 +0000</pubDate>
		<dc:creator>Chris Sedlmayr</dc:creator>
				<category><![CDATA[sysad]]></category>

		<guid isPermaLink="false">http://chris.sedlmayr.co.uk/?p=17</guid>
		<description><![CDATA[I recently had the need to rename a bunch of files according to a simple rule.
In the directory, any files that had a prefix of "Gee_" should have the prefix changed to "Kif_"
After a little digging I found a simple but quite tasty solution.
Simply run this at your cli.

&#160;
for f in Gee_*; do mv &#34;$f&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the need to rename a bunch of files according to a simple rule.<br />
In the directory, any files that had a prefix of "Gee_" should have the prefix changed to "Kif_"<br />
After a little digging I found a simple but quite tasty solution.<br />
Simply run this at your cli.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> Gee_<span style="color: #000000; font-weight: bold;">*</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$f</span>&quot;</span> <span style="color: #ff0000;">&quot;Kif_<span style="color: #007800;">${f#Gee_}</span>&quot;</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>Job done. It finds files matching the pattern supplied, then loops through renaming them appropriately.</p>
<p>It's worth noting this isn't recursive so will only complete for files in your current directory. </p>
]]></content:encoded>
			<wfw:commentRss>http://chris.sedlmayr.co.uk/archives/17-renaming-multiple-files-by-rule/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The use of 301 rewrite</title>
		<link>http://chris.sedlmayr.co.uk/archives/54-the-use-of-301-rewrite/</link>
		<comments>http://chris.sedlmayr.co.uk/archives/54-the-use-of-301-rewrite/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 20:26:15 +0000</pubDate>
		<dc:creator>Chris Sedlmayr</dc:creator>
				<category><![CDATA[sysad]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[hosting]]></category>

		<guid isPermaLink="false">http://chris.sedlmayr.co.uk/?p=54</guid>
		<description><![CDATA[If you are hosting a domain (or multiple domains) using VirtualHost entries, it is bad practice to use individual entries for the same domain just to cover the inclusion or exclusion of the www in the address, amongst other things it is bad for SEO, but of course you still want visitors to be able [...]]]></description>
			<content:encoded><![CDATA[<p>If you are hosting a domain (or multiple domains) using VirtualHost entries, it is bad practice to use individual entries for the same domain just to cover the inclusion or exclusion of the www in the address, amongst other things it is bad for SEO, but of course you still want visitors to be able to go to your site via the 2 starting addresses http://sedlmayr.co.uk and http://www.sedlmayr.co.uk</p>
<p>For example you should not have an entry for www.sedlmayr.co.uk and another for sedlmayr.co.uk<br />
There are a few ways you can do this but have found this particular one to be effective.<br />
Whatever url you go to; http://sedlmayr.co.uk or http://www.sedlmayr.co.uk a redirect happens on the http://sedlmayr.co.uk that sends you to http://www.sedlmayr.co.uk.</p>
<p>But what about people that go to specific pages such as http://sedlmayr.co.uk/services</p>
<p>We use a RewriteRule so that whatever is after the domain itself (in this case services)(When using http://sedlmayr.co.uk) http://sedlmayr.co.uk/services is shown as http://www.sedlmayr.co.uk/services<br />
It is very simple to achieve this.</p>
<p>Within you VirtualHost entry you need to specify a ServerAlias. So I would have<br />
ServerName www.sedlmayr.co.uk<br />
ServerAlias sedlmayr.co.uk<br />
And then within your projects .htaccess file you would put</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">RewriteCond %{HTTP_HOST} ^sedlmayr\.co.uk
RewriteRule ^(.*)$ http://www.sedlmayr.co.uk/$1 [R=301,L]</pre></div></div>

<p>Which needs to go at the top.<br />
That's it!<br />
Hope this is helpful to you at some point.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.sedlmayr.co.uk/archives/54-the-use-of-301-rewrite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Imagemagick sfThumbnail Plugin Fix for Scaling under Symfony</title>
		<link>http://chris.sedlmayr.co.uk/archives/49-imagemagick-sfthumbnail-plugin-fix-for-scaling-under-symfony/</link>
		<comments>http://chris.sedlmayr.co.uk/archives/49-imagemagick-sfthumbnail-plugin-fix-for-scaling-under-symfony/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 20:22:03 +0000</pubDate>
		<dc:creator>Chris Sedlmayr</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[1.0]]></category>
		<category><![CDATA[imageMagick]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[sfThumbnail]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://chris.sedlmayr.co.uk/?p=49</guid>
		<description><![CDATA[I've been using the sfThumbnail Plugin in symfony for image resizing when users upload. When I asked the plugin to resize an image with scaling there was a problem and the image came out skewed and distorted. After a little research I found the following fix.
Once you have installed the plugin, edit the sfImageMagickAdapter.class.php in [...]]]></description>
			<content:encoded><![CDATA[<p>I've been using the sfThumbnail Plugin in symfony for image resizing when users upload. When I asked the plugin to resize an image with scaling there was a problem and the image came out skewed and distorted. After a little research I found the following fix.</p>
<p>Once you have installed the plugin, edit the sfImageMagickAdapter.class.php in the plugin dir.</p>
<p>Change lines 223-237:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000088;">$width</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sourceWidth</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sourceHeight</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'method'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;shave_all&quot;</span><span style="color: #339933;">:</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ceil</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$height</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$height</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$width</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ceil</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$height</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$width</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$width</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span></pre></div></div>

<p>to:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000088;">$width</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sourceWidth</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sourceHeight</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$mWidth</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">maxWidth</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$mHeight</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">maxHeight</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'method'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;shave_all&quot;</span><span style="color: #339933;">:</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ceil</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$height</span><span style="color: #339933;">*</span><span style="color: #000088;">$mWidth</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #000088;">$mHeight</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$height</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$height</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$width</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ceil</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$height</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$width</span><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mHeight</span><span style="color: #339933;">/</span><span style="color: #000088;">$mWidth</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$width</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span></pre></div></div>

<p>It's a straight forward edit so you should be able to see why this simple change has the desired effect, and your images will now behave nicely when scaling.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.sedlmayr.co.uk/archives/49-imagemagick-sfthumbnail-plugin-fix-for-scaling-under-symfony/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO: collapse the web debug toolbar in symfony by default</title>
		<link>http://chris.sedlmayr.co.uk/archives/44-howto-collapse-the-web-debug-toolbar-in-symfony-by-default/</link>
		<comments>http://chris.sedlmayr.co.uk/archives/44-howto-collapse-the-web-debug-toolbar-in-symfony-by-default/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 19:59:42 +0000</pubDate>
		<dc:creator>Chris Sedlmayr</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[1.0]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://chris.sedlmayr.co.uk/?p=44</guid>
		<description><![CDATA[To automatically collapse, hide, shrink (or whatever you want to call it) the web debug toolbar to just the SF and close buttons; add this line
window.onload=sfWebDebugToggleMenu;
to the end of this file ...\symfony\web\sf\sf_web_debug\js\main.js
This handy little tip courtesy of IsRobot.
]]></description>
			<content:encoded><![CDATA[<p>To automatically collapse, hide, shrink (or whatever you want to call it) the web debug toolbar to just the SF and close buttons; add this line<br />
window.onload=sfWebDebugToggleMenu;</p>
<p>to the end of this file ...\symfony\web\sf\sf_web_debug\js\main.js</p>
<p>This handy little tip courtesy of IsRobot.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.sedlmayr.co.uk/archives/44-howto-collapse-the-web-debug-toolbar-in-symfony-by-default/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using helpers within an action in symfony</title>
		<link>http://chris.sedlmayr.co.uk/archives/38-using-helpers-within-an-action-in-symfony/</link>
		<comments>http://chris.sedlmayr.co.uk/archives/38-using-helpers-within-an-action-in-symfony/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 19:57:46 +0000</pubDate>
		<dc:creator>Chris Sedlmayr</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[1.0]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://chris.sedlmayr.co.uk/?p=38</guid>
		<description><![CDATA[If you ever need to use a helper outside a template, you can still load a helper group from anywhere by calling

sfLoader::loadHelpers&#40;$helpers&#41;

where $helpers is a helper group name or an array of helper group names.
For instance, if you want to use simple_format_text() in an action, you need to call

sfLoader::loadHelpers&#40;'Text'&#41;;

first.
I know this is covered in the [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever need to use a helper outside a template, you can still load a helper group from anywhere by calling</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">sfLoader<span style="color: #339933;">::</span><span style="color: #004000;">loadHelpers</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$helpers</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>where $helpers is a helper group name or an array of helper group names.<br />
For instance, if you want to use simple_format_text() in an action, you need to call</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">sfLoader<span style="color: #339933;">::</span><span style="color: #004000;">loadHelpers</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Text'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>first.</p>
<p>I know this is covered in the symfony docs but it's a fairly handy thing to know so thought I would make it easier to find.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.sedlmayr.co.uk/archives/38-using-helpers-within-an-action-in-symfony/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zebra Striping with PHP The Easy Way</title>
		<link>http://chris.sedlmayr.co.uk/archives/29-zebra-striping-with-php-the-easy-way/</link>
		<comments>http://chris.sedlmayr.co.uk/archives/29-zebra-striping-with-php-the-easy-way/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 19:49:18 +0000</pubDate>
		<dc:creator>Chris Sedlmayr</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[fmod]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zebra striping]]></category>

		<guid isPermaLink="false">http://chris.sedlmayr.co.uk/?p=29</guid>
		<description><![CDATA[Using one of the built in Math functions of PHP we can easily create zebra striped lists.
Let's say we have an array of entries stored within the $comments variable.
All we have to do with this is to use the fmod function and assign a css class that alternates per entry.

&#60;ul&#62;
  &#60;?php foreach &#40;$comments as [...]]]></description>
			<content:encoded><![CDATA[<p>Using one of the built in Math functions of PHP we can easily create zebra striped lists.<br />
Let's say we have an array of entries stored within the $comments variable.<br />
All we have to do with this is to use the fmod function and assign a css class that alternates per entry.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;ul&gt;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$int</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;li class=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">fmod</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$int</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'even'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'odd'</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/ul&gt;</pre></div></div>

<p>Then just give the even and odd classes different colours to suit your layout.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">li<span style="color: #6666ff;">.even</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
li<span style="color: #6666ff;">.odd</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>And you're done!</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.sedlmayr.co.uk/archives/29-zebra-striping-with-php-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
