<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Glen Scott - Keeping it simple</title>
	
	<link>http://www.glenscott.co.uk/blog</link>
	<description>Thoughts on software development and other geeky pursuits.</description>
	<lastBuildDate>Fri, 10 Feb 2012 17:23:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/GlenScott-KeepingItSimple" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="glenscott-keepingitsimple" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>SimpleCrypt PHP class for simple cryptography</title>
		<link>http://www.glenscott.co.uk/blog/2012/02/09/simplecrypt-php-class-for-simple-cryptography/</link>
		<comments>http://www.glenscott.co.uk/blog/2012/02/09/simplecrypt-php-class-for-simple-cryptography/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 09:33:50 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[open source]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/blog/?p=743</guid>
		<description><![CDATA[I have just pushed a simple class called SimpleCrypt to GitHub: https://github.com/glenscott/simple-crypt This is an OO wrapper around the most common mcrypt functions. An example of use: If you find it useful, please let me know!]]></description>
			<content:encoded><![CDATA[<p>I have just pushed a simple class called <code>SimpleCrypt</code> to GitHub:</p>
<p><a href="https://github.com/glenscott/simple-crypt">https://github.com/glenscott/simple-crypt</a></p>
<p>This is an OO wrapper around the most common mcrypt functions.  An example of use:</p>
<pre class="brush: php; title: ; notranslate">
require_once 'SimpleCrypt.php';

// show the algorithms available for use
print_r( SimpleCrypt::get_available_algorithms() );

// encrypt a string using Triple DES (CBC mode)
$crypt = new SimpleCrypt( 'tripledes', 'mysecretkey' );
$encrypted_data = $crypt-&gt;encrypt_data( 'stringtoencrypt' );
echo &quot;Encrypted data: &quot; . bin2hex( $encrypted_data ) . &quot;\n&quot;;
echo &quot;Decrypted data: &quot; . $crypt-&gt;decrypt_data( $encrypted_data ) . &quot;\n&quot;;
</pre>
<p>If you find it useful, please let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/blog/2012/02/09/simplecrypt-php-class-for-simple-cryptography/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mac OS X 10.7.3 upgrades PHP from 5.3.6 to 5.3.8</title>
		<link>http://www.glenscott.co.uk/blog/2012/02/08/mac-os-x-10-7-3-upgrades-php-from-5-3-6-to-5-3-8/</link>
		<comments>http://www.glenscott.co.uk/blog/2012/02/08/mac-os-x-10-7-3-upgrades-php-from-5-3-6-to-5-3-8/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 17:22:31 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/blog/?p=741</guid>
		<description><![CDATA[As described in Apple&#8217;s security notes for Mac OS X 10.7.3, PHP is upgraded to version 5.3.8 as part of the update.]]></description>
			<content:encoded><![CDATA[<p>As described in Apple&#8217;s <a href="http://support.apple.com/kb/HT5130">security notes for Mac OS X 10.7.3</a>, PHP is upgraded to version 5.3.8 as part of the update.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/blog/2012/02/08/mac-os-x-10-7-3-upgrades-php-from-5-3-6-to-5-3-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Map invoke errors when using MongoDB MapReduce</title>
		<link>http://www.glenscott.co.uk/blog/2012/02/02/map-invoke-errors-when-using-mongodb-mapreduce/</link>
		<comments>http://www.glenscott.co.uk/blog/2012/02/02/map-invoke-errors-when-using-mongodb-mapreduce/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 11:34:33 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[mongodb]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/blog/?p=732</guid>
		<description><![CDATA[When running MapReduce operations on your data, you must make sure that any fields you refer to within your map operation are available for every document in your collection. If you try a map operation and some documents do not have the required field, you will get the following assertion error when running the command: [...]]]></description>
			<content:encoded><![CDATA[<p>When running MapReduce operations on your data, you must make sure that any fields you refer to within your map operation <strong>are available for every document</strong> in your collection.  If you try a map operation and some documents do not have the required field, you will get the following assertion error when running the command:</p>
<pre>map invoke failed: JS Error: TypeError: this.fieldname has no properties</pre>
<p><code>fieldname</code> in this case is a field that does not exist in all of the documents.</p>
<p>To prevent this error, you can pass the optional <code>query</code> parameter to the command to make sure that only documents with this field are queried.  For example, in PHP, add the following to the command operation:</p>
<pre class="brush: php; title: ; notranslate">

$db-&gt;command(
    'mapreduce' =&gt; 'collection',
    'map'       =&gt; $map,
    'reduce'    =&gt; $reduce,
    'out'       =&gt; array( 'inline' =&gt; 1 ),
    'query'     =&gt; array( &quot;fieldname&quot; =&gt; array( '$exists' =&gt; true, ) )
);
</pre>
<p>This makes sure that MapReduce operations are only run on a subset of the collection.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/blog/2012/02/02/map-invoke-errors-when-using-mongodb-mapreduce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Complaining to Virgin Media</title>
		<link>http://www.glenscott.co.uk/blog/2012/01/18/complaining-to-virgin-media/</link>
		<comments>http://www.glenscott.co.uk/blog/2012/01/18/complaining-to-virgin-media/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 09:01:01 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[broadband]]></category>
		<category><![CDATA[complain]]></category>
		<category><![CDATA[virgin]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/blog/?p=725</guid>
		<description><![CDATA[Yesterday, the 17th January 2012, Virgin Media broadband customers experienced partial or total loss of connectivity throughout the afternoon and evening. As one of those customers affected by the outage, I am making a formal complaint to the company. As I work from home and require internet connectivity at all times, this outage had a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/raver_mikey/3570914819/" title="&quot;Broadband power to all the people&quot; by Gene Hunt, on Flickr"><img src="http://farm4.staticflickr.com/3623/3570914819_1c2251f513.jpg" width="500" height="375" alt="&quot;Broadband power to all the people&quot;"></a></p>
<p>Yesterday, the 17th January 2012, Virgin Media broadband customers experienced partial or total loss of connectivity throughout the afternoon and evening.  As one of those customers affected by the outage, I am making a formal complaint to the company.  As I work from home and require internet connectivity at all times, this outage had a serious affect on my business.</p>
<p>For others that are considering complaining, here is how you can do it &#8212; it took me a fair bit of searching to find this, so I hope this is helpful to others.</p>
<p>Firstly, you may wish to read <a href="http://shop.virginmedia.com/content/dam/allyours/pdf/Consumer%20Complaint%20code%20Jan%2011.pdf">Virgin Media&#8217;s Code of Practice for complaints</a>.</p>
<p>To submit a complaint, you can use the web form located here:</p>
<p><a href="https://help.virginmedia.com/system/selfservice.controller?CONFIGURATION=1002&#038;PARTITION_ID=1&#038;TIMEZONE_OFFSET=&#038;USERTYPE=1&#038;VM_CUSTOMER_TYPE=Cable&#038;CMD=ESCALATION_REQUEST">Virgin Media &#8211; Contact Us</a></p>
<ol>
<li>Select <strong>General Enquiry</strong></li>
<li>Choose <strong>I have cable services</strong></li>
<li>Select <strong>Make a customer services complaint</strong></li>
<li>Click the red <strong>Next</strong> button at the bottom of the page</li>
</ol>
<p>This leads you to a contact form where you can submit your complaint.  You will also need you Virgin Media account number and the password you use for logging into the site.</p>
<p>Good luck!</p>
<p><small>Photo credit: Gene Hunt</small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/blog/2012/01/18/complaining-to-virgin-media/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Going Freelance – Part 3</title>
		<link>http://www.glenscott.co.uk/blog/2012/01/09/going-freelance-part-3/</link>
		<comments>http://www.glenscott.co.uk/blog/2012/01/09/going-freelance-part-3/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 09:29:15 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[freelancing]]></category>
		<category><![CDATA[accounting]]></category>
		<category><![CDATA[freeagent]]></category>
		<category><![CDATA[invoicing]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/blog/?p=721</guid>
		<description><![CDATA[In Part 2, I mentioned how I used Google Docs as a way of managing business records. Although this turned out to be a reasonable solution, I soon found myself wanting something more bespoke. Enter FreeAgent. I heard a few other freelancers recommending this service, so I signed up for a free 30 day trial [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/teegardin/5913014568/" title="Balancing The Account By Hand by kenteegardin, on Flickr"><img src="http://farm7.staticflickr.com/6052/5913014568_a1f3148bf7.jpg" width="500" height="347" alt="Balancing The Account By Hand"></a></p>
<p>In <a href="/blog/2011/09/23/going-freelance-part-2/">Part 2</a>, I mentioned how I used <a href="http://docs.google.com/">Google Docs</a> as a way of managing business records.  Although this turned out to be a reasonable solution, I soon found myself wanting something more bespoke.</p>
<p>Enter <a href="http://www.freeagent.com">FreeAgent</a>.  I heard a few other freelancers recommending this service, so I signed up for a free 30 day trial to see what the fuss was about.  FreeAgent provides a way of managing your client details, invoices and tax affairs.  The interface is very slick and friendly, and means keeping on top of record keeping is now much less of a chore!</p>
<p>I&#8217;ve now been using the paid service for 2 months and I can heartily recommend it.  If you want to give it a go, you can <a href="http://fre.ag/41if4gaa">use this link to get 10% off the subscription price of FreeAgent</a>.</p>
<p><small>(photo credit: <a href="http://www.seniorliving.org/">www.seniorliving.org</a>)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/blog/2012/01/09/going-freelance-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exporting specific documents from MongoDB</title>
		<link>http://www.glenscott.co.uk/blog/2012/01/05/exporting-a-single-document-from-mongodb/</link>
		<comments>http://www.glenscott.co.uk/blog/2012/01/05/exporting-a-single-document-from-mongodb/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 12:29:34 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[mongodb]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/blog/?p=710</guid>
		<description><![CDATA[MongoDB comes with a useful tool, mongoexport, for exporting collections. However, you can also use it to export specific documents by utilising the query parameter. You can export a single document using it&#8217;s ObjectId using a command similar to the following: Replace host_name, username, database_name and collection_name with the appropriate values. Replace 4f045677a1ef264746000011 with the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/crodas/4941192194/" title="Mongodb by Cesar Rodas, on Flickr"><img src="http://farm5.staticflickr.com/4078/4941192194_b3b2f39653.jpg" width="500" height="333" alt="Mongodb"></a></p>
<p>MongoDB comes with a useful tool, <code>mongoexport</code>, for exporting collections.  However, you can also use it to export specific documents by utilising the <code>query</code> parameter.  You can export a single document using it&#8217;s ObjectId using a command similar to the following:</p>
<pre class="brush: bash; title: ; notranslate">
mongoexport -h &quot;host_name&quot; -u &quot;username&quot; -d &quot;database_name&quot; -c &quot;collection_name&quot; -q '{&quot;_id&quot;:ObjectId(&quot;4f045677a1ef264746000011&quot;)}' -o output.js -p
</pre>
<ul>
<li>Replace host_name, username, database_name and collection_name with the appropriate values.
</li>
<li>Replace <code>4f045677a1ef264746000011</code> with the ObjectID that you wish to export</li>
</ul>
<p>You will be prompted for a password, and then the document will be written to <code>output.js</code>. </p>
<p>To export multiple documents, you can utilise an <code>$in</code> clause in the query parameter like this:</p>
<pre class="brush: bash; title: ; notranslate">
-q '{&quot;_id&quot;:{&quot;$in&quot; :[ ObjectId(&quot;4f048dc6a1ef26da4b000008&quot;),ObjectId(&quot;4ed8ee16a1ef26085600001a&quot;),ObjectId(&quot;4efc46e0a1ef26b73d0007be&quot;)]}}'
</pre>
<p>To import these exported documents into another MongoDB server, you can use the <code>mongoimport</code> like so:</p>
<pre class="brush: bash; title: ; notranslate">
mongoimport -h &quot;host_name&quot; -u &quot;username&quot; -p -d &quot;database_name&quot; -c &quot;collection_name&quot; output.js
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/blog/2012/01/05/exporting-a-single-document-from-mongodb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iCal 502 error when syncing with Yahoo! Calendar</title>
		<link>http://www.glenscott.co.uk/blog/2011/10/26/ical-502-error-when-syncing-with-yahoo-calendar/</link>
		<comments>http://www.glenscott.co.uk/blog/2011/10/26/ical-502-error-when-syncing-with-yahoo-calendar/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 08:43:59 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[webapps]]></category>
		<category><![CDATA[yahoo]]></category>
		<category><![CDATA[calendar]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/blog/?p=672</guid>
		<description><![CDATA[In the last few days, my iCal has been giving me the following error message when trying to access my Yahoo! Calendar via CalDAV: The request for account "Yahoo! Calendar" failed. The server responded with "502" to operation CalDAVAccountRefreshQueueableOperation. Yahoo! have acknowledged this is a problem on their side: We are aware of a Calendar [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few days, my iCal has been giving me the following error message when trying to access my Yahoo! Calendar via CalDAV:</p>
<p><code>The request for account "Yahoo! Calendar" failed.</p>
<p>The server responded with<br />
"502"<br />
to operation<br />
CalDAVAccountRefreshQueueableOperation.<br />
</code></p>
<p><img src="/images/ical-502-error.png" width="534" height="312" alt="iCal error message when syncing with yahoo! calendar"></p>
<p>Yahoo! have acknowledged this is a problem on their side:</p>
<blockquote><p>
We are aware of a Calendar (Proxy error) and our engineering team is working to resolve this issue. We apologize for the inconvenience and hope to have it resolved soon.
</p></blockquote>
<p>(source: <a href="http://help.yahoo.com/l/us/yahoo/calendar/yahoocalendar/sync/">Syncing / Mobile Sync | Yahoo! Calendar Help</a>)</p>
<p><strong>update 2nd November 2011:</strong> I am no longer seeing this error message, and Yahoo! have removed the notice from their help page.  Looks like the issue has been resolved!</p>
<p><strong>update 3rd November 2011:</strong> Seems like I spoke too soon, the error is back!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/blog/2011/10/26/ical-502-error-when-syncing-with-yahoo-calendar/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Camera and photo improvements in iOS5</title>
		<link>http://www.glenscott.co.uk/blog/2011/10/14/camera-and-photo-improvements-in-ios5/</link>
		<comments>http://www.glenscott.co.uk/blog/2011/10/14/camera-and-photo-improvements-in-ios5/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 14:49:54 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[iphone]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[iOS]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/blog/?p=638</guid>
		<description><![CDATA[The camera functionality in the iPhone has always been one of my most used features. iOS5 brings some enhancements, which are listed below: Camera improvements Double-click the Home button when device is asleep to bring up a camera shortcut on iPhone 4S, iPhone 4, iPhone 3GS and iPod touch (4th generation) Volume Up button to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/nicokaiser/5718296862/" title="iPhone Camera by Nico Kaiser, on Flickr"><img src="http://farm3.static.flickr.com/2710/5718296862_4b58e7bcbb.jpg" width="500" height="333" alt="iPhone Camera"></a></p>
<p>The camera functionality in the iPhone has always been one of my most used features.  iOS5 brings some enhancements, which are listed below:</p>
<h2>Camera improvements</h2>
<ul>
<li>Double-click the Home button when device is asleep to bring up a camera shortcut on iPhone 4S, iPhone 4, iPhone 3GS and iPod touch (4th generation)</li>
<li>Volume Up button to take a picture</li>
<li>Optional grid lines to line up shots</li>
<li>Pinch to zoom in the preview screen</li>
<li>Swipe to camera roll from preview screen</li>
<li>Tap and hold to lock focus and exposure; iPad 2 and iPod touch (4th generation) only support exposure lock</li>
</ul>
<h2>Photo improvements</h2>
<ul>
<li>Crop and rotate</li>
<li>Red-eye removal</li>
<li>One-tap enhance</li>
<li>Organise photos into albums</li>
</ul>
<p>This list was taken from the official release notes, which were accessible via iTunes pre-installation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/blog/2011/10/14/camera-and-photo-improvements-in-ios5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with MongoDB and PHP on Mac OS X</title>
		<link>http://www.glenscott.co.uk/blog/2011/10/06/getting-started-with-mongodb-and-php-on-mac-os-x/</link>
		<comments>http://www.glenscott.co.uk/blog/2011/10/06/getting-started-with-mongodb-and-php-on-mac-os-x/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 21:16:18 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[open source]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/blog/?p=633</guid>
		<description><![CDATA[Introduction MongoDB is a document-orientated database written with scalability and high-performance in mind. It is one of a growing number of NoSQL systems &#8211; a database that does not rely on SQL or relational theory at all. Getting a MongoDB server working with PHP on Mac OS X is relatively straightforward, and this tutorial shows [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/sooey/5745780202/" title="NYã¿ã‚„ã’ã®Mongo goodsè²°ã£ãŸï¼ by junojp, on Flickr"><img src="http://farm3.static.flickr.com/2707/5745780202_154a6256c0.jpg" width="500" height="500" alt="NYã¿ã‚„ã’ã®Mongo goodsè²°ã£ãŸï¼"></a></p>
<h2>Introduction</h2>
<p><a href="http://www.mongodb.org/">MongoDB</a> is a document-orientated database written with scalability and high-performance in mind.  It is one of a growing number of NoSQL systems &#8211; a database that does not rely on SQL or relational theory at all.</p>
<p>Getting a MongoDB server working with PHP on Mac OS X is relatively straightforward, and this tutorial shows you how.</p>
<h2>Installing the MongoDB Server</h2>
<p>The first step requires you to download and install the actual MongoDB system.  The example shown below downloads v2.0.0 64 bit binaries for OS X.  For other binaries, please check out the <a href="http://www.mongodb.org/downloads">MongoDB Downloads</a> page.</p>
<pre class="brush: bash; title: ; notranslate">
cd /tmp
curl -O http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.0.0.tgz
tar zxvf mongodb-osx-x86_64-2.0.0.tgz
sudo mv mongodb-osx-x86_64-2.0.0 /usr/local/mongodb
mkdir /usr/local/mongodb/data
</pre>
<h2>Configuring the MongoDB server</h2>
<p>We need to create a small configuration file so that MongoDB knows where its data files reside.  Create the file <code>/usr/local/mongodb/mongod.conf</code> and add the following line:</p>
<pre class="brush: bash; title: ; notranslate">
dbpath = /usr/local/mongodb/data
</pre>
<h2>Starting MongoDB</h2>
<p>To manually start the MongoDB server, use the following command:</p>
<pre class="brush: bash; title: ; notranslate">
/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/mongod.conf
</pre>
<p>This will start the server and will by default log all output to STDOUT.</p>
<h2>Installing the MongoDB PHP Extension</h2>
<p>Installing the PHP extension is simple:</p>
<pre class="brush: bash; title: ; notranslate">
sudo pecl install mongo
</pre>
<p>Once this has completed, add the following line to your <code>/etc/php.ini</code> file:</p>
<pre class="brush: bash; title: ; notranslate">
extension=mongo.so
</pre>
<p>Restart apache using <code>sudo apachectl restart</code>, and the extension should be available.  This can be verified with the <code>phpinfo</code> call:</p>
<p><img src="/images/mongo-php.png" width="600" height="372" alt="MongoDB extension for PHP" /></p>
<h2>Example PHP script</h2>
<p>To test your setup, the following simple script can be used to create a new collection and add two new records:</p>
<pre class="brush: php; title: ; notranslate">
    &lt;?php

    // connect
    $m = new Mongo();

    // select a database
    $db = $m-&gt;comedy;

    // select a collection (analogous to a relational database's table)
    $collection = $db-&gt;cartoons;

    // add a record
    $obj = array( &quot;title&quot; =&gt; &quot;Calvin and Hobbes&quot;, &quot;author&quot; =&gt; &quot;Bill Watterson&quot; );
    $collection-&gt;insert($obj);

    // add another record, with a different &quot;shape&quot;
    $obj = array( &quot;title&quot; =&gt; &quot;XKCD&quot;, &quot;online&quot; =&gt; true );
    $collection-&gt;insert($obj);

    // find everything in the collection
    $cursor = $collection-&gt;find();

    // iterate through the results
    foreach ($cursor as $obj) {
        echo $obj[&quot;title&quot;] . &quot;\n&quot;;
    }

    ?&gt;
</pre>
<p>The script should output the following:</p>
<pre>
Calvin and Hobbes
XKCD
</pre>
<p>And that&#8217;s it!  You now have a working MongoDB setup on Mac OS X.</p>
<p>For more information on the PHP extension for MongoDB, please see the following pages in the PHP Manual:</p>
<p><a href="http://php.net/manual/en/book.mongo.php">PHP: Mongo &#8211; Manual</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/blog/2011/10/06/getting-started-with-mongodb-and-php-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Steve Jobs, 1955 – 2011</title>
		<link>http://www.glenscott.co.uk/blog/2011/10/06/steve-jobs-1955-2011/</link>
		<comments>http://www.glenscott.co.uk/blog/2011/10/06/steve-jobs-1955-2011/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 10:12:25 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[iphone]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/blog/?p=640</guid>
		<description><![CDATA[For me, it wasn&#8217;t the iPod, iPhone or iPad but the Mac that was Steve Jobs&#8217; greatest success. After buying an indigo iMac in 2000, it reignited my passion for computing and I never looked back. The Mac made computing pleasurable, and for that I will be eternally grateful to Steve&#8217;s vision and passion. A [...]]]></description>
			<content:encoded><![CDATA[<p>For me, it wasn&#8217;t the iPod, iPhone or iPad but the Mac that was Steve Jobs&#8217; greatest success.  After buying an indigo iMac in 2000, it reignited my passion for computing and I never looked back.  The Mac made computing pleasurable, and for that I will be eternally grateful to Steve&#8217;s vision and passion.  A truly inspiring man.</p>
<p>Thanks, Steve.</p>
<p><img src="/images/steve-jobs-m.png" width="600" alt="Steve Jobs on Apple homepage" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/blog/2011/10/06/steve-jobs-1955-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 0.377 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-02-10 18:24:43 -->

