<?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>Meta Bates</title>
	<atom:link href="http://www.metabates.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.metabates.com</link>
	<description>The technical ramblings of Mark Bates.</description>
	<lastBuildDate>Sun, 15 Aug 2010 12:49:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Fixtures v. Factories &#8211; Can&#8217;t We All Just Get Along?</title>
		<link>http://www.metabates.com/2010/08/15/fixtures-v-factories-cant-we-all-just-get-along/</link>
		<comments>http://www.metabates.com/2010/08/15/fixtures-v-factories-cant-we-all-just-get-along/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 12:49:37 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[factories]]></category>
		<category><![CDATA[fixtures]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=358</guid>
		<description><![CDATA[Testing in Ruby on Rails is incredibly easy. I mean stupidly easily. So easy that if you&#8217;re not doing it, you are a very, very bad developer and should re-evaluate your career choices. (Yes, I believe in testing that much!) One thing that is not all that easy, however, is object creation and populating your [...]]]></description>
			<content:encoded><![CDATA[<p>Testing in Ruby on Rails is incredibly easy. I mean stupidly easily. So easy that if you&#8217;re not doing it, you are a very, very bad developer and should re-evaluate your career choices. (Yes, I believe in testing that much!) One thing that is not all that easy, however, is object creation and populating your test database. Five years ago when I first started working with Rails the only options we had to get data into the database were fixtures, or hastily written &#8216;factory&#8217;-esque methods custom to each application.</p>
<p>Fixtures, for those who don&#8217;t know, are YAML files that contain YAML-ized versions of objects that then get loaded into the test database when you run your test suite. These objects can then be pulled back from the database during your tests. Sounds great, doesn&#8217;t it? Well, not everybody thinks so. One of the biggest problems with fixtures is they can very quickly get out of control. Keeping track of all the different scenarios your tests needs can get very confusing and frustrating to deal with.</p>
<p><img class="alignleft" title="Factory Workers" src="http://www.uni.edu/schneidj/webquests/adayinthelife/lotsofworkers.jpg" alt="" width="360" height="283" />So how do we fix this problem? Well, most developers have turned to using factories. Factories allow us to quickly build the data we need for each test, now the building of the data you need for your test is right there in a setup or before method. Easy to manage and keep track of. Now there are a plethora of different factory libraries meant to make this task nicer, a few of the popular ones are <a href="http://github.com/thoughtbot/factory_girl" target="_blank">Factory Girl</a>, <a href="http://github.com/notahat/machinist">Machinist</a>, and <a href="http://github.com/flogic/object_daddy" target="_blank">Object Daddy</a>. The problem with this approach, however, is that it can slow down your tests as you are building database objects for nearly every test, and as we all know, object creation and database inserting can be expensive.</p>
<p>So, what can we do to help solve both of these problems? Well, we can use both of these technologies. Together. Yeah, that&#8217;s right I&#8217;m saying you should use fixtures as well as factories. Sound crazy? Not really. Let me explain.</p>
<p>Most Rails applications have most, if not all, of their functionality behind a login. So whenever we&#8217;re testing some controller action that sites behind a login we need a user to login with. If we were using factories we would have a setup or before method that would create a new User object and save it to the database, and it would do that for every variant of the test, as well as every other test in our suite that needs a user object.</p>
<p>Why not, create one user object and use that repeatedly through our tests? What I like to do is stick one or two users in my fixtures, so that they&#8217;re there whenever I need one. I like to do this with most of my major models. Then, when I need to have some custom scenarios, I can break out the factories and build those custom scenarios.</p>
<p>So what does this achieve? Well, I&#8217;ve sped up my tests by already having a few objects in the database, and not having to create them (and roll them back) with each single test. I&#8217;ve also cleaned up my tests significantly by eliminating a lot of setup and/or before methods where these objects were being created. I&#8217;ve also eliminated the biggest problems with fixtures, that they can get overwhelming, because we are only keeping one or two objects in them and using factories for the rest.</p>
<p>I hoped this helped you to understand that we don&#8217;t have to throw the baby out with the bath water when it comes to fixtures and factories, we can use both. Not go forth and test! Test like your life depends on it (because it does!!).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2010/08/15/fixtures-v-factories-cant-we-all-just-get-along/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CoverMe &#8211; Code Coverage for Ruby 1.9</title>
		<link>http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/</link>
		<comments>http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 17:49:44 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rcov]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=343</guid>
		<description><![CDATA[Ruby 1.9(.2) is an amazing language to develop applications in. It&#8217;s faster, more powerful, cleaner, and a huge improvement over Ruby 1.8.x. Because of those reasons every Ruby developer should move to this exciting new version of our language. When making a move of this size it&#8217;s important to have the right tools to help [...]]]></description>
			<content:encoded><![CDATA[<p>Ruby 1.9(.2) is an amazing language to develop applications in. It&#8217;s faster, more powerful, cleaner, and a huge improvement over Ruby 1.8.x. Because of those reasons every Ruby developer should move to this exciting new version of our language.</p>
<div id="_mcePaste">When making a move of this size it&#8217;s important to have the right tools to help us along. Unfortunately, one of the most useful tools as a Ruby developer, <a href="http://github.com/relevance/rcov">RCov</a>, does not work with Ruby 1.9.</div>
<div id="_mcePaste">RCov, for those unfamiliar analyzes your code and tells you which part of your code was not executed. This is INCREDIBLY useful when hooked up to your test suite. While, it&#8217;s not the only metric you should use when determining how good your test coverage it, it certainly is a great first step to point out exactly which parts of your code haven&#8217;t been touched at all!</div>
<p>Enter <a href="http://github.com/markbates/cover_me">CoverMe</a>.</p>
<h2>History</h2>
<p>While working on a Ruby 1.9/Rails 3 project, and loving everything about it (except for the lack of RCov), I came across a <a href="http://engineering.attinteractive.com/2010/08/code-coverage-in-ruby-1-9/">post</a> by Aaron Patterson (of <a href="http://github.com/tenderlove/nokogiri">Nokogiri</a> fame). In this post he quickly outlined a very basic coverage tool using the new built-in Coverage module in Ruby 1.9.</p>
<p>After spending a morning playing with it, I was quickly able to grow the idea into something useful for the project. Later that day the company I was consulting for (<a href="http://www.biddingforgood.com">BiddingForGood.com</a>), and in particular their chief architect, <a href="http://twitter.com/stuartmg">Stuart Garner</a>, told me to take a day or two and clean it up and release it for the world to use, and so <a href="http://github.com/markbates/cover_me">here</a> it is.</p>
<h2>Features</h2>
<p>Here is a brief overview of the features of CoverMe:</p>
<h3>Index Page</h3>
<ul>
<li>Sortable column headers (File, Lines, Lines of Code, Tested %).</li>
<li>Searching/filtering by file name.</li>
<li>Filtering by coverage percent.</li>
<li>Color coded list of files to quickly see which ones are 100% covered, &gt; 90% covered, or less than 90% covered.</li>
<li>Large color coded average coverage percent, for quick reference.</li>
</ul>
<h3>Detail Page</h3>
<ul>
<li>Line by line coverage report</li>
<li>Color coded lines to quickly see which lines where executed and which ones were not.</li>
<li>Side by side viewing with the corresponding test/spec file (if one exists).</li>
</ul>
<p>See the <a href="http://github.com/markbates/cover_me">README</a> file for more information on installation and usage.</p>
<h2>Thanks</h2>
<p>I would just quickly like to give another quick thanks to Aaron Patterson for pointing out the Coverage module in Ruby 1.9 and inspiring this, hopefully, helpful little gem. Also another big thanks to Stuart Garner for pushing me to package this up and release it to the world.</p>
<h2>Screenshots</h2>

<a href='http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/detail_side_by_side/' title='detail_side_by_side'><img width="150" height="150" src="http://www.metabates.com/wp-content/uploads/2010/08/detail_side_by_side-150x150.png" class="attachment-thumbnail" alt="detail_side_by_side" title="detail_side_by_side" /></a>
<a href='http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/detail/' title='detail'><img width="150" height="150" src="http://www.metabates.com/wp-content/uploads/2010/08/detail-150x150.png" class="attachment-thumbnail" alt="detail" title="detail" /></a>
<a href='http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/index_filter/' title='index_filter'><img width="150" height="150" src="http://www.metabates.com/wp-content/uploads/2010/08/index_filter-150x150.png" class="attachment-thumbnail" alt="index_filter" title="index_filter" /></a>
<a href='http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/index_search/' title='index_search'><img width="150" height="150" src="http://www.metabates.com/wp-content/uploads/2010/08/index_search-150x150.png" class="attachment-thumbnail" alt="index_search" title="index_search" /></a>
<a href='http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/index/' title='index'><img width="150" height="150" src="http://www.metabates.com/wp-content/uploads/2010/08/index-150x150.png" class="attachment-thumbnail" alt="index" title="index" /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Testing is NOT an Option</title>
		<link>http://www.metabates.com/2010/07/01/testing-is-not-an-option/</link>
		<comments>http://www.metabates.com/2010/07/01/testing-is-not-an-option/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 14:04:38 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=337</guid>
		<description><![CDATA[Five years ago I left the world of contracting and reentered the world of the full time employee, and I enjoyed every minute of it (well, almost). Now fast forward five years and I find myself once again at a crossroads. Do I continue on as an FTE or do I become a contractor, and [...]]]></description>
			<content:encoded><![CDATA[<p>Five years ago I left the world of contracting and reentered the world of the full time employee, and I enjoyed every minute of it (well, almost). Now fast forward five years and I find myself once again at a crossroads. Do I continue on as an FTE or do I become a contractor, and play the field, so to speak? Looks like I&#8217;m going to go with the hired gun route for a little while, but that&#8217;s not really the point of this post.</p>
<p>During the past week or so I&#8217;ve spoken with many great companies and people. I&#8217;ve been fortunate enough to have a high degree of interest in what I can bring to the table. During those discussions I talked with a really nice guy at a what seems to be a really cool company, I won&#8217;t name names, because this isn&#8217;t about either the person or the company, but rather something the engineer said during our phone conversation that got me to thinking.</p>
<p><img class="alignleft" title="Failure Testing" src="http://www.commercialventvac.com/finao/failure_testing.jpg" alt="" width="400" height="240" />&#8220;We don&#8217;t have any tests because I couldn&#8217;t convince the company to allocate the time for them.&#8221; That statement really hung with me. After I got off the phone I started thinking really hard about that statement, and all I could think of was how testing is not an option and people shouldn&#8217;t need to be convinced to have time allocated to them.</p>
<p>As developers it is our responsibility to insist on testing. Always include testing in your time estimates. Never give the client (or your company) an option that includes a time estimate without testing. If a feature takes 2 days to code and a day to write tests, then your estimate is 3 days, never 2. You should never say, &#8220;Well, I can get it done in two days if I don&#8217;t write any tests.&#8221; That&#8217;s just an unacceptable thing to say. What you should be saying is, &#8220;That feature will take three days to code&#8221;.</p>
<p>I don&#8217;t feel I should sit here and tell you all the reasons why you should test, you should know them already, and frankly, they&#8217;re all very obvious! But, if you need a few bullet points to &#8216;convince&#8217; your client, here are a few:</p>
<ul>
<li>Less bugs &#8211; The more tests you have the less bugs you will have. It&#8217;s just a fact. You won&#8217;t have 100% bug free code, that&#8217;s a nearly impossible goal, but you highly reduce the likely hood that as soon as you get your code into production your users will find all the breaking points of your code.</li>
<li>Better maintainability, means faster feature turn around &#8211; When you have a large test suite it means adding, updating, or even removing features because a whole lot easier, which means it SAVES time! Why? Simple, you don&#8217;t have to go through and manually test every aspect of your code to make sure you didn&#8217;t break something elsewhere by adding that validation, or by refactoring that bit of code, etc&#8230; That translates into real $ savings.</li>
<li>Test driven development saves time &#8211; this isn&#8217;t quite the same as my last bullet point. Imagine, if you will, you are writing a four step wizard in your application. If you write a few test scripts using something like Cucumber first before you write your code you can simply keep re-running those to make sure your code is working. If you don&#8217;t have those test scripts written then you continually have to keep going to a browser and entering all the information in each of the steps so you can test something in step four. Which one do you think takes longer, having a few test scripts you can run, or manually going through the four page wizard each time you make a change?</li>
<li>It&#8217;s an investment &#8211; thinking of having test scripts like owning a house. When you don&#8217;t have tests and you just keep testing in the browser or the command line what you are doing is a kin to &#8220;renting&#8221;. There is money being spent, but at the end of the day you have nothing to show for it. You&#8217;ve spent hours &#8220;testing&#8221;, but tomorrow when you come in you have to do it all over again. When you spend those hours writing tests you are actually &#8220;buying&#8221; something. You have something to show for that time and money you&#8217;ve spent. Tomorrow, next week, next month, next year, those scripts will still be there, they&#8217;ll still be working for you, giving  you a return on your investment.</li>
</ul>
<p>Well, I hope I have hopefully made a case to you the engineer as to why you should insist on testing. It&#8217;s the right thing to do, for you, for your application and for you client. If if anyone tries to give you grief about it, send them my way, I&#8217;ll sort em out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2010/07/01/testing-is-not-an-option/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Six Tracks of Drums</title>
		<link>http://www.metabates.com/2010/06/14/six-tracks-of-drums/</link>
		<comments>http://www.metabates.com/2010/06/14/six-tracks-of-drums/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 04:06:01 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[bleeding ears]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[recording]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=329</guid>
		<description><![CDATA[When I was 11 I made my very first recording. It was 1987 and the technology choices for recording were, how to put this, almost non-existant. So I did what any smart 11 year old would do, I improvised! Let me walk you through the history of my recording career. Don&#8217;t worry, I&#8217;ll make it [...]]]></description>
			<content:encoded><![CDATA[<p>When I was 11 I made my very first recording. It was 1987 and the technology choices for recording were, how to put this, almost non-existant. So I did what any smart 11 year old would do, I improvised! Let me walk you through the history of my recording career. Don&#8217;t worry, I&#8217;ll make it brief.</p>
<h3>The Boom Box.</h3>
<p>I had a two cassette boom box, it was a beast of a machine. It was a &#8216;portable&#8217; machine, meaning that it took 8 D batteries and a burly man named Attila to carry it. My recordings started simply on this machine. I would use the built in microphone to record my awful wailings and terribly out of tune acoustic guitar.</p>
<p>As my love of bands like the Beatles grew, so did my desire to capture my musical legacy the way I desired. It was around age 12 or so that the true experimentation began. I started playing around with using different input devices. I acquired a rather terrible Radio Shack microphone for the princely sum of $19.95. It sported, and I kind you not, a &#8220;built-in on/off switch&#8221;. That was actually a feature of this microphone. Actually it was the only feature of this microphone! My other trick for recording was to use a pair of headphones as a microphone. Did it sound good? Absolutely not! But it worked.</p>
<p>While the &#8216;quality&#8217; of the recordings got marginally better with my new microphone and headphone combinations, I was lacking the studio trickery I so desired. I needed multitrack. If the Beatles had it, why didn&#8217;t I? Of course I couldn&#8217;t afford an actual multitrack recorder at this age, so again, improvisation proved key. I realized that if I recorded me singing and playing (at the same time), I could then pop that tape into the top player and record me playing and singing again while the first tape plays back into the second tape. How did it sound? How do you think it sounded??</p>
<h3>The 4 Track!</h3>
<p>At the tender age of 14 I managed to squeeze together enough allowance and saved up enough birthday/Christmas presents to get a Fostex 4-track cassette recorder. It was incredible! Here was what I had wanted all along. I could now discretely record all the wonderful parts (up to four) I could dream up!</p>
<p>I felt like the Beatles making Sgt. Pepper. Never before had anyone wielded such recording power (except for everyone else who had)! I was George Martin. I learned what every last knob on that machine did. I knew all of it&#8217;s tricks. I played with the varispeed knob. I recorded backwards parts. I was crazy.</p>
<p>Then I made a huge discovery! I could mix the 4 tracks down to stereo, pop that mix down back in the 4 track and then have another 2 tracks to play with! Brilliant!! The world was my musical oyster, and damn I was rocking it!</p>
<h3>The 8 Track!!</h3>
<p>When I was 18 years old I took a trip on the green line T to the Guitar Center on Comm Ave in Boston and purchased my musical destiny, a Tascam 488 8-track cassette recorder. Wow! I can still remember that day. Sitting on the T ride back to my house with that box on my lap. Giddy, excited, nervous, anxious, I can&#8217;t describe how I felt on that ride. I can say that it felt like it was going to take forever to get home!</p>
<p>I finally got home, rushed out to the little studio room my father and I had built in his garage and proceeded to hook it up. I had a 4 EQs per channel, inserts, sends, cues, all sorts of wonderful things! The sound was better, the quality higher, it even had DBX noise reduction! DBX! I still don&#8217;t know what it is, but I get very excited knowing it&#8217;s there!</p>
<p>That day I re-recorded a song I had recorded on my 4-track, that song was called, &#8220;I and You&#8221;. It was a dreadful song that I thought had to be the next big thing. And why wouldn&#8217;t it be? I recorded it on an 8-track!</p>
<h3>The Computer Age.</h3>
<p>In 1996 I moved to Liverpool, England to do my degree in Music. I moved all of my recording equipment across the pond with me. There was no way I was going to go to music college and not have a means to record all the amazing #1 hits I was going to write! The cosmos, on the hand, had slightly different plans for me. In the Spring of 1998 my house was broken into, and everything I owned was stolen, including my beloved 8-track recorder.</p>
<p>My world was shattered. I was a broken and lost man. How could this happen to me? Why Lord? Why?? Thankfully I managed to get a handsome of money from my parent&#8217;s insurance company to cover the claims, well, 75% of the total value anyway. Not great, but it was certainly better than nothing.</p>
<p>It was with this insurance money that I bought my own computer. My family had had computers since I was 8 or 9, but this one was mine, and I had plans for it. Since September of 1998 I have been recording music on my computer. Back then it was very difficult, now, it&#8217;s incredibly easy. I can record 8 tracks on my iPad should I wish.</p>
<h3>So What?</h3>
<p><a href="http://www.metabates.com/wp-content/uploads/2010/06/IMG_1094.jpg"><img class="alignleft size-medium wp-image-332" title="IMG_1094" src="http://www.metabates.com/wp-content/uploads/2010/06/IMG_1094-300x225.jpg" alt="" width="300" height="225" /></a>Why am I talking about this now? I was recently doing some work around the house and stumbled across a rather large box full of cassette tapes. When I saw the box it all came flooding back to me. The countless hours spent recording. The incredible amount of songs I wrote, covered, or in most cases just butchered. They were all on these cassettes, and they were fading.</p>
<p>How long could these cassettes last? What would happen to those songs? What if I never heard them again?</p>
<p>Now, I&#8217;m under no illusions that these songs are well written, well recorded, or well performed. As a matter of fact, I know it&#8217;s the opposite of that. They were poorly written, recorded, and performed. But you know what? They&#8217;re mine, and I want to preserve them. That&#8217;s why I have undertaken an enormous project to catalog and digitally capture the music on those tapes.</p>
<p>It&#8217;s going to be an enormous project, that I know. I&#8217;ll do a cassette here, and a cassette there, and eventually I&#8217;ll have them all my computer and safely backed up. Will I remix them? Edit them? Release them? Chances are no to all those questions. That&#8217;s not really the point. I just want to know that those songs are safe. Maybe I&#8217;ll take a couple of them, polish them, and give them a new life with my band, but let&#8217;s see what happens, shall we?</p>
<p><a href="http://www.metabates.com/wp-content/uploads/2010/06/IMG_1095.jpg"><img class="alignright size-medium wp-image-333" title="IMG_1095" src="http://www.metabates.com/wp-content/uploads/2010/06/IMG_1095-300x225.jpg" alt="" width="300" height="225" /></a>I purchased a used Tascam 488 MKII on eBay, and tonight I transferred my first cassette. I&#8217;m excited about this project. Hearing these songs again brings up some great memories, and some awful ones. For example, tonight&#8217;s cassette contained six recordings. The first five I remember quite vividly. The sixth, however, is clear why I forgot. It was a &#8216;cover&#8217; of &#8220;A Day In The Life&#8221; by the Beatles. But it consisted of a click track, a vocal, and 6, yes 6, tracks of drums!!! Oh, during the middle eight of the songs, two of the drum tracks switch to piano!! Why?? That&#8217;s a question I would like answered as well.</p>
<p>Anyway, expect a post every now and again about my on going battle with these cassettes. I&#8217;m sure there will be some funny, and occasionally horrific, stories to share about the experience.</p>
<p>PS. If anybody out there has some great earplugs they want to lend me, I&#8217;ll take them!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2010/06/14/six-tracks-of-drums/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>APN on Rails has a new Home.</title>
		<link>http://www.metabates.com/2010/03/10/apn-on-rails-has-a-new-home/</link>
		<comments>http://www.metabates.com/2010/03/10/apn-on-rails-has-a-new-home/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 15:46:20 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[apn]]></category>
		<category><![CDATA[apn_on_rails]]></category>
		<category><![CDATA[github.com]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=327</guid>
		<description><![CDATA[Quite often I get asked why don&#8217;t I blog more? Why don&#8217;t I tweet more? Why don&#8217;t I _fill in the blank_ more. The answer is I&#8217;m a busy man. I&#8217;m the CTO for a pre-funding startup, www.shortbord.com, the father of two adorable little boys, the lead singer of a Boston-based band, www.myspace.com/colawarvets, and that&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Quite often I get asked why don&#8217;t I blog more? Why don&#8217;t I tweet more? Why don&#8217;t I _fill in the blank_ more. The answer is I&#8217;m a busy man. I&#8217;m the CTO for a pre-funding startup, <a href="http://www.shortbord.com/invites/ZAZLBQH5FA">www.shortbord.com</a>, the father of two adorable little boys, the lead singer of a Boston-based band, <a href="http://www.myspace.com/colawarvets">www.myspace.com/colawarvets</a>, and that&#8217;s just the big stuff! I have to prioritize what I can spend my time on, and unfortunately some of my open source projects are the first to get the ax.</p>
<p>Why do the open source projects always seem to get the ax? Well, let me start by saying that they don&#8217;t <em>always</em> get the ax, but they certainly jump to the top of the list. There are certain libraries I&#8217;ve written, <a href="http://github.com/markbates/cachetastic">cachetastic</a> and <a href="http://github.com/markbates/configatron">configatron</a>, are the two most prominent that I use day in and day out. They will always get the love the deserve. Then there are projects like APN on Rails. I wrote it because I had an iPhone app (no longer available) that I wanted notifications for, and there was nothing else available for Ruby to do the job. The plugin took off like crazy and I was overwhelmed with patches, questions, bugs, etc&#8230; That was great, and I was happy to help, for a time, but alas, I haven&#8217;t written an iPhone app for ages, and I just don&#8217;t have time to maintain a plugin that I wasn&#8217;t even using.</p>
<p>A while ago I realized that the best thing for APN on Rails, myself, and for the community was to find someone to take over the project so that it got the love it deserved. I put out the call and the good folks over at <a href="http://www.prx.org/">PRX</a> (Public Radio Exchange) answered the call. The folks at PRX have written some great iPhone apps, including the very popular &#8220;This American Life&#8221; app.</p>
<p>So I&#8217;m happy to announce that the new official home for APN on Rails is now at: <a href="http://github.com/PRX/apn_on_rails">http://github.com/PRX/apn_on_rails</a>. I ask that you continue to show the same support to PRX that you have shown to me over the life of this plugin.</p>
<p>Again, thank you to everyone, and thank you to Rebecca Nesson and the folks over at PRX for picking up the project and giving it renewed life.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2010/03/10/apn-on-rails-has-a-new-home/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ruby 1.9 &amp; Rails 3.0</title>
		<link>http://www.metabates.com/2010/02/08/ruby-1-9-rails-3-0/</link>
		<comments>http://www.metabates.com/2010/02/08/ruby-1-9-rails-3-0/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 15:06:27 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[active record]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=313</guid>
		<description><![CDATA[I&#8217;ve always been a big proponent of Ruby 1.9, I make no bones about it. My question is why wouldn&#8217;t you be? It&#8217;s faster, more powerful, easier to use, and makes things a lot clearer and cleaner than 1.8. So why then are pretty much all of us still running our applications on 1.8.x? Great [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been a big proponent of Ruby 1.9, I make no bones about it. My question is why wouldn&#8217;t you be? It&#8217;s faster, more powerful, easier to use, and makes things a lot clearer and cleaner than 1.8. So why then are pretty much all of us still running our applications on 1.8.x? Great question, and as far as I can tell there is really only 1 answer.</p>
<p>That answer? Because no one else is. It&#8217;s stupid really, but it&#8217;s the truth. We&#8217;re all afraid to run our applications in 1.9 because we don&#8217;t know many other people that are. Because of that it makes it hard for you to make your application work with 1.9 because all those gems and libraries  you use aren&#8217;t 1.9 compatible, so you&#8217;re forced to keep running your app on 1.8. And so the cycle continues.</p>
<p>Enter Rails 3.0. Here is a major upgrade to the most prominent web framework in the Ruby community, and I would argue the reason that most of us got into Ruby in the first place. This upgrade will force us all to make some pretty severe changes to our applications to make them fully compatible.  The changes in ActiveRecord alone are so sweeping and massive that we, as a community, are going to have to put some serious time into upgrade our applications. Yet, despite this, we are all going to do it.</p>
<p>Why are we all going to upgrade to Rails 3.0? Because it  looks cool and sexy, and we want those great new features and all those performance enhancements to make our applications run faster. Which leads me back to Ruby 1.9.</p>
<p>In Rails 3.0 they are dropping support for Ruby 1.8.6 and below in favor of Ruby &gt;1.8.7 and &gt;1.9.1. I propose that Rails 3.0 becomes Ruby 1.9 compatible only. Think about it. What a perfect opportunity for us all. We are all going to have to upgrade the libraries and gems we maintain to support Rails 3.0 and we are going to be upgrading our applications to Rails 3.0, so why not go full steam into Ruby 1.9?</p>
<p>There is no better time than now to push forward into the future as a whole community. Let&#8217;s put Ruby 1.8 behind and reap the benefits of what Ruby 1.9 has to offer. What do you say? Can we do it? I think we can.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2010/02/08/ruby-1-9-rails-3-0/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>APN on Rails Needs a Home</title>
		<link>http://www.metabates.com/2009/12/21/apn-on-rails-needs-a-home/</link>
		<comments>http://www.metabates.com/2009/12/21/apn-on-rails-needs-a-home/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 16:30:41 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[apn]]></category>
		<category><![CDATA[apn_on_rails]]></category>
		<category><![CDATA[apple push notifications]]></category>
		<category><![CDATA[push notification]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=304</guid>
		<description><![CDATA[Hey there everyone, recently I have been getting a lot of requests for bug fixes and new features for the APN on Rails gem that I wrote. While I appreciate that the gem is getting a lot of use and helping a lot of people out, I, unfortunately, no longer have the time to maintain [...]]]></description>
			<content:encoded><![CDATA[<p>Hey there everyone, recently I have been getting a lot of requests for bug fixes and new features for the APN on Rails gem that I wrote. While I appreciate that the gem is getting a lot of use and helping a lot of people out, I, unfortunately, no longer have the time to maintain the gem.</p>
<p>Recent changes in my career have meant that I have moved away from doing a lot o iPhone development, and because of that I no longer have the time, nor the desire, to keep maintaining a gem I&#8217;m no longer using.</p>
<p>So, because of that, I would to find a new home for the APN on Rails gem so that it gets the love and attention it so desires. Are there any takers out there? Is someone willing to take on the ownership of this, apparently, very useful gem? If you are willing to take it on, please let me know and we can workout the details.</p>
<p>Thanks to everyone who has said good things about the gem, and I&#8217;m glad that it has helped people get to using push notifications quicker, hopefully, one of you can take this project and run with it. Thanks again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2009/12/21/apn-on-rails-needs-a-home/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>First Book Review is a 5-Star One!</title>
		<link>http://www.metabates.com/2009/11/19/first-book-review-is-a-5-star-one/</link>
		<comments>http://www.metabates.com/2009/11/19/first-book-review-is-a-5-star-one/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 21:09:56 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Press]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[distributed programmig]]></category>
		<category><![CDATA[distributed programming with ruby]]></category>
		<category><![CDATA[distributed ruby]]></category>
		<category><![CDATA[drb]]></category>
		<category><![CDATA[rinda]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=295</guid>
		<description><![CDATA[About.com became the first, that I know about, to review my book, &#8220;Distributed Programming with Ruby&#8221;. What a great first review to have as well. They rated the book 5 out of 5 stars! The review can be found here. &#8220;Anyone working with distributed programming in Ruby will want this book.&#8221; The only downside they [...]]]></description>
			<content:encoded><![CDATA[<p>About.com became the first, that I know about, to review my book, &#8220;Distributed Programming with Ruby&#8221;. What a great first review to have as well. They rated the book 5 out of 5 stars! The review can be found <a href="http://ruby.about.com/od/bookreviews/gr/distributedprogramming.htm">here</a>.</p>
<blockquote><p>&#8220;Anyone working with distributed programming in Ruby will want this book.&#8221;</p></blockquote>
<p>The only downside they saw in the book, was that they wanted it to be longer! I have to save something for the 2nd edition, don&#8217;t I? <img src='http://www.metabates.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If you haven&#8217;t purchased yours yet, I encourage you to do so. It&#8217;s on sale at <a href="http://book.markbates.com">Amazon.com</a> right now.</p>
<p>If you have reviewed the book, or know of a review of the book, please pass it along.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2009/11/19/first-book-review-is-a-5-star-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Distributed Programming with Ruby &#8211; Now Available</title>
		<link>http://www.metabates.com/2009/11/12/distributed-programming-with-ruby-now-available/</link>
		<comments>http://www.metabates.com/2009/11/12/distributed-programming-with-ruby-now-available/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 20:40:31 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[distributed programmig]]></category>
		<category><![CDATA[distributed programming with ruby]]></category>
		<category><![CDATA[distributed ruby]]></category>
		<category><![CDATA[drb]]></category>
		<category><![CDATA[rinda]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=290</guid>
		<description><![CDATA[Well folks, it&#8217;s been a long road, nearly a year since I presented the idea for &#8220;Distributed Programming with Ruby&#8221; to Obie Fernandez in a hot tub in Florida, but finally my book is done, dusted, back from the printers and available for purchase from a variety of places, include Amazon.com! It was an absolutely [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://book.markbates.com"><img class="alignleft size-medium wp-image-231" style="margin: 10px;" title="Distributed Programming with Ruby" src="http://www.metabates.com/wp-content/uploads/2009/06/0321638360_bates_mech_page_3-261x300.jpg" alt="Distributed Programming with Ruby" width="261" height="300" /></a>Well folks, it&#8217;s been a long road, nearly a year since I presented the idea for &#8220;Distributed Programming with Ruby&#8221; to Obie Fernandez in a hot tub in Florida, but finally my book is done, dusted, back from the printers and available for purchase from a variety of places, include <a href="http://book.markbates.com">Amazon.com</a>!</p>
<p>It was an absolutely amazing experience and I can&#8217;t thank everyone involved with the project enough for all of their help, guidance, and having to put up with me over the past year.</p>
<p>I would go into detail about all the people I wish to thank, but I did that already in the book, and let&#8217;s be honest, you&#8217;re going to buy it and read it anyway, so I don&#8217;t want to ruin the surprise. <img src='http://www.metabates.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;m sure you&#8217;ve already purchased your copy, but if you haven&#8217;t might I recommend you pop over to <a href="http://book.markbates.com">Amazon</a> right now and pick yourself up a copy. They&#8217;re selling pretty well and you don&#8217;t want to miss out, do you? I didn&#8217;t think so.</p>
<p>If you are someone with a popular blog and you would like to do a review of the book, please drop me a line and I&#8217;ll see what we can do about hooking you up with a copy. Please understand, though, the publishers aren&#8217;t going to send out copies to everyone who requests them, so there will be a bit of vetting going on.</p>
<p>Also, if you have already purchased the book if you wouldn&#8217;t mind leaving a review of it on <a href="http://book.markbates.com">Amazon</a>, that would be much appreciated. It doesn&#8217;t matter where you bought the book, if you could leave a review there, it will really make a difference. Thanks.</p>
<h3><a href="http://book.markbates.com">Buy &#8220;Distributed Programming with Ruby&#8221; Today!</a></h3>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2009/11/12/distributed-programming-with-ruby-now-available/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Introducing Warp Drive for Rails</title>
		<link>http://www.metabates.com/2009/10/07/introducing-warp-drive-for-rails/</link>
		<comments>http://www.metabates.com/2009/10/07/introducing-warp-drive-for-rails/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 13:00:19 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[engines]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[warp drive]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=269</guid>
		<description><![CDATA[At work recently we had a need to build a large Rails application that we then wanted to, for lack of a better word, subclass. Unfortunately there is no real good way of doing that. Rails Engines and templates have way too may limitations. We wanted to bundle up the entire Rails app (models, controllers, [...]]]></description>
			<content:encoded><![CDATA[<p>At work recently we had a need to build a large Rails application that we then wanted to, for lack of a better word, subclass. Unfortunately there is no real good way of doing that. Rails Engines and templates have way too may limitations. We wanted to bundle up the entire Rails app (models, controllers, views, routes, migrations, configurations, libs, assets, etc&#8230; everything!), but there was no good way of doing that. Well, now there is, it&#8217;s called the Warp Drive.</p>
<p>I&#8217;ve decided to just include my README file below to explain what it is, since it&#8217;s a bit lengthy, and I don&#8217;t feel like retyping.</p>
<p>This is still in it&#8217;s early stages, so use with care, but it does seem to be working for us on a daily basis. Let me know what you think!</p>
<h2>What is Warp Drive?</h2>
<p>Warp Drive is what Rails Engines wish they could be, and more! They kick Rails templates in the ass, and they beat keeping an ever evolving base Rails app up to date.</p>
<h3>What are Rails Engines?</h3>
<p>Rails Engines allow you to package up some of a Rails app (controllers, models, views, routes, libs) and put them in a plugin that can be included into a new Rails app, thereby giving it the functionality you had in the engine. That sounds good, but what about the downsides of using an engine? Well, you can&#8217;t override or extend any of the functionality from the engine in your main application. You can hack at the plugin, but now you&#8217;ve made it difficult to update. So what do you do if you want to add or alter a method to a controller or model? What do you do if you want to change the look and feel of a view? You have to copy everything into your main application. Boo!</p>
<p>Rails Engines also don&#8217;t allow you to package up migrations, assets, plugins, initializers, etc&#8230; All the fun stuff that you&#8217;ve come to know and love about a Rails application.</p>
<h3>Enter the Warp Drive!</h3>
<p>So what is a Warp Drive? Great question. To put it simply a Warp Drive is a standard, full featured, Rails application that you can easily bundle up into a Ruby Gem, and include into another Rails app. That second Rails app now has all the power of the first Rails. That is all there is to it.</p>
<h2>Creating a Warp Drive.</h2>
<p>Let&#8217;s assume we have an application that implements AuthLogic for handling user registration/authentication. We have controllers, views, models, plugins, initializers, configurations, migrations, tasks, etc&#8230; it&#8217;s a full featured fully functional Rails application, we call it authenticator.</p>
<p>We want to turn our authenticator application into a Warp Drive. We can do it in three simple steps, the first two steps you only need to do the first time, to set everything up.</p>
<ol>
<li><code>$ gem install warp_drive</code></li>
<li><code>$ warpify</code><br />
That will add a little bit of code to your <code>Rakefile</code>. That code simply requires the Warp Drive gem, and gives you hooks to configure the gem of your Warp Drive application.</li>
<li>$ <code>rake warp_drive:compile</code> (<code>rake warp_drive:install</code>)This will either compile your gem for your (<code>warp_drive:compile</code>) or compile and install your gem (<code>warp_drive:install</code>)</li>
</ol>
<p>That&#8217;s it! You should now have your Rails application bundled up and/or installed as a RubyGem!</p>
<h2>Using a Warp Drive.</h2>
<p>With your fancy new Warp Drive, authenticator, built and installed how do you use it in that new application your building? Again, it&#8217;s stupid easy, and it only takes one step, that only needs to be run once:</p>
<ol> <code>$ install_warp_drive authenticator</code></ol>
<p>That will put a few lines of code in your <code>Rakefile</code>, so you have access to all the <code>Rakefile</code> tasks in your Warp Drive, and a line in your <code>config/environment.rb</code> so that it will load your Warp Drive when you launch your application.</p>
<p>That&#8217;s it! You&#8217;re done. Now you can run <code>rake db:migrate</code> to run the migrations from both your Warp Drive and your new application. Enjoy!</p>
<h2>Overriding, Extending, and Other Such Fun Things</h2>
<h3>Overriding and Extending</h3>
<p>You&#8217;ve been enjoying your new Warp Drive back application for a little while now, but you decide you really need to change an action in your controller, how do you go about that? Simple, just like you would any normal alteration to a Ruby class.</p>
<p>Example:<br />
Here is what the action looks like in our Warp Drive UsersController:</p>
<pre><code>
  def new
    @user = User.new
  end
</code></pre>
<p>In our new application we can just open up the UsersController like this:</p>
<pre><code>
  class UsersController &lt; ApplicationController

    def new_with_default_name
      new_without_default_name
      @user.login = 'default_name'
    end

    alias_method_chain :new, :default_name

  end
</code></pre>
<p>Viola! The same works for any thing else in the system, models, libs, etc&#8230; In our example we used <code>alias_method_chain</code> to retain the original method, but we could have completely rewritten the method as well.</p>
<p>You can also plop in a new view and it will override the view that was in your Warp Drive. The sky is really the limit.</p>
<h3>Assets</h3>
<p>You can easily bundle assets from your public directory in your Warp Drive. Just make sure they are in folders called <code>warp_drive</code>. Those folders will then be symlinked to your new project&#8217;s public directory when the application starts up.</p>
<h3>Keep Those Rake Tasks Private!</h3>
<p>We all them, Rake tasks we have created to help us do all sorts of things, and we usually don&#8217;t want them to ship. Well, Warp Drive has you covered there. Just place your tasks in folders called <code>private</code> and Bob&#8217;s your uncle they won&#8217;t be available in the compiled gem.</p>
<pre><code>
  lib/
    tasks/
      foo.rake
      private/
        bar.rake
</code></pre>
<p>In this example <code>foo.rake</code> will be available to clients of your Warp Drive, but <code>bar.rake</code> will not be.</p>
<p>Copyright (c) 2009 Mark Bates</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2009/10/07/introducing-warp-drive-for-rails/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 3.980 seconds -->
<!-- Cached page served by WP-Cache -->
