<?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>david winter &#187; osx</title>
	<atom:link href="http://davidwinter.me.uk/articles/tag/osx/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidwinter.me.uk</link>
	<description>you were expecting someone else?</description>
	<lastBuildDate>Mon, 28 Jun 2010 20:37:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Using o2 PAYG mobile broadband</title>
		<link>http://davidwinter.me.uk/articles/2010/06/19/using-o2-payg-mobile-broadband/</link>
		<comments>http://davidwinter.me.uk/articles/2010/06/19/using-o2-payg-mobile-broadband/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 21:34:42 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[o2]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=195</guid>
		<description><![CDATA[Our internet connection via our landline has been dead since Tuesday afternoon, so I&#8217;ve needed an alternative connection in the meantime to give me my twitter fix! I&#8217;d kept an eye on the o2 pay-as-you-go mobile broadband for a while, because it offered the cheapest, noncommittal setup. A one off £20 for the USB dongle, [...]]]></description>
			<content:encoded><![CDATA[<p>Our internet connection via our landline has been dead since Tuesday afternoon, so I&#8217;ve needed an alternative connection in the meantime to give me my twitter fix! </p>

<p>I&#8217;d kept an eye on the o2 pay-as-you-go mobile broadband for a while, because it offered the cheapest, noncommittal setup. A one off £20 for the USB dongle, and then as little as £2 for 500MB for a 24 hour period. </p>

<p>So I plug in the dongle and we get a nice little installer to set everything up; installing drivers and the o2 Mobile Connect application. The annoying thing is that if you install going this route, you can only connect if you have this app open. You can&#8217;t just use system preferences. Also, turns out this &#8216;handy&#8217; installer program then blocks you from getting to the installation files again, and the dongle will refuse to do anything unless Mobile Connect is open (you&#8217;ll get a red light on the dongle when it&#8217;s being evil).</p>

<p>So, what can you do?</p>

<p><span id="more-195"></span></p>

<ol>
<li>Drag <code>Mobile Connect.app</code> to the trash from your Applications directory. </li>
<li>Then head into System > Library > Extensions and delete <code>ZTEUSBCDCACMData.kext</code> and <code>ZTEUSBMassStorageFilter.kext</code></li>
<li>Go into Network in System Preferences and remove the devices starting with ZTEUSB.</li>
<li>Then restart your Mac.</li>
</ol>

<p>Now, let&#8217;s install things a different route giving everyone more flexibility.</p>

<ol>
<li>Plug in the dongle and when the CD Icon appears on the desktop, open it up, but rather than double clicking on the installer, right click on it and select &#8216;Show Package Contents&#8217;. </li>
<li>Now head to Contents then Resources. Now double click on the <code>drv.pkg</code> file and install this only. </li>
<li>Once complete, restart your Mac again. </li>
</ol>

<p>And now to configure the connection:</p>

<ol>
<li>Open System Preferences, and go to the Network pane. </li>
<li>You should have three new items in there. Click on ZTEUSBModem. </li>
<li>Set the telephone number to <code>*99#</code></li>
<li>Username to <code>o2bb</code></li>
<li>Password to <code>password</code> </li>
<li>Click on Advanced. Select Vendor; Generic, Model; GPRS (GSM/3G) and set the APN to <code>m-bb.o2.co.uk</code> </li>
<li>Click on OK and then Apply. </li>
<li>Now you can click &#8216;Connect&#8217; and all should work fine. </li>
</ol>

<p>That is of course, besides the crappy image compression and caching o2 force onto you! Need to find a solution for that next.</p>

<p><strong>Update</strong>: Here&#8217;s a solution for getting around the image compression, and Javascript injection; use a SSH SOCKS proxy. Works a treat.</p>

<ol>
<li>Open up <code>Terminal.app</code></li>
<li>Run <code>ssh -ND 9999 username@yourserver.com</code></li>
<li>Enter your password if/when prompted (you may have key authentication setup)</li>
<li>That&#8217;s the SOCKS proxy setup. Now go to System Preferences and open the network connection.</li>
<li>Click on ZTEUSBModem.</li>
<li>Then Advanced, Proxies</li>
<li>Check the SOCKS Proxy and enter in <code>localhost</code> and <code>9999</code></li>
<li>Click OK and then Apply.</li>
</ol>

<p>All done. You should now get perfect images and no longer have Javascript inserted into all webpages. Both of which weren&#8217;t clearly mentioned when purchasing my dongle.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2010/06/19/using-o2-payg-mobile-broadband/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache, PHP and MongoDB on Mac OS X 10.6 Snow Leopard</title>
		<link>http://davidwinter.me.uk/articles/2010/01/02/apache-php-and-mongodb-on-mac-os-x-10-6-snow-leopard/</link>
		<comments>http://davidwinter.me.uk/articles/2010/01/02/apache-php-and-mongodb-on-mac-os-x-10-6-snow-leopard/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 13:12:13 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=152</guid>
		<description><![CDATA[MongoDB (from &#8220;humongous&#8221;) is a scalable, high-performance, open source, schema-free, document-oriented database. There&#8217;s a lot of buzz brewing about it, so I wanted to give it a try with PHP on my development Mac. The following is how I went about installing Apache, PHP and MongoDB on Snow Leopard. You must have installed the Xcode [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mongodb.org/display/DOCS/Home">MongoDB</a> (from &#8220;humongous&#8221;) is a scalable, high-performance, open source, schema-free, document-oriented database.</p>

<p>There&#8217;s a lot of <a href="http://delicious.com/search?p=mongodb&amp;chk=&amp;context=popular|&amp;fr=del_icio_us&amp;lc=">buzz</a> brewing about it, so I wanted to give it a try with PHP on my development Mac. The following is how I went about installing Apache, PHP and MongoDB on Snow Leopard. You must have installed the <a href="[http://developer.apple.com/tools/xcode/">Xcode</a> developer tools (found on the Snow Leopard install DVD) and <a href="[http://www.macports.org/">MacPorts</a> for this to all work.</p>

<p><span id="more-152"></span></p>

<p>First, let&#8217;s install Apache:</p>

<pre><code>sudo port install apache2
</code></pre>

<p>Nice and simple. Now we can move onto PHP:</p>

<pre><code>sudo port install php5 +apache2 +pear
</code></pre>

<p>To enable PHP for Apache:</p>

<pre><code>cd /opt/local/apache2/modules
sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
</code></pre>

<p>I like to make some alias commands for starting, restarting and stopping Apache:</p>

<pre><code>mate ~/.bashrc

alias apache-start="sudo /opt/local/apache2/bin/apachectl start"
alias apache-restart="sudo /opt/local/apache2/bin/apachectl restart"
alias apache-stop="sudo /opt/local/apache2/bin/apachectl stop"

source ~/.bashrc
</code></pre>

<p>Now we can make a few changes to the Apache config so that we can use our Sites directory:</p>

<pre><code>sudo mate /opt/local/apache2/conf/httpd.conf
</code></pre>

<p>I&#8217;m using Textmate here (<code>mate</code>), but you can use any editor you wish, like <code>nano</code>.</p>

<p>Change the <code>DocumentRoot</code>:</p>

<pre><code>DocumentRoot "/Users/davidwinter/Sites"
</code></pre>

<p>Then update the <code>&lt;Directory&gt;</code> path to the updated <code>DocumentRoot</code> path.  </p>

<pre><code>&lt;Directory "/Users/davidwinter/Sites"&gt;
</code></pre>

<p>We also want to enable <code>index.php</code> as a directory index file:</p>

<pre><code>&lt;IfModule dir_module&gt;
    DirectoryIndex index.html index.php
&lt;/IfModule&gt;
</code></pre>

<p>And then add the PHP mime type:</p>

<pre><code>&lt;IfModule mime_module&gt;
    ...
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
&lt;/IfModule&gt;
</code></pre>

<p>Now we need to setup the <code>php.ini</code> file:</p>

<pre><code>sudo cp /opt/local/etc/php5/php.ini-development /opt/local/etc/php5/php.ini

sudo mate /opt/local/etc/php5/php.ini
</code></pre>

<p>My <a href="[http://php.net/manual/en/timezones.php">timezone</a> is for London:</p>

<pre><code>date.timezone = Europe/London
</code></pre>

<p>Now we can get onto installing MongoDB (this will install the latest stable version as of time of writing &#8211; 1.2.1): </p>

<pre><code>sudo port install mongodb
</code></pre>

<p>And then the PHP MongoDB extension:</p>

<pre><code>sudo pecl install mongo
</code></pre>

<p>You&#8217;ll need to add the extension to the bottom of your <code>php.ini</code> file:</p>

<pre><code>sudo mate /opt/local/etc/php5/php.ini

extension=mongo.so
</code></pre>

<p>Now startup Apache using the <code>alias</code> created earlier:</p>

<pre><code>apache-start
</code></pre>

<p>If you create a file in your Sites directory, called <code>test.php</code>, and add the following to it:</p>

<pre><code>&lt;?php phpinfo(); ?&gt;
</code></pre>

<p>Then visit the page in your browser; <a href="http://localhost/test.php">http://localhost/test.php</a></p>

<p>You can then scroll down the page and you should see a section titled &#8216;mongo&#8217;. This means the extension is working!</p>

<p>Now we need to startup MongoDB:</p>

<pre><code>mkdir -p ~/data/db
mongod --dbpath ~/data/db/
</code></pre>

<p>Almost there, now a simple MongoDB test in PHP:</p>

<pre><code>&lt;?php
// Connect:
$connection = new Mongo();
// Select database:
$db = $connection-&gt;my_db;
// Select collection:
$films = $db-&gt;films;

$frwl = array(
    'title' =&gt; 'From Russia With Love',
    'year' =&gt; 1963,
    'actor' =&gt; 'Sean Connery'
);
// Save array to collection:
$films-&gt;insert($frwl);

$gf = array(
    'title' =&gt; 'Goldfinger',
    'year' =&gt; 1964,
    'actor' =&gt; 'Sean Connery',
    'girl' =&gt; 'Pussy Galore'
);

$films-&gt;insert($gf);

// Count documents in collection:
if ($films-&gt;count()): ?&gt;
&lt;table&gt;
    &lt;tr&gt;
        &lt;th&gt;Title&lt;/th&gt;
        &lt;th&gt;Year&lt;/th&gt;
        &lt;th&gt;Actor&lt;/th&gt;
        &lt;th&gt;Girl&lt;/th&gt;
    &lt;/tr&gt;
    &lt;?php foreach ($films-&gt;find() as $film): ?&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;?php echo $film['title']; ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo $film['year']; ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo $film['actor']; ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo $film['girl']; ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;?php endforeach; ?&gt;
&lt;/table&gt;
&lt;?php endif;
?&gt;
</code></pre>

<p>Very exciting stuff. More to follow.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2010/01/02/apache-php-and-mongodb-on-mac-os-x-10-6-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Applescript to shutdown in 15 seconds</title>
		<link>http://davidwinter.me.uk/articles/2009/05/28/applescript-to-shutdown-in-15-seconds/</link>
		<comments>http://davidwinter.me.uk/articles/2009/05/28/applescript-to-shutdown-in-15-seconds/#comments</comments>
		<pubDate>Thu, 28 May 2009 19:25:33 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2009/05/28/applescript-to-shutdown-in-15-seconds/</guid>
		<description><![CDATA[set userCancelled to false try set answer to display dialog "Backup complete. Shutting down in 15 seconds." giving up after 15 on error number -128 set userCancelled to true end try if userCancelled then else if gave up of answer then tell application "Finder" shut down end tell end if]]></description>
			<content:encoded><![CDATA[<pre><code>set userCancelled to false

try
    set answer to display dialog "Backup complete. Shutting down in 15 seconds." giving up after 15
on error number -128
    set userCancelled to true
end try

if userCancelled then

else if gave up of answer then
    tell application "Finder"
        shut down
    end tell
end if
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2009/05/28/applescript-to-shutdown-in-15-seconds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install pecl_http for PHP</title>
		<link>http://davidwinter.me.uk/articles/2008/11/24/install-pecl_http-for-php/</link>
		<comments>http://davidwinter.me.uk/articles/2008/11/24/install-pecl_http-for-php/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 21:33:41 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[pecl_http]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=117</guid>
		<description><![CDATA[You will probably want to ensure that curl supports https before getting underway: curl -V Check that the output contains https: &#62;: curl -V curl 7.19.2 (i386-apple-darwin9.5.0) libcurl/7.19.2 OpenSSL/0.9.8i zlib/1.2.3 Protocols: tftp ftp telnet dict http file https ftps Features: Largefile NTLM SSL libz If it doesn&#8217;t: sudo port deactivate curl sudo port install curl [...]]]></description>
			<content:encoded><![CDATA[<p>You will probably want to ensure that <code>curl</code> supports <code>https</code> before getting underway:</p>

<pre><code>curl -V
</code></pre>

<p>Check that the output contains <code>https</code>:</p>

<pre><code>&gt;: curl -V
curl 7.19.2 (i386-apple-darwin9.5.0) libcurl/7.19.2 OpenSSL/0.9.8i zlib/1.2.3
Protocols: tftp ftp telnet dict http file https ftps 
Features: Largefile NTLM SSL libz
</code></pre>

<p>If it doesn&#8217;t:</p>

<pre><code>sudo port deactivate curl
sudo port install curl +ssl
</code></pre>

<p>Once you have <code>curl</code> with <code>https</code> support:</p>

<pre><code>sudo pecl install pecl_http
</code></pre>

<p>If you followed my previous <a href="/articles/2008/11/22/php5-lighttpd-and-imagick-on-mac-os-x-leopard/">howto</a>, you&#8217;ll want to move the module to the location specified in your <code>php.ini</code> file:</p>

<pre><code>sudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20060613/http.so /opt/local/lib/php/extensions
</code></pre>

<p>Restart <code>lighttpd</code> and then you&#8217;ll be good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2008/11/24/install-pecl_http-for-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>syslogd slowing my mac to a crawl</title>
		<link>http://davidwinter.me.uk/articles/2008/09/04/syslogd-slowing-my-mac-to-a-crawl/</link>
		<comments>http://davidwinter.me.uk/articles/2008/09/04/syslogd-slowing-my-mac-to-a-crawl/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 21:46:42 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=98</guid>
		<description><![CDATA[For the last few days, I&#8217;ve noticed my Mac getting slower, and slower, and slower. To the point where my mouse was jerking about all over the place, and where I was considering smashing my head against the wall next to me. Opening up Activity Monitor showed that the syslogd and mount_hfs processes were hogging [...]]]></description>
			<content:encoded><![CDATA[<p>For the last few days, I&#8217;ve noticed my Mac getting slower, and slower, and slower. To the point where my mouse was jerking about all over the place, and where I was considering smashing my head against the wall next to me.</p>

<p>Opening up Activity Monitor showed that the <code>syslogd</code> and <code>mount_hfs</code> processes were hogging up both of my CPU cores. One each. The greedy bastards.</p>

<p>A little googling, and I found that deleting the file /var/log/asl.db seems to solve the problem. So far, my Mac seems to be speeding along quite merily now, but I&#8217;ll give it a few days before confirming mission accomplished.</p>

<ol>
<li>Restart your Mac.</li>
<li>When at the login screen, enter your password, then hold down shift and login. This will prevent your startup items from launching.</li>
<li><p>Open Terminal.app and enter the following (at your own risk!!):</p>

<pre><code>sudo launchctl stop com.apple.syslogd
sudo rm /var/log/asl.db
sudo launchctl start com.apple.syslogd
</code></pre></li>
<li><p>Logout, and then log back in again.</p></li>
</ol>

<p><strong>Update:</strong> That didn&#8217;t last long :( It had been zipping along so much faster, but it just started happening again. I&#8217;m trying to restart now, but I&#8217;ve just got the spinner on screen, and fear that I&#8217;m now going to have to force power off. I hope my <a href="http://www.drobo.com/">Drobo</a> turns up asap so I can have a decent backup of my stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2008/09/04/syslogd-slowing-my-mac-to-a-crawl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extracted Enhanced Podcast Files</title>
		<link>http://davidwinter.me.uk/articles/2008/08/16/extracted-enhanced-podcast-files/</link>
		<comments>http://davidwinter.me.uk/articles/2008/08/16/extracted-enhanced-podcast-files/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 16:37:37 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[podcasts]]></category>
		<category><![CDATA[quicktime]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=97</guid>
		<description><![CDATA[I finally found a way to extract the XML files from enhanced podcasts that handle chapters and links. Open up the podcast file in Quicktime.app Window > Show Movie Properties Select the first &#8216;Text Track&#8217; and ensure it is enabled. File > Export Select the &#8216;Text to QuickTime TeXML&#8217; format You should then have a [...]]]></description>
			<content:encoded><![CDATA[<p>I finally found a way to extract the XML files from enhanced podcasts that handle chapters and links.</p>

<ol>
<li>Open up the podcast file in Quicktime.app</li>
<li>Window > Show Movie Properties</li>
<li>Select the first &#8216;Text Track&#8217; and ensure it is enabled. </li>
<li>File > Export</li>
<li>Select the &#8216;Text to QuickTime TeXML&#8217; format</li>
</ol>

<p>You should then have a lovely XML file. Just need to figure a way to parse the files to get the simple stuff out. Like when to display a link/when a chapter starts, and grab the link/chapter name.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2008/08/16/extracted-enhanced-podcast-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X/HFS+ case-insensitive? Why?</title>
		<link>http://davidwinter.me.uk/articles/2008/05/17/mac-os-xhfs-case-insensitive-why/</link>
		<comments>http://davidwinter.me.uk/articles/2008/05/17/mac-os-xhfs-case-insensitive-why/#comments</comments>
		<pubDate>Sat, 17 May 2008 16:04:03 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=94</guid>
		<description><![CDATA[I just found out that HFS+, the preferred file system for Mac OS X, is case-insensitive when it comes to files and directories. I don&#8217;t understand why? It&#8217;s sure as hell causing issues with stuff I&#8217;m copying from my Ubuntu PC. Just seems like a dumb idea.]]></description>
			<content:encoded><![CDATA[<p>I just found out that HFS+, the preferred file system for Mac OS X, is case-insensitive when it comes to files and directories. I don&#8217;t understand why? It&#8217;s sure as hell causing issues with stuff I&#8217;m copying from my Ubuntu PC.</p>

<p>Just seems like a dumb idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2008/05/17/mac-os-xhfs-case-insensitive-why/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
