<?xml version="1.0"?>
<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/"
	>
   <channel>
      <pubDate>Fri, 29 Aug 2008 22:44:22 GMT</pubDate>
      <lastBuildDate>Fri, 29 Aug 2008 22:44:22 GMT</lastBuildDate>
      <language>en</language>
      <docs>http://www.rssboard.org/rss-specification</docs>
      <title>CrunchBang ~ php</title>
      <link>http://crunchbang.org/tags/php/</link>
      <description>Code, Design &amp; GNU/Linux</description>

<item>
    <title>Interesting Stuff Elsewhere</title>
    <link>http://crunchbang.org/archives/2008/05/17/interesting-stuff-elsewhere/</link>
    <pubDate>Sat, 17 May 2008 04:25:10 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/05/17/interesting-stuff-elsewhere/</guid>
    <description><![CDATA[
    <p>I have created a new page on my website. For lack of a better name, I have called the page &#34;<a href="http://crunchbang.org/elsewhere/ " title="Interesting Stuff Elsewhere">Interesting Stuff Elsewhere</a>&#34;. The page features a list of links to &#34;stuff&#34; which I have deemed interesting enough to share via my <a href="http://www.google.com/reader/ " title="Google Reader">Google Reader</a> account.</p>

<p>The &#34;stuff&#34; is a hodgepodge collection of articles, blog posts, podcasts and videos; having said that, the &#34;stuff&#34; could be anything and the only real way to find out what the &#34;stuff&#34; is, is to click on the links. One thing is for sure, all the links lead to dead good &#34;stuff&#34; :)</p>

<p>See: <a href="http://crunchbang.org/elsewhere/ " title="Interesting Stuff Elsewhere">http://crunchbang.org/elsewhere/</a></p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/google/" title="Browse all posts tagged with &#8220;google&#8221;">google</a>, <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/webdesign/" title="Browse all posts tagged with &#8220;webdesign&#8221;">webdesign</a>, <a href="http://crunchbang.org/tags/whird/" title="Browse all posts tagged with &#8220;whird&#8221;">whird</a></p>
    ]]></description>
</item>

<item>
    <title>A(nother) Regular Expression Test Tool</title>
    <link>http://crunchbang.org/archives/2008/05/07/another-regular-expression-test-tool/</link>
    <pubDate>Wed, 07 May 2008 17:44:26 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/05/07/another-regular-expression-test-tool/</guid>
    <description><![CDATA[
    <p>I came across another <a href="http://regex.larsolavtorvik.com/ " title="A regular expression test tool.">regular expression test tool</a> today. This one is an Ajax enabled regex tool which lets you evaluate regex expressions in several languages, including PHP PCRE and PHP POSIX, with instant results. You can choose which functions to use, such as match, match all, replace, split etc. I much prefer it to the <a href="http://crunchbang.org/archives/2008/02/18/regular-expression-test-tool/ " title="Regular Expression Test Tool">similar regex tool</a> I mentioned a couple of months ago. Everything considered, it&#39;s a very handy resource for when you are struggling with those pesky expressions.</p>

<p>URL: <a href="http://regex.larsolavtorvik.com/ " title="Regular Expression Tool">http://regex.larsolavtorvik.com/</a><br />
Blog: <a href="http://larsolavtorvik.com/ " title="Lars Olav Torvik - Programming and computer stuff.">Lars Olav Torvik - Programming and computer stuff.</a></p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/programming/" title="Browse all posts tagged with &#8220;programming&#8221;">programming</a>, <a href="http://crunchbang.org/tags/tools/" title="Browse all posts tagged with &#8220;tools&#8221;">tools</a></p>
    ]]></description>
</item>

<item>
    <title>Wiki Rewrite</title>
    <link>http://crunchbang.org/archives/2008/05/04/wiki-rewrite/</link>
    <pubDate>Sun, 04 May 2008 16:06:08 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/05/04/wiki-rewrite/</guid>
    <description><![CDATA[
    <p>Over the last couple of nights I have completely rewritten my <a href="http://crunchbang.org/wiki/ " title="CrunchBang Wiki">personal wiki</a>. The wiki previously used the PHP <a href="http://wikkawiki.org/ " title="WikkaWiki">WikkaWiki</a> wiki engine, it now uses a bunch of custom PHP scripts. The scripts are similar to those used by my blog software, <a href="http://crunchbang.org/projects/whird/ " title="Whird">Whird</a>. I decided to perform the rewrite for numerous reasons, some of which I have listed below:</p>

<ol>
<li><p>I was unhappy with how WikkaWiki was formatting the underlying HTML, specifically the way in which it would never use the paragraph tag, opting instead to insert break tags. While this probably sounds like a minor issue, it was really beginning to bug me.</p></li>
<li><p>I started this site [<em>crunchbang.org</em>] with the intention of coding all of the software/scripts myself. Therefore, and somewhat obviously, my use of WikkaWiki was always going to provide reason for my conscience to niggle me.</p></li>
<li><p>As mentioned before, <a href="http://crunchbang.org/archives/2008/02/10/wikka-wakka-wiki/ " title="See previous post, Wikka Wakka Wiki.">WikkaWiki is very hackable</a>; however, it was never going to be as hackable as something I had produced myself.</p></li>
<li><p>I wanted both my blog and my wiki to use the <a href="http://en.wikipedia.org/wiki/Markdown " title="Wikipedia - Markdown">Markdown</a> markup language. While this was not a problem for my blog [<em>it has always used Markdown</em>] I could not find any suitable plugins/hacks for enabling Markdown within WikkaWiki.</p></li>
</ol>

<p>The rewrite is pretty much complete and is now live. I have tried to make sure any URLs used by WikkaWiki are either reused or redirected. Please feel free to drop me a comment if you notice anything funky occurring.</p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/programming/" title="Browse all posts tagged with &#8220;programming&#8221;">programming</a>, <a href="http://crunchbang.org/tags/webdesign/" title="Browse all posts tagged with &#8220;webdesign&#8221;">webdesign</a>, <a href="http://crunchbang.org/tags/whird/" title="Browse all posts tagged with &#8220;whird&#8221;">whird</a></p>
    ]]></description>
</item>

<item>
    <title>Create MySQL User Accounts from the Command Line</title>
    <link>http://crunchbang.org/archives/2008/04/17/create-mysql-user-accounts-from-the-command-line/</link>
    <pubDate>Thu, 17 Apr 2008 10:55:15 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/04/17/create-mysql-user-accounts-from-the-command-line/</guid>
    <description><![CDATA[
    <p>I have my <a href="http://crunchbang.org/archives/2008/01/10/apache-mysql-and-php-on-ubuntu/ " title="Linux, Apache, MySQL and PHP on Ubuntu.">LAMP</a> install process down to fine art, which is a good thing considering the amount of Linux installs I have been performing lately. Anyhow, just recently I have been experiencing some issues with creating <a href="http://en.wikipedia.org/wiki/Mysql " title="Wikipedia - MySQL">MySQL</a> user accounts. Normally, for ease of use, I would simply login to <a href="http://en.wikipedia.org/wiki/Phpmyadmin " title="Wikipedia - phpMyAdmin">phpMyAdmin</a> and create a new user account, but, for some unknown reason, this method has not been working; maybe there is a compatibility issue between the latest versions of MySQL Server and phpMyAdmin available from the <a href="http://www.ubuntu.com/ " title="Ubuntu, Linux for human beings.">Ubuntu</a> repositories?</p>

<p>Anyway, to get around this little problem, I have been creating new MySQL user accounts via the command line. It is a fairly straightforward procedure, but like a lot of administration tasks, it is not something I do on a daily basis. With this in mind, I thought it would be a good idea to record the process for future reference.</p>

<p>Follow the steps below to create a new user MySQL account. Note, these instructions assume that you have already <a href="http://crunchbang.org/archives/2008/01/10/apache-mysql-and-php-on-ubuntu/ " title="Apache, MySQL and PHP on Ubuntu.">set-up Apache, MySQL and PHP</a>.</p>

<p><strong>1.</strong> Open a terminal and login to MySQL as root:</p>

<pre><code>mysql --user="root" --password="your_root_password"
</code></pre>

<p><strong>2.</strong> Create a new user and password with the following command:</p>

<pre><code>CREATE USER 'new_username'@'localhost' IDENTIFIED BY 'password_for_new_username';
</code></pre>

<p><strong>3.</strong> Assign privileges to the new user, enter the command:</p>

<pre><code>GRANT ALL ON *.* TO 'new_username'@'localhost';
</code></pre>

<p><strong>4.</strong> Exit MySQL interface, enter:</p>

<pre><code>exit
</code></pre>

<p><strong>Notes:</strong> The above instructions will create a new user account on &#34;localhost&#34; and grant the user all privileges. While this is safe for my development environment, you would obviously want to grant only the necessary permissions in a production environment.</p>

<p>For more developer information, including the MySQL Reference Manual, visit: <a href="http://dev.mysql.com/ " title="MySQL developer information.">http://dev.mysql.com/</a></p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/mysql/" title="Browse all posts tagged with &#8220;mysql&#8221;">mysql</a>, <a href="http://crunchbang.org/tags/phpmyadmin/" title="Browse all posts tagged with &#8220;phpmyadmin&#8221;">phpmyadmin</a>, <a href="http://crunchbang.org/tags/terminal/" title="Browse all posts tagged with &#8220;terminal&#8221;">terminal</a>, <a href="http://crunchbang.org/tags/ubuntu/" title="Browse all posts tagged with &#8220;ubuntu&#8221;">ubuntu</a></p>
    ]]></description>
</item>

<item>
    <title>Perplexed by Web Frameworks</title>
    <link>http://crunchbang.org/archives/2008/03/28/perplexed-by-web-frameworks/</link>
    <pubDate>Fri, 28 Mar 2008 23:40:43 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/03/28/perplexed-by-web-frameworks/</guid>
    <description><![CDATA[
    <p>The latest <a href="http://www.lugradio.org/ " title="Linux Radio Show - LugRadio">LugRadio</a> episode features a discussion about <a href="http://www.djangoproject.com/ " title="Django Python Web Framework">Django</a> and other web frameworks. I found the feature interesting, but I have to admit that I find the subject of web frameworks somewhat perplexing. I have yet to fully embrace any such framework, although I have played with the <a href="http://framework.zend.com/ " title="Zend Framework">Zend Framework</a>. I think there are a number of reasons I have not fully adopted any frameworks:</p>

<ol>
<li><p>I am put off by having to learn all the new classes, structures and methods employed by said frameworks. Surely my time would be better spent actually learning more about the core language?</p></li>
<li><p>I fear that using a framework would somehow stifle innovation. I am under no illusions of being the most innovative player, however, I find it hard to shake. I guess I am questioning where the innovation comes from if everyone is using the same framework?</p></li>
<li><p>It is fun to write your own code, functions, classes and routines etc. I like to experiment with code, I like to make mistakes, before fixing them &#8212; it is this that keeps me interested. I would be concerned that using a framework would takeaway much of that.</p></li>
</ol>

<p>Having said all that, I&#39;m not totally opposed to frameworks and I think they have their place; three PHP frameworks of interest to me are:</p>

<ol>
<li>Zend Framework: <a href="http://framework.zend.com/ " title="Zend Framework">http://framework.zend.com/</a></li>
<li>CakePHP: <a href="http://www.cakephp.org/ " title="CakePHP - the rapid development PHP framework.">http://www.cakephp.org/</a></li>
<li>Symfony: <a href="http://www.symfony-project.org/ " title="Symfony Open-Source PHP Web Framework">http://www.symfony-project.org/</a></li>
</ol>

<p>I am going to look into the above to see what they have to offer; however, I think I will probably continue to hack together my own code for a while to come.</p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/programming/" title="Browse all posts tagged with &#8220;programming&#8221;">programming</a>, <a href="http://crunchbang.org/tags/webdesign/" title="Browse all posts tagged with &#8220;webdesign&#8221;">webdesign</a></p>
    ]]></description>
</item>

<item>
    <title>TwitterZoid PHP Script</title>
    <link>http://crunchbang.org/archives/2008/02/20/twitterzoid-php-script/</link>
    <pubDate>Wed, 20 Feb 2008 02:16:55 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/02/20/twitterzoid-php-script/</guid>
    <description><![CDATA[
    <p>It&#39;s a rather silly name, I know; however, TwitterZoid is the chosen name of my PHP script for parsing Twitter RSS feeds. I&#39;ve been using <a href="http://twitter.com/ " title="Twitter - What are you doing?">Twitter</a> quite steadily for a couple of weeks now and I thought it might be nice to include <a href="http://crunchbang.org/what-am-i-doing/ " title="What am I doing?">my latest tweets on my blog</a>, so I wrote TwitterZoid to do just that.</p>

<p>TwitterZoid differs to other PHP based Twitter RSS parsers, <em>at least the ones I tried before I wrote it</em>, in that it will automatically link both <a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=63 " title="Back @ you baby! Or: What does @username do?">lexicons</a> and URLs found within individual tweets. It also tries to mimic Twitter&#39;s timestamping, although this could be improved.</p>

<h3>TwitterZoid usage</h3>

<p>I wanted to make TwitterZoid as simple to use as possible. Therefore I decided to write the script to be used as a simple include file which can be used on any PHP page. Basically, to use TwitterZoid all you need to do is set a couple of variables, include <code>twitterzoid.php</code> and then <code>echo</code> the main <code>$TwitterZoid</code> variable where you would like your list of tweets to appear.</p>

<h4>Example set-up:</h4>

<pre><code>$twitter_username = "corenominal";
$twitter_feed = "http://twitter.com/statuses/user_timeline/99713.rss";
require_once('twitterzoid.php');
</code></pre>

<h4>Call on the main TwitterZoid variable to produce the list of tweets:</h4>

<pre><code>echo $TwitterZoid;
</code></pre>

<p>Don&#39;t worry if this reads like gibberish, I&#39;ve included an example page within the download.</p>

<h3>TwitterZoid examples</h3>

<p>There are currently two demonstrations of TwitterZoid in action, see:</p>

<p>My official &#34;What am I doing?&#34; Twitter page:<br />
<a href="http://crunchbang.org/what-am-i-doing/ " title="What am I doing?">http://crunchbang.org/what-am-i-doing/</a></p>

<p>A more stylised version of &#34;What am I doing?&#34;, included within the download:<br />
<a href="http://crunchbang.org/projects/twitterzoid/demo/ " title="What am I doing? - demo version included with download.">http://crunchbang.org/projects/twitterzoid/demo/</a></p>

<h3>Download TwitterZoid</h3>

<p><strong>Location:</strong> <a href="http://crunchbang.org/projects/twitterzoid/twitterzoid-0.1.tar.gz " title="Download TwitterZoid">http://crunchbang.org/projects/twitterzoid/twitterzoid-0.1.tar.gz</a><br />
<strong>MD5:</strong> 99dace9f9872cf1ebf93588bb2d36458</p>

<h3>TwitterZoid license</h3>

<p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>

<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.</p>

<p><a href="http://www.gnu.org/licenses/ " title="GNU General Public License">http://www.gnu.org/licenses/</a></p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/code/" title="Browse all posts tagged with &#8220;code&#8221;">code</a>, <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/projects/" title="Browse all posts tagged with &#8220;projects&#8221;">projects</a>, <a href="http://crunchbang.org/tags/scripts/" title="Browse all posts tagged with &#8220;scripts&#8221;">scripts</a>, <a href="http://crunchbang.org/tags/twitter/" title="Browse all posts tagged with &#8220;twitter&#8221;">twitter</a>, <a href="http://crunchbang.org/tags/webdesign/" title="Browse all posts tagged with &#8220;webdesign&#8221;">webdesign</a></p>
    ]]></description>
</item>

<item>
    <title>Regular Expression Test Tool</title>
    <link>http://crunchbang.org/archives/2008/02/18/regular-expression-test-tool/</link>
    <pubDate>Mon, 18 Feb 2008 16:36:29 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/02/18/regular-expression-test-tool/</guid>
    <description><![CDATA[
    <p>I&#39;ve used this web based <a href="http://www.solmetra.lt/scripts/regex/ " title="Regular Expression Test Tool">regular expression test tool</a> a couple of times over the last day or so. While I don&#39;t normally struggle with <a href="http://en.wikipedia.org/wiki/Regular_expressions " title="Wikipedia - Regular Expressions">regular expressions</a>, this tool has still come in handy; it has saved me from the &#34;code it and cross your fingers&#34; approach I normally take.</p>

<p>This is a great tool for anyone who works with <a href="http://en.wikipedia.org/wiki/PHP " title="Wikipedia - PHP">PHP</a>, especially as the service uses PHP regular expression functions as a base for its operations.</p>

<p>URL: <a href="http://www.solmetra.lt/scripts/regex/ " title="Regular Expression Test Tool">http://www.solmetra.lt/scripts/regex/</a></p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/programming/" title="Browse all posts tagged with &#8220;programming&#8221;">programming</a>, <a href="http://crunchbang.org/tags/tools/" title="Browse all posts tagged with &#8220;tools&#8221;">tools</a></p>
    ]]></description>
</item>

<item>
    <title>Wikka Wakka Wiki</title>
    <link>http://crunchbang.org/archives/2008/02/10/wikka-wakka-wiki/</link>
    <pubDate>Sun, 10 Feb 2008 04:54:02 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/02/10/wikka-wakka-wiki/</guid>
    <description><![CDATA[
    <p>Over the last couple of days I have mainly been playing with <a href="http://wikkawiki.org/ " title="WikkaWiki">WikkaWiki</a>, a flexible, standards-compliant and lightweight wiki engine written in PHP. I&#39;ve toyed with the idea of creating a personal wiki for sometime, but, I&#39;ve been reluctant to start one for fear of it becoming just another thing to update and maintain. Anyhow, I now seem to have conquered this fear and I&#39;ve created <a href="http://crunchbang.org/wiki/ " title="CrunchBangWiki">my first wiki</a>.</p>

<p>Now, being a new wiki it naturally doesn&#39;t contain much of any content, but, at this moment that&#39;s not too important, the important thing is that I&#39;ve started it, the content will come later. I&#39;m planning on using the wiki to document my <a href="http://www.ubuntu.com/ " title="Ubuntu, Linux for human beings.">Ubuntu</a>/<a href="http://crunchbang.org/projects/linux/ " title="CrunchBang Linux project page.">CrunchBang Linux</a> projects. I&#39;ll also be using it to privide supporting supporting material for my blog. For example, stuff like this <a href="http://crunchbang.org/archives/2007/10/26/howto-setup-a-crontab-file/ " title="Howto set-up a crontab file.">crontab howto</a>, and these <a href="http://crunchbang.org/archives/2007/11/17/150-extra-gimp-brushes-for-ubuntu/ " title="150 extra brushes for GIMP and Ubuntu.">GIMP brushes</a> would be better suited to the wiki.</p>

<p>Regarding the WikkaWiki software, it&#39;s quite impressive and fairly easy to work with. I looked at several other PHP based wiki projects, but IMHO WikkaWiki was the best &#8212; apart from maybe <a href="http://meta.wikimedia.org/wiki/MediaWiki " title="MediaWiki - it powers Wikipedia dont you know!">MediaWiki</a>, but then I considered that to be overkill for my needs. If you&#39;re starting a new wiki then I&#39;d certainly recommend at least looking into the possibility of using WikkaWiki. It has many great features, some that I noticed include:</p>

<ul>
<li>a super easy installation process</li>
<li>a nice default design and easy to customise CSS</li>
<li>code base is very hackable, including actions/plugins</li>
<li>RSS feeds for recently updated content, comments etc</li>
<li>syntax highlighting of published code, courtesy of the <a href="http://qbnz.com/highlighter/ " title="GeSHi">GeSHi plugin</a></li>
<li>it&#39;s super scary fast</li>
</ul>

<p>All-in-all WikkaWiki has impressed me a lot; besides, if it&#39;s <a href="http://puppylinux.org/wikka/PuppyLinuxMainPage " title="WikkaWiki - good enough for Puppy Linux!">good enough for Puppy Linux</a>, it&#39;s good enough for me ;)</p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/software/" title="Browse all posts tagged with &#8220;software&#8221;">software</a>, <a href="http://crunchbang.org/tags/ubuntu/" title="Browse all posts tagged with &#8220;ubuntu&#8221;">ubuntu</a>, <a href="http://crunchbang.org/tags/wiki/" title="Browse all posts tagged with &#8220;wiki&#8221;">wiki</a></p>
    ]]></description>
</item>

<item>
    <title>PHP Function: Word Filter</title>
    <link>http://crunchbang.org/archives/2008/01/29/php-function-word-filter/</link>
    <pubDate>Tue, 29 Jan 2008 10:39:54 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/01/29/php-function-word-filter/</guid>
    <description><![CDATA[
    <p>So, last night I was mainly experimenting with <a href="http://crunchbang.org/projects/whird/ " title="Whird">Whird</a>, more specifically I was trying to build an internal search feature. This is something I&#39;ve been putting off for long enough, and I&#39;d really like to get it coded up. I didn&#39;t finish it last night, but at least I&#39;ve made a start.</p>

<p>Anyhow, during my experimentation I wrote this little PHP function for filtering words out of a string. Basically the function takes 2 strings as arguments before filtering words out of the first string based on words found in the second. I&#39;ve posted it below for future reference:</p>

<pre><code>function word_filter($string1,$string2){
    $string1 = trim($string1);
    $string1 = preg_replace('/s+/', ' ', $string1);
    $string1 = explode(" ",$string1);
    $wordcount = count($string1);
    $i = 0;
    while ($i &lt; $wordcount) {
        $string = $string1[$i];
        if (strstr(strtolower($string2),strtolower($string))) {
            $string1[$i] = "";
        }
    $i++;
    }
$string1 = implode(" ",$string1);        
return($string1);
}
</code></pre>

<h3>Example usage</h3>

<p>This is probably not the best example, but this:</p>

<pre><code>$poem = &lt;&lt;&lt;EOD
&lt;p&gt;&lt;em&gt;GIVE me women, wine, and snuff &lt;br /&gt;
Untill I cry out "hold, enough!" &lt;br /&gt;
You may do so sans objection &lt;br /&gt;
Till the day of resurrection: &lt;br /&gt;
For, bless my beard, they aye shall be &lt;br /&gt;
My beloved Trinity.&lt;/em&gt;&lt;/p&gt;
EOD;

$common_words = 'and be but do for is it may me my not of the they there so was you';

echo word_filter($poem,$common_words);
</code></pre>

<p>Would output something like this:</p>

<p><em>GIVE  women, wine,  snuff <br /> Untill  cry out &#34;hold, enough!&#34; <br />     sans objection <br /> Till  day resurrection: <br /> For, bless  beard,  aye shall  <br />  beloved Trinity.</em></p>

<p><a href="http://en.wikipedia.org/wiki/John_Keats " title="Wikipedia - John Keats">John Keats</a> would be proud, not! Please feel free to optimise, or let me know if a one line equivalent already exists :)</p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/code/" title="Browse all posts tagged with &#8220;code&#8221;">code</a>, <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/projects/" title="Browse all posts tagged with &#8220;projects&#8221;">projects</a>, <a href="http://crunchbang.org/tags/whird/" title="Browse all posts tagged with &#8220;whird&#8221;">whird</a></p>
    ]]></description>
</item>

<item>
    <title>Parsing RSS feeds with PHP &amp; SimplePie</title>
    <link>http://crunchbang.org/archives/2008/01/13/parsing-rss-feeds-with-php-and-simplepie/</link>
    <pubDate>Sun, 13 Jan 2008 02:25:10 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2008/01/13/parsing-rss-feeds-with-php-and-simplepie/</guid>
    <description><![CDATA[
    <p>Tonight I have mainly been playing around with <a href="http://simplepie.org/ " title="SimplePie: RSS and Atom feed parsing in PHP.">SimplePie</a>, a PHP class for parsing RSS and Atom feeds. To quote the <a href="http://simplepie.org/ " title="SimplePie: RSS and Atom feed parsing in PHP.">SimplePie site</a>:</p>

<blockquote>
  <p>SimplePie is a very fast and easy-to-use class, written in PHP, that puts the &#34;simple&#34; back into &#34;really simple syndication&#34;. Flexible enough to suit beginners and veterans alike, SimplePie is focused on speed, ease of use, compatibility and standards compliance.</p>
</blockquote>

<p>I&#39;m totally impressed with SimplePie and I&#39;ll certainly consider using it within future web projects. I performed a quick test with it tonight by parsing a couple of feeds and displaying the results on my <a href="http://philipnewborough.com/ " title="About Philip Newborough.">philipnewborough.com</a> domain, it worked a treat. Good stuff.</p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/webdesign/" title="Browse all posts tagged with &#8220;webdesign&#8221;">webdesign</a></p>
    ]]></description>
</item>

<item>
    <title>Cruciforum - Crucially Simple</title>
    <link>http://crunchbang.org/archives/2007/11/11/cruciforum-crucially-simple/</link>
    <pubDate>Sun, 11 Nov 2007 08:58:11 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2007/11/11/cruciforum-crucially-simple/</guid>
    <description><![CDATA[
    <p><a href="http://www.kryogenix.org/days/2007/11/11/cruciforum-v124 " title="as days pass by">Stuart Langridge</a> has updated his really simple forum software, <a href="http://www.kryogenix.org/code/cruciforum/ " title="Cruciforum - crucially simple">Cruciforum</a>.</p>

<blockquote>
  <p>Cruciforum is really, really simple. There&#39;s no database required to run it &#8212; you don&#39;t need MySQL or anything &#8212; it doesn&#39;t have user accounts, it doesn&#39;t need an administrator. It&#39;s really low-impact on your server because all the pages are plain HTML &#8212; if someone&#39;s browsing the forum then they don&#39;t even use PHP! Just fire it up and go; all you need on the server is PHP support, which most things have.</p>
  
  <p>Cruciforum is built with Joel Spolsky&#39;s <a href="http://www.joelonsoftware.com/articles/BuildingCommunitieswithSo.html " title="Building Communities with Software">thoughts on forum design</a> in mind, and a few other tweaks that might be interesting. It&#39;s designed to be crucially simple.</p>
</blockquote>

<p>I really like simple web software [<em>the simpler the better if you ask me</em>] and Cruciforum is about as simple as it gets. I really like the fact that there is no need to create an account before you can post a message.</p>

<p>Cruciforum also features built in support for <a href="http://akismet.com/ " title="Akismet - Antispam">Akismet</a> spam protection [<em>which I guess is a must when there&#39;s no account system.</em>] <a href="http://textile.thresholdstate.com/ " title="Textile - A Humane Web Text Generator">Textile</a> is used for converting user input and <a href="http://www.gravatar.com/ " title="Gravatar - Globally recognized avatars.">Gravatar</a> support is also a nice touch.</p>

<p>The only thing missing at the moment is support for RSS &#8212; this has been recognised and there&#39;s a <a href="http://www.kryogenix.org/bugs/cruciforum/rss-feed.html " title="cruciforum bug: rss-feed">bug report here</a>.</p>

<p>I can see many uses for Cruciforum, it has a lot of potential. Check it out here: <a href="http://www.kryogenix.org/code/cruciforum/ " title="Cruciforum - crucially simple">http://www.kryogenix.org/code/cruciforum/</a></p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/software/" title="Browse all posts tagged with &#8220;software&#8221;">software</a>, <a href="http://crunchbang.org/tags/tools/" title="Browse all posts tagged with &#8220;tools&#8221;">tools</a></p>
    ]]></description>
</item>

<item>
    <title>Ternary Operator in PHP</title>
    <link>http://crunchbang.org/archives/2007/11/04/ternary-operator-in-php/</link>
    <pubDate>Sun, 04 Nov 2007 00:43:41 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2007/11/04/ternary-operator-in-php/</guid>
    <description><![CDATA[
    <p>Over on <a href="http://www.planet-php.net/ " title="Planet PHP - All news in one place.">Planet PHP</a> there&#39;s a running debate [<em>see <a href="http://www.alexatnet.com/node/100 " title="6 PHP coding tips to write less code.">here</a>, <a href="http://www.phpcult.com/blog/02/less-code-vs-good-code/ " title="Less code vs good code.">here</a> &amp; <a href="http://www.phpguru.org/article.php/154 " title="Less code vs good code - my take.">here</a></em>] over the use of the ternary operator. I love a good debate so I thought I&#39;d chip in with my 2 pennies.</p>

<p>The ternary operator looks attractive and can reduce the amount of code that you write. I know this but I still don&#39;t use it. I think PHP is an awesome language and a major contributing factor to its awesomeness is its simplicity. It&#39;s a relatively easy language to learn and I think that the wide spread use of the ternary operator would only increase the barrier to entry [<em>not a good thing!</em>]</p>

<p>Also, I find it interesting that the ternary operator is hardly ever referenced in the comments and code examples at <a href="http://php.net/ " title="PHP.net">PHP.net</a>. Indeed chapter 16 &#34;<a href="http://uk3.php.net/manual/en/language.control-structures.php " title="PHP - Control Structures">Control Structures</a>&#34; of the manual hardly mentions it at all.</p>

<h3>Ternary operator code example</h3>

<p>In case you&#39;ve no idea what this post is about.</p>

<p><strong>Before:</strong> <em>no ternary operator, easy to understand</em></p>

<pre><code>if ($treat == 'cream') {
    $cat = 'Happy!';
} else {
    $cat = 'Not so happy.';
}
</code></pre>

<p><strong>After:</strong> <em>ternary operator in use, less code but not so easy to understand</em></p>

<pre><code>$cat = ($treat == 'cream') ? 'Happy!' : 'Not so happy.';
</code></pre>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/code/" title="Browse all posts tagged with &#8220;code&#8221;">code</a>, <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/programming/" title="Browse all posts tagged with &#8220;programming&#8221;">programming</a></p>
    ]]></description>
</item>

<item>
    <title>PHP 5 &amp; Feed Updates</title>
    <link>http://crunchbang.org/archives/2007/10/29/php-and-feed-updates/</link>
    <pubDate>Mon, 29 Oct 2007 11:32:54 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2007/10/29/php-and-feed-updates/</guid>
    <description><![CDATA[
    <p>It&#39;s been a long time coming but my website [<em><a href="http://crunchbang.org/ " title="CrunchBang.org">CrunchBang.org</a></em>] is now finally running on PHP 5. My <a href="http://unitedhosting.co.uk " title="United Hosting">hosting provider</a> performed the upgrade earlier this month and made the switch optional on a domain basis. Any domain on their servers can run either PHP version 4 [<em>default</em>] or upgrade to version 5 by adding a script handler in <code>.htaccess</code>:</p>

<pre><code>Action php5-script /interpreters/php5-script
AddHandler php5-script .php
</code></pre>

<p>My development systems all run PHP 5 so the switch was a breeze. Hopefully from now on I&#39;ll be able to avoid <a href="http://crunchbang.org/archives/2007/09/26/php-strrpos-vs-strpos/ " title="strrpos vs strpos">stuff like this</a>.</p>

<p>Also, I&#39;ve been working on my <a href="http://crunchbang.org/tags/whird/ " title="Posts relating to Whird">Whird project</a> over the weekend. I&#39;ve now added feeds for individual tags and updated various features to improve usability. I&#39;ve had to place some URL rewrites for the new feeds and I&#39;m hoping that the various planets [<em><a href="http://ubuntuweblogs.org/ " title="Planet Ubuntu Users">Planet Ubuntu Users</a>, <a href="http://planet.ubuntu-uk.org/ " title="Planet Ubuntu UK">Planet Ubuntu UK</a></em>] don&#39;t get flooded &#8212; I apologise if they do :)</p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/code/" title="Browse all posts tagged with &#8220;code&#8221;">code</a>, <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/ubuntu/" title="Browse all posts tagged with &#8220;ubuntu&#8221;">ubuntu</a>, <a href="http://crunchbang.org/tags/unitedhosting/" title="Browse all posts tagged with &#8220;unitedhosting&#8221;">unitedhosting</a>, <a href="http://crunchbang.org/tags/whird/" title="Browse all posts tagged with &#8220;whird&#8221;">whird</a></p>
    ]]></description>
</item>

<item>
    <title>Howto Set-up a Crontab File</title>
    <link>http://crunchbang.org/archives/2007/10/26/howto-setup-a-crontab-file/</link>
    <pubDate>Fri, 26 Oct 2007 17:18:28 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2007/10/26/howto-setup-a-crontab-file/</guid>
    <description><![CDATA[
    <p>Yesterday I mainly worked on some PHP backup scripts [<em>not very exciting, but necessary.</em>] The scripts are run at regular intervals and perform various data backups across numerous domains. To accomplish this I set-up some cron jobs that will automatically execute the scripts at set intervals.</p>

<p>This is not the first time that I&#39;ve had to set-up cron jobs [<em>I&#39;ve got several that date back a few years.</em>] I think that having the ability to set-up scheduled tasks is really quite important. Therefore I thought I&#39;d blog about it for future reference.</p>

<h3>What is cron?</h3>

<p>Cron is a daemon/service that executes shell commands periodically on a given schedule. Cron is driven by a crontab, a configuration file that holds details of what commands are to be run along with a timetable of when to run them.</p>

<h3>Creating a crontab file</h3>

<p>You can create a crontab file by entering the following terminal command:</p>

<pre><code>crontab -e
</code></pre>

<p>Entering the above command will open a terminal editor [<em>Ubuntu uses Nano by default</em>] with a new blank crontab file [<em>or it will open an existing crontab if you already have one.</em>] You can now enter the commands to be executed [<em>see syntax below</em>] before saving the file and exiting the editor. As long as your entries were entered correctly your commands should now be executed at the times/dates you specified. You can see a list of active crontab entries by entering the following terminal command:</p>

<pre><code>crontab -l
</code></pre>

<h3>Crontab syntax</h3>

<p>A crontab file has six fields for specifying minute, hour, day of month, month, day of week and the command to be run at that interval. See below:</p>

<pre><code>*     *     *     *     *  command to be executed
-     -     -     -     -
|     |     |     |     |
|     |     |     |     +----- day of week (0 - 6) (Sunday=0)
|     |     |     +------- month (1 - 12)
|     |     +--------- day of month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)
</code></pre>

<h3>Crontab examples</h3>

<p>Writing a crontab file can be a somewhat confusing for first time users [<em>and the above table probably doesn&#39;t help much!</em>] Therefore I&#39;ve listed below some crontab examples:</p>

<pre><code>* * * * * &lt;command&gt; #Runs every minute
30 * * * * &lt;command&gt; #Runs at 30 minutes past the hour
45 6 * * * &lt;command&gt; #Runs at 6:45 am every day
45 18 * * * &lt;command&gt; #Runs at 6:45 pm every day
00 1 * * 0 &lt;command&gt; #Runs at 1:00 am every Sunday
00 1 * * 7 &lt;command&gt; #Runs at 1:00 am every Sunday
00 1 * * Sun &lt;command&gt; #Runs at 1:00 am every Sunday
30 8 1 * * &lt;command&gt; #Runs at 8:30 am on the first day of every month
00 0-23/2 02 07 * &lt;command&gt; #Runs every other hour on the 2nd of July
</code></pre>

<p>As well as the above there are also special strings that can be used:</p>

<pre><code>@reboot &lt;command&gt; #Runs at boot
@yearly &lt;command&gt; #Runs once a year [0 0 1 1 *]
@annually &lt;command&gt; #Runs once a year [0 0 1 1 *]
@monthly &lt;command&gt; #Runs once a month [0 0 1 * *]
@weekly &lt;command&gt; #Runs once a week [0 0 * * 0]
@daily &lt;command&gt; #Runs once a day [0 0 * * *]
@midnight &lt;command&gt; #Runs once a day [0 0 * * *]
@hourly &lt;command&gt; #Runs once an hour [0 * * * *]
</code></pre>

<h3>Multiple commands</h3>

<p>A double-ampersand &#34;<code>&amp;&amp;</code>&#34; can be used to run multiple commands consecutively. The following example would run <code>command_01</code> and then <code>command_02</code> once a day:</p>

<pre><code>@daily &lt;command_01&gt; &amp;&amp; &lt;command_02&gt;
</code></pre>

<h3>Disabling email notifications</h3>

<p>By default a cron job will send an email to the user account executing the cronjob. If this is not needed put the following command at the end of the cron job line:</p>

<pre><code>&gt;/dev/null 2&gt;&amp;1
</code></pre>

<h3>Specifying a crontab file to use</h3>

<p>As mentioned at the top of this post, you can create a new crontab file with the &#34;<code>crontab -e</code>&#34; command. However, you may already have a crontab file, if you do you can set it to be used with the following command:</p>

<pre><code>crontab -u &lt;username&gt; &lt;crontab file&gt;
</code></pre>

<p>Therefore the following command&#8230;</p>

<pre><code>crontab -u tux ~/crontab
</code></pre>

<p>&#8230;would set Tux&#39;s crontab file to that of the file named &#34;crontab&#34; residing in Tux&#39;s home directory.</p>

<h3>Removing a crontab file</h3>

<p>To remove your crontab file simply enter the following terminal command:</p>

<pre><code>crontab -r
</code></pre>

<h3>Further information</h3>

<p>Refer to the man page for further information about crontab. Enter the terminal command:</p>

<pre><code>man crontab
</code></pre>

<h3>External links</h3>

<p>Some external links for your browsing pleasure:</p>

<ul>
<li><a href="http://en.wikipedia.org/wiki/Cron " title="Cron article on Wikipedia">Cron article on Wikipedia</a></li>
<li><a href="https://help.ubuntu.com/community/CronHowto " title="CronHowto">Ubuntu Documentation - CronHowto</a></li>
<li><a href="http://www.debianhelp.co.uk/schedulejobs.htm " title="Scheduling Backup Jobs using at and crontab in debian">Debian Help - Scheduling Backup Jobs using at and crontab in debian</a></li>
<li><a href="http://www.mattcutts.com/blog/how-to-fetch-a-url-with-curl-or-wget-silently/ " title="How to fetch a url with curl or wget silently">Matt Cutts - How to fetch a url with curl or wget silently</a></li>
<li><a href="http://www.sitepoint.com/article/introducing-cron " title="Getting PHP and Cron to Work Together">Sitepoint - Getting PHP and Cron to Work Together</a></li>
</ul>

<p>I think that pretty much covers the subject of cron jobs and crontab. Please feel free to comment if I&#39;ve missed anything/made any boobs.</p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/code/" title="Browse all posts tagged with &#8220;code&#8221;">code</a>, <a href="http://crunchbang.org/tags/crontab/" title="Browse all posts tagged with &#8220;crontab&#8221;">crontab</a>, <a href="http://crunchbang.org/tags/linux/" title="Browse all posts tagged with &#8220;linux&#8221;">linux</a>, <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/ubuntu/" title="Browse all posts tagged with &#8220;ubuntu&#8221;">ubuntu</a></p>
    ]]></description>
</item>

<item>
    <title>User Agent Sniffer</title>
    <link>http://crunchbang.org/archives/2007/10/18/user-agent-sniffer/</link>
    <pubDate>Thu, 18 Oct 2007 08:52:21 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2007/10/18/user-agent-sniffer/</guid>
    <description><![CDATA[
    <p>I&#39;ve currently got several web projects at various stages of development. One thing that all of these projects have in common is that they all capture and manipulate user-agent stings.</p>

<h3>What are user-agent strings?</h3>

<p>User-agents strings are used by client applications such as web browsers, feed readers, bots and other software to identify themselves to the servers they are connecting to. The strings contain important information such as application type, version, language and operating system. A typical user-agent string might look like this:</p>

<pre><code>Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.7 (like Gecko) (Kubuntu)
</code></pre>

<p>The above example is used to identify that the client is a Mozilla compatible Konqueror web browser running on Kubuntu Linux.</p>

<h3>Collecting user-agent strings</h3>

<p>To run tests on my projects I need some sample data to play around with [<em>a list or database table of user-agent strings.</em>] I figured that the best way to get this sample data would be to collect some user-agent strings from the wild. So, I wrote a quick PHP script to do just that.</p>

<p>I ran the script on this site [<em>crunchbang.org</em>] for ten days, starting on October 7th 2007. During that ten day period the script captured a total of 2272 unique user-agent strings. The captured list included both standard and non-standard strings.</p>

<h3>A few facts about user-agent strings</h3>

<p>After capturing the list I then edited the PHP script so that it would report a few facts. Here is a breakdown of what was returned:</p>

<p><strong>1.</strong> At just 6 characters in length the shortest user-agent string captured was:</p>

<pre><code>NG/2.0
</code></pre>

<p><strong>2.</strong> The longest measured in at 205 characters, it was:</p>

<pre><code>Mozilla/5.0 (compatible; MSIE 7.0; Windows; HTMLAB; .NET CLR 1.1.4322; 
MEGAUPLOAD 1.0; Seekmo; ZangoToolbar4.8.2; Alexa Toolbar; Hotbar 4.2.8.0) (compatible; 
Googlebot/2.1; +http://www.google.com/bot.html)
</code></pre>

<p><strong>3.</strong> The average computed length of the user-agent strings was 91.2750880282 characters.</p>

<p><strong>4.</strong> Most strings contained some non-alphanumeric characters, these were:</p>

<pre><code>/ . ( ; - : ) + _ ! = , @ &amp;  ' [ ] * ~ ? { }
</code></pre>

<p><strong>5.</strong> The strangest user-agent string was:</p>

<pre><code>Mmm.... Brains....
</code></pre>

<h3>View the whole report</h3>

<p>You can view the whole report here: <a href="http://crunchbang.org/misc/user-agent-report-2007-10-17.txt " title="View the User Agent Sniffer report.">http://crunchbang.org/misc/user-agent-report-2007-10-17.txt</a></p>

<h3>Get the sample data</h3>

<p>I thought it would be good to share the sample data. There&#39;s no private or confidential information in the data and I figure it may come in handy for other developers working on similar projects.</p>

<p>You can get the data as an ASCII file [<em>one user-agent string per line</em>] here: <a href="http://crunchbang.org/misc/sample-user-agents-ascii.txt " title="Get the sample data as a flat ascii file.">http://crunchbang.org/misc/sample-user-agents-ascii.txt</a></p>

<p>Or, as an SQL statement here: <a href="http://crunchbang.org/misc/sample-user-agents-mysql.txt " title="Insert the sample data into a MySQL database using this SQL statement.">http://crunchbang.org/misc/sample-user-agents-mysql.txt</a></p>

<h3>Get the PHP script</h3>

<p>If you fancy having a go at collecting your own samples you can grab my PHP script here: <a href="http://crunchbang.org/misc/ua-sniffer.txt " title="Get the User Agent Sniffer PHP script.">http://crunchbang.org/misc/ua-sniffer.txt</a></p>

<p>The script requires the use of MySQL. Other than that it&#39;s a fairly straightforward affair. Just edit the four settings to define your database name, address, username and password.</p>

<p>I ran the script by calling it with a <code>require_once</code> statement. Note that the script also sets and reads a cookie so you&#39;ll need to call on it before outputting any data to the client.</p>

<pre><code>require_once("ua-sniffer.php");
</code></pre>

<p>Once the script has collected some user-agent strings it is possible to query it and have it produce a basic report. You can do this by accessing the script through your browser like so:</p>

<pre><code>http://www.example.com/ua-sniffer.php?report=true
</code></pre>

<h3>Links to external references</h3>

<ul>
<li><a href="http://en.wikipedia.org/wiki/User_agent " title="User Agent article on Wikipedia">User Agent article on Wikipedia</a></li>
<li><a href="http://www.user-agents.org/ " title="List of User-Agents at user-agents.org">List of User-Agents at user-agents.org</a></li>
<li><a href="http://www.zytrax.com/tech/web/browser_ids.htm " title="Browser ID strings at zytrax.com">Another list of browser ID strings</a></li>
<li><a href="http://www.useragentstring.com/ " title="User agent string analysis">User agent string analysis</a></li>
</ul>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/code/" title="Browse all posts tagged with &#8220;code&#8221;">code</a>, <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/programming/" title="Browse all posts tagged with &#8220;programming&#8221;">programming</a>, <a href="http://crunchbang.org/tags/projects/" title="Browse all posts tagged with &#8220;projects&#8221;">projects</a>, <a href="http://crunchbang.org/tags/scripts/" title="Browse all posts tagged with &#8220;scripts&#8221;">scripts</a></p>
    ]]></description>
</item>

<item>
    <title>301 Redirect with PHP</title>
    <link>http://crunchbang.org/archives/2007/10/02/301-redirect-with-php/</link>
    <pubDate>Tue, 02 Oct 2007 03:09:28 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2007/10/02/301-redirect-with-php/</guid>
    <description><![CDATA[
    <p>I&#39;ve just had to permanently redirect an entire site. The site consisted of several hundred pages and on the face of it, it seemed like a daunting task. However two lines of PHP came to the rescue :-)</p>

<pre><code> Header( "HTTP/1.1 301 Moved Permanently" );
 Header( "Location: http://www.new-location.com" );
</code></pre>

<p>Luckily, each page on the site referred to a single configuration file and this made the process painless.</p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/code/" title="Browse all posts tagged with &#8220;code&#8221;">code</a>, <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/webdesign/" title="Browse all posts tagged with &#8220;webdesign&#8221;">webdesign</a></p>
    ]]></description>
</item>

<item>
    <title>PHP: strrpos() vs strpos()</title>
    <link>http://crunchbang.org/archives/2007/09/26/php-strrpos-vs-strpos/</link>
    <pubDate>Wed, 26 Sep 2007 12:45:48 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2007/09/26/php-strrpos-vs-strpos/</guid>
    <description><![CDATA[
    <p>I normally wouldn&#39;t post about such trivial matters, however this particular trivial matter bugged me for several hours this afternoon, so I thought I mention it.</p>

<p>It seems that one of the problems of coding on a development server that runs PHP 5 for a production server that runs PHP 4 is the subtle differences in the language. These subtle differences can really throw a spanner in the works [<em>like one did to me this afternoon.</em>]</p>

<p>Basically my development code used the <a href="http://php.net/manual/en/function.strrpos.php " title="PHP Manual - strrpos">strrpos()</a> function to attempt to find the first occurrence of a string within a string. While this worked just fine with PHP 5, it bombed big time with PHP 4 [<em>which will only find the first occurrence of a single character.</em>] Apparently I should have been using the <a href="http://php.net/manual/en/function.strpos.php " title="PHP Manual - strpos">strpos()</a> function instead!</p>

<p>Oh well, live and learn.</p>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/programming/" title="Browse all posts tagged with &#8220;programming&#8221;">programming</a></p>
    ]]></description>
</item>

<item>
    <title>7 Reasons He Switched Back to PHP</title>
    <link>http://crunchbang.org/archives/2007/09/26/7-reasons-he-switched-back-to-php/</link>
    <pubDate>Wed, 26 Sep 2007 03:37:10 GMT</pubDate>
    <dc:creator>Philip Newborough</dc:creator>
    <guid>http://crunchbang.org/archives/2007/09/26/7-reasons-he-switched-back-to-php/</guid>
    <description><![CDATA[
    <blockquote>
  <p>I didn’t abandon the rewrite IDEA, though. I just asked myself one important question:<br />
  “Is there anything Rails can do, that PHP CAN’T do?”<br />
  The answer is no.</p>
</blockquote>

<p>Derek Silvers writes a <a href="http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html " title="7 reasons not to start using Rails.">good article</a> with 7 good reasons as to why he switched back to PHP after 2 years of coding Ruby on Rails.</p>

<p>I&#39;ve always liked the idea of learning Rails, [<em>is it just me or has Rails been portrayed as a sexy/trendy language?</em>] but I&#39;ve never started because PHP has always been good enough for my own projects. I&#39;m glad I didn&#39;t waste 2 years learning another language just to find that out!</p>

<p>My favourite reason from the article:</p>

<blockquote>
  <p>7 - PROGRAMMING LANGUAGES ARE LIKE GIRLFRIENDS: THE NEW ONE IS BETTER BECAUSE <em>YOU</em> ARE BETTER</p>
</blockquote>

    <p style="font-size:smaller;">Tags: <a href="http://crunchbang.org/tags/php/" title="Browse all posts tagged with &#8220;php&#8221;">php</a>, <a href="http://crunchbang.org/tags/programming/" title="Browse all posts tagged with &#8220;programming&#8221;">programming</a></p>
    ]]></description>
</item>

 </channel>
</rss>