<?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>Schadenfreude &#187; ruby</title>
	<atom:link href="http://www.ralree.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ralree.com</link>
	<description>Malicious enjoyment derived from observing someone else's misfortune</description>
	<lastBuildDate>Sun, 28 Feb 2010 04:18:37 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ruby to generate RSS feeds for sites that don&#8217;t offer them</title>
		<link>http://www.ralree.com/2009/08/23/ruby-to-generate-rss-feeds-for-sites-that-dont-offer-them/</link>
		<comments>http://www.ralree.com/2009/08/23/ruby-to-generate-rss-feeds-for-sites-that-dont-offer-them/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 14:53:41 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[generation]]></category>
		<category><![CDATA[gist]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyrss]]></category>
		<category><![CDATA[scraping]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[xpath]]></category>

		<guid isPermaLink="false">http://www.ralree.com/?p=22648</guid>
		<description><![CDATA[There&#8217;s this site that has an equipment exchange I wanted to keep track of.  Yet, it&#8217;s done with what seems to be a custom php file rather than vbulletin, so none of the usual RSS feeds from the site apply to it.  So, I decided to make a scraper/feed-generator to get me the [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s this site that has an equipment exchange I wanted to keep track of.  Yet, it&#8217;s done with what seems to be a custom php file rather than vbulletin, so none of the usual RSS feeds from the site apply to it.  So, I decided to make a scraper/feed-generator to get me the latest version every 5 minutes and generate a nice RSS feed, so I can view it in Google Reader.  The volume of posting is low enough that this won&#8217;t be annoying to see in my daily feeds.</p>
<p>I usually use Ruby for this because it offers Hpricot, a very nice and fast scraper and XPath interface. This time, I resolved to find something that does RSS generation better, and I stumbled upon <a href="http://rubyrss.com/">RubyRSS</a>, which <strong>happens to be in the core ruby distribution</strong>!<br />
<span id="more-22648"></span><br />
Here&#8217;s what I ended up with after about an hour:</p>
<p><script src="http://gist.github.com/173318.js"></script></p>
<p>Now this is impressive if you look at the fail of html <code>id</code> and <code>class</code> attributes coming out of the original page.  I had to base everything off of the links to the items that were not images, and then the structure <em>up the tree</em> from there (see the liberal use of <code>.parent</code>).  I&#8217;ve rediscovered that Hpricot is awesome (_why, come back to us!), and that it truly only takes 30 lines of code to generate a nice RSS feed in ruby.  The resultant RSS feed for MDShooters Classifieds site is <a href="http://www.ralree.com/mdshooters_classifieds.xml">here</a>.</p>
<p>And now, yet another RSS feed generator: <a href="http://ralree.com/md_super_ads.xml">MD Super Ads</a></p>
<p>Here&#8217;s the code:</p>
<p><script src="http://gist.github.com/173623.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2009/08/23/ruby-to-generate-rss-feeds-for-sites-that-dont-offer-them/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OSCON Sessions, Day 2</title>
		<link>http://www.ralree.com/2008/07/25/oscon-sessions-day-2/</link>
		<comments>http://www.ralree.com/2008/07/25/oscon-sessions-day-2/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 13:44:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[beer]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[hadoop]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[oscon]]></category>
		<category><![CDATA[oscon2008]]></category>
		<category><![CDATA[politics]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[swig]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/07/25/oscon-sessions-day-2</guid>
		<description><![CDATA[Oh man, what a day.  
I attended quite a few talks, grabbed a lot of swag, and entered a few contests.  I ended up buying the Arduino Starter Kit from MAKE so I can do some awesome embedded Ruby like I saw at FOSCON.  It looks really fun &#8211; I can&#8217;t wait [...]]]></description>
			<content:encoded><![CDATA[<p>Oh man, what a day.  </p>
<p>I attended quite a few talks, grabbed a lot of swag, and entered a few contests.  I ended up buying the <a href="http://www.makershed.com/ProductDetails.asp?ProductCode=MSAK">Arduino Starter Kit from MAKE</a> so I can do some awesome <a href="http://rad.rubyforge.org/">embedded Ruby</a> like I saw at FOSCON.  It looks really fun &#8211; I can&#8217;t wait to try it out.</p>
<p>The talks I attended were half-way decent, but I learned a lot more on the first day.</p>
<h2><a href="http://github.com/hank/life/tree/master/oscon/2008/sessions/Hadoop.EC2.rdoc">Hadoop and EC2</a></h2>
<p>A good overview of how one can use Amazon&#8217;s S3 and EC2 services to cheaply process and store data on a pretty large scale.  The New York Times digitized hundreds of years of articles in <em>a single day</em> using these services and some awesome C++ code.</p>
<h2><a href="http://github.com/hank/life/tree/master/oscon/2008/sessions/Open.Standards.Cloud.Computing.rdoc">Open standards in cloud computing</a></h2>
<p>This ended up being a marketing talk.  I don&#8217;t know what it had to do with cloud computing, and I didn&#8217;t stick around to find out.</p>
<h2><a href="http://github.com/hank/life/tree/master/oscon/2008/sessions/Ruby.1.9.rdoc">Ruby 1.9: What to Expect</a></h2>
<p>An awesome overview of all the new stuff in Ruby 1.9 given by Sam Ruby.  I had no idea they were changing so much, and this was a good dive with code examples into that.  There was some discussion among everyone in the middle on whether <code>for</code> loops should work like <code>.each</code> blocks with regards to scope.  I happen to disagree with what ended up being the popular thought on this subject.  Most were advocating that a <code>for</code> loop constitutes a block, and that scope variables and iterators should be localized inside of it.  This is contrary to almost every language, which I brought up using the example of C.  Yet, when you iterate with <code>.each</code>, you immediately define a block and a scoped iterator, which, if it has a conflicting name with the outside world, it doesn&#8217;t matter since that&#8217;s out of scope.  The only thing this changes is the value of a variable outside after the loop finishes.  I think leaving the ability to modify a variable external to the loop is very convenient &#8211; in summary, <em>leave it how you&#8217;ve done it in Ruby 1.9 already</em>.</p>
<h2><a href="http://github.com/hank/life/tree/master/oscon/2008/sessions/Mobile.rdoc">Ubuntu on the Go: Subnotebook and MID technologies</a></h2>
<p>This was an interesting session on where Canonical is taking mobile technology, and what the community can do to help.  They seem to have a pretty neat subnotebook coming out soon.</p>
<h2><a href="http://github.com/hank/life/tree/master/oscon/2008/sessions/SWIG.rdoc">Python, C++, and SWIG</a></h2>
<p>This could have been one of the best talks, but the speed at which it was given and the lack of enthusiasm in the presentation left most of us either bored or unfulfilled at the end of the talk.  He spent the first half explaining what Python and C++ were, then he got to what SWIG is.  The end was a quick dive into an extremely complicated bunch of files that didn&#8217;t help very much.  In the future, it would be helpful to go to a SWIG talk that details <em>how to make a simple Python extension with SWIG</em>.  I may have to throw that one together myself&#8230;</p>
<p>I also attended the tail end of <a href="http://en.oreilly.com/oscon2008/public/schedule/detail/2872">Designing Political Web Apps for MoveOn.org</a>, but I didn&#8217;t take any notes.  </p>
<p>We ended up going to dinner at <a href="http://www.widmer.com/Default.aspx">Widmer Brothers</a>, which was pretty awesome.  I had the Pork Schnitzel, a very tender piece of meat if I do say so myself, along with 2 Full Nelson IPAs.  Afterwards, we caught the bus from the convention center to BeerForge and the SourceForge Community Choice Awards party.  Beerforge was a blast.  I ended up talking to <a href="http://www.jbkempf.com/">Jean-Baptiste Kempf</a>, one of the developers of VLC, for hours &#8211; a truly great guy.  I learned a lot about France and the French people, but also about VLC.  Apparently, you can use VLC from the command line much like mplayer, which I did not know.  Yet, he explained that they removed Directshow support from VLC in Linux in favor of open source alternatives, which in part I can understand.  Yet, the only codec available that is able to smoothly play 1080p h264 video is closed source (<a href="http://www.coreavc.com/">CoreAVC</a>), and until the ffmpeg avc codec catches up, I&#8217;ll have to continue using mplayer.  When I can play everything back smoothly with VLC, I may consider switching.</p>
<p>The beer at BeerForge was pretty good &#8211; I had the IPA.  SourceForge had some sort of mixed drink which wasn&#8217;t too great.  All in all, a good day, but now I&#8217;m dehydrated&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/07/25/oscon-sessions-day-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OSCON Sessions, Day 1</title>
		<link>http://www.ralree.com/2008/07/24/oscon-sessions-day-1/</link>
		<comments>http://www.ralree.com/2008/07/24/oscon-sessions-day-1/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 08:08:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[africa]]></category>
		<category><![CDATA[chisimba]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[ejabberd]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[foscon]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[oscon]]></category>
		<category><![CDATA[oscon08]]></category>
		<category><![CDATA[philanthropy]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/07/24/oscon-sessions-day-1</guid>
		<description><![CDATA[I went to 5 sessions today, and I was pleasantly surprised by most of them.  
CouchDB
CouchDB is a distributed non-relational database written in Erlang.  It is unique in that its main query interface is simply HTTP REST, and for every UPDATE, it simply creates a new version of the row.  Additionally, you [...]]]></description>
			<content:encoded><![CDATA[<p>I went to 5 sessions today, and I was pleasantly surprised by most of them.  </p>
<h2><a href="http://github.com/hank/life/tree/master/oscon/2008/sessions/CouchDB.rdoc">CouchDB</a></h2>
<p>CouchDB is a distributed non-relational database written in Erlang.  It is unique in that its main query interface is simply HTTP REST, and for every UPDATE, it simply creates a new version of the row.  Additionally, you can request the entire history of a row very simply.</p>
<h2><a href="http://github.com/hank/life/tree/master/oscon/2008/sessions/Hypertable.rdoc">Hypertable</a></h2>
<p>An open-source implementation of Google&#8217;s bigtable.  Hypertable uses novel methods such as Bloom filters to significantly decrease query times, as well as smart messaging to distribute a database across many nodes.  It is also non-relational.</p>
<h2><a href="http://github.com/hank/life/tree/master/oscon/2008/sessions/Africa.rdoc">Creating and supporting Free Software in Africa</a></h2>
<p>A group of CS professors hailing from Africa have gotten together to create a community that fosters creativity and innovation from people in Africa.  People in first-world countries can participate by acting as mentors, or directly contribute to the projects involved.  <a href="http://en.wikipedia.org/wiki/Chisimba">Chisimba</a> is an open-source MVC framework for rapid application development.  I am very interested in contributing to this project.</p>
<h2><a href="http://github.com/hank/life/tree/master/oscon/2008/sessions/LucidDB.rdoc">LucidDB</a></h2>
<p>I thought going in that this would be somehow in the same ballpark as Hypertable and CouchDB, but I was disappointed.  Basically, they are using compression and some fairly neat indexing to speed up traditional database queries.  The main problem is that they only have a Java API, which completely turned me off after 30 minutes.  Before that, it seemed like they were getting some pretty promising results.  If they add some more APIs in the future, this may be another one to take a look at.</p>
<h2><a href="http://github.com/hank/life/tree/master/oscon/2008/sessions/History.of.Failure.rdoc">A History of Failure</a></h2>
<p>An awesome talk by Paul Fenwick from Australia, generally detailing failures in computer science and engineering going back into the 20th century and even back to Roman times.  This was a wonderful presentation &#8211; he&#8217;s a really good speaker &#8211; and it poked a <em>lot</em> of fun at New Zealand.</p>
<p>All in all, I must say that this OSCON is much better than last year&#8217;s at least according to what I was looking for in the sessions.  The exhibit hall is also very good this year &#8211; I&#8217;m pretty loaded down with swag at the moment.  </p>
<p>I know someone who would have gotten a kick out of <a href="http://en.oreilly.com/oscon2008/public/schedule/detail/4549">Temporally Quaquaversal Virtual Nanomachine Programming In Multiple Topologically Connected Quantum-Relativistic Parallel Timespaces&#8230;Made Easy!</a> had they been here.  He needs to come next year (you know who you are..)</p>
<p>Tonight, I also attended <a href="http://pdxfoscon.org/">FOSCON 4: Cooking with Ruby</a>.  This was a spectacular event hosted by Cubespace.  I have to say that the live coding competition was a great spectacle, and held everyone&#8217;s attention for hours.  It was an epic battle between Symfony, Rails, Smalltalk/Seaside, and Drupal.  The rankings ended up being the following:</p>
<ol>
<li>Rails</li>
<li>Drupal</li>
<li>Symfony</li>
<li>Smalltalk/Seaside</li>
</ol>
<p>The presentations were good as well for the most part (notes <a href="http://github.com/hank/life/tree/master/oscon/2008/foscon/Notes.rdoc">here</a>).  <strong>AND THEY HAD BEER!</strong> I had some of the best keg beer imaginable &#8211; I thought it would be crap like you usually get out of a keg, but this was real quality Northwestern hopped pale ale.  My cup says Bridgeport Ales, so I&#8217;ll have to investigate.  If anyone knows the exact beer that was available in the left-side keg tonight, I&#8217;d appreciate a comment.  I also met some cool people, some of which are all into XMPP and ejabberd.  I may have to check all of that out now&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/07/24/oscon-sessions-day-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pradipta&#8217;s Rolodex Epic Conclusion</title>
		<link>http://www.ralree.com/2008/07/18/pradipta-s-rolodex-epic-conclusion/</link>
		<comments>http://www.ralree.com/2008/07/18/pradipta-s-rolodex-epic-conclusion/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 23:05:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[recruiting]]></category>
		<category><![CDATA[rolodex]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/07/18/pradipta-s-rolodex-epic-conclusion</guid>
		<description><![CDATA[If you don&#8217;t already know about Pradipta&#8217;s Rolodex, read up here
Here&#8217;s the epic apology email from THE MAN HIMSELF!:

Hi All,
First of all I just wanted to say I apologize for the emails I sent. As of today I promise to stop the Email marketing campaigns. And I do believe it was a very&#8230;very..stupid mistake, this [...]]]></description>
			<content:encoded><![CDATA[<p>If you don&#8217;t already know about Pradipta&#8217;s Rolodex, read up <a href="http://groups.google.com/group/pradiptas-rolodex">here</a></p>
<p>Here&#8217;s the epic apology email from <strong>THE MAN HIMSELF!</strong>:</p>
<blockquote><p>
Hi All,</p>
<p>First of all I just wanted to say I apologize for the emails I sent. As of today I promise to stop the Email marketing campaigns. And I do believe it was a very&#8230;very..stupid mistake, this is the result of working late.</p>
<p>Also, I am deeply amazed of how talented you guys are. I mean seriously all this happened in less than 24 hours.  I hope this mishap would create a benefit for all of us.</p>
<p>I understand this is fun for a lot of you, however, people are getting angry so if we could keep everything under the google groups that would be most appreciated.</p>
<p>http://groups.google.com/group/pradiptas-rolodex?hl=en</p>
<p>If anyone wants to contact me feel free to contact this new email<br />
pradipta416@gmail.com.</p>
<p>Humbly Sorry,<br />
Pradipta (Max) Archiputra</p>
<p>P.S: this time I used BCC. :)
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/07/18/pradipta-s-rolodex-epic-conclusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNS for bash</title>
		<link>http://www.ralree.com/2008/03/31/dns-for-bash/</link>
		<comments>http://www.ralree.com/2008/03/31/dns-for-bash/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 01:16:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[camping]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/03/31/dns-for-bash</guid>
		<description><![CDATA[Today, I decided I wanted a network service that propagated variables and aliases to every login shell that subscribed to it.  This is dangerous on a large scale, but perfectly acceptable on my small home network where everyone trusts everyone else.
First, I got Camping installed, bringing back fond memories of Ruby development.  I [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I decided I wanted a network service that propagated variables and aliases to every login shell that subscribed to it.  This is dangerous on a large scale, but perfectly acceptable on my small home network where everyone trusts everyone else.</p>
<p>First, I got <a href="http://code.whytheluckystiff.net/camping">Camping</a> installed, bringing back fond memories of Ruby development.  I then copied off the blog example, and created TreeHugger, a 427 line script that provides a web interface to edit the variables, and a plain text output for the shells to source.  </p>
<p><a href="http://modzer0.cs.uaf.edu/repos/hank/code/ruby/treehugger.rb">This script</a>, when run, allows some simple MVC actions to an sqlite3 database.</p>
<p><img src="http://ralree.com/assets/2008/3/31/screenshot2.png" alt="Example Screenshot"/></p>
<p>As you can see, I have some aliases here I want to send to all the subscribing hosts.  Eventually, I want to add some detection functionality to the database (mostly reverse DNS lookups for host rule referencing).  I just have to access <code>/out</code> to get my desired output:</p>
<pre><code>
# Treehugger Configuration
# Aliases
alias ai='sudo apt-get install'
alias aup='sudo apt-get update'
alias aug='sudo apt-get upgrade'

# Environment Variables
</code></pre>
<p>Now, to get this into bash.  I looked into making the <code>date</code> command spit out pretty unique timestamps.  Turns out you can do this with the nanoseconds format:</p>
<pre><code>
$ date +%s%N
1206926780157462141
</code></pre>
<p>I made it so <code>wget</code> saves the treehugger config to a tempfile using the somewhat random seed above as a filename suffix, and then I have my shell source it:</p>
<pre><code>
FILENAME=/tmp/treehugger-`date +%s%N`; 2&gt;/dev/null wget -O $FILENAME  http://rofl.who/treehugger/out &#038;&#038; source $FILENAME &#038;&#038; rm $FILENAME
</code></pre>
<p>And now I have nice aliases on my laptop served up from my desktop as fresh as the shell:</p>
<pre><code>
hank@davros:~$ alias
alias ai='sudo apt-get install'
alias aug='sudo apt-get upgrade'
alias aup='sudo apt-get update'
alias ls='ls --color=auto'
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/03/31/dns-for-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make a Flash Line Chart in Rails using Ziya</title>
		<link>http://www.ralree.com/2008/02/16/how-to-make-a-flash-line-chart-in-rails-using-ziya/</link>
		<comments>http://www.ralree.com/2008/02/16/how-to-make-a-flash-line-chart-in-rails-using-ziya/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 22:58:15 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[charts]]></category>
		<category><![CDATA[graphs]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ziya]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/how-to-make-a-flash-line-chart-in-rails-using-ziya</guid>
		<description><![CDATA[Ziya is pretty cool, and the documentation is slowly starting to surface.  I was annoyed that I couldn’t find a good example paste of how to make a line chart.  Then I watched the screencast.  It’s the first example he does, so I’m posting it here so those who can’t watch it [...]]]></description>
			<content:encoded><![CDATA[<p>Ziya is pretty cool, and the documentation is slowly starting to surface.  I was annoyed that I couldn’t find a good example paste of how to make a line chart.  Then I watched the <a href="http://www.youtube.com/watch?v=axIMmMHdXzo">screencast</a>.  It’s the first example he does, so I’m posting it here so those who can’t watch it can actually find out how to do it.</p>
<p>I’m going to operate on the precondition that you’ve installed Ziya and included it in your controller properly.  Do the bar chart example before going any further.</p>
<p>Now, make this function in your controller:</p>
<pre><code>
def refresh_chart
  chart = ZIya::Charts::Line.new
  render :text =&gt; chart
end
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/02/16/how-to-make-a-flash-line-chart-in-rails-using-ziya/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Photoslice in Bluecloth and Mephisto</title>
		<link>http://www.ralree.com/2008/01/05/photoslice-in-bluecloth-and-mephisto/</link>
		<comments>http://www.ralree.com/2008/01/05/photoslice-in-bluecloth-and-mephisto/#comments</comments>
		<pubDate>Sat, 05 Jan 2008 21:49:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bluecloth]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[mephisto]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/01/06/photoslice-in-bluecloth-and-mephisto</guid>
		<description><![CDATA[So, I found this today, and it is awesome.  I wanted it in Bluecloth so I could use it in Mephisto.  Here&#8217;s how.
First, I needed to make it so I could still do normal images, but turn on coolness if I want.  Here&#8217;s the goal I came up with for the grammar:

[![](thumburl.jpg)](imageurl.jpg [...]]]></description>
			<content:encoded><![CDATA[<p>So, I found <a href="http://www.photoslice.net/guide/">this</a> today, and it is awesome.  I wanted it in Bluecloth so I could use it in Mephisto.  Here&#8217;s how.</p>
<p>First, I needed to make it so I could still do normal images, but turn on coolness if I want.  Here&#8217;s the goal I came up with for the grammar:</p>
<pre><code>
[![](thumburl.jpg)](imageurl.jpg "Scrolly Text at top" "photoslice")
</code></pre>
<p>Here&#8217;s the first test, with a single image:</p>
<p><a href="http://ralree.com/assets/2008/1/5/foshizzlepowell.jpg" title="Colin Powell Loves you" rel="photoslice"><img src="http://ralree.com/assets/2008/1/5/foshizzlepowell_thumb.jpg" alt=""/></a></p>
<p>And now a set with a namespace:</p>
<p><a href="http://ralree.com/assets/2008/1/5/ninjabeg.jpg" title="Ninjas killed his family.  Poor guy..." rel="photoslice.bluecloth"><img src="http://ralree.com/assets/2008/1/5/ninjabeg_thumb.jpg" alt=""/></a><br />
<a href="http://ralree.com/assets/2008/1/5/South_Park_Zach.jpg" title="Zach used to look like this." rel="photoslice.bluecloth"><img src="http://ralree.com/assets/2008/1/5/South_Park_Zach_thumb.jpg" alt=""/></a><br />
<a href="http://ralree.com/assets/2008/1/5/South_Park_Hank.jpg" title="I used to look like this." rel="photoslice.bluecloth"><img src="http://ralree.com/assets/2008/1/5/South_Park_Hank_thumb.jpg" alt=""/></a></p>
<p>I did it by simply modifying the regex and image url parsing function in BlueCloth like so:</p>
<div class="CodeRay">
<div class="code">
<pre>
  <span class="co">InlineLinkRegex</span> = <span class="rx"><span class="dl">%r{</span><span class="k">
    </span><span class="ch">\(</span><span class="k">            # Literal paren
      [ ]*        # Zero or more spaces
      &lt;?(.+?)&gt;?     # URI = $1
      [ ]*        # Zero or more spaces

      (?:         # title
        ([</span><span class="ch">\&quot;</span><span class="ch">\'</span><span class="k">])    # Opening quote char = $2
        (.*?)     # Title = $3
        </span><span class="ch">\2</span><span class="k">        # Matching quote char
      )?          # Title is optional
      [ ]*        # Zero or more spaces
      (?:         # rel
        ([</span><span class="ch">\&quot;</span><span class="ch">\'</span><span class="k">])    # Opening quote char = $2
        (.*?)     # rel = $5
        </span><span class="ch">\4</span><span class="k">        # Matching quote char
      )?          # rel is optional
    </span><span class="ch">\)</span><span class="k">
    </span><span class="dl">}</span><span class="mod">x</span></span>

    <span class="c"># and later...</span>

        <span class="c"># ...or for an inline style second part</span>
        <span class="r">elsif</span> <span class="iv">@scanner</span>.scan( <span class="co">InlineLinkRegex</span> )
          url = <span class="iv">@scanner</span>[<span class="i">1</span>]
          title = <span class="iv">@scanner</span>[<span class="i">3</span>]
          rel = <span class="iv">@scanner</span>[<span class="i">5</span>]
          <span class="iv">@log</span>.debug <span class="s"><span class="dl">&quot;</span><span class="k">  Found an inline link to %p</span><span class="dl">&quot;</span></span> % url

          text += <span class="s"><span class="dl">%{</span><span class="k">&lt;a href=&quot;%s&quot;</span><span class="dl">}</span></span> % escape_md( url )
          <span class="r">if</span> title
            title.gsub!( <span class="rx"><span class="dl">/</span><span class="k">&quot;</span><span class="dl">/</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">&amp;quot;</span><span class="dl">&quot;</span></span> )
            text += <span class="s"><span class="dl">%{</span><span class="k"> title=&quot;%s&quot;</span><span class="dl">}</span></span> % escape_md( title )
          <span class="r">end</span>
          <span class="r">if</span> rel
            rel.gsub!( <span class="rx"><span class="dl">/</span><span class="k">&quot;</span><span class="dl">/</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">&amp;quot;</span><span class="dl">&quot;</span></span> )
            text += <span class="s"><span class="dl">%{</span><span class="k"> rel=&quot;%s&quot;</span><span class="dl">}</span></span> % escape_md( rel )
          <span class="r">end</span>
</pre>
</div>
</div>
<p>I also added the following to my Mephisto theme layout, in the head section:</p>
<pre><code>
   &lt;!-- Photoslice --&gt;
   &lt;link rel="stylesheet" type="text/css" href="/javascripts/photoslice/style.css" /&gt;
   {{ "photoslice/functions.js" | javascript }}
</code></pre>
<p>Once again, Ruby is awesome.  And so is Markdown.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/01/05/photoslice-in-bluecloth-and-mephisto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Chart Testing</title>
		<link>http://www.ralree.com/2007/10/22/flash-chart-testing/</link>
		<comments>http://www.ralree.com/2007/10/22/flash-chart-testing/#comments</comments>
		<pubDate>Mon, 22 Oct 2007 03:00:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/11/17/flash-chart-testing</guid>
		<description><![CDATA[I&#8217;m testing a flash chart plugin based on this.

            
I&#8217;m testing a flash chart plugin based on this.

Basically, it works by pulling from a PHP file that has some nifty PHP code in it:



&#60;?php
# Data
$xlabels = array(
  &#34;Barney Flats Oatmeal Stout&#34;,
  &#34;Rogue [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m testing a flash chart plugin based on <a href="http://pullmonkey.com/projects/open_flash_chart">this</a>.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="660" height="300" id="graph41544" align="middle"><param name="allowScriptAccess" value="always" /><param name="movie" value="/open-flash-chart.swf?width=660 &amp;height=300 &amp;data=%2Fcharts%2F2007-10-21-beer.php" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" /><embed src="/open-flash-chart.swf?width=660&amp;height=300&amp;data=%2Fcharts%2F2007-10-21-beer.php" quality="high" bgcolor="#FFFFFF" width="660" height="300" name="open-flash-chart" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>
<p>            <span id="more-4243"></span></p>
<p>I&#8217;m testing a flash chart plugin based on <a href="http://pullmonkey.com/projects/open_flash_chart">this</a>.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="660" height="300" id="graph234140" align="middle"><param name="allowScriptAccess" value="always" /><param name="movie" value="/open-flash-chart.swf?width=660 &amp;height=300 &amp;data=%2Fcharts%2F2007-10-21-beer.php" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" /><embed src="/open-flash-chart.swf?width=660&amp;height=300&amp;data=%2Fcharts%2F2007-10-21-beer.php" quality="high" bgcolor="#FFFFFF" width="660" height="300" name="open-flash-chart" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>
<p>Basically, it works by pulling from <a href="/charts/2007-10-21-beer.php">a PHP file</a> that has some nifty PHP code in it:</p>
<div class="CodeRay">
<div class="code">
<pre>
&lt;?php
# Data
$xlabels = array(
  &quot;Barney Flats Oatmeal Stout&quot;,
  &quot;Rogue Chocolate Stout&quot;,
  &quot;Rogue Mocha Porter&quot;,
  &quot;Samuel Smith's Old Brewery Pale Ale&quot;
);

$data = array(4.95, 4.9, 4.85, 4.75);

include_once( 'open-flash-chart.php' );
$g = new graph();

$g-&gt;title( 'Favorite Beer to Date', '{font-size: 26px; color: #EEEEEE;}' );

$g-&gt;set_data( $data );
$g-&gt;bar_filled( 50, '#9999CC', '#8080A0', 'Overall Rating', 9 );

$g-&gt;set_x_labels( $xlabels );
$g-&gt;set_x_label_style( 9, &quot;#EEEEEE&quot; );
$g-&gt;set_y_label_style( 9, &quot;#EEEEEE&quot; );

$g-&gt;set_y_max( 5 );
$g-&gt;set_y_min( 4 );

$g-&gt;bg_colour = '#202028';
$g-&gt;x_axis_colour( '#D0D0D0', '#808080' );
$g-&gt;y_axis_colour( '#D0D0D0', '#808080' );

echo $g-&gt;render();
?&gt;
</pre>
</div>
</div>
<p>Then, in Mephisto, I have this line in my post:</p>
<pre><code>
&lt;macro:chart width="660"&gt;/charts/2007-10-21-beer.php&lt;/macro:chart&gt;
</code></pre>
<p>It&#8217;s quite cool, actually.  I did it by installing <a href="http://pullmonkey.com/projects/open_flash_chart/">this nifty plugin</a> in my Mephisto checkout.  Then, I added some stuff to get the following:</p>
<pre><code>

https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/filtered_column_flash_chart/

</code></pre>
<p>Just install it like any other mephisto plugin (if you&#8217;re brave &#8230; it&#8217;s probably buggy as all hell):</p>
<pre><code>
./script/plugin install https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/filtered_column_flash_chart/
</code></pre>
<p>Then copy the <strong><em>swf</strong></em> to your public directory in your Mephisto tree, and restart Mephisto.  Then make a nice post about graphing, and a graph data page to go along with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2007/10/22/flash-chart-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Site5 promo code for October</title>
		<link>http://www.ralree.com/2007/10/20/site5-promo-code-for-october/</link>
		<comments>http://www.ralree.com/2007/10/20/site5-promo-code-for-october/#comments</comments>
		<pubDate>Sat, 20 Oct 2007 04:05:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[shopping]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/20/site5-promo-code-for-october</guid>
		<description><![CDATA[You can still get 13% off a new Site5 7.5TB/750GB/$7.50 Plan until November!  These guys are a great rails host.  Get this deal while it&#8217;s hot!
Code: HALLOWEEN2007

]]></description>
			<content:encoded><![CDATA[<h2>You can still get <strong>13%</strong> off a new Site5 <strong>7.5TB/750GB/$7.50</strong> Plan until November!  These guys are a great rails host.  Get this deal while it&#8217;s hot!</h2>
<h1>Code: <strong>HALLOWEEN2007</strong></h1>
<p><a href="http://www.site5.com/affiliates/idevaffiliate.php?id=1570"><img src="http://ralree.info/assets/2007/10/20/theplan_medium.png" alt="Go Now!"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2007/10/20/site5-promo-code-for-october/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Beer Atom Feed</title>
		<link>http://www.ralree.com/2007/10/13/a-beer-atom-feed/</link>
		<comments>http://www.ralree.com/2007/10/13/a-beer-atom-feed/#comments</comments>
		<pubDate>Sat, 13 Oct 2007 03:10:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[beer]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/a-beer-atom-feed</guid>
		<description><![CDATA[So, after reviewing over 50 beers on BeerAdvocate, I&#8217;ve come to the conclusion that them not having an RSS or Atom feed of my most recent reviews available is stupid.  So, I decided to make my own by scraping their HTML today.  I started off by pumping some random code into irb that [...]]]></description>
			<content:encoded><![CDATA[<p>So, after reviewing over 50 beers on <a href="http://www.beeradvocate.com">BeerAdvocate</a>, I&#8217;ve come to the conclusion that them not having an RSS or Atom feed of my most recent reviews available is stupid.  So, I decided to make my own by scraping their HTML today.  I started off by pumping some random code into irb that included <a href="http://code.whytheluckystiff.net/hpricot/wiki/HpricotBasics">Hpricot</a> and <a href="http://builder.rubyforge.org/">Builder</a>.  Ruby rocks for doing stuff like this.</p>
<p>            <span id="more-4053"></span></p>
<p>So, after reviewing over 50 beers on <a href="http://www.beeradvocate.com">BeerAdvocate</a>, I&#8217;ve come to the conclusion that them not having an RSS or Atom feed of my most recent reviews available is stupid.  So, I decided to make my own by scraping their HTML today.  I started off by pumping some random code into irb that included <a href="http://code.whytheluckystiff.net/hpricot/wiki/HpricotBasics">Hpricot</a> and <a href="http://builder.rubyforge.org/">Builder</a>.  Ruby rocks for doing stuff like this.  Anyway, I ended up with this at the end:</p>
<div class="CodeRay">
<div class="code">
<pre><code>
require <span class="s"><span class="dl">'</span><span class="k">rubygems</span><span class="dl">'</span></span>
require <span class="s"><span class="dl">'</span><span class="k">hpricot</span><span class="dl">'</span></span>
require <span class="s"><span class="dl">'</span><span class="k">open-uri</span><span class="dl">'</span></span>
require <span class="s"><span class="dl">'</span><span class="k">builder</span><span class="dl">'</span></span>

<span class="c"># Get the document to scrape</span>
doc = Hpricot(open(<span class="s"><span class="dl">&quot;</span><span class="k">http://beeradvocate.com/user/beer_reviews?user=ralree</span><span class="dl">&quot;</span></span>))
trs = (doc/<span class="s"><span class="dl">&quot;</span><span class="k">table</span><span class="dl">&quot;</span></span>)[<span class="i">2</span>].search(<span class="s"><span class="dl">&quot;</span><span class="k">tr</span><span class="dl">&quot;</span></span>)

<span class="c"># Create the feed</span>
target = <span class="co">File</span>.new(<span class="s"><span class="dl">&quot;</span><span class="k">beer.xml</span><span class="dl">&quot;</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">w</span><span class="dl">&quot;</span></span>)
xml = <span class="co">Builder</span>::<span class="co">XmlMarkup</span>.new(<span class="sy">:target</span> =&gt; target, <span class="sy">:indent</span> =&gt; <span class="i">1</span>)
xml.instruct!
xml.feed <span class="s"><span class="dl">&quot;</span><span class="k">xmlns</span><span class="dl">&quot;</span></span> =&gt; <span class="s"><span class="dl">&quot;</span><span class="k">http://www.w3.org/2005/Atom</span><span class="dl">&quot;</span></span> <span class="r">do</span>
  xml.id <span class="s"><span class="dl">&quot;</span><span class="k">http://www.ralree.info/beer.xml</span><span class="dl">&quot;</span></span>
  xml.title <span class="s"><span class="dl">&quot;</span><span class="k">ralree the BeerAdvocate</span><span class="dl">&quot;</span></span>
  xml.subtitle <span class="s"><span class="dl">&quot;</span><span class="k">Recent Beer Reviews</span><span class="dl">&quot;</span></span>
  xml.link  <span class="s"><span class="dl">&quot;</span><span class="k">rel</span><span class="dl">&quot;</span></span> =&gt; <span class="s"><span class="dl">&quot;</span><span class="k">self</span><span class="dl">&quot;</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">href</span><span class="dl">&quot;</span></span> =&gt; <span class="s"><span class="dl">&quot;</span><span class="k">http://www.ralree.info/beer.xml</span><span class="dl">&quot;</span></span>
  xml.updated <span class="co">Time</span>.now.iso8601
  xml.author  { xml.name <span class="s"><span class="dl">&quot;</span><span class="k">Erik Gregg</span><span class="dl">&quot;</span></span>; xml.email <span class="s"><span class="dl">&quot;</span><span class="k">ralree@gmail.com</span><span class="dl">&quot;</span></span> }

  <span class="c"># For each TR, make an entry</span>
  trs.each <span class="r">do</span> |a|
    tds = a.search(<span class="s"><span class="dl">&quot;</span><span class="k">td</span><span class="dl">&quot;</span></span>).to_a
    <span class="r">if</span> tds.length == <span class="i">7</span>
    xml.entry <span class="r">do</span>
        xml.updated(<span class="co">Time</span>.parse(tds[<span class="i">0</span>].inner_html.gsub(<span class="s"><span class="dl">'</span><span class="k">-</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">/</span><span class="dl">'</span></span>)).iso8601)
        xml.title((tds[<span class="i">1</span>]/<span class="s"><span class="dl">&quot;</span><span class="k">a/b</span><span class="dl">&quot;</span></span>).inner_html)
        xml.link(<span class="sy">:href</span> =&gt;
          (<span class="s"><span class="dl">&quot;</span><span class="k">http://www.beeradvocate.com</span><span class="dl">&quot;</span></span> + ((tds[<span class="i">1</span>]/<span class="s"><span class="dl">&quot;</span><span class="k">a</span><span class="dl">&quot;</span></span>)[<span class="i">0</span>][<span class="s"><span class="dl">&quot;</span><span class="k">href</span><span class="dl">&quot;</span></span>]))) <span class="r">do</span> |x|
          xml.text!((tds[<span class="i">1</span>]/<span class="s"><span class="dl">&quot;</span><span class="k">a/b</span><span class="dl">&quot;</span></span>)[<span class="i">0</span>].inner_html)
        <span class="r">end</span>
        xml.summary <span class="r">do</span> |p|
          p.cdata! <span class="s"><span class="dl">&lt;&lt;EOOMFG</span></span><span class="s"><span class="k">
Brewery: </span><span class="il"><span class="dl">#{</span>(tds[<span class="i">2</span>]/<span class="s"><span class="dl">&quot;</span><span class="k">a</span><span class="dl">&quot;</span></span>)[<span class="i">0</span>].inner_html<span class="dl">}</span></span><span class="k">
Style: </span><span class="il"><span class="dl">#{</span>(tds[<span class="i">3</span>]/<span class="s"><span class="dl">&quot;</span><span class="k">a</span><span class="dl">&quot;</span></span>)[<span class="i">0</span>].inner_html<span class="dl">}</span></span><span class="k">
Serving: </span><span class="il"><span class="dl">#{</span>tds[<span class="i">4</span>].inner_html<span class="dl">}</span></span><span class="k">
ABV: </span><span class="il"><span class="dl">#{</span>tds[<span class="i">5</span>].inner_html<span class="dl">}</span></span><span class="k">
Rating: </span><span class="il"><span class="dl">#{</span>(tds[<span class="i">6</span>]/<span class="s"><span class="dl">&quot;</span><span class="k">b</span><span class="dl">&quot;</span></span>).inner_html<span class="dl">}</span></span><span class="dl">
EOOMFG</span></span>
        <span class="r">end</span>
      <span class="r">end</span>
    <span class="r">end</span>
  <span class="r">end</span>
<span class="r">end</span>
</code></pre>
</div>
</div>
<p>This produces the feed that you can find <a href="http://ralree.info/beer/beer.xml">here</a>.  Feel free to add it to your aggregator, and you&#8217;ll be notified whenever I review a beer!  This is what it looks like:</p>
<p><img src="http://ralree.info/assets/2007/10/13/beerfeed.png" alt="ZOMG BEER!"/></p>
<h2>Get the codez <a href="http://modzer0.cs.uaf.edu/repos/hank/code/ruby/beer_atom_feed/">here</a></h2>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2007/10/13/a-beer-atom-feed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.491 seconds -->
