<?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>SickBiscuit &#187; PHP</title>
	<atom:link href="http://sickbiscuit.com/blog/category/code/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://sickbiscuit.com/blog</link>
	<description>The personal blog of Steven Wilkin</description>
	<lastBuildDate>Sun, 27 Jun 2010 21:52:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A dummy datasource for CakePHP</title>
		<link>http://sickbiscuit.com/blog/2010/02/14/a-dummy-datasource-for-cakephp/</link>
		<comments>http://sickbiscuit.com/blog/2010/02/14/a-dummy-datasource-for-cakephp/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 18:10:54 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://sickbiscuit.com/blog/?p=443</guid>
		<description><![CDATA[I was recently developing a project at work which at the beginning didn&#8217;t need a database. However, Cake was still testing the database connection and issuing a warning as a result when it couldn&#8217;t connect. My solution was to create a dummy datasource which silenced the warnings and allowed me to get on with the [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently developing a project at <a href="http://rehabstudio.com/">work</a> which at the beginning didn&#8217;t need a database. However, <a href="http://cakephp.org">Cake</a> was still testing the database connection and issuing a warning as a result when it couldn&#8217;t connect. My solution was to create a dummy datasource which silenced the warnings and allowed me to get on with the rest of development in relative peace.</p>
<p>The scope of the project changed and a database was required. The dummy datasource had to go so I thought I&#8217;d share it here before it was thrown to the winds.</p>
<p>Here&#8217;s the datasource, which belongs in <code>models/datasources/dbo/dbo_dummy.php</code>:</p>
<pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> DboDummy <span style="color: #000000; font-weight: bold;">extends</span> DboSource <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">function</span> connect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connected</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">function</span> disconnect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connected</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<p>To use the datasource use the following in your <code>config/database.php</code>:</p>
<pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> DATABASE_CONFIG <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000033;">$default</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
                <span style="color: #0000ff;">'driver'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'dummy'</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'host'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'login'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'password'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'database'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://sickbiscuit.com/blog/2010/02/14/a-dummy-datasource-for-cakephp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nano-Apps</title>
		<link>http://sickbiscuit.com/blog/2009/01/26/nano-apps/</link>
		<comments>http://sickbiscuit.com/blog/2009/01/26/nano-apps/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 16:49:04 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://sickbiscuit.com/blog/?p=335</guid>
		<description><![CDATA[Last month Giles Bowkett in the trawls of his hypergraphia wrote a post on Nano-Apps, quirky one page apps which serve up a piece of trivia or answer a question like is George W. Bush still president?
Previously I had put together hometi.me, a little AJAX-y app to let me know how much longer I had [...]]]></description>
			<content:encoded><![CDATA[<p>Last month <a href="http://twitter.com/gilesgoatboy">Giles Bowkett</a> in the trawls of his hypergraphia wrote a post on <a href="http://gilesbowkett.blogspot.com/2008/12/nanoapps-i-love.html">Nano-Apps</a>, quirky one page apps which serve up a piece of trivia or answer a question like <a href="http://www.isgeorgewbushstillpresident.com/">is George W. Bush still president?</a></p>
<p>Previously I had put together <a href="http://hometi.me/">hometi.me</a>, a little AJAX-y app to let me know how much longer I had to go until I could leave work for the day and when a new nano-app reporting Belfast&#8217;s <a href="http://twitter.com/goodonpaper">goodonpaper</a>&#8217;s <a href="http://www.isgoodonpaperhavingacoffeeincharlies.com/">coffee drinking habits</a> surfaced the bug bit me and I wanted to do something and do it quick.</p>
<p>I had the embryo of an idea on a Sunday and had production code on the following Saturday morning.</p>
<p>The app attempts to answer the question <a href="http://isitraininginbelfast.com/">is it raining in Belfast?</a> by scraping the <a href="http://www.metoffice.gov.uk/weather/uk/ni/belfast_forecast_weather.html">MET office forecast for Belfast</a> and sometimes gets it right. It has a Ruby back-end and PHP front-end and is available on <a href="http://github.com/stevenwilkin/isitraininginbelfast.com/tree/master">GitHub</a> for anyone interested. The graphics need tweaked and it would no doubt be better displaying the weather that was previously forecast for the current time period, but it&#8217;s out there doing it&#8217;s thing which was the point in the exercise.</p>
<p>During this process something that caught my eye is <a href="http://github.com/bmizerany/sinatra/tree/master">Sinatra</a>, a Ruby framework suited to creating web-apps with minimal code. Now all I need is a idea to implement with it&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://sickbiscuit.com/blog/2009/01/26/nano-apps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
