<?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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Open Sourcery</title>
	
	<link>http://www.opensourcery.co.za</link>
	<description>Wizardry through open source</description>
	<lastBuildDate>Wed, 04 Aug 2010 13:04:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/OpenSourcery" /><feedburner:info uri="opensourcery" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>daemon-kit 0.1.8 released</title>
		<link>http://feedproxy.google.com/~r/OpenSourcery/~3/IzKvd8icrEM/</link>
		<comments>http://www.opensourcery.co.za/2010/08/04/daemon-kit-0-1-8-released/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 13:04:46 +0000</pubDate>
		<dc:creator>Kenneth Kalmer</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[daemon-kit]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=292</guid>
		<description><![CDATA[I&#8217;m proud to announce that daemon-kit has finally made it to 0.1.8.1, almost a year after the last patch release. There has been a lot of changes since the last release, mostly cleanly up and staying with the times (so to speak). Github has an awesome compare view, detailing the historic moment, and I&#8217;ll go [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m proud to announce that daemon-kit has finally made it to 0.1.8.1, almost a year after the last patch release. There has been a lot of changes since the last release, mostly cleanly up and staying with the times (so to speak). Github has an awesome compare view, <a href="http://github.com/kennethkalmer/daemon-kit/compare/0.1.7.12...0.1.8" target="_blank">detailing the historic moment</a>, and I&#8217;ll go through it here in some detail as well.</p>
<p>First off I&#8217;d like to thank a few people who have quietly and vocally contributed to or promoted daemon-kit. In no particular order, thanks goes to:</p>
<ul>
<li><a href="http://fourbeansoup.com">Josh Owens</a> (<a href="http://twitter.com/joshowens">@joshowens</a>) for actively testing bug fixes and promoting the project</li>
<li><a href="http://www.mikeperham.com">Mike Perham</a> (<a href="http://twitter.com/mperham">@mperham</a>) for actively reporting bugs, providing patches and promoting the project</li>
<li>I&#8217;ve pulled in patches from the forks of <a href="http://github.com/mhutchin">Michael Hutchinson</a>, <a href="http://github.com/milann">Milan Novota</a>, <a href="http://github.com/jgeiger">Joey Geiger</a>, and <a href="http://github.com/merrells">John Merrels</a></li>
<li><a href="http://github.com/gcampbell">Greg Campbell</a> reported an issue with the AMQP generated daemons only hours after pushing 0.1.8 to gemcutter</li>
</ul>
<p>The two biggest changes for me has been converting all the generators to use Thor, and using Bundler in the generated daemons. Both of these projects have received some flack, but they both continue to serve me very well and I&#8217;m sure they&#8217;ll serve daemon-kit well.</p>
<p>The logger got some minor updates, to be more compatible with the standard Ruby logger class. A brand new XMPP generator is included, and it uses Blather for some awesome evented-goodness. Argument handling got fixed up, email exceptions got removed from the project (I might consider implementing them after overhauling the error reporting features of dk). Hoptoad error reporting got upgraded to the use the newer API. The generated rake tasks are more forgiving when rspec/cucumber or other gems are missing. The cron daemon got some love, allowing easier exception logging/notification for when scheduled tasks fail.</p>
<p>I&#8217;ll continue chipping away at the project, tidying up loose ends as they are reported, and start developing a proper test suite for everything.</p>
<p>Over the long term I&#8217;m hoping to reach the following goals:</p>
<ul>
<li>Always running the eventmachine reactor (think node.rb)</li>
<li>Support for more modular daemons, including &#8217;single-file&#8217; daemons</li>
<li>Support for daemons inside Rails projects</li>
</ul>
<p>Some things will probably get thrown out, like generating configs for god &amp; monit. The more I use chef, the more I realize that those responsibilities lie with the infrastructure management (or devops), and not within the project itself. I&#8217;m aware this might cause an upset, however I firmly believe that a lighter and smaller daemon-kit will serve the greater community better.</p>
<p>Thanks for making daemon-kit the number 1 daemonizing project. Please share the love and send feedback, and more importantly use Github issues to log issues, feedback, and wishes.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=IzKvd8icrEM:RA0OoL_Jc4s:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=IzKvd8icrEM:RA0OoL_Jc4s:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=IzKvd8icrEM:RA0OoL_Jc4s:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=IzKvd8icrEM:RA0OoL_Jc4s:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=IzKvd8icrEM:RA0OoL_Jc4s:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=IzKvd8icrEM:RA0OoL_Jc4s:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/OpenSourcery/~4/IzKvd8icrEM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.za/2010/08/04/daemon-kit-0-1-8-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.opensourcery.co.za/2010/08/04/daemon-kit-0-1-8-released/</feedburner:origLink></item>
		<item>
		<title>Paginating documents with couchrest and will_paginate</title>
		<link>http://feedproxy.google.com/~r/OpenSourcery/~3/LVTSfGBi3oY/</link>
		<comments>http://www.opensourcery.co.za/2010/02/08/paginating-documents-with-couchrest-and-will_paginate/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 20:34:16 +0000</pubDate>
		<dc:creator>Kenneth Kalmer</dc:creator>
				<category><![CDATA[nosql]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[couchdb]]></category>
		<category><![CDATA[couchrest]]></category>
		<category><![CDATA[will_paginate]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=283</guid>
		<description><![CDATA[CouchDB is hands down my favorite of the NoSQL variants and offers some pretty spectacular features, none of which I will bore you with in this post. I will however jot down how I (fairly easily) achieved pagination with couchrest &#38; will_paginate in a fairly large Rails application recently.
John P Wood discussed some issues they [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://couchdb.apache.org/">CouchD</a>B is hands down my favorite of the NoSQL variants and offers some pretty spectacular features, none of which I will bore you with in this post. I will however jot down how I (fairly easily) achieved pagination with <a href="http://github.com/couchrest/couchrest">couchrest</a> &amp; <a href="http://github.com/mislav/will_paginate">will_paginate</a> in a fairly large Rails application recently.</p>
<p>John P Wood <a href="http://johnpwood.net/2009/08/18/couchdb-the-last-mile/">discussed some issues</a> they faced with will_paginate and couchrest during the migration of TextMe to CouchDB, but l left out some code to work with. Couchrest itself had some pagination support that got pulled to some extent&#8230; This left me wanting, and wondering, since it was my turn to walk down this path.</p>
<p>CouchDB is a different beast, its aggressive use of indexes means that occasionally you loose some functionality that you&#8217;ve been accustomed to having in other persistence mechanisms, like the number of rows matching a query. Jan Lenhardt explains on the <a href="https://issues.apache.org/jira/browse/COUCHDB-82">CouchDB issue tracker in more detail</a>, but it boils down that you need a reduce function to calculate the number of rows. Sounds difficult? Not at all!</p>
<p>In my case I had a collection of announcements to deal with, and the announcement archives is a paginating collection of documents. Standard will_paginate stuff, nothing special.</p>
<p><em>Those reading in a reader would want to click through to the post to view the embedded gists further down, or view them <a href="http://gist.github.com/298523">directly at Github</a></em><em>.</em></p>
<p>Below is a condensed version of the model from our paginating system:</p>
<p><script src="http://gist.github.com/298523.js?file=announcement.rb"></script> I&#8217;ve included only one view and a corresponding class method, as it is enough to proof the principle. Lets dissect.</p>
<p>The map/reduce functions are extremely simplistic, they simply emit the announcer and the date the announcement was created. This allows for easy scoping and ordering of the announcements. The reduce simply counts our returned records.  The magic is in the class method that sets up our WillPaginate::Collection with data from our views.</p>
<p>Line 30 creates a new WillPaginate::Collection instance, passing it the page number and total per page as parameters, it gives us back a pager that we can manipulate.</p>
<p>Lines 31 through 38 uses couchrest&#8217;s pagination support to pull out data from our view. The most important things to note here are that the <em>page</em> and <em>per_page</em> options are sent to the paginator and <em>we skip the reduce step</em>.</p>
<p>Once we have our records loaded, we &#8216;replace&#8217;  the pager&#8217;s collection with our results from our view (line 40).</p>
<p>The final step is to determine the total number of documents available to us, and for this we need the reduce function. On line 42 we call the same view, with the same arguments, except for requiring the reduce step to happen. We use the results (lines 43 to 47) to inform the pager (will_paginate&#8217;s pager) how many rows there are in total.</p>
<p>The controller and the views might look something like this:  <script src="http://gist.github.com/298523.js?file=announcements_controller.rb"></script><br />
<script src="http://gist.github.com/298523.js?file=index.html.haml"></script></p>
<p>It worked, and it shows that we don&#8217;t loose as much as we might think when moving away from ActiveRecord and the ton of plugins surrounding it.</p>
<p>Thanks to John for documenting the migration of TextMe, just knowing that it was possible to combine couchrest &amp; will_paginate gave me the push I needed to figure this out.</p>
<p>Disclaimer: This code is extracted &#8220;as is&#8221; from a real life system and might contain idioms/phrases, and even code, that doesn&#8217;t make 100% when viewed in a gist. Please wear your thinking cap when applying this lesson to your own projects.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=LVTSfGBi3oY:7n5lrieMxYQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=LVTSfGBi3oY:7n5lrieMxYQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=LVTSfGBi3oY:7n5lrieMxYQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=LVTSfGBi3oY:7n5lrieMxYQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=LVTSfGBi3oY:7n5lrieMxYQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=LVTSfGBi3oY:7n5lrieMxYQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/OpenSourcery/~4/LVTSfGBi3oY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.za/2010/02/08/paginating-documents-with-couchrest-and-will_paginate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.opensourcery.co.za/2010/02/08/paginating-documents-with-couchrest-and-will_paginate/</feedburner:origLink></item>
		<item>
		<title>Correlating documents in CouchDB</title>
		<link>http://feedproxy.google.com/~r/OpenSourcery/~3/04PavWzPRdw/</link>
		<comments>http://www.opensourcery.co.za/2009/12/13/correlating-documents-in-couchdb/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 20:40:35 +0000</pubDate>
		<dc:creator>Kenneth Kalmer</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[couchdb]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=275</guid>
		<description><![CDATA[I&#8217;m in the very fortunate position, two actually, of being able to 1) migrate my biggest production application from MySQL to CouchDB, and 2) build a stunning new system for a multinational welfare organization on top of CouchDB.
I&#8217;ve been lurking in the CouchDB world for quite some time and have spent a lot of time [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m in the very fortunate position, two actually, of being able to 1) migrate my biggest production application from MySQL to CouchDB, and 2) build a stunning new system for a multinational welfare organization on top of CouchDB.</p>
<p>I&#8217;ve been lurking in the CouchDB world for quite some time and have spent a lot of time wrestling with how to loosely relate documents in CouchDB to each other. A big part of learning to use CouchDB successfully is to break away from the shackles of the relational world. Relationships between documents is one such a shackle that seems hard to break.</p>
<p>It is unavoidable that data has to be correlated, and I wanted to rethink how to do it. After plenty of discussions in #ruote with John Mettraux we came up with a model based on how the web works. Since CouchDB is &#8220;off the web&#8221;, the approach feels quite fitting to me and hopefully to you too.</p>
<p>First some insight into my thinking at this stage.</p>
<p>The web has been successful in loosely expressing relationships between documents. Take two examples:</p>
<p><script src="http://gist.github.com/255582.js?file=gistfile1.htm"></script> and  <script src="http://gist.github.com/255582.js?file=gistfile2.htm"></script></p>
<p><em>For those of you reading this through a reader, click through to see the gist&#8217;s above.</em></p>
<p>Simple as it seems, in both cases we have a document that is somehow related to the page. The nature of the relationship is expressed via the <em>rel</em> attribute, and the target specified via the <em>href</em> attribute. This got me thinking. Since CouchDB is made <em>off the web, </em>can&#8217;t these same principles be applied?</p>
<p>Yes, they can. And here is how:</p>
<p>Currently you might be tempted to express relationships link this in your JSON:</p>
<p><script src="http://gist.github.com/255582.js?file=gistfile3.js"></script> Where changing it to this holds the key:  <script src="http://gist.github.com/255582.js?file=gistfile4.js"></script></p>
<p>If anything this format, albeit more verbose, expresses the relationships more clearly and in a format that is web friendly. We&#8217;ve broken the shackles of relational thinking.</p>
<p><strong>Enter Correlate</strong></p>
<p><a href="http://github.com/kennethkalmer/correlate" target="_blank">Correlate</a> is an experiment in this line of thinking. It is a mixin for CouchRest&#8217;s extended documents that allows you to express these relationships:</p>
<p><script src="http://gist.github.com/255582.js?file=gistfile5.rb"></script></p>
<p>Correlate generates getter and setter methods for working with your relationships and lot more (review the <a href="http://github.com/kennethkalmer/correlate/blob/master/README.rdoc" target="_blank">README</a>). It also includes a compatibility layer for ActiveRecord to help when you&#8217;re migrating from ActiveRecord to CouchRest or building a system on CouchDB that needs to access legacy data via ActiveRecord.</p>
<p>The project is still pretty much a moving target, but I&#8217;d love to hear how others address the same issues. Correlate does a great job at maintaining relationship information in a <em>web friendly</em> manner and providing you with some convenience around the verbose data structure. Correlate also has a lot of room for improvement, but that will hopefully change over the coming days as I continue integrating it deeply into my existing projects.</p>
<p>Please fork the project on github and join the experiment with me.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=04PavWzPRdw:RUp70o93eaM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=04PavWzPRdw:RUp70o93eaM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=04PavWzPRdw:RUp70o93eaM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=04PavWzPRdw:RUp70o93eaM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=04PavWzPRdw:RUp70o93eaM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=04PavWzPRdw:RUp70o93eaM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/OpenSourcery/~4/04PavWzPRdw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.za/2009/12/13/correlating-documents-in-couchdb/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.opensourcery.co.za/2009/12/13/correlating-documents-in-couchdb/</feedburner:origLink></item>
		<item>
		<title>VirtualBox, Gentoo and serial consoles</title>
		<link>http://feedproxy.google.com/~r/OpenSourcery/~3/o0TZ1dQfFCE/</link>
		<comments>http://www.opensourcery.co.za/2009/09/30/virtualbox-gentoo-and-serial-consoles/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 21:08:50 +0000</pubDate>
		<dc:creator>Kenneth Kalmer</dc:creator>
				<category><![CDATA[gentoo]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[quickies]]></category>
		<category><![CDATA[serial]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=271</guid>
		<description><![CDATA[More as a reminder to myself for when I need this again, but I&#8217;m sure everyone needs this at least once.
Having screwed up my kernel configs for my VirtualBox Gentoo image, I needed a serial console to catch the boot messages scrolling past in order to see if all the required hardware was being loaded [...]]]></description>
			<content:encoded><![CDATA[<p>More as a reminder to myself for when I need this again, but I&#8217;m sure everyone needs this at least once.</p>
<p>Having screwed up my kernel configs for my VirtualBox Gentoo image, I needed a serial console to catch the boot messages scrolling past in order to see if all the required hardware was being loaded by the kernel. I&#8217;ve never done this on a physical machine before but I am converted now and will acquire a USB to serial port converter in the near future&#8230;</p>
<p>Using <a href="http://www.codestrom.com/wandering/2009/06/opensolaris-virtualbox-ttya-console-debugging.html" target="_blank">this article as a base</a> you need to do the following:</p>
<ol>
<li>Enable serial ports for your virtual machine</li>
<li>Select &#8220;Host Pipe&#8221;</li>
<li>Enter <em>/tmp/vboxconsole</em> as the filename</li>
<li>Use netcat to read the console: <em>nc -U /tmp/vboxconsole</em></li>
</ol>
<p>When booting you need to amend your grub boot line to have the following at the end:</p>
<pre>console=ttyS0,38400</pre>
<p>Making it look something like this:</p>
<pre>kernel=/kernel-2.6.30-r6 root=/dev/sda3 console=ttyS0,38400</pre>
<p>Proceed to boot and look at netcat to see the entire boot output scroll past without disappearing into thin air when the kernel panics.</p>
<p>Man, I love virtualization. I tested this on Mac OS X 10.5 with VirtualBox 3.0.6, but it should work on any *nix platform. Some more <a href="http://www.gentoo-wiki.info/HOWTO_Linux_serial_console">Gentoo serial console madness</a> can be found on the old Gentoo Wiki.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=o0TZ1dQfFCE:MTAlETBRrMU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=o0TZ1dQfFCE:MTAlETBRrMU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=o0TZ1dQfFCE:MTAlETBRrMU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=o0TZ1dQfFCE:MTAlETBRrMU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=o0TZ1dQfFCE:MTAlETBRrMU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=o0TZ1dQfFCE:MTAlETBRrMU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/OpenSourcery/~4/o0TZ1dQfFCE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.za/2009/09/30/virtualbox-gentoo-and-serial-consoles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.opensourcery.co.za/2009/09/30/virtualbox-gentoo-and-serial-consoles/</feedburner:origLink></item>
		<item>
		<title>Rails specs not running under Ruby 1.9 ?</title>
		<link>http://feedproxy.google.com/~r/OpenSourcery/~3/AlGCRkE5U7s/</link>
		<comments>http://www.opensourcery.co.za/2009/09/27/rails-specs-not-running-under-ruby-1-9/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 08:08:11 +0000</pubDate>
		<dc:creator>Kenneth Kalmer</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby19]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=265</guid>
		<description><![CDATA[I spent some time getting PowerDNS on Rails to run on Ruby 1.9.1, which ended up being very easy due to the small amount of plugins &#38; gems used by the project. The only change I had to make myself was to the acts_as_audited plugin, where the one-line fix got merged upstream.
The worst part of [...]]]></description>
			<content:encoded><![CDATA[<p>I spent some time getting <a href="http://github.com/kennethkalmer/powerdns-on-rails">PowerDNS on Rails</a> to run on Ruby 1.9.1, which ended up being very easy due to the small amount of plugins &amp; gems used by the project. The only change I had to make myself was to the <a href="http://github.com/kennethkalmer/acts_as_audited">acts_as_audited</a> plugin, where the <a href="http://github.com/collectiveidea/acts_as_audited/commit/02e35ac368f3125887c4752a39610f5e914ff6b7#L0L40">one-line fix got merged upstream</a>.</p>
<p>The worst part of the process was getting the specs to run with <em>rake spec</em>. Using <em>./script/spec</em> it worked on individual specs and on all the specs worked as advertised, but <em>rake spec</em> didn&#8217;t do anything.</p>
<p>After a lot of time spent in the debugger I wasn&#8217;t any wiser. The only difference was that in Ruby 1.8 the example groups were fully loaded, and in Ruby 1.9 they were empty. I gave up and started searching relentlessly for some information on the issue. I couldn&#8217;t find anything, until I found an indirect solution on the <a href="http://wiki.github.com/dchelimsky/rspec/ruby-191">rspec wiki</a>. It seems that if you have any versions of the test-unit gem after the 1.2.3 release installed, your Rails specs will simply not run. For me, removing test-unit 2.0.3 made the difference and the specs ran properly. PowerDNS on Rails has now joined the ranks of my <a href="/ruby-19-progress-report/">Ruby 1.9 compatible projects</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=AlGCRkE5U7s:UVLdNutINM0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=AlGCRkE5U7s:UVLdNutINM0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=AlGCRkE5U7s:UVLdNutINM0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=AlGCRkE5U7s:UVLdNutINM0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=AlGCRkE5U7s:UVLdNutINM0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=AlGCRkE5U7s:UVLdNutINM0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/OpenSourcery/~4/AlGCRkE5U7s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.za/2009/09/27/rails-specs-not-running-under-ruby-1-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.opensourcery.co.za/2009/09/27/rails-specs-not-running-under-ruby-1-9/</feedburner:origLink></item>
		<item>
		<title>Ruote in 20 minutes video</title>
		<link>http://feedproxy.google.com/~r/OpenSourcery/~3/sFq0kOYiP4Y/</link>
		<comments>http://www.opensourcery.co.za/2009/08/25/ruote-in-20-minutes-video/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 17:45:29 +0000</pubDate>
		<dc:creator>Kenneth Kalmer</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruote]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=258</guid>
		<description><![CDATA[Kudos to my brother and the rest of the guys at Monopost for cleaning up the bad audio as best they can.

Ruote in 20 minutes from Kenneth Kalmer on Vimeo.
The original post of the presentation is over here.
]]></description>
			<content:encoded><![CDATA[<p>Kudos to my <a href="http://twitter.com/Will_Mono">brother</a> and the rest of the guys at <a href="http://www.monopost.tv">Monopost</a> for cleaning up the bad audio as best they can.</p>
<p><object width="400" height="300" data="http://vimeo.com/moogaloop.swf?clip_id=6261927&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=6261927&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /></object></p>
<p><a href="http://vimeo.com/6261927">Ruote in 20 minutes</a> from <a href="http://vimeo.com/kennethkalmer">Kenneth Kalmer</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>The original post of the presentation is over <a href="/2009/03/04/ruote-in-20-minutes/">here</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=sFq0kOYiP4Y:eP8tIrWXNWk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=sFq0kOYiP4Y:eP8tIrWXNWk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=sFq0kOYiP4Y:eP8tIrWXNWk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=sFq0kOYiP4Y:eP8tIrWXNWk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=sFq0kOYiP4Y:eP8tIrWXNWk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=sFq0kOYiP4Y:eP8tIrWXNWk:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/OpenSourcery/~4/sFq0kOYiP4Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.za/2009/08/25/ruote-in-20-minutes-video/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.opensourcery.co.za/2009/08/25/ruote-in-20-minutes-video/</feedburner:origLink></item>
		<item>
		<title>Getting the Ruby 1.9 ball rolling</title>
		<link>http://feedproxy.google.com/~r/OpenSourcery/~3/k4mDQmdZAEo/</link>
		<comments>http://www.opensourcery.co.za/2009/08/14/getting-the-ruby-19-ball-rolling/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 15:36:51 +0000</pubDate>
		<dc:creator>Kenneth Kalmer</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby19]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=243</guid>
		<description><![CDATA[
After I read this post on Labnotes I decided to &#8220;take the plunge&#8221; into the world of Ruby 1.9 properly. I mean, I was at RubyKaigi where the biggest lesson of all was &#8220;Change!&#8221; (and changing to 1.9). Ruby 1.9.1 has been stable for quite some time now, and 1.9.2 is due out on Christmas. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.labnotes.org/2009/08/13/i-switched-to-ruby-1-9-and-you-should-too/"><img src="http://twictur.es/i/3306126571.gif" alt="" /></a></p>
<p>After I read <a href="http://blog.labnotes.org/2009/08/13/i-switched-to-ruby-1-9-and-you-should-too/">this post</a> on Labnotes I decided to &#8220;take the plunge&#8221; into the world of Ruby 1.9 properly. I mean, I was at RubyKaigi where the biggest lesson of all was &#8220;Change!&#8221; (and changing to 1.9). Ruby 1.9.1 has been stable for quite some time now, and 1.9.2 is due out on Christmas. And we&#8217;re still stuck on 1.8.6 ? <strong>WTF</strong></p>
<p>Getting started with Ruby 1.9 is easy (only time will tell <a href="http://twitter.com/vandermerwe/status/3307761128">how much pain</a> is caused). I have to admit I&#8217;m not as brave to wipe my rubygems installation, I might still need 1.8.6 (and I seriously hope I don&#8217;t).</p>
<p>So Relevance made this awesome bash script called <a href="http://blog.thinkrelevance.com/2009/7/29/ruby-switcher-working-with-multiple-ruby-versions-has-never-been-this-easy">ruby_switcher.sh</a> that you absolutely have to try. Once you have it installed and working as per their instructions you need to make one small change to the very last line of ruby_switcher.sh. That change looks like this:</p>
<pre>#use_leopard_ruby
use_ruby_191</pre>
<p>Simple and I can easily toggle 1.8.6 mode if needed.</p>
<p><img src="http://twictur.es/i/3307027729.gif" alt="" /></p>
<p>Yes, I did.</p>
<p>So over the coming days I&#8217;ll be working through all 28 of my github repos and making sure they run on 1.9. This is no small task, but I&#8217;m looking forward to getting my &#8220;house&#8221; in order.</p>
<p>At this stage I know <a href="http://github.com/kennethkalmer/acts_as_audited">acts_as_audited</a> is 1.9 compatible, I fixed it earlier the week while testing ruby_switcher. I had a look at <a href="http://github.com/kennethkalmer/activerecord-tableless-models">ActiveRecord::Tableless</a> and decided to pull the plug on the project completely (<a href="http://github.com/kennethkalmer/activerecord-tableless-models/commit/097ad7f5f2d5589beb867790873df04f25c5b842">see here</a>).</p>
<p>I&#8217;m really looking forward to this adventure and sharing the ups and downs of the road with everyone. Ultimately I would love it if we can get the South Africa Ruby ecosystem on 1.9.X ASAP.</p>
<p>Follow my project updates over on my <a href="/ruby-19-progress-report">Ruby 1.9 Progress Report</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=k4mDQmdZAEo:e-PB-gl7keU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=k4mDQmdZAEo:e-PB-gl7keU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=k4mDQmdZAEo:e-PB-gl7keU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=k4mDQmdZAEo:e-PB-gl7keU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=k4mDQmdZAEo:e-PB-gl7keU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=k4mDQmdZAEo:e-PB-gl7keU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/OpenSourcery/~4/k4mDQmdZAEo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.za/2009/08/14/getting-the-ruby-19-ball-rolling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.opensourcery.co.za/2009/08/14/getting-the-ruby-19-ball-rolling/</feedburner:origLink></item>
		<item>
		<title>Looking beyond daemon-kit 0.2</title>
		<link>http://feedproxy.google.com/~r/OpenSourcery/~3/cVybcewoIBA/</link>
		<comments>http://www.opensourcery.co.za/2009/08/09/looking-beyond-daemon-kit-02/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 21:40:07 +0000</pubDate>
		<dc:creator>Kenneth Kalmer</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[daemon-kit]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=234</guid>
		<description><![CDATA[
I wrote daemon-kit to solve two big issues with writing daemon processes in Ruby:

Everyone is re-inventing the daemons gem
Individual daemons share a lot common code, apart from the daemonizing bits

As for #1, daemon-kit at first wrapped the daemons gem, and later ripped it out completely as it was difficult to wrap up the worst of [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-237 alignright" title="Works Ahead - Singapore Department of Transport " src="http://www.opensourcery.co.za/wp-content/uploads/2009/08/works-ahead.jpg" alt="Works Ahead - Singapore Department of Transport " width="180" height="150" /></p>
<p>I wrote <a href="http://github.com/kennethkalmer/daemon-kit">daemon-kit</a> to solve two big issues with writing daemon processes in Ruby:</p>
<ol>
<li>Everyone is re-inventing the <a href="http://daemons.rubyforge.org/">daemons gem</a></li>
<li>Individual daemons share a lot common code, apart from the daemonizing bits</li>
</ol>
<p>As for #1, daemon-kit at first wrapped the daemons gem, and later ripped it out completely as it was difficult to wrap up the worst of the daemons gem properly.</p>
<p>#2 seemed to be a twofold problem that daemon-kit has also addressed with great success. The first was addressing the all too common issues of logging, pid file management, umasks, signal traps, config files, exception handling and other &#8220;low-level&#8221; issues. Everyone was implementing these things to a limited extent in their daemons and this could cause a lot of frustration when done wrong. The second part was the need, even if undiscovered, for higher level re-use and development speed. Daemon-kit addresses this with some limited generators, making it easy to get going with a cron-style daemon, AMQP &amp; XMPP bots as well as the newest addition, Ruote remote participants.</p>
<p>All this is fine and well, and people seem to like the project. The mailing list is getting some noise, we&#8217;re over <a href="http://github.com/kennethkalmer/daemon-kit/watchers">200 watchers strong</a> on Github and the IRC channel has some folks popping in to say hi.</p>
<p>However, daemon-kit quickly made me lazy and realize there is a couple of things it can do much better. If you&#8217;ve used a generator before, you&#8217;ll notice the generated code is very much stuck to that type of daemon. Changing from XMPP to AMQP (for illustrative purposes) would be best accomplished by generating a new project and copying over the <em>lib/</em> folder only. This sucks.</p>
<p>Another problem is people, myself included, would like to have <a href="http://groups.google.com/group/eventmachine/msg/84372822d1cb06db">Sinatra-style daemons</a> (i.e. one file) for smaller tasks. Currently this is not possible at all. Another thing I know people are doing behind my back is generating daemons inside Rails projects, which may or may not work, depending on whether you load Rails&#8217; environment.rb.</p>
<p><strong>So, what happens now?</strong></p>
<p>My thoughts are to implement privilege dropping support and tag a 0.2 release. This gives us a feature complete framework, albeit not as good as it can be. I&#8217;ll maintain 0.2 as a stable while undertaking the rewrite. A rewrite? Read on.</p>
<p>I <a href="http://groups.google.com/group/daemon-kit/browse_thread/thread/6d8be608798f67e6">posted to the daemon-kit list</a> a suggestion for stackable daemon environments. I&#8217;ve discussed this in IRC with a few folks as well. <a href="http://github.com/jpr5">Jordan Ritter</a> gave me an exceptional breakdown of the dangers of doing something because it is &#8220;neat&#8221; and I&#8217;ve taken his warning to heart. However, I cannot seem to argue against stackable daemon environments, it sounds too good.</p>
<p>The idea is pretty simple. Stack-entries can be compared to Rack applications, with two significant differences. The first is that they will be <em>called only once</em>. They have the opportunity to change the environment in which the final code runs. The second is that they can be called at four different stages of the daemon lifecycle: argument processing, pre-daemonization, post-daemonization and shutdown. This differs from Rack&#8217;s single <em>call()</em> method.</p>
<p>The stackable nature also gives the stack members easier ways to set conventions and can dramatically minimize configuration. It paves the way for plugins, sinatra-style daemons, rails-based daemons and easier packaging of distributable daemons, and so much more. Looking at the internals of daemon-kit, it would greatly help simplify the existing code as well as help separate utility classes from stack members.</p>
<p>The more I think about it, the more obvious this becomes, and the more possibilities unfold for the framework. This will definitely make daemon-kit a force to be reckoned with, and hopefully I can persuade other library developers to offload their daemonizing code to daemon-kit, just like rack developers offload their HTTP handling to rack.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=cVybcewoIBA:3MnxkTxfUUM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=cVybcewoIBA:3MnxkTxfUUM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=cVybcewoIBA:3MnxkTxfUUM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=cVybcewoIBA:3MnxkTxfUUM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=cVybcewoIBA:3MnxkTxfUUM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=cVybcewoIBA:3MnxkTxfUUM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/OpenSourcery/~4/cVybcewoIBA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.za/2009/08/09/looking-beyond-daemon-kit-02/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.opensourcery.co.za/2009/08/09/looking-beyond-daemon-kit-02/</feedburner:origLink></item>
		<item>
		<title>DaemonKit Lightning Talk RubyKaigi 2009</title>
		<link>http://feedproxy.google.com/~r/OpenSourcery/~3/8oduJBzF4UU/</link>
		<comments>http://www.opensourcery.co.za/2009/07/18/daemonkit-lightning-talk-rubykaigi-2009/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 15:30:46 +0000</pubDate>
		<dc:creator>Kenneth Kalmer</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[daemon-kit]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[rubykaigi]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=231</guid>
		<description><![CDATA[Daemon Kit &#8211; RubyKaigi 2009
View more documents from Kenneth Kalmer.

Undoubtedly my worst time on stage ever! Ubuntu gave me issues with the projector, so I actually had to leave the stage to go to another conference hall to get the setup working again and run back up to the main hall&#8230; Once there, I was [...]]]></description>
			<content:encoded><![CDATA[<div id="__ss_1738038" style="width: 425px; text-align: left;"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" title="Daemon Kit - RubyKaigi 2009" href="http://www.slideshare.net/kenneth.kalmer/daemon-kit-rubykaigi-2009">Daemon Kit &#8211; RubyKaigi 2009</a><object width="425" height="355" data="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=daemon-kit20090718kaigi-090718102212-phpapp02&amp;stripped_title=daemon-kit-rubykaigi-2009" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=daemon-kit20090718kaigi-090718102212-phpapp02&amp;stripped_title=daemon-kit-rubykaigi-2009" /><param name="allowfullscreen" value="true" /></object></p>
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">documents</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/kenneth.kalmer">Kenneth Kalmer</a>.</div>
</div>
<p>Undoubtedly my worst time on stage ever! Ubuntu gave me issues with the projector, so I actually had to leave the stage to go to another conference hall to get the setup working again and run back up to the main hall&#8230; Once there, I was a mumbling mess, but made it through without the buzzer beating me.</p>
<p>Presenting a lightning talk at a Japanese conference is surely something else, the audience expects fireworks and the presenters deliver. It was truly an amazing experience, humilation and all, and I&#8217;m looking forward to the last day of the conference.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=8oduJBzF4UU:zgxxnBoRj6M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=8oduJBzF4UU:zgxxnBoRj6M:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=8oduJBzF4UU:zgxxnBoRj6M:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=8oduJBzF4UU:zgxxnBoRj6M:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=8oduJBzF4UU:zgxxnBoRj6M:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=8oduJBzF4UU:zgxxnBoRj6M:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/OpenSourcery/~4/8oduJBzF4UU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.za/2009/07/18/daemonkit-lightning-talk-rubykaigi-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.opensourcery.co.za/2009/07/18/daemonkit-lightning-talk-rubykaigi-2009/</feedburner:origLink></item>
		<item>
		<title>Getting “copy friendly” with jQuery</title>
		<link>http://feedproxy.google.com/~r/OpenSourcery/~3/8LewdTMSGhs/</link>
		<comments>http://www.opensourcery.co.za/2009/07/10/getting-copy-friendly-with-jquery/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 08:39:04 +0000</pubDate>
		<dc:creator>Kenneth Kalmer</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=223</guid>
		<description><![CDATA[When I&#8217;m not busy writing backends for large service provisioning platforms, I get to spend some time in the user-facing interfaces of these platforms. We&#8217;ve prided ourselves so far on maintaining cross browser compatibility (excluding IE6), and to a certain extend mobile phone accessiblity as well. All the dynamics of the interface is done with [...]]]></description>
			<content:encoded><![CDATA[<p>When I&#8217;m not busy writing backends for large service provisioning platforms, I get to spend some time in the user-facing interfaces of these platforms. We&#8217;ve prided ourselves so far on maintaining cross browser compatibility (excluding IE6), and to a certain extend mobile phone accessiblity as well. All the dynamics of the interface is done with jQuery, and it is done unobtrusively as well. We frequently test the site with Javascript disabled, to make sure that everything works as expected, and it mostly does. Webrat is a great help here as well, since it navigates the site without Javascript&#8230;</p>
<p>But enough blabbering, the ISP in a Box platform is huge, and interacts with various other service providers through a myriad of API&#8217;s, some of them as reliable as convicted mobster. Our support teams are constantly double checking the interactions between the autonomous participants and our service providers, and this means a lot of copying and pasting, from our interfaces to theirs.</p>
<p>They simply &#8220;double click&#8221; to select text in our interface, causing the browser to copy additional whitespace with the selected text. When pasting into a search box they need to prune the additional whitespace off manually, making the process even slower and more tedious than it needs to be. I can&#8217;t replicate this with Firefox on Ubuntu, but it happens to the Windows guys&#8230;</p>
<p>In the previous version of the system I solved the issue quickly and bluntly by simply placing all the information in text fields that were styled to be transparent. In this day and age of unobtrusiveness I thought it more appropriate to generate the text fields on the fly, since they&#8217;re a convenience and have no effect on the functionality of the system.</p>
<p>It took me 5 minutes to get this done in jQuery, and another 10 to figure out how to wrap it all up as a jQuery plugin. I love jQuery&#8230;</p>
<p>Ladies and gentleman, I present you with the<a href="http://github.com/kennethkalmer/jquery-copyfriendly/tree/master"> jQuery copyfriendly</a> plugin.</p>
<p><strong>Usage</strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.copyme'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">copyfriendly</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>And then mark your &#8220;copy friendly&#8221; HTML elements like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;table<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tr<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;td</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;copyme&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Hello<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/table<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Or inline like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;code<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;span</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;copyme&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Heya<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/span<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/code<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>copyfriendly() takes on parameter currently, which is optional:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  copyfriendly<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#123;</span>
    klass<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;borderless&quot;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The &#8216;klass&#8217; option tells copyfriendly which CSS class to apply to the inputs generated.</p>
<p><strong>Sample CSS</strong></p>
<p>You can make the inputs generated by copyfriendly invisible using this sample CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">  input<span style="color: #6666ff;">.borderless</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Do be warned that it might take a little more to align the appearance of the remaining text with the surrounding text in the document.</p>
<p><strong>How it works</strong></p>
<p>Actually quite simple. All it does is extract the text from the element and then replaces that text with an input tag of type &#8220;text&#8221;, and the value is the original text extract from the matching element. The size of the element is dynamically calculated from the string length, so there might be room for improvement here.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=8LewdTMSGhs:XHo620iAGnw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=8LewdTMSGhs:XHo620iAGnw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=8LewdTMSGhs:XHo620iAGnw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=8LewdTMSGhs:XHo620iAGnw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?i=8LewdTMSGhs:XHo620iAGnw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/OpenSourcery?a=8LewdTMSGhs:XHo620iAGnw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/OpenSourcery?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/OpenSourcery/~4/8LewdTMSGhs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.za/2009/07/10/getting-copy-friendly-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.opensourcery.co.za/2009/07/10/getting-copy-friendly-with-jquery/</feedburner:origLink></item>
	</channel>
</rss>
