<?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>Will's Web Miscellany</title>
	<atom:link href="http://willj.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://willj.net</link>
	<description>will.thoughts.pop</description>
	<lastBuildDate>Wed, 11 Aug 2010 09:50:24 +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>Basic zeroMQ Ruby example</title>
		<link>http://willj.net/2010/08/01/basic-zero-mq-ruby-example/</link>
		<comments>http://willj.net/2010/08/01/basic-zero-mq-ruby-example/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 23:58:16 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[zeroMQ]]></category>

		<guid isPermaLink="false">http://willj.net/?p=738</guid>
		<description><![CDATA[Update: As Jake pointed out in the comments you obviously need zero MQ installed for this example to work. Just &#8216;brew install zeromq&#8217; or &#8216;port install zmq&#8217; on OS X, or use your Linux package manager. I couldn&#8217;t find may examples of zeroMQ usage in Ruby so here is a basic sender/consumer I made to [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: As Jake pointed out in the comments you obviously need zero MQ installed for this example to work. Just &#8216;brew install zeromq&#8217; or &#8216;port install zmq&#8217; on OS X, or use your Linux package manager.</p>
<p>I couldn&#8217;t find may examples of zeroMQ usage in Ruby so here is a basic sender/consumer I made to test it. First install the &#8216;zmq&#8217; gem:</p>
<p><code>gem install zmq --no-ri --no-rdoc</code></p>
<p>Now start a worker, you can start as many as you want:</p>
<p><script src="http://gist.github.com/502689.js?file=recv.rb"></script></p>
<p>Now stick some messages on the queue:</p>
<p><script src="http://gist.github.com/502689.js?file=send.rb"></script></p>
<p>You should get messages distributed to all the worker processes you started up. Pretty simple!</p>
]]></content:encoded>
			<wfw:commentRss>http://willj.net/2010/08/01/basic-zero-mq-ruby-example/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>map-reduce using mongoid</title>
		<link>http://willj.net/2010/07/12/map-reduce-using-mongoid/</link>
		<comments>http://willj.net/2010/07/12/map-reduce-using-mongoid/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 23:31:19 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[mongoid]]></category>

		<guid isPermaLink="false">http://willj.net/?p=735</guid>
		<description><![CDATA[It took me a while to work out how to use map-reduce in Ruby using mongoid so I thought I&#8217;d share it here in-case it helps anyone else get there quicker. I start out with a model that includes Mongoid::Document: To map-reduce across the collection I need to define a map and reduce function in [...]]]></description>
			<content:encoded><![CDATA[<p>It took me a while to work out how to use map-reduce in Ruby using mongoid so I thought I&#8217;d share it here in-case it helps anyone else get there quicker. I start out with a model that includes Mongoid::Document:</p>
<p><script src="http://gist.github.com/471933.js?file=gistfile1.rb"></script></p>
<p>To map-reduce across the collection I need to define a map and reduce function in javascript then run the on the collection:</p>
<p><script src="http://gist.github.com/471936.js?file=gistfile1.rb"></script></p>
<p>I can roll this into my VisitorSession model:</p>
<p><script src="http://gist.github.com/471938.js?file=gistfile1.rb"></script></p>
<p>This obviously makes it easier to call:</p>
<p><code>>> VisitorSession.first(:conditions => {:project_id => '2f5178'}).visits_for_project<br />
=> 1</code></p>
]]></content:encoded>
			<wfw:commentRss>http://willj.net/2010/07/12/map-reduce-using-mongoid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing the warden and rails3 TypeError (can&#8217;t convert nil into String) error</title>
		<link>http://willj.net/2010/07/11/fixing-the-warden-and-rails3-typeerror-cant-convert-nil-into-string-error/</link>
		<comments>http://willj.net/2010/07/11/fixing-the-warden-and-rails3-typeerror-cant-convert-nil-into-string-error/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 00:58:52 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[warden]]></category>

		<guid isPermaLink="false">http://willj.net/?p=729</guid>
		<description><![CDATA[I&#8217;ve upgraded an app I run that uses warden to Rails3. I started getting &#8220;TypeError (can&#8217;t convert nil into String)&#8221; exceptions after the upgrade: I tracked it down to the action name not getting set, so I added this in my Warden::Manager.before_failure block: env['action_dispatch.request.path_parameters'][:action] = "login" The complete block now: There may be a better [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve upgraded an app I run that uses <a title="warden" href="http://github.com/hassox/warden">warden</a> to Rails3. I started getting &#8220;TypeError (can&#8217;t convert nil into String)&#8221; exceptions after the upgrade:</p>
<p><script src="http://gist.github.com/471166.js?file=gistfile1.txt"></script></p>
<p>I tracked it down to the action name not getting set, so I added this in my Warden::Manager.before_failure block:</p>
<p><code>env['action_dispatch.request.path_parameters'][:action] = "login"</code></p>
<p>The complete block now:</p>
<p><script src="http://gist.github.com/471168.js?file=gistfile1.rb"></script></p>
<p>There may be a better way of doing this, but it works for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://willj.net/2010/07/11/fixing-the-warden-and-rails3-typeerror-cant-convert-nil-into-string-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fixing the rspec2 and rails3 &#8220;there is already a transaction in progress&#8221; error</title>
		<link>http://willj.net/2010/07/08/fixing-the-rspec2-and-rails3-there-is-already-a-transaction-in-progress-error/</link>
		<comments>http://willj.net/2010/07/08/fixing-the-rspec2-and-rails3-there-is-already-a-transaction-in-progress-error/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 21:15:52 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[rspec-rails]]></category>

		<guid isPermaLink="false">http://willj.net/?p=719</guid>
		<description><![CDATA[I upgraded an app to rspec2 and rails3 recently and ran into a problem. I run each test in a transaction which rolls back after each test has finished. This works fine normally, but It seemed that after the upgrade the first failing test would cause this per-test transaction to not get rolled back so [...]]]></description>
			<content:encoded><![CDATA[<p>I upgraded an app to rspec2 and rails3 recently and ran into a problem. I run each test in a transaction which rolls back after each test has finished. This works fine normally, but It seemed that after the upgrade the first failing test would cause this per-test transaction to not get rolled back so all the subsequent tests would run in the same transaction.</p>
<p>This caused the tests so fail with validation errors as test data was getting re-inserted, and a validates_uniqueness_of validation was complaining each time, note the second failing test, this test should have passed but failed with a &#8220;Validation failed: Name has already been taken&#8221; error:</p>
<p><script src="http://gist.github.com/468605.js?file=gistfile1.txt"></script></p>
<p>It turns out that what was actually happening was that an exception raised in the after(:each) block was causing the rollback to fail and the failing test was just masking the error. This was my after(:each) block:</p>
<p><script src="http://gist.github.com/468617.js?file=gistfile1.rb"></script></p>
<p>This code fails when there is no directory to remove and though this worked fine in the older version of rspec (rspec just ignored the error) with rspec2 it caused the issues discussed above. The solution (because I don&#8217;t care if the file exists or not before I delete it) is as simple as adding a condition:</p>
<p><script src="http://gist.github.com/468634.js?file=gistfile1.rb"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://willj.net/2010/07/08/fixing-the-rspec2-and-rails3-there-is-already-a-transaction-in-progress-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NWRUG June 17th &#8211; Mongo</title>
		<link>http://willj.net/2010/06/16/nwrug-june-17th-mongo/</link>
		<comments>http://willj.net/2010/06/16/nwrug-june-17th-mongo/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 08:49:16 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[NWRUG]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://willj.net/?p=708</guid>
		<description><![CDATA[I forgot to blog about this earlier, but Adam Holt will be talking about all things mongo on Thursday the 17th June (that&#8217;s tomorrow at the time of posting). There will be free pizza afterwards, you just need to sign up (soon) if you&#8217;re coming.]]></description>
			<content:encoded><![CDATA[<p>I forgot to blog about this earlier, but Adam Holt will be talking about all things mongo on Thursday the 17th June (that&#8217;s tomorrow at the time of posting). There will be free pizza afterwards, you just need to <a href="http://nwrug.org/events/june10/">sign up (soon) if you&#8217;re coming</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://willj.net/2010/06/16/nwrug-june-17th-mongo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Buying an r4 card from r4i.co.uk, or Using your Terms and Conditions to redefine assumptions</title>
		<link>http://willj.net/2010/06/02/buying-an-r4-card-from-r4i-co-uk-or-using-your-terms-and-conditions-to-redefine-assumptions/</link>
		<comments>http://willj.net/2010/06/02/buying-an-r4-card-from-r4i-co-uk-or-using-your-terms-and-conditions-to-redefine-assumptions/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 18:05:08 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Customer service]]></category>

		<guid isPermaLink="false">http://willj.net/?p=691</guid>
		<description><![CDATA[It&#8217;s not often I receive such poor customer service from somewhere that I feel the need to write about it, but I just did from r4i.co.uk. The Background My daughter will be travelling early on Saturday morning (before the post arrives) so I wanted to get her an R4 card for her DS to make [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not often I receive such poor customer service from somewhere that I feel the need to write about it, but I just did from r4i.co.uk.</p>
<h2>The Background</h2>
<p>My daughter will be travelling early on Saturday morning (before the post arrives) so I wanted to get her an R4 card for her DS to make her long journey a bit easier. I decided to do this on Monday 31st May, a bank holiday in the UK.</p>
<h2>The Order</h2>
<p>I decided to order one from r4i.co.uk. They had good prices, and their website promised same-day dispatch and 2-4 day delivery. I ordered after midday (I&#8217;m not sure of the exact time) but I got my payment and order confirmation email at 13:48, the order should arrive on Thursday at the latest.</p>
<h2>Taking a step back</h2>
<p>Before I continue let&#8217;s look at the relatively simple term &#8220;same-day dispatch&#8221;. It would be all-too easy to make a rash assumption about what exactly that means, but ask yourself what it means to you. Ask yourself when you would expect a company to dispatch something you ordered at 1:48PM on Monday if they advertised &#8220;same-day dispatch&#8221;.</p>
<p>For my part I assumed my order would be dispatched on the same Monday I ordered it. I realise that Monday 31st May is a public holiday, but I would guess that large e-commerce outfits continue to dispatch 7 days a week, certainly if they advertise same-day dispatch. Even so, if it was dispatched on Tuesday it should still arrive on Friday, so I wasn&#8217;t worried.</p>
<h2>The Order, part 2</h2>
<p>I replied to the order confirmation email almost as soon as I got it asking simply:</p>
<p style="padding-left: 30px;">&#8220;I just wanted to confirm that this order will be delivered before Friday.&#8221;</p>
<p>The next day (Tuesday 1st June) I received the reply:</p>
<p style="padding-left: 30px;">&#8220;Delivery is two to five working days&#8221;</p>
<p>That&#8217;s not what the website said, so I emailed back immediately:</p>
<p style="padding-left: 30px;">&#8220;On the checkout page (and confirmation email) it says &#8220;FREE 2-4 DAYS UK SHIPPING&#8221;, not 2-5. Your site also says &#8220;Same day dispatch&#8221;, so it should be here no later than Thursday, possibly earlier?&#8221;</p>
<p>I didn&#8217;t receive a response, not a good sign. Today (Wednesday 2nd June) I received an email saying that my order had been dispatched. Uh-oh, it was meant to be dispatched on Monday. This email suggests it was dispatched two days late. I called r4i.co.uk to clear this up.</p>
<h2>Customer Service &#8211; Calling r4i.co.uk to sort it out</h2>
<p>It took about 10 minute to get through to r4i.co.uk and when I did, and explained my situation. I was told that:</p>
<ul>
<li>Same-day dispatch only applies on &#8220;working days&#8221; which I assume to be Monday to Friday</li>
<li>Same-day means &#8220;within 24 hours&#8221;</li>
</ul>
<p>This blew away all the assumptions I had made about the meaning of &#8220;Same-day dispatch&#8221;. I asked some friends what they thought to get more opinions on &#8220;Same-day&#8221; in case I was making an odd assumption:</p>
<p style="padding-left: 30px;">Me: &#8220;Same Day Dispatch&#8221;, what does this mean to you?<br />
Friend 1: They get it on the road today.<br />
Me: just to clarify, same-day being same named day, or within 24 hours?<br />
Friend 1: Same named day, but depending on their closing hours, I&#8217;d expect it to be processed first thing the next day if I ordered <span style="text-decoration: underline;"><em>late</em></span> at night.</p>
<p>Another friend:</p>
<p style="padding-left: 30px;">Me: &#8220;Same Day Dispatch&#8221;, what does this mean to you?<br />
Friend 2: Same day dispatch means something is sent out the same day, so if it&#8217;s something I request I assume it&#8217;s shipped the same day I request it.<br />
Me: Same-day being same named day, or within 24 hours?<br />
Friend 2:  Same named day.</p>
<p>Notice that both of these friends made the same assumption that I was talking about the same thing when I said &#8220;Same day&#8221;. Think back to your assumption about what &#8220;Same-day dispatch&#8221; means. Does it align with those assumptions? I&#8217;m guessing not.</p>
<p>OK, back to the call. According to the person on the phone if I&#8217;d read the terms and conditions I would have discovered this for myself. I didn&#8217;t read the terms and conditions though, so it&#8217;s my fault right? But really, who reads them? Some people do. Not most people though. Not for a £12 memory card. Not when your assumptions about what &#8220;Same-day&#8221; means are solid enough to not cast doubt. The two people I spoke to apologised but refused to do anything to help me. The second of those people gave me a lecture on how I should read the terms and conditions like I should if I was buying a house or a car.</p>
<p><img class="size-full wp-image-702 alignright" title="Same-day dispatch" src="http://willj.net/wp-content/uploads/2010/06/same-day.png" alt="" width="128" height="398" /></p>
<h2>The problem</h2>
<p>r4i.co.uk promised something and then re-defined that promise in their terms and conditions. They overrode assumptions with a lengthy legal document that few people are likely to read. It must be great to be able to boast about same-day dispatch on your website (see the screen-grab from their site on the right), but if your definition of what same-day dispatch is is different to what most other peoples definition is then isn&#8217;t that verging on lying?</p>
<p>Add to this the &#8220;Sorry but we&#8217;re not going to help&#8221; attitude of the people I spoke to on the phone and I&#8217;m not a happy customer.</p>
<h2>The Solution</h2>
<p>This seems fairly simple. Don&#8217;t mislead to your customers because it makes you sound good. If your customers assumed definition of &#8220;Same-day dispatch&#8221; is different than your definition of &#8220;Same-day dispatch&#8221; then don&#8217;t claim to do it, wether you can put forward your definition in your terms and conditions or not. A relevant phrase that I heard from a marketing guy I knew once is &#8220;<a title="Managing user expectations" href="http://en.wikipedia.org/wiki/User_expectations">Managing User Expectations</a>&#8220;.</p>
<p>The technical solution for r4i.co.uk is to only display the same day dispatch banner at times when it&#8217;s relevant. This is stupidly easy to do, it&#8217;s what dynamic websites like e-commerce sites are good for. The customer services solution is not to argue that it&#8217;s my fault and that I should have read the terms and conditions to discover that they re-defined a seemingly common assumption, it&#8217;s to fix it. To send a new unit out via some quicker delivery method that will arrive on time. Unless they don&#8217;t like having customers, in which case they handled the call just fine.</p>
<h2>Takeaway</h2>
<p>Your customers, users and clients all come to you with assumptions and expectations, you need to be careful about trampling on these. If you have to break out the phrase &#8220;you should have read the terms and conditions&#8221; then the chances are you have failed to do this and you have reached the point where you have an unhappy customer.</p>
]]></content:encoded>
			<wfw:commentRss>http://willj.net/2010/06/02/buying-an-r4-card-from-r4i-co-uk-or-using-your-terms-and-conditions-to-redefine-assumptions/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Upgrading PHP 5.1 to 5.2 on CentOS 5.4 for SugarCRM</title>
		<link>http://willj.net/2010/05/05/upgrading-php-5-1-to-5-2-on-centos-5-4-for-sugarcrm/</link>
		<comments>http://willj.net/2010/05/05/upgrading-php-5-1-to-5-2-on-centos-5-4-for-sugarcrm/#comments</comments>
		<pubDate>Wed, 05 May 2010 09:17:26 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sugarcrm]]></category>

		<guid isPermaLink="false">http://willj.net/?p=689</guid>
		<description><![CDATA[If you have the misfortune to need to install SugarCRM on Centos 5.4 you will need PHP 5.2 minimum, unfortunately the current version of CentOS (5.4) only comes with PHP 5.1. Follow these instructions to upgrade to PHP 5.2, they worked fine for me, I just wish I&#8217;d found them earlier.]]></description>
			<content:encoded><![CDATA[<p>If you have the misfortune to need to install SugarCRM on Centos 5.4 you will need PHP 5.2 minimum, unfortunately the current version of CentOS (5.4) only comes with PHP 5.1. Follow <a href="http://wiki.centos.org/HowTos/PHP_5.1_To_5.2">these instructions</a> to upgrade to PHP 5.2, they worked fine for me, I just wish I&#8217;d found them earlier.</p>
]]></content:encoded>
			<wfw:commentRss>http://willj.net/2010/05/05/upgrading-php-5-1-to-5-2-on-centos-5-4-for-sugarcrm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recycling Group Finder iPhone app &#8211; updates</title>
		<link>http://willj.net/2010/04/28/recycling-group-finder-iphone-app-updates/</link>
		<comments>http://willj.net/2010/04/28/recycling-group-finder-iphone-app-updates/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 09:51:59 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[finder]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Freecycle]]></category>
		<category><![CDATA[Freegle]]></category>

		<guid isPermaLink="false">http://willj.net/?p=686</guid>
		<description><![CDATA[I&#8217;ve pushed a new release of the Recycling Group Finder iPhone app that updates the group database, there should be a lot more Freegle groups available now. Get it from the app store.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve pushed a new release of the <a title="Recycling Group Finder iPhone app" href="http://supershinyrobot.com/iphone/finder">Recycling Group Finder iPhone app</a> that updates the group database, there should be a lot more Freegle groups available now. Get it from <a title="Recycling Group Finder iphone app on the app store" href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=352279226&amp;mt=8">the app store</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://willj.net/2010/04/28/recycling-group-finder-iphone-app-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Freecycle and Freegle group finder for the iPhone</title>
		<link>http://willj.net/2010/02/02/freecycle-freegle-group-finder-for-the-iphone/</link>
		<comments>http://willj.net/2010/02/02/freecycle-freegle-group-finder-for-the-iphone/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 20:40:56 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[finder]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[overcycle]]></category>
		<category><![CDATA[Freecycle]]></category>
		<category><![CDATA[Freegle]]></category>

		<guid isPermaLink="false">http://willj.net/?p=680</guid>
		<description><![CDATA[I&#8217;ve launched my first iPhone app, the Recycling Group Finder for iPhone. It complements the Recycling Group Finder web app making it even easier to find your closest Freecycle or Freegle group by using the iPhone&#8217;s in-built GPS. Check out the information page and give it a go, it&#8217;s free.]]></description>
			<content:encoded><![CDATA[<div id="attachment_679" class="wp-caption alignnone" style="width: 408px"><a href="http://willj.net/wp-content/uploads/2010/02/large.png"><img class="size-full wp-image-679 " title="Recycling Group Finder app for the iPhone" src="http://willj.net/wp-content/uploads/2010/02/large.png" alt="" width="398" height="298" /></a><p class="wp-caption-text">Recycling Group Finder app for the iPhone</p></div>
<p>I&#8217;ve launched my first iPhone app, the <a title="Find Freecycle and Freegle groups on your iPhone" href="http://supershinyrobot.com/iphone/finder">Recycling Group Finder for iPhone</a>. It complements the <a title="Find Freecycle and Freegle groups close to you" href="http://recyclinggroupfinder.com/">Recycling Group Finder</a> web app making it even easier to find your closest Freecycle or Freegle group by using the iPhone&#8217;s in-built GPS. <a title="Recycling Group Finder for iPhone" href="http://supershinyrobot.com/iphone/finder">Check out the information page</a> and give it a go, it&#8217;s free.</p>
]]></content:encoded>
			<wfw:commentRss>http://willj.net/2010/02/02/freecycle-freegle-group-finder-for-the-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating a plist file in rails</title>
		<link>http://willj.net/2010/01/25/generating-a-plist-file-in-rails/</link>
		<comments>http://willj.net/2010/01/25/generating-a-plist-file-in-rails/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 12:01:29 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[builder]]></category>
		<category><![CDATA[plist]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://willj.net/?p=674</guid>
		<description><![CDATA[I recently wrote an iPhone app (Waiting for approval in the app store at the time of writing) that needed data exported from a website (recyclinggroupfinder.com). The simplest way of handling external data in an app it seems is using a plist file, so I wrote this to generate one for me. First of all [...]]]></description>
			<content:encoded><![CDATA[<p>I recently wrote an iPhone app (Waiting for approval in the app store at the time of writing) that needed data exported from a website (<a href="http://recyclinggroupfinder.com/">recyclinggroupfinder.com</a>). The simplest way of handling external data in an app it seems is using a plist file, so I wrote this to generate one for me.</p>
<p>First of all I made my action respond to the plist format:</p>
<p><script src="http://gist.github.com/281821.js"></script> Next I created a builder file to format the data:  <script src="http://gist.github.com/285786.js?file=gistfile1.rb"></script></p>
<p>Then register the MIME type at the bottom of environment.rb:</p>
<p><code>Mime::Type.register "text/plist", :plist</code></p>
<p>And that&#8217;s it! Well mostly. The XML file generated can be made significantly smaller by converting it into the binary plist format, run this on the command line in terminal after downloading the generated XML plist.</p>
<p><code>cat things_xml.plist | plutil -convert binary1 - -o things.plist</code></p>
<p>The resultant binary plist is almost half the size of the XML one, much better for inclusion in an iPhone app:</p>
<p><code>pleb:~ will$ ls -l things*<br />
-rw-r--r--  1 will  will  1247300 20 Jan 18:50 things.plist<br />
-rw-r--r--@ 1 will  will  2110437 20 Jan 18:50 things_xml.plist</code></p>
<p>Of course it would be much better to generate the binary format directly, and the <a title="plist-official" href="http://github.com/DanaDanger/plist-official">plist-official</a> gem looks like it can handle that and I mean to investigate, but I wrote the XML version before finding the gem, and it works for me!</p>
]]></content:encoded>
			<wfw:commentRss>http://willj.net/2010/01/25/generating-a-plist-file-in-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
