<?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>Menial &#187; Code</title>
	<atom:link href="http://menial.co.uk/blog/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://menial.co.uk</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Tue, 31 Jan 2012 12:06:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Applescript for starting and stopping Apache and MySQL</title>
		<link>http://menial.co.uk/blog/2008/11/16/applescript-for-starting-and-stopping-apache-and-mysql/</link>
		<comments>http://menial.co.uk/blog/2008/11/16/applescript-for-starting-and-stopping-apache-and-mysql/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 20:33:46 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://menial.co.uk/blog/?p=27</guid>
		<description><![CDATA[Useful for saving as an executable.]]></description>
			<content:encoded><![CDATA[<p>Got a couple of pieces of AppleScript for starting and stopping Apache and MySQL which are too small to be worth posting as downloads. I don&#8217;t use these any more, but they were handy for custom installs of Apache/MySQL.</p>
<p><strong>Starting:</strong><br />
<code>do shell script "/sw/sbin/apachectl start" password "MY_PASSWORD" with administrator privileges do shell script "/usr/local/mysql/bin/mysqld_safe &gt; /dev/null 2&gt;&amp;1 &amp;" password "MY_PASSWORD" with administrator privileges</code></p>
<p><strong>Stopping:</strong><br />
<code>do shell script "/sw/sbin/apachectl stop" password "MY_PASSWORD" with administrator privileges do shell script "/usr/local/mysql/bin/mysqladmin -u root -pROOT_MYSQL_PASSWORD shutdown" password "MY_PASSWORD" with administrator privileges</code></p>
<p>You will obviously need to change MY_PASSWORD to your admin password. You need to change ROOT_MYSQL_PASSWORD to your root MySQL password, or another user name/password combo with shutdown privileges. Note: there should <em>not</em> be a space between -p and ROOT_MYSQL_PASSWORD.</p>
<p>Also, the path to apache/mysql might need changing. You can find out where they are by running <code>which apachectl</code> and <code>which mysqld_safe</code> in the terminal.</p>
<p>Just paste the code into Script Editor, and save how/wherever you like. I save mine as run-only executables which show up nicely in <a href="http://quicksilver.blacktree.com/">Quicksilver</a>.</p>
<p>Can&#8217;t remember where this code originally came from, but it&#8217;s pretty handy, so thanks whoever pointed me at this.</p>
]]></content:encoded>
			<wfw:commentRss>http://menial.co.uk/blog/2008/11/16/applescript-for-starting-and-stopping-apache-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP ForceDownload Component</title>
		<link>http://menial.co.uk/blog/2007/01/07/cakephp-force-download-component/</link>
		<comments>http://menial.co.uk/blog/2007/01/07/cakephp-force-download-component/#comments</comments>
		<pubDate>Mon, 08 Jan 2007 06:42:55 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://menial.co.uk/blog/?p=14</guid>
		<description><![CDATA[Old code for forcing CakePHP to present a file as a download rather than display in-browser.]]></description>
			<content:encoded><![CDATA[<p><strong>Important!</strong> This is old code. I’ve not used it for a long time. It might still be useful. Be careful.</p>
<p> </p>
<p>This snippet is a CakePHP component which can be used to force a users browser to download a specified file instead of attempting to display it. It will happily deal with any file your scripts have read access to. When provided with an absolute file location and filename for the downloaded file, it will attempt to look up an appropriate mime-type for the file, output some HTTP headers followed by the file data itself.</p>
<p>You are responsible for exiting after calling this method. Not exiting will result in CakePHP trying to render a page after sending the file data, causing (possibly invisible) errors. I have also removed error checking code responsible for checking the file path and download name as it is very app-specific. You will probably want to add your own.</p>
<p><strong>Note:</strong> I have not tested this on a Windows-based machine. I don&#8217;t see why it shouldn&#8217;t work, but you have been told.</p>
<p> </p>
<p><strong>Usage</strong></p>
<p><code> var $components = array('ForceDownload')<br />
...<br />
$this-&gt;ForceDownload-&gt;forceDownload('/path/to/file.php', 'MyPHPFile.php');<br />
exit();</code></p>
<p> </p>
<p><strong>Download</strong><br />
<a href="/wp-content/uploads/force_download.zip">ForceDownload.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://menial.co.uk/blog/2007/01/07/cakephp-force-download-component/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CakePHP Favatar Controller</title>
		<link>http://menial.co.uk/blog/2006/12/17/cakephp-favatar-controller/</link>
		<comments>http://menial.co.uk/blog/2006/12/17/cakephp-favatar-controller/#comments</comments>
		<pubDate>Sun, 17 Dec 2006 23:15:15 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://menial.co.uk/blog/?p=7</guid>
		<description><![CDATA[Old code for displaying favicons as avatars in a CakePHP powered site.]]></description>
			<content:encoded><![CDATA[<p><strong>Important!</strong> This is old code. I&#8217;ve not used it for a long time. It might still be useful. Be careful.</p>
<p> </p>
<p>Favatars is a WordPress plugin for displaying favicons as avatars next to blog post comments. This code is an adaptation of the original work to turn it into a CakePHP Controller. When given a URL, it will attempt to locate a favicon for that site. If one is found, it is cached and displayed. If not, it will display a default image.</p>
<p>By using this controller within&lt;img&gt; tags, favicons can be used as images anywhere within your site, without knowing their specific address. It is currently in use on this blog and favicons will appear next to post comments.</p>
<p>Instructions for use are included in the download. I can no longer offer support for this code.</p>
<p><a href="/wp-content/uploads/favatars.zip">Favatars.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://menial.co.uk/blog/2006/12/17/cakephp-favatar-controller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP iCal Parser</title>
		<link>http://menial.co.uk/blog/2006/12/15/php-ical-parser/</link>
		<comments>http://menial.co.uk/blog/2006/12/15/php-ical-parser/#comments</comments>
		<pubDate>Sat, 16 Dec 2006 05:17:12 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://menial.co.uk/blog/?p=21</guid>
		<description><![CDATA[PHP code for parsing iCalendar (.ics) files into nested associative arrays.]]></description>
			<content:encoded><![CDATA[<p> </p>
<p><strong>Important!</strong> This is old code. I’ve not used it for a long time. It might still be useful. Be careful.</p>
<p>This code parses iCalendar  (<a href="http://www.ietf.org/rfc/rfc2445.txt">RFC 2445</a>) compliant files into nested associative arrays. It doesn&#8217;t do the full iCal specification, as I only needed a subset of it, but the code is easily extended and should just ignore anything it doesn&#8217;t understand. It&#8217;s old and currently unused by me, but should still work!</p>
<p>I&#8217;d love to hear back from anyone who uses this. If you send changes, I&#8217;ll merge them into the download.</p>
<p> </p>
<p> </p>
<p><strong>Download:</strong></p>
<p><a href="/wp-content/uploads/parse_ics.zip">PHP iCal Parser</a></p>
]]></content:encoded>
			<wfw:commentRss>http://menial.co.uk/blog/2006/12/15/php-ical-parser/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

