<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Shannon McPherson's Web Log &#187; ruby</title>
	<atom:link href="http://mcphersonz.wordpress.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://mcphersonz.wordpress.com</link>
	<description>random crap, mostly about programming or opperating systems.</description>
	<lastBuildDate>Thu, 12 Nov 2009 13:36:59 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='mcphersonz.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/9aa4358306dc01fdf45c7063218041fb?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Shannon McPherson's Web Log &#187; ruby</title>
		<link>http://mcphersonz.wordpress.com</link>
	</image>
			<item>
		<title>The RSpec Book by David Chelimsky, Dave Astels, Zach Dennis, Aslak Hellesøy, Bryan Helmkamp, Dan North</title>
		<link>http://mcphersonz.wordpress.com/2009/05/13/the-rspec-book-by-david-chelimsky-dave-astels-zach-dennis-aslak-helles%c3%b8y-bryan-helmkamp-dan-north/</link>
		<comments>http://mcphersonz.wordpress.com/2009/05/13/the-rspec-book-by-david-chelimsky-dave-astels-zach-dennis-aslak-helles%c3%b8y-bryan-helmkamp-dan-north/#comments</comments>
		<pubDate>Wed, 13 May 2009 08:39:46 +0000</pubDate>
		<dc:creator>mcphersonz</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mcphersonz.wordpress.com/?p=80</guid>
		<description><![CDATA[I felt compelled to post this because this book is just great &#38; I wanted to share it with anyone who is interested. If you are just getting into behavior driven development (BDD), RSpec or cucumber then I have a book to recommend to you! Having heard nothing but good things, I recently purchased &#8220;The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=80&subd=mcphersonz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I felt compelled to post this because this book is just great &amp; I wanted to share it with anyone who is interested. If you are just getting into behavior driven development (BDD), RSpec or cucumber then I have a book to recommend to you! Having heard nothing but good things, I recently purchased &#8220;<a href="http://www.pragprog.com/titles/achbd/the-rspec-book" target="_blank">The RSpec Book</a>&#8221; by David Chelimsky, Dave Astels, Zach Dennis, Aslak Hellesøy, Bryan Helmkamp, Dan North from Pragmatic Programmers.</p>
<p>It&#8217;s a easy read that is packed with great tips on how to approach BDD &#8211; as well as detailed info on rspec&#8217;s features, and tons of other very useful stuff.</p>
<p>The book is in beta right now (not finished) but you can purchase &amp; get the PDF right now. As updates are made you can re-download the PDF. Once the book is actually finished as paperback will be sent to me. I can&#8217;t wait!</p>
<p>Worth mentioning is that I  am just a fan &#8212; not affiliated with anyone who makes money from this, nor do I make any money for posting this or my website in general. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcphersonz.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcphersonz.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcphersonz.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcphersonz.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcphersonz.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcphersonz.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcphersonz.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcphersonz.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcphersonz.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcphersonz.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=80&subd=mcphersonz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcphersonz.wordpress.com/2009/05/13/the-rspec-book-by-david-chelimsky-dave-astels-zach-dennis-aslak-helles%c3%b8y-bryan-helmkamp-dan-north/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/021b171a2eca6472ee63699c3abeafbb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">mcphersonz</media:title>
		</media:content>
	</item>
		<item>
		<title>Recommended Gems, Plugins and various notes on what&#8217;s hot in the ruby on rails world</title>
		<link>http://mcphersonz.wordpress.com/2009/05/13/recommended-gems-plugins-and-various-notes-on-whats-hot-in-the-ruby-on-rails-world/</link>
		<comments>http://mcphersonz.wordpress.com/2009/05/13/recommended-gems-plugins-and-various-notes-on-whats-hot-in-the-ruby-on-rails-world/#comments</comments>
		<pubDate>Wed, 13 May 2009 08:30:12 +0000</pubDate>
		<dc:creator>mcphersonz</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mcphersonz.wordpress.com/?p=76</guid>
		<description><![CDATA[Performance Optimization
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
- optimization doesn&#8217;t end with speeding up my Ruby code (or Rails itself).
The performance of production application heavily depends on its environment &#8211; server filesystems, databases, load balancing solutions.
Testing
&#8212;&#8212;-
- use gems like UnitRecord or dust to cut off the database for unit testing. Mock all unit tests out to speed things up drastically.
- to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=76&subd=mcphersonz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Performance Optimization<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
- optimization doesn&#8217;t end with speeding up my Ruby code (or Rails itself).<br />
The performance of production application heavily depends on its environment &#8211; server filesystems, databases, load balancing solutions.</p>
<p>Testing<br />
&#8212;&#8212;-<br />
- use gems like UnitRecord or dust to cut off the database for unit testing. Mock all unit tests out to speed things up drastically.<br />
- to scale large tests you can offload them to remote BAMs(Bad Ass Machines), or send tests to multiple processors. Deep Test allows you to spawn multiple remote threads to run functional tests<br />
- to benchmark a specific url you can use the ab (Apache HTTP server benchmarking tool) command:  ab -n 100 <a href="http://localhost:3000/quick_reply/list" rel="nofollow">http://localhost:3000/quick_reply/list</a><br />
- Errorlytics web service detects 404 errors via JS &amp; redirects user based on rules that you define at errorlytics.com &#8211; <a href="http://www.errorlytics.com/" rel="nofollow">http://www.errorlytics.com/</a><br />
- Using factories instead of fixtures.<br />
- Fixtures are more brittle &amp; they seperate the data from the test, creating a assumption that the data already exists &amp; is correct to begin with.<br />
- Factories &#8230;. Fixjour, Factory Girl, Object_daddy and Machinist are plugins that aim at creating factories.<br />
- Cucumber tips: <a href="http://media.railscasts.com/videos/159_more_on_cucumber.mov" rel="nofollow">http://media.railscasts.com/videos/159_more_on_cucumber.mov</a></p>
<p>Cucumber<br />
&#8212;&#8212;&#8211;<br />
- Write tests first, the run cucumber. To run a specific feature run: cucumber features/name.feature<br />
- Use output of cucumber to create stub step definitions.<br />
- Make each test pass, from the top down.</p>
<p>Feature: title<br />
In Order To [business value]<br />
As a [role]<br />
I want to [action] some feature</p>
<p>Scenatio: title<br />
When [context]<br />
And [more contect]<br />
When I do [action]<br />
And [other action]<br />
Then I should see [outcome]<br />
But I should not see [outcome]</p>
<p>Database<br />
&#8212;&#8212;&#8211;<br />
- CouchDB is a new way to think about database storage. Schema-less design. <a href="http://couchdb.apache.org/" rel="nofollow">http://couchdb.apache.org/</a></p>
<p>Video / Screen / Pod casts<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><a href="http://railscasts.com/episodes" rel="nofollow">http://railscasts.com/episodes</a></p>
<p><a href="http://peepcode.com" rel="nofollow">http://peepcode.com</a></p>
<p><a href="http://pivotallabs.com/talks/" rel="nofollow">http://pivotallabs.com/talks/</a></p>
<p><a href="http://www.railsenvy.com/podcast" rel="nofollow">http://www.railsenvy.com/podcast</a></p>
<p><a href="http://confreaks.com/events" rel="nofollow">http://confreaks.com/events</a></p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcphersonz.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcphersonz.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcphersonz.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcphersonz.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcphersonz.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcphersonz.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcphersonz.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcphersonz.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcphersonz.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcphersonz.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=76&subd=mcphersonz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcphersonz.wordpress.com/2009/05/13/recommended-gems-plugins-and-various-notes-on-whats-hot-in-the-ruby-on-rails-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://media.railscasts.com/videos/159_more_on_cucumber.mov" length="33131697" type="video/quicktime" />
	
		<media:content url="http://0.gravatar.com/avatar/021b171a2eca6472ee63699c3abeafbb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">mcphersonz</media:title>
		</media:content>
	</item>
		<item>
		<title>autotest+mumbles for Growl like notifications</title>
		<link>http://mcphersonz.wordpress.com/2008/08/27/autotestmumbles-for-growl-like-notifications/</link>
		<comments>http://mcphersonz.wordpress.com/2008/08/27/autotestmumbles-for-growl-like-notifications/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 03:01:01 +0000</pubDate>
		<dc:creator>mcphersonz</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mcphersonz.wordpress.com/?p=45</guid>
		<description><![CDATA[I was working with a colleague today who was kind enough to introduce me to autotest for continuous test integration. Change a file in your app &#38; tests are automatically run for you&#8230; Nice.
One thing that really stood out aesthetically was how status messages were passed to Growl (in OSX) for eye-pleasing popup notifications outside [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=45&subd=mcphersonz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was working with a colleague today who was kind enough to introduce me to autotest for continuous test integration. Change a file in your app &amp; tests are automatically run for you&#8230; Nice.</p>
<div id="attachment_52" class="wp-caption alignright" style="width: 310px"><a href="http://mcphersonz.files.wordpress.com/2008/08/screenshot.png"><img class="size-medium wp-image-52" src="http://mcphersonz.files.wordpress.com/2008/08/screenshot.png?w=300&#038;h=225" alt="my mumble alert" width="300" height="225" /></a><p class="wp-caption-text">screenshot of my mumble alert (top-right)</p></div>
<p>One thing that really stood out aesthetically was how status messages were passed to Growl (in OSX) for eye-pleasing popup notifications outside of a terminal window.</p>
<p>Being a <a href="http://www.ubuntu.com/getubuntu/download" target="_blank">ubuntu</a> user, I started looking for a similar solution for linux. It turns out there is a great utility for linux that resembles Growl &#8212; it&#8217;s called <a href="http://www.mumbles-project.org/" target="_blank">Mumbles</a>. The challenge was getting Mumbles to work with autotest.</p>
<p>After searching google, I found <a href="http://caffeinatedcode.wordpress.com/2008/02/22/mumble-your-tests/" target="_blank">one post that got me started</a>. This is a good post, but I had to fill in a few blanks to get everything to work.</p>
<p>Here&#8217;s what I did:</p>
<ol>
<li>Install ZenTest:</li>
</ol>
<ul>
<blockquote>
<li>sudo gem install ZenTest</li>
</blockquote>
</ul>
<ol>
<li>Install Mumbles
<ul>
<li>grab the latest .deb file or source from the <a href="http://www.mumbles-project.org/" target="_blank">mumbles-project</a> page:</li>
<blockquote>
<li>wget <a href="https://sourceforge.net/project/showfiles.php?group_id=193587&amp;package_id=227998" rel="nofollow">https://sourceforge.net/project/showfiles.php?group_id=193587&amp;package_id=227998</a></li>
</blockquote>
<li>test out mumbles by running:</li>
<blockquote>
<li>mumbles &amp;</li>
<li>mumbles-send &#8216;a title&#8217; &#8216;it works!!&#8217;</li>
</blockquote>
<li>assuming mumbles has been installed correctly, you should see a little notification pop up. I recommend that at this point you add mumbles to your system session so it will start when you login to ubuntu.</li>
<blockquote>
<li>gnome-session-properties</li>
<li>add -&gt; &#8220;mumbles&#8221; for name &amp; command -&gt; ok</li>
</blockquote>
</ul>
</li>
<li>Install ruby-dbus. I could not find a gem, so install manually:
<ul>
<li>grab the latest from <a href="https://trac.luon.net/ruby-dbus/" rel="nofollow">https://trac.luon.net/ruby-dbus/</a></li>
<blockquote>
<li>wget <a href="https://trac.luon.net/data/ruby-dbus/releases/ruby-dbus-0.2.1.tar.gz" rel="nofollow">https://trac.luon.net/data/ruby-dbus/releases/ruby-dbus-0.2.1.tar.gz</a></li>
</blockquote>
<li>extract the archive to a local directory</li>
<blockquote>
<li>tar -xvf ./ruby-dbus-0.2.1.tar.gz</li>
</blockquote>
<li>look over the README file &#8212; it provides simple instructions:</li>
<blockquote>
<li>ruby setup.rb config</li>
<li>ruby setup.rb setup</li>
<li>sudo ruby setup.rb install</li>
</blockquote>
<li>test this out by requiring dbus via irb:</li>
</ul>
<ul>
<blockquote>
<li>irb</li>
<li>irb(main):001:0&gt; require &#8216;dbus&#8217;</li>
<li>=&gt; true</li>
</blockquote>
</ul>
</li>
<li>Create a .autotest file in your application root directory (or your home directory to make the settings global) Thanks to <a href="//caffeinatedcode.wordpress.com/2008/02/22/mumble-your-tests/" target="_blank">CaffinatedCode</a> for this script &#8212; they wrote it:</li>
</ol>
<ul>
<blockquote>
<li>require &#8216;dbus&#8217;def send_message(title, message, icon)<br />
begin<br />
bus = DBus::SessionBus.instance<br />
mumbles_service = bus.service(&#8220;org.mumblesproject.Mumbles&#8221;)<br />
mumbles = mumbles_service.object(&#8220;/org/mumblesproject/Mumbles&#8221;)<br />
mumbles.introspect<br />
mumbles_iface = mumbles["org.mumblesproject.Mumbles"]<br />
sig = mumbles_iface.signals["Notify"]<br />
bus.emit(mumbles_service, mumbles, mumbles_iface, sig, title, message, icon)<br />
rescue Exception =&gt; e<br />
end<br />
end</p>
<p>Autotest.add_hook :ran_command do |at|<br />
begin<br />
output = at.results.last.slice(/(\d+) examples?, (\d+) failures?(, \d+ pending)?/)<br />
if output =~ /.*[1-9] failure.*/ then<br />
send_message(&#8220;FAIL&#8221;, &#8220;#{output}&#8221;, &#8220;fail.png&#8221;)<br />
else<br />
send_message(&#8220;PASS&#8221;, &#8220;#{output}&#8221;, &#8220;pass.png&#8221;)<br />
end<br />
rescue Exception =&gt; e<br />
end<br />
end</li>
</blockquote>
</ul>
<p>Now for the fun part. From within your app root, type:</p>
<p>autotest</p>
<p>If everything works out, you should see a few things flash by &#8211; I get a error about &#8220;Insecure world writable dir&#8221; in my home dir. I just ignored that. After that, you should see a test summary in the terminal window, followed by a mumbles popup notificaton. Kick ass!</p><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mcphersonz.wordpress.com/45/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mcphersonz.wordpress.com/45/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcphersonz.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcphersonz.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcphersonz.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcphersonz.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcphersonz.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcphersonz.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcphersonz.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcphersonz.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcphersonz.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcphersonz.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=45&subd=mcphersonz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcphersonz.wordpress.com/2008/08/27/autotestmumbles-for-growl-like-notifications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/021b171a2eca6472ee63699c3abeafbb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">mcphersonz</media:title>
		</media:content>

		<media:content url="http://mcphersonz.files.wordpress.com/2008/08/screenshot.png?w=300" medium="image">
			<media:title type="html">my mumble alert</media:title>
		</media:content>
	</item>
		<item>
		<title>What&#8217;s Poignant? Chunky Bacon!</title>
		<link>http://mcphersonz.wordpress.com/2008/07/26/whats-poignant-chunky-bacon/</link>
		<comments>http://mcphersonz.wordpress.com/2008/07/26/whats-poignant-chunky-bacon/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 18:24:31 +0000</pubDate>
		<dc:creator>mcphersonz</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mcphersonz.wordpress.com/?p=25</guid>
		<description><![CDATA[I feel like I have been in a cave for the last 6 months&#8230; Well, I sorta have. I&#8217;ve been working on a rails project for Epocrates.com for the last 6 months &#8212; a type of social network that joins wall street with MDs opted into market research. What a great learning experience &#38; opportunity. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=25&subd=mcphersonz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignleft" style="margin:10px;" src="http://photos3.meetupstatic.com/photos/event/e/1/9/4/global_2097748.jpeg" alt="Chunky Bacon" width="180" height="152" />I feel like I have been in a cave for the last 6 months&#8230; Well, I sorta have. I&#8217;ve been working on a rails project for <a href="http://www.epocrates.com" target="_blank">Epocrates.com</a> for the last 6 months &#8212; a type of social network that joins wall street with MDs opted into market research. What a great learning experience &amp; opportunity. It&#8217;ll be great one day&#8230;</p>
<div class="mceTemp">
<p>Anyway, I just discovered the &#8220;<a title="Why's (Poignant) Guide to Ruby" href="http://poignantguide.net/ruby/" target="_blank">Why&#8217;s (Poignant) Guide to Ruby</a>&#8221; today when I was looking at local ruby groups on <a title="San Jose Ruby Hackfest" href="http://ruby.meetup.com/117/" target="_blank">meetup.com</a> &#8211; I noticed a chunky bacon comic &amp; remembered a co-worker&#8217;s printout of one of these. &#8220;What is this?&#8221; I asked myself. 1 min on google &amp; there I was&#8230;. reading over ruby goodness &amp; chuckling over &#8220;Chunky Bacon&#8221; comics&#8230;. They grow on you &#8211; trust me.</div>
<p>I could only get to chapter 4 today (F.Y.I. A.D.D.4-I) &#8212; but it was a nice fresh take on ruby &amp; programming in general. Rather basic &amp; elementary so far, but recommended nonetheless.I never thought of an array as a caterpillar&#8230;  <a href="http://poignantguide.net/ruby/" target="_blank"></a></p>
<p><a href="http://poignantguide.net/ruby/" target="_blank">Check it out if you have not already</a>!</p><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mcphersonz.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mcphersonz.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcphersonz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcphersonz.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcphersonz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcphersonz.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcphersonz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcphersonz.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcphersonz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcphersonz.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcphersonz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcphersonz.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=25&subd=mcphersonz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcphersonz.wordpress.com/2008/07/26/whats-poignant-chunky-bacon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/021b171a2eca6472ee63699c3abeafbb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">mcphersonz</media:title>
		</media:content>

		<media:content url="http://photos3.meetupstatic.com/photos/event/e/1/9/4/global_2097748.jpeg" medium="image">
			<media:title type="html">Chunky Bacon</media:title>
		</media:content>
	</item>
		<item>
		<title>RailsConf 2008 was killer!</title>
		<link>http://mcphersonz.wordpress.com/2008/06/02/railsconf-2008-was-killer/</link>
		<comments>http://mcphersonz.wordpress.com/2008/06/02/railsconf-2008-was-killer/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 09:51:19 +0000</pubDate>
		<dc:creator>mcphersonz</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mcphersonz.wordpress.com/?p=21</guid>
		<description><![CDATA[I just got home from my trip to the RailsConf 2008 trip &#8212; it was the shit!
No time to say much now, other than it was great &#38; I hope you made it there&#8230;
What a great conference.
So many things from this event will change my approach to programming &#8212; I wish I had enough energy [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=21&subd=mcphersonz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I just got home from my trip to the <a href="http://en.oreilly.com/rails2008/public/content/home" target="_blank">RailsConf 2008</a> trip &#8212; it was the shit!</p>
<p>No time to say much now, other than it was great &amp; I hope you made it there&#8230;</p>
<p>What a great conference.</p>
<p>So many things from this event will change my approach to programming &#8212; I wish I had enough energy to post more details at this time, but I am exhausted. Look for a post in the near future about what I have learned &#8212; there&#8217;s a lot to share.</p>
<p>For now, check out info on the <a href="http://en.oreilly.com/rails2008/public/content/home" target="_blank">RailsConf website</a>.</p><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mcphersonz.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mcphersonz.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcphersonz.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcphersonz.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcphersonz.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcphersonz.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcphersonz.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcphersonz.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcphersonz.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcphersonz.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcphersonz.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcphersonz.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=21&subd=mcphersonz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcphersonz.wordpress.com/2008/06/02/railsconf-2008-was-killer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/021b171a2eca6472ee63699c3abeafbb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">mcphersonz</media:title>
		</media:content>
	</item>
		<item>
		<title>Updating Instiki from v0.10 to v0.13</title>
		<link>http://mcphersonz.wordpress.com/2008/04/12/updating-instiki-from-v010-to-v013/</link>
		<comments>http://mcphersonz.wordpress.com/2008/04/12/updating-instiki-from-v010-to-v013/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 10:17:58 +0000</pubDate>
		<dc:creator>mcphersonz</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mcphersonz.wordpress.com/?p=14</guid>
		<description><![CDATA[A company I work for uses Instiki to as a wiki-type system on the company intranet. Instiki is a simple RoR (Ruby on Rails) wiki clone written by David Heinemeier Hansson (&#8230; the creator of the Ruby on Rails framework). It&#8217;s a great app &#38; I would recommend looking into it if you have not [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=14&subd=mcphersonz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A company I work for uses <a href="http://www.instiki.org" target="_blank">Instiki</a> to as a wiki-type system on the company <a href="http://en.wikipedia.org/wiki/Intranet" target="_blank">intranet</a>. Instiki is a simple RoR (<a href="http://rubyonrails.com/">Ruby on Rails</a>) wiki clone written by <a href="http://www.loudthinking.com/" target="_blank">David Heinemeier Hansson</a> (&#8230; the creator of the Ruby on Rails framework). It&#8217;s a great app &amp; I would recommend looking into it if you have not already.</p>
<p>Anyway, I found that upgrading from v0.10 to v0.13 was a little challenging. Here&#8217;s what I did to make it work the way I wanted it to:</p>
<p><strong>1. <a href="http://rubyforge.org/frs/download.php/34016/instiki-0.13.0.tgz" target="_blank">Download</a> &amp; Install instiki v0.13. </strong>It&#8217;s damn easy. Follow onscreen directions. If you get stuck, see the <a href="http://www.instiki.org" target="_blank">Instiki</a> website.</p>
<p><strong>2. Dump data from v0.10 to a sql file. </strong></p>
<p>There is a dump script for recent versions of instiki, but I did not see the v0.10 install. The dump script is called &#8220;import_storage&#8221;.</p>
<p>You can use the &#8220;import_storage &#8220;script that comes with v0.13 to dump the data from your v0.10 install by executing the following from within instiki v0.13 app root directory:</p>
<blockquote><p>ruby script/import_storage -t /tmp/i2500 -i /usr/local/instiki-0.10.1/ -d mysql -o /tmp/instiki_20080408-1.sql</p>
<p><strong><em>where:</em></strong><br />
/usr/local/instiki-0.10.1/ is the path to the 0.10 app<br />
/tmp/instiki_20080408-1.sql  is the path of the dump file<br />
/tmp/12500 is a temp path (may or may not be needed depending on system permissions)</p></blockquote>
<p>From there, you should have a sql file that contains a dump of the current v0.10 database in the form of a .sql file located at:  /tmp/instiki_20080408-1.sql</p>
<p><strong>3. Load up 0.10 data into the 0.13 database<br />
</strong></p>
<p>When you installed instiki 0.13, you created a new database. Let&#8217;s call that database &#8220;wiki&#8221;. You need to load the sql file you just created into that database now.</p>
<p>You can load the .sql file into your mysql &#8216;wiki&#8217; database by executing:</p>
<blockquote><p>$ mysql -u[username] -p[password] wiki &lt; /tmp/instiki_20080408-1.sql</p></blockquote>
<p><strong>4. Empty the SPAM pattern file</strong></p>
<p>v0.13 contains a SPAM detection feature that uses keywords. Cool idea, but the default list of patterns is kinda odd. For example, any page that contains the following words will be marked as SPAM: airplane, good job, hamburger&#8230;. and a ton of other totally random words. I would definitely recommend emptying the SPAM pattern file (and adding words as necessary if needed).</p>
<p>You can empty the SPAM pattern file by executing:</p>
<blockquote><p>echo &#8220;&#8221; &gt; [app root]/config/spam_patterns.txt</p></blockquote>
<p><strong>5. Allow forward-slash (/) to appear in page names.</strong></p>
<p>With instiki v0.10, page names could contain forward slashes in them, for example: &#8220;CARS/TRUCKS&#8221;. When I installed v0.13, I found that links to these pages would cause a internal server error &#8211; a error screen was displayed instead of the page I wanted. Not sure if this is due to changes with rails, routing, or instiki itself, but I was able to change the routes to behave the way I wanted them to by adding 1 line to [app root]/config/routes.rb&#8230;.</p>
<p>after the last &#8220;connect_to_web&#8221; line in routes.rb, I added:</p>
<blockquote><p>connect_to_web map, &#8216;:web/show/*id&#8217;, :controller =&gt; &#8216;wiki&#8217;, :action =&gt; &#8217;show&#8217;</p></blockquote>
<p>This should &#8220;glob&#8221; any text after :web/show to an array. Also, you will then need to edit the &#8220;load_page&#8221; method in [app root]/app/controllers/wiki_controller.rb to work with the array (it expects a string by default).</p>
<p>Search [app root]/app/controllers/wiki_controller.rb for &#8220;def load_page&#8221;, and replace the line:</p>
<blockquote><p>@page_name = params['id']</p></blockquote>
<p>with:</p>
<blockquote><p>@page_name = params['id'].to_a.join(&#8216;/&#8217;)</p></blockquote>
<p>At that point, you should be able to use forward slashes in page names.</p>
<p><strong>6. Tweak the HTML sanitization file<br />
</strong></p>
<p>Lastly, I tweaked the [app root]/lib/sanitize.rb file a bit. You may need to add elements to the &#8220;acceptable_elements&#8221; array as needed (top of the file). But more importantly, I found that HTML that was entered in uppercase (for example, &lt;BR&gt; or &lt;H1&gt;) was being escaped. I know it&#8217;s old-school HTML, but that&#8217;s what the company&#8217;s wiki contained. So, rather than updating the HTML, I made the wiki accept it. It seems that because it is uppercase, it fails to match the acceptable list of tags.  I changed the sanitize_html method to be:</p>
<blockquote><p><strong>def sanitize_html(html)</strong><br />
if html.index(&#8220;&lt;&#8221;)<br />
tokenizer = HTML::Tokenizer.new(html)<br />
new_text = &#8220;&#8221;</p>
<p>while token = tokenizer.next<br />
node = XHTML::Node.parse(nil, 0, 0, token, false)<br />
new_text &lt;&lt; case node.tag?<br />
when true<br />
<strong> if ALLOWED_ELEMENTS.include?(node.name.downcase)</strong><br />
if node.closing != :close<br />
node.attributes.delete_if { |attr,v| !ALLOWED_ATTRIBUTES.include?(attr) }<br />
ATTR_VAL_IS_URI.each do |attr|<br />
val_unescaped = <strong>CGI.unescapeHTML(node.attributes[attr].to_s).gsub(/[00-40\177-\240]+/,&#8221;).downcase</strong><br />
if val_unescaped =~ /^[a-z0-9][-+.a-z0-9]*:/ and !ALLOWED_PROTOCOLS.include?(val_unescaped.split(&#8216;:&#8217;)[0])<br />
node.attributes.delete attr<br />
end<br />
end<br />
if node.attributes['style']<br />
node.attributes['style'] = sanitize_css(node.attributes['style'])<br />
end<br />
end<br />
node.to_s<br />
else<br />
node.to_s.gsub(/&lt;/, &#8220;&lt;&#8221;)<br />
end<br />
else<br />
node.to_s.gsub(/&lt;/, &#8220;&lt;&#8221;)<br />
end<br />
end</p>
<p>html = new_text<br />
end<br />
html<br />
<strong> end</strong></p></blockquote>
<p>&#8230; the main difference is the addition of &#8220;downcase&#8221; methods to the comparison lines.</p>
<p>That&#8217;s it. Works great for me. Please let me know if this was helpful, or if you have a better way to achieve these results!</p><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mcphersonz.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mcphersonz.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcphersonz.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcphersonz.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcphersonz.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcphersonz.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcphersonz.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcphersonz.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcphersonz.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcphersonz.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcphersonz.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcphersonz.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=14&subd=mcphersonz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcphersonz.wordpress.com/2008/04/12/updating-instiki-from-v010-to-v013/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/021b171a2eca6472ee63699c3abeafbb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">mcphersonz</media:title>
		</media:content>
	</item>
		<item>
		<title>Parse PubMed database using their API + ruby + ActiveRecord</title>
		<link>http://mcphersonz.wordpress.com/2008/03/23/parse-pubmed-database-using-their-api-ruby-activerecord/</link>
		<comments>http://mcphersonz.wordpress.com/2008/03/23/parse-pubmed-database-using-their-api-ruby-activerecord/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 19:22:02 +0000</pubDate>
		<dc:creator>mcphersonz</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ActiveRecord]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[PubMed]]></category>

		<guid isPermaLink="false">http://mcphersonz.wordpress.com/?p=12</guid>
		<description><![CDATA[In case any of you need to parse the PubMed database, here&#8217;s what I came up with as a first try. Run via a ruby script. You will need ruby, ActiveRecord (if you have rails setup, you should be good), and a few libraries &#8212; use gem install [x] for the libraries that you don&#8217;t [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=12&subd=mcphersonz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In case any of you need to parse the PubMed database, here&#8217;s what I came up with as a first try. Run via a ruby script. You will need ruby, ActiveRecord (if you have rails setup, you should be good), and a few libraries &#8212; use gem install [x] for the libraries that you don&#8217;t have &#8212; if you have rails installed, you probably only need to get &#8220;xmlsimple&#8221;.</p>
<blockquote><p> gem install xmlsimple</p></blockquote>
<p>I used 3 tables in my mysql database: articles, authors, and a join table articles_authors</p>
<p>Here&#8217;s the schema:</p>
<blockquote><p>DROP TABLE IF EXISTS `pubmed`.`articles`;<br />
CREATE TABLE  `pubmed`.`articles` (<br />
`id` int(11) NOT NULL auto_increment,<br />
`pubmed_id` int(11) NOT NULL,<br />
`source` varchar(50) character set latin1 default NULL,<br />
`title` varchar(255) character set latin1 default NULL,<br />
`full_journal_name` varchar(255) character set latin1 default NULL,<br />
`author_list` varchar(255) character set latin1 default NULL,<br />
`pub_date` date default NULL,<br />
PRIMARY KEY  (`id`)<br />
) ENGINE=MyISAM AUTO_INCREMENT=34013 DEFAULT CHARSET=utf8;</p>
<p>DROP TABLE IF EXISTS `pubmed`.`articles_authors`;<br />
CREATE TABLE  `pubmed`.`articles_authors` (<br />
`article_id` int(11) NOT NULL,<br />
`author_id` int(11) NOT NULL<br />
) ENGINE=MyISAM DEFAULT CHARSET=latin1;</p>
<p>DROP TABLE IF EXISTS `pubmed`.`authors`;<br />
CREATE TABLE  `pubmed`.`authors` (<br />
`id` int(11) NOT NULL auto_increment,<br />
`name` varchar(255) default NULL,<br />
`pubmed_id` int(11) default NULL,<br />
PRIMARY KEY  (`id`)<br />
) ENGINE=MyISAM AUTO_INCREMENT=69002 DEFAULT CHARSET=latin1;</p></blockquote>
<p>Here&#8217;s the ruby script:</p>
<blockquote><pre>
# #!/usr/local/bin/ruby -w

# Require Files &amp; Libs

require 'net/http'

require 'rubygems'

require 'active_record'

require 'xmlsimple'

# App Configuration Settings

empty_tables = true

# Search Settings

searchRelDate = 7

searchLimit = 100000

batch_size = 100

searchUrlBase = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&amp;retmax=#{searchLimit}&amp;"

summaryUrlBase = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&amp;retmode=xml&amp;id="

# Database Settings:

db_host    = "localhost"

db_user    = "root"

db_pass    = "password"

db_schema  = "pubmed"

# Header Output:

puts  "#"

puts  "# PubMed parsing tool."

dash = "========================================================================="

# Connect to DB using Active Record:

ActiveRecord::Base.establish_connection(:adapter=&gt;"mysql", :database=&gt;db_schema, :username=&gt;db_user, :password=&gt;db_pass, :host=&gt;db_host)

# Define SearchResults model:

class Article &lt; ActiveRecord::Base

  set_table_name "articles"

end

class Author &lt; ActiveRecord::Base

  set_table_name "authors"

end

class ArticleAuthor  0

          property['Item'].each{|author| article[:authors] &lt; "#{article_summary['Id']}",

        :source =&gt; article['Source'],

        :title =&gt; article['Title'],

        :full_journal_name =&gt; article['FullJournalName'],

        :pub_date =&gt; article['PubDate'],

        :author_list =&gt; article[:authors].join(', ')

      )

      # Add Authors to database:

      article[:authors].each{|author|

        # See if the author exists already:

        exists = Author.find_all_by_name("#{author}")    

        if exists.length == 0

          new_author = Author.create(

            :name =&gt; author,

            :pubmed_id =&gt; "#{article_summary['Id']}"

          )

        else

          new_author = exists[0]

        end

        # Add to join table:

        ArticleAuthor.create(

          :author_id =&gt;  new_author.id,

          :article_id =&gt;  new_article.id

        )

      } 

    }

  batch_current += 1

end
</pre>
</blockquote>
<p>From there, you can run queries like this:</p>
<blockquote><p>SELECT author_id, authors.name, count(author_id)<br />
FROM articles_authors, authors<br />
WHERE articles_authors.author_id = authors.id<br />
GROUP BY author_id<br />
ORDER BY count(author_id) desc</p>
<p>SELECT articles.pubmed_id, authors.name, articles.title, articles.source, articles.pub_date, articles.id<br />
FROM articles_authors, authors, articles<br />
WHERE articles_authors.author_id = authors.id and articles_authors.article_id = articles.id<br />
and authors.name = &#8220;Li Y&#8221;<br />
GROUP BY articles.pubmed_id</p></blockquote><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mcphersonz.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mcphersonz.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcphersonz.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcphersonz.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcphersonz.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcphersonz.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcphersonz.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcphersonz.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcphersonz.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcphersonz.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcphersonz.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcphersonz.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=12&subd=mcphersonz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcphersonz.wordpress.com/2008/03/23/parse-pubmed-database-using-their-api-ruby-activerecord/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/021b171a2eca6472ee63699c3abeafbb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">mcphersonz</media:title>
		</media:content>
	</item>
		<item>
		<title>Pure ruby CRON jobs on rails.</title>
		<link>http://mcphersonz.wordpress.com/2007/10/09/pure-ruby-cron-jobs-on-rails/</link>
		<comments>http://mcphersonz.wordpress.com/2007/10/09/pure-ruby-cron-jobs-on-rails/#comments</comments>
		<pubDate>Tue, 09 Oct 2007 21:10:34 +0000</pubDate>
		<dc:creator>mcphersonz</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mcphersonz.wordpress.com/2007/10/09/pure-ruby-cron-jobs-on-rails/</guid>
		<description><![CDATA[Installing
I found a post by &#8220;Loren Johnson&#8221; that had code that worked well for me:
rails test
sudo gem install daemons
cd test
ruby script/plugin install http://svn.kylemaxwell.com/rails_plugins/daemon_generator/trunk
ruby script/generate daemon tester
Using
First off, check out the (brief)  Daemon Generator readme file.
Open up the file that was generated from the &#8220;generate&#8221; command above:
/lib/daemons/tester.rb
It&#8217;s short &#8212; take a look. This is where [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=5&subd=mcphersonz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Installing</strong><br />
I found a post by &#8220;Loren Johnson&#8221; that had code that worked well for me:</p>
<p>rails test<br />
sudo gem install daemons<br />
cd test<br />
ruby script/plugin install <a href="http://svn.kylemaxwell.com/rails_plugins/daemon_generator/trunk" rel="nofollow">http://svn.kylemaxwell.com/rails_plugins/daemon_generator/trunk</a><br />
ruby script/generate daemon tester</p>
<p><strong>Using</strong><br />
First off, check out the (brief)  <a href="http://svn.kylemaxwell.com/rails_plugins/daemon_generator/tags/rel-0.5.0/README" target="_blank">Daemon Generator readme file.</a></p>
<p>Open up the file that was generated from the &#8220;generate&#8221; command above:<br />
/lib/daemons/tester.rb<br />
It&#8217;s short &#8212; take a look. This is where your custom stuff will added. More on that later.</p>
<p>Open up your /log/xyz.log file (development.log, production.log, etc) &#8212; it should have a message like this: This daemon is still runnig at Tue Oct 09 13:43:38 -0700 2007.</p>
<p>&#8230;That was inserted by a function stub created within tester.rb.</p>
<p>Change tester.rb to do something useful&#8230; As a simple example, I changed the line in tester.rb  from:<br />
ActiveRecord::Base.logger &lt;&lt; &#8220;This daemon is still running at #{Time.now}.\n&#8221;<br />
to:<br />
ActiveRecord::Base.logger &lt;&lt; &#8220;Disk space free: &#8220;+`df -hl | grep /dev/sda2`+&#8221;\n&#8221;</p>
<p>&#8230;.. you get the idea.</p>
<p>NOTE that changing the code within the file tester.rb does not take effect until you restart the daemon:   ruby script/daemons restart</p>
<p><strong>Links</strong><br />
<a href="http://kylemaxwell.typepad.com/everystudent/2006/08/after_writing_r.html" target="_blank">http://kylemaxwell.typepad.com/everystudent/2006/08/after_writing_r.html</a><br />
<a href="http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails" target="_blank">http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails</a><br />
<a href="http://douglasfshearer.com/blog/cron-jobs-in-ruby-on-rails" target="_blank">http://douglasfshearer.com/blog/cron-jobs-in-ruby-on-rails</a></p><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mcphersonz.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mcphersonz.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcphersonz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcphersonz.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcphersonz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcphersonz.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcphersonz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcphersonz.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcphersonz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcphersonz.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcphersonz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcphersonz.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=5&subd=mcphersonz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcphersonz.wordpress.com/2007/10/09/pure-ruby-cron-jobs-on-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/021b171a2eca6472ee63699c3abeafbb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">mcphersonz</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby LDAP Authentication with net/ldap</title>
		<link>http://mcphersonz.wordpress.com/2007/10/09/ruby-ldap-authentication-with-netldap/</link>
		<comments>http://mcphersonz.wordpress.com/2007/10/09/ruby-ldap-authentication-with-netldap/#comments</comments>
		<pubDate>Tue, 09 Oct 2007 06:09:09 +0000</pubDate>
		<dc:creator>mcphersonz</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mcphersonz.wordpress.com/2007/10/09/ruby-ldap-authentication-with-netldap/</guid>
		<description><![CDATA[I&#8217;m working on a Rails project that requires LDAP authentication.
I searched the net for a long time, but finally got something to work for me.
&#8230;  just use your own username, password &#38; hostname.
Note that the username and password should be contained in SINGLE QUOTES unless you have some reason to use double quotes&#8230;. that messed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=4&subd=mcphersonz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m working on a Rails project that requires LDAP authentication.</p>
<p>I searched the net for a long time, but finally got something to work for me.</p>
<p>&#8230;  just use your own username, password &amp; hostname.</p>
<p>Note that the username and password should be contained in SINGLE QUOTES unless you have some reason to use double quotes&#8230;. that messed me up for a while.</p>
<p>&lt;pre&gt;<br />
require &#8216;rubygems&#8217;<br />
require &#8216;net/ldap&#8217;</p>
<p>user = &#8216;DOMAIN_NAME\my_username&#8217;<br />
pass = &#8216;my_password&#8217;<br />
ldap = Net::LDAP.new :host =&gt; &#8220;x.x.x.x&#8221;, :port =&gt; 389, :auth =&gt; {:method =&gt; :simple, :username =&gt; user, :password =&gt; pass}<br />
p (ldap.bind) ? &#8220;Authorization Succeeded!&#8221; : &#8220;Authorization Failed: #{ldap.get_operation_result.message}&#8221;<br />
&lt;/pre&gt;</p><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mcphersonz.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mcphersonz.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcphersonz.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcphersonz.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcphersonz.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcphersonz.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcphersonz.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcphersonz.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcphersonz.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcphersonz.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcphersonz.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcphersonz.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=4&subd=mcphersonz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcphersonz.wordpress.com/2007/10/09/ruby-ldap-authentication-with-netldap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/021b171a2eca6472ee63699c3abeafbb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">mcphersonz</media:title>
		</media:content>
	</item>
		<item>
		<title>Freedb parser</title>
		<link>http://mcphersonz.wordpress.com/2007/05/10/freedb-parser/</link>
		<comments>http://mcphersonz.wordpress.com/2007/05/10/freedb-parser/#comments</comments>
		<pubDate>Thu, 10 May 2007 04:55:08 +0000</pubDate>
		<dc:creator>mcphersonz</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://mcphersonz.wordpress.com/2007/05/10/freedb-parser/</guid>
		<description><![CDATA[I have been working on a program that will help with mp3 ID3 tags. The idea is that the program will analyze any available data (artist, album, track length, genre,  etc) against a huge database of information. From there, you could add data to the mp3 tags based on match results.
Anyway, here&#8217;s what I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=3&subd=mcphersonz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have been working on a program that will help with mp3 ID3 tags. The idea is that the program will analyze any available data (artist, album, track length, genre,  etc) against a huge database of information. From there, you could add data to the mp3 tags based on match results.</p>
<p>Anyway, here&#8217;s what I have so far &#8212; it&#8217;s a ruby program that you execute from a command line. Combined with a freedb database (freedb.org), this script parses the data into a mySQL database. I work on one genre at a time &#8212; there are over 700k records in the rock &amp; misc categories &#8212; any more would start to create memory issues.</p>
<p>Send me a email if you are interested in the code.</p><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mcphersonz.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mcphersonz.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcphersonz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcphersonz.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcphersonz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcphersonz.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcphersonz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcphersonz.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcphersonz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcphersonz.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcphersonz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcphersonz.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcphersonz.wordpress.com&blog=1079187&post=3&subd=mcphersonz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcphersonz.wordpress.com/2007/05/10/freedb-parser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/021b171a2eca6472ee63699c3abeafbb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">mcphersonz</media:title>
		</media:content>
	</item>
	</channel>
</rss>