<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5864306358439624490</id><updated>2011-04-21T19:57:40.845-04:00</updated><category term='ruby highlight code syntax'/><category term='clear file upload field rails ruby reset empty'/><category term='rss atom feed parser generator rome java ruby'/><title type='text'>Desert Rose</title><subtitle type='html'>A simple ruby and mostly rails blog.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://keith-desertrose.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864306358439624490/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://keith-desertrose.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>keith</name><uri>http://www.blogger.com/profile/18441815541850875829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5864306358439624490.post-4995151390096653982</id><published>2009-05-05T01:31:00.007-04:00</published><updated>2009-05-05T02:07:04.993-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rss atom feed parser generator rome java ruby'/><title type='text'>rss/atom feed parsing/generating</title><content type='html'>I'm working on a little personal webapp that deals with RSS and ATOM feeds and thought I'd share my decision for the library I will be using.&lt;br /&gt;&lt;br /&gt;First, let's talk about a couple main requirements.&lt;br /&gt;&lt;br /&gt;I need to be able to parse both feed types and store them in an agnostic state (this is so I can allow for the possibility of merging two different feed types).&lt;br /&gt;&lt;br /&gt;I'll be dealing with a lot of feeds, so naturally, performance needs to be there.  This includes support for some type of caching or intelligent updater.&lt;br /&gt;&lt;br /&gt;So, really I wanted a library that:&lt;br /&gt;&lt;br /&gt;- abstracted RSS 2.0/ATOM 1.0 details (a bonus if it did other versions)&lt;br /&gt;- was reasonably fast&lt;br /&gt;- had some type of caching or intelligent updater&lt;br /&gt;- parsing was robust and liberal; generation was conservative&lt;br /&gt;- well documented&lt;br /&gt;&lt;br /&gt;Initially, I looked around for ruby libraries and found some decent stuff.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sporkmonger.com/projects/feedtools"&gt;feedtools&lt;/a&gt; was the first gem I looked at and it did faily well.  It abstracted RSS &amp; ATOM and had caching.  Unfortuntely, it uses REXML which I hear is up to 60 times slower than libxml these days.  And unfortunately, the project isn't being maintained anymore.  It was passed onto someone else, but he seems to have left it also and started &lt;a href="http://github.com/seangeo/ratom/tree/v0_2_1"&gt;rAtom&lt;/a&gt;.&lt;br /&gt;I also read good things about &lt;a href="http://github.com/pauldix/feedzirra/tree/master"&gt;feedzirra&lt;/a&gt;.  It boasts blazing performance which is always cool but ended up finding another solution before trying it.&lt;br /&gt;&lt;br /&gt;It was after feedtools failure that I decided to expand my search beyond just ruby.  I came across some candidates in python and php, but the one that has caught my eye and seems to pass preliminary proofs of concept is &lt;a href="https://rome.dev.java.net/"&gt;Java's Rome&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I was pretty sure that school would be the last time I used java, but turns out I was wrong.  And happily wrong.&lt;br /&gt;&lt;br /&gt;Rome is mature.  Very mature.  It supports the earliest versions of RSS and ATOM, in a beautiful abstract way; performance-wise it's faster than REXML (not saying much); has an intelligent updater module; seems robust from preliminary tests but investigating further; and lastly, those java folks like their documentation.  It is kinda bland to read, but whatever.  Extra bonus - it has recently hit 1.0 (March 2009), which means it is still under active development and has a community around it.&lt;br /&gt;&lt;br /&gt;I actually thought this would be a good opportunity to start trying out Jruby on Rails but I'm have a few kinks w/ rails 2.3.2 and my jruby 1.1.6.  I think I need to upgrade but after looking at the potential headaches in deployment, I think I will leave this battle for another day.  Right now, I just want to get moving on my project.&lt;br /&gt;&lt;br /&gt;So, hopefully Rome turns out to be as good as I think it is.  Interested to hear thoughts/comments!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5864306358439624490-4995151390096653982?l=keith-desertrose.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://keith-desertrose.blogspot.com/feeds/4995151390096653982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://keith-desertrose.blogspot.com/2009/05/rssatom-feed-parsinggenerating.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864306358439624490/posts/default/4995151390096653982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864306358439624490/posts/default/4995151390096653982'/><link rel='alternate' type='text/html' href='http://keith-desertrose.blogspot.com/2009/05/rssatom-feed-parsinggenerating.html' title='rss/atom feed parsing/generating'/><author><name>keith</name><uri>http://www.blogger.com/profile/18441815541850875829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5864306358439624490.post-8282428402020556478</id><published>2009-04-26T17:32:00.002-04:00</published><updated>2009-04-26T17:53:59.354-04:00</updated><title type='text'>super cheap VPS hosting</title><content type='html'>I just read &lt;a href="http://news.ycombinator.com/item?id=569338"&gt;this post&lt;/a&gt; on hacker news and there are a couple links on some suspiciously low hosting services.&lt;br /&gt;&lt;br /&gt;Check out:&lt;br /&gt;&lt;a href="http://www.lowendbox.com/"&gt;http://www.lowendbox.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I think this is the recommended one:&lt;br /&gt;&lt;a href="http://www.prgmr.com/xen/"&gt;http://www.prgmr.com/xen/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If anyone tries it, let me know how it goes please.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5864306358439624490-8282428402020556478?l=keith-desertrose.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://keith-desertrose.blogspot.com/feeds/8282428402020556478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://keith-desertrose.blogspot.com/2009/04/super-cheap-vps-hosting.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864306358439624490/posts/default/8282428402020556478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864306358439624490/posts/default/8282428402020556478'/><link rel='alternate' type='text/html' href='http://keith-desertrose.blogspot.com/2009/04/super-cheap-vps-hosting.html' title='super cheap VPS hosting'/><author><name>keith</name><uri>http://www.blogger.com/profile/18441815541850875829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5864306358439624490.post-5252974534654219016</id><published>2009-04-26T04:24:00.012-04:00</published><updated>2009-04-26T04:51:11.694-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby highlight code syntax'/><title type='text'>code highlighting with javascript</title><content type='html'>I didn't think I'd write two posts in one day, but after trying for an hour to get this to work, I thought I better put this up.&lt;br /&gt;&lt;br /&gt;If you want to write code in your blog post and have it nicely colored there are javascript libraries that will do this for you.  I've chosen Alex Gorbatchev's &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter"&gt;Syntax Highlighter.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is how to get it to work.&lt;br /&gt;&lt;br /&gt;In the &amp;lt;head&amp;gt; element of your HTML, you need to add this:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&amp;lt;link href="http://alexgorbatchev.com/pub/sh/1.5.1/styles/SyntaxHighlighter.css" rel="stylesheet" type="text/css"&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For Blogger ppl, this means going to &lt;span style="font-weight: bold;"&gt;Layout&lt;/span&gt;, then &lt;span style="font-weight: bold;"&gt;Edit HTML&lt;/span&gt;, then inserting the above right before the tag.&lt;br /&gt;&lt;br /&gt;Then before the &amp;lt;/body&amp;gt; tag, insert:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&amp;lt;script language="javascript" src="http://alexgorbatchev.com/pub/sh/1.5.1/scripts/shCore.js"&amp;gt;&lt;br /&gt;&amp;lt;script language="'javascript'" src="'http://alexgorbatchev.com/pub/sh/1.5.1/scripts/shBrushRuby.js'/"&amp;gt;&lt;br /&gt;&amp;lt;script language="'javascript'"&amp;gt;&lt;br /&gt;dp.SyntaxHighlighter.BloggerMode();&lt;br /&gt;dp.SyntaxHighlighter.HighlightAll('code');&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;br /&gt;This works for Ruby code but can be adjusted to add other languages.  The different language scripts can be found &lt;a href="http://alexgorbatchev.com/pub/sh/1.5.1/scripts/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Also, there are different CSS styles that you can hook up and they are found &lt;a href="http://alexgorbatchev.com/pub/sh/2.0.296/styles/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I basically followed this &lt;a href="http://yacoding.blogspot.com/2008/05/how-to-add-syntax-highlight-to-blogger.html"&gt;blog&lt;/a&gt; and used &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter:Hosting"&gt;Alex's hosting&lt;/a&gt;.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5864306358439624490-5252974534654219016?l=keith-desertrose.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://keith-desertrose.blogspot.com/feeds/5252974534654219016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://keith-desertrose.blogspot.com/2009/04/code-highlight-with-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864306358439624490/posts/default/5252974534654219016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864306358439624490/posts/default/5252974534654219016'/><link rel='alternate' type='text/html' href='http://keith-desertrose.blogspot.com/2009/04/code-highlight-with-javascript.html' title='code highlighting with javascript'/><author><name>keith</name><uri>http://www.blogger.com/profile/18441815541850875829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5864306358439624490.post-1356436348651876111</id><published>2009-04-26T02:43:00.011-04:00</published><updated>2009-04-26T04:24:15.359-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='clear file upload field rails ruby reset empty'/><title type='text'>Clearing the file upload field</title><content type='html'>I recently needed to add file upload functionality to a rails app and discovered that HTML doesn't let you clear the file upload field after you have selected a file (in the case where you suddenly changed your mind and decided not to upload anything).&lt;br /&gt;&lt;br /&gt;So after searching for a while I found an &lt;a href="answer"&gt;answer&lt;/a&gt; and it isn't pretty.  You have to pretty much replace the file upload field with a new one using javascript.&lt;br /&gt;&lt;br /&gt;Here is a basic example using jQuery:&lt;br /&gt;&lt;br /&gt;In the view:&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;%= f.file_field :attachment %&gt;&lt;br /&gt;&lt;%= link_to_function 'clear', clear_js(id, name) %&gt;&lt;/pre&gt; where id and name should be the same as your file field.  Right now, I'm trying to figure out a way of pulling this info out cleanly from the form builder but not having much progress.&lt;br /&gt;&lt;br /&gt;In a helper:&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;# creates an equivalent file field and replaces the current one&lt;br /&gt;def clear_js(id, name)&lt;br /&gt;    %Q[&lt;br /&gt;    var newButton = document.createElement("input");&lt;br /&gt;    $(newButton).attr("type","file");&lt;br /&gt;    $(newButton).attr("id", "#{id}");&lt;br /&gt;    $(newButton).attr("name", "#{name}");&lt;br /&gt;    $(newButton).attr("size", "30");&lt;br /&gt;    $("##{id}").replaceWith(newButton);&lt;br /&gt;    ]&lt;br /&gt;end&lt;/pre&gt; FYI, I &lt;a href="http://www.codestore.net/store.nsf/cmnts/6D4763C006912AF0862569B4005DDF81?OpenDocument"&gt;read&lt;/a&gt; that you can't just alter the value of the field with something like $('input').value = ' ', and for a good reason - then someone could theoretically write a script to set the value to any file on your computer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5864306358439624490-1356436348651876111?l=keith-desertrose.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://keith-desertrose.blogspot.com/feeds/1356436348651876111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://keith-desertrose.blogspot.com/2009/04/clearing-file-upload-field.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5864306358439624490/posts/default/1356436348651876111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5864306358439624490/posts/default/1356436348651876111'/><link rel='alternate' type='text/html' href='http://keith-desertrose.blogspot.com/2009/04/clearing-file-upload-field.html' title='Clearing the file upload field'/><author><name>keith</name><uri>http://www.blogger.com/profile/18441815541850875829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
