<?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-5393915095624425190</id><updated>2012-01-19T16:25:57.365Z</updated><category term='sessions'/><category term='ruby'/><category term='images'/><category term='linux'/><category term='java'/><category term='mime-type'/><category term='webrat'/><category term='jpeg'/><category term='rails'/><category term='rails3'/><category term='cucumber'/><category term='jruby'/><category term='ubuntu'/><category term='merb'/><category term='http authentication'/><category term='jpg'/><category term='merb2'/><category term='subversion'/><title type='text'>DermoLogical</title><subtitle type='html'>Yet Another Blog About Web Development (YABAWD)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-6466065417547481358</id><published>2008-12-24T14:04:00.002Z</published><updated>2008-12-24T14:11:59.564Z</updated><title type='text'>My .irbrc file</title><content type='html'>Here's my .irbrc file. This is based off of &lt;a href="http://giantrobots.thoughtbot.com/2008/12/23/script-console-tips"&gt;this post&lt;/a&gt; by Thoughtbot about using wirble with your IRB.&lt;br /&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/39689.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;This gives me auto-completion, history, color, Rails SQL output and a few other conveniences.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-6466065417547481358?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/6466065417547481358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=6466065417547481358' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/6466065417547481358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/6466065417547481358'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2008/12/my-irbrc-file.html' title='My .irbrc file'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-4035310004550124124</id><published>2008-12-24T13:48:00.003Z</published><updated>2008-12-24T13:50:33.999Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='merb2'/><category scheme='http://www.blogger.com/atom/ns#' term='merb'/><category scheme='http://www.blogger.com/atom/ns#' term='rails3'/><title type='text'>On the Rails merger with Merb</title><content type='html'>I think overall it will be a good thing.&lt;br /&gt;&lt;br /&gt;There obviously are a lot of common goals between the two frameworks but I'm more interested in how they merge some of the more controversial differences. Both teams have already mentioned modularity and internal APIs as something that Rails is going to adopt, but what about some of the smaller differences?&lt;br /&gt;Some of the more difficult issues to be resolved might be:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Merb's requirement for an explicit call to render or display - will that be optional?&lt;/li&gt;&lt;li&gt;Merb's mailer and exception handling - Merb way is probably superior&lt;/li&gt;&lt;li&gt;Rails' extensive use of monkey patching and magic versus Merb's preference for code simplicity&lt;/li&gt;&lt;li&gt;Rails' use of test/unit versus Merb's RSpec preference - will all of rails internal tests be rewritten in RSpec?&lt;/li&gt;&lt;li&gt;slices versus engines - support both??&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;None of these issues are huge and insurmountable but there are a lot of differences that will have to be debated. Will it be a full or partial buy-in to the Merb philosophy by the Rails team? If it is a full buy-in, Rails backward compatibility will probably suffer. If Rails 3.0 is only a partial merge of the Merb way, merbists may look at Rails 3.0 as a watered-down bastardization of Merb and just continue using Merb 1.x.&lt;br /&gt;&lt;br /&gt;I'm certainly looking forward to seeing what they come up with!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-4035310004550124124?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/4035310004550124124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=4035310004550124124' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/4035310004550124124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/4035310004550124124'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2008/12/on-rails-merger-with-merb.html' title='On the Rails merger with Merb'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-1405647956818176730</id><published>2008-11-30T13:19:00.004Z</published><updated>2008-11-30T20:18:06.668Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='webrat'/><category scheme='http://www.blogger.com/atom/ns#' term='cucumber'/><category scheme='http://www.blogger.com/atom/ns#' term='merb'/><title type='text'>Writing User Stories with Merb, Cucumber, merb_cucumber and webrat</title><content type='html'>I decided to try out cucumber and webrat for writing user stories in my sample merb application. &lt;a href="http://github.com/dermotbrennan/merbbit/tree/master"&gt;Merbbit&lt;/a&gt; is a merb-based web app for community-driven link submission. Think Digg, Reddit etc.&lt;br /&gt;&lt;br /&gt;I had used user stories before but I found so time-consuming as to be of little use. I was hoping that using webrat's shortcuts, the new improved story runner Cucumber and factory_girl would speed up writing these tests.&lt;br /&gt;&lt;br /&gt;Getting setup was quite pain-free.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;sudo gem install cucumber webrat david-&lt;em&gt;merb_cucumber&lt;/em&gt; --no-ri --no-rdoc&lt;br /&gt;merb-gen cucumber --session-type=webrat&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This will also install a sample login feature that should pass if you’re using merb-auth. I was using merb-auth but when I ran:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;rake features&lt;/pre&gt;The feature failed with the error:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Could not find field labeled "login"&lt;/pre&gt;&lt;br /&gt;This was because I had changed the login field in the login form from 'login' to 'email'. This was easy to fix. In features/login.feature I just changed&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;And I fill in "login" with "i_dont_exist"&lt;/pre&gt;to&lt;br /&gt;&lt;pre&gt;And I filled in "email" with "i_dont_exist"&lt;/pre&gt;And it worked!&lt;br /&gt;&lt;br /&gt;One of the first cool things I notice about cucumber is how much more colourful it is than the original user stories. It also discreetly tells you what line and what file the step starts on. This can be useful when you forget which file you wrote the matching step in.&lt;br /&gt;&lt;pre&gt;And I fill in "password" with "and_i_dont_have_a_password"  # features/steps/common_webrat.rb:16&lt;/pre&gt;The failed login scenario of the Login feature comes for free. I now needed to write a successful login scenario.&lt;br /&gt;&lt;pre&gt;Scenario: Successful Login&lt;br /&gt;Given I am not authenticated&lt;br /&gt;And an user exists with login "me@example.com" and password "secret_password"&lt;br /&gt;When I go to /login&lt;br /&gt;And I fill in "email" with "me@example.com"&lt;br /&gt;And I fill in "password" with "secret_password"&lt;br /&gt;And I press "Log In"&lt;br /&gt;Then the login request should succeed&lt;br /&gt;And I should see "me" in user_login&lt;br /&gt;&lt;/pre&gt;I had to write some new steps before I could run this scenario.&lt;br /&gt;&lt;br /&gt;For the step "And a user with login "me", email "me@example.com" and password "secret_password"" I needed to create a step that would populate the database with a user. I decided to use &lt;a href="http://github.com/thoughtbot/factory_girl/tree/master"&gt;factory girl&lt;/a&gt;&lt;br /&gt;&lt;pre&gt;$ sudo gem install thoughtbot-factory_girl&lt;br /&gt;&lt;br /&gt;add require 'factories' to features/env.rb&lt;br /&gt;&lt;br /&gt;features/factories.rb:&lt;br /&gt;gem 'thoughtbot-factory_girl'&lt;br /&gt;require 'factory_girl'&lt;br /&gt;&lt;br /&gt;Factory.define :user do |u|&lt;br /&gt;u.login 'me'&lt;br /&gt;u.email 'me@example.com'&lt;br /&gt;u.password 'password'&lt;br /&gt;u.password_confirmation 'password'&lt;br /&gt;u.active 'active'&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;require 'features/steps/common_factory_steps'&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;features/steps/common_factory_steps:&lt;br /&gt;Given /^a user with login "(.+)", email "(.+)" and password "(.+)"$/ do |login, email, password|&lt;br /&gt;Factory(:user, :login =&gt; login, :email =&gt; email, :password =&gt; password, :password_confirmation =&gt; password)&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;For the step "Then the login request should succeed", merb_cucumber comes with a "Then the login request should fail" but not a succeed step. It's easy to create one though.&lt;br /&gt;&lt;pre&gt;Then /^the (.*) ?request should succeed/ do |_|&lt;br /&gt;response.should be_successful&lt;br /&gt;end&lt;/pre&gt;I can't see an easy way using merb to tell if a specific template has been rendered like in rails integration testing (render_template) so I settled for just verifying that the users login "me" appears inside an element called 'user_login'.&lt;br /&gt;&lt;pre&gt;Then /^I should see "(.+)" in (.+)$/ do |message, id|&lt;br /&gt;response.should have_xpath("//*[@id=\"#{id}\" and text()=\"#{message}\"]")&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;This step could be used to test for any piece of text inside an element with a given id.&lt;br /&gt;&lt;br /&gt;Sources that helped:&lt;br /&gt;&lt;a href="http://github.com/david/merb_cucumber/tree/master"&gt;http://github.com/david/merb_cucumber/tree/master&lt;/a&gt;&lt;br /&gt;&lt;a href="http://github.com/brynary/webrat/tree/master"&gt;http://github.com/brynary/webrat/tree/master&lt;/a&gt;&lt;br /&gt;&lt;a href="http://rubybling.blogspot.com/2008/10/merbcucumber-almost-baked.html"&gt;http://rubybling.blogspot.com/2008/10/merbcucumber-almost-baked.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-1405647956818176730?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/1405647956818176730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=1405647956818176730' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/1405647956818176730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/1405647956818176730'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2008/11/writing-user-stories-with-merb-cucumber.html' title='Writing User Stories with Merb, Cucumber, merb_cucumber and webrat'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-4251073341353037153</id><published>2008-02-22T18:04:00.003Z</published><updated>2008-02-22T19:28:09.537Z</updated><title type='text'>Emacs Cheat Sheet</title><content type='html'>I have been trying to learn emacs. Note the use of the word learn. It's not just something you can just use, you have to learn and get used to a heap of things before you can meaningful use it. There are lots of cheatsheets for emacs out there but I want to compile my own one with just the stuff that is most important to me.&lt;br /&gt;&lt;br /&gt;The best way to learn emacs is probably by going through a tutorial like this &lt;a href="http://www2.lib.uchicago.edu/keith/tcl-course/emacs-tutorial.html"&gt;one&lt;/a&gt; and the built-in tutorial but what's missing is a quickstart tutorial for emacs...&lt;br /&gt;&lt;br /&gt;Here's my attempt:&lt;br /&gt;&lt;br /&gt;C-x         Ctrl and press x&lt;br /&gt;M-x        Meta/Alt key and press x&lt;br /&gt;C-x y      Ctrl and press x and then press y&lt;br /&gt;M-x  y    Meta/Alt key and press x and then press y&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Getting Started&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Installing on Debian/Ubuntu: sudo apt-get install emacs&lt;br /&gt;&lt;br /&gt;Starting a new file (from the commandline):&lt;br /&gt;&lt;tt&gt;&lt;b&gt;emacs filename&lt;/b&gt;&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;Starting a new file (from inside Emacs):&lt;br /&gt;C-x b  and type the name of your new file&lt;br /&gt;&lt;br /&gt;C-h t - start the builtin tutorial&lt;br /&gt;&lt;kbd&gt;C-g &lt;/kbd&gt;Abort a command&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Saving&lt;/span&gt;&lt;br /&gt;&lt;tt&gt;C-x C-s   Save&lt;br /&gt;C-x s        Save all (or a few at a time)&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Navigation&lt;/span&gt;&lt;br /&gt;&lt;tt&gt;C-a         Beginning of line   &lt;br /&gt;C-e         End of line&lt;br /&gt;M-f         Forward one word&lt;br /&gt;M-b         Backward one word&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Editing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;C-d    == DELETE, deletes character to the right&lt;br /&gt;backspace == Deleting, deletes character to the left&lt;br /&gt;&lt;kbd&gt;M-d &lt;/kbd&gt;Delete word&lt;br /&gt;&lt;kbd&gt;C-k &lt;/kbd&gt;Delete to the end of the line&lt;br /&gt;C-x u or C-_    Undo (Redo is more complicated)&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Cutting, Copying and Pasting&lt;br /&gt;&lt;/span&gt;While copying is still copying, what I think 90% of people know as cutting and pasting is not called as such in Emacs. We have Killing and Yanking. Basically kill == cut, yank == paste. (The name yank is a bit counter-intuitive at first I think. It made me assume it was cut. like you were yanking it out of the text, but in fact you're yanking it back into the text.) Emacs also has the concept of a kill-ring. That's just a fancy name for a clipboard.&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;&lt;kbd&gt;C-k &lt;/kbd&gt;   Kill/Cut to the end of the line&lt;br /&gt;&lt;kbd&gt;C-SPACEBAR&lt;/kbd&gt;  - mark the start of a piece of text followed one one of the following:&lt;br /&gt; M-w     Copy&lt;br /&gt; C-w     Kill/Cut&lt;br /&gt;&lt;br /&gt;&lt;kbd&gt;C-y&lt;/kbd&gt;     Paste (yank)&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Find/Replace&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;kbd&gt;C-s &lt;/kbd&gt;Find... (&lt;strong&gt;S&lt;/strong&gt;earch) - This does some cool highlighting of matches&lt;br /&gt;&lt;kbd&gt;C-s C-s &lt;/kbd&gt;Find again&lt;br /&gt;&lt;kbd&gt;M-% &lt;/kbd&gt;Replace&lt;br /&gt;&lt;kbd&gt;C-g &lt;/kbd&gt;Abort&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Moving between buffers (fancy name for an open file)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;C-x b    switch-to-buffer. Prompts for a buffer name and switches the buffer of the current window to that buffer.&lt;br /&gt;C-x C-b     list-buffers.&lt;br /&gt;C-x k        kill-buffer.&lt;br /&gt;&lt;br /&gt;Navigating between open windows (split views and stuff)&lt;br /&gt;C-x o     other-window. Switch to another window, making it the active window.&lt;br /&gt;&lt;dl&gt;&lt;dt&gt;&lt;kbd&gt;&lt;tt&gt;&lt;tt&gt;C-x 1  &lt;/tt&gt;&lt;/tt&gt;&lt;/kbd&gt;&lt;code&gt;&lt;tt&gt;&lt;tt&gt;delete-other-windows&lt;/tt&gt;&lt;/tt&gt;&lt;/code&gt;&lt;tt&gt;&lt;tt&gt;. Deletes all other windows except the current one, making one window on the screen.&lt;/tt&gt;&lt;/tt&gt;&lt;/dt&gt;&lt;/dl&gt;&lt;kbd&gt;&lt;tt&gt;&lt;tt&gt;C-x 0&lt;/tt&gt;&lt;/tt&gt;&lt;/kbd&gt;&lt;tt&gt;&lt;tt&gt;    &lt;code&gt;delete-window&lt;/code&gt;. Deletes just the current window&lt;br /&gt;&lt;kbd&gt;C-x 2&lt;/kbd&gt;&lt;code&gt;  split-window-vertically&lt;br /&gt;&lt;/code&gt;&lt;kbd&gt;C-x 3  &lt;/kbd&gt;&lt;code&gt;split-window-horizontally&lt;br /&gt;&lt;br /&gt;Exiting&lt;br /&gt;&lt;/code&gt;&lt;kbd&gt;C-x C-c&lt;/kbd&gt;   - exit, prompts for saves&lt;br /&gt;&lt;kbd&gt;C-x C-&lt;span style="font-family:Georgia,serif;"&gt;z    - suspend&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;Thats all for now!&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/tt&gt;&lt;/tt&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-4251073341353037153?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/4251073341353037153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=4251073341353037153' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/4251073341353037153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/4251073341353037153'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2008/02/emacs-cheat-sheet.html' title='Emacs Cheat Sheet'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-6217221153239262033</id><published>2008-01-11T12:41:00.000Z</published><updated>2008-01-11T12:55:12.021Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='images'/><category scheme='http://www.blogger.com/atom/ns#' term='mime-type'/><category scheme='http://www.blogger.com/atom/ns#' term='jpg'/><category scheme='http://www.blogger.com/atom/ns#' term='merb'/><category scheme='http://www.blogger.com/atom/ns#' term='jpeg'/><title type='text'>MERB: Rendering JPEG's from actions</title><content type='html'>While working on my MERB app, I wanted to pull an image from the database and render it inline as if it were a static jpg. I knew how to do this in Rails but not in MERB. It turns out to be really easy, although quite different from how it is done in Rails.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://hassox.blogspot.com/2007/10/adding-mime-types-to-merb.html"&gt;This&lt;/a&gt; blog post was very useful to figuring it out.&lt;br /&gt;&lt;br /&gt;Let's suppose you have a database model Image and an Images controller and action 'show'. Firstly at the end of your merb_init.rb file, put the following line:&lt;br /&gt;&lt;pre&gt;Merb.add_mime_type(:jpg, :to_jpg, %w[image/jpeg], {})&lt;/pre&gt;&lt;br /&gt;then in the controller add a provides parameter for jpg and &lt;br /&gt;&lt;br /&gt;In your model add a method to_jpg like so.&lt;br /&gt;&lt;pre&gt;def to_jpeg&lt;br /&gt;  data&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;Where data is the name of the column in your images table that holds the binary data.&lt;br /&gt;&lt;br /&gt;Make sure you restart your server after all these changes.&lt;br /&gt;&lt;br /&gt;Next your controller should look something like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class Image &lt; Application&lt;br /&gt;  provides :xml, :js, :yaml, :jpg&lt;br /&gt;&lt;br /&gt;  def show&lt;br /&gt;    image = Image.find(params[:id])&lt;br /&gt;    render image&lt;br /&gt;  end&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And thats it! If you go to /images/1.jpg (assuming RESTful routing...), the controller will retrieve the image with id 1 and MERB will call the to_jpg method on that object. It will then output that binary image data and send with the correct http header Content-Type parameter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-6217221153239262033?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/6217221153239262033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=6217221153239262033' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/6217221153239262033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/6217221153239262033'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2008/01/merb-rendering-jpegs-from-actions.html' title='MERB: Rendering JPEG&apos;s from actions'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-2167196449231401916</id><published>2008-01-10T15:17:00.000Z</published><updated>2008-01-11T12:55:35.296Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='merb'/><title type='text'>Merb Gotchas</title><content type='html'>I'm gonna to keep this post up to date with any gotchas or "mistakes of understanding" that I make as I work on MERB.&lt;br /&gt;&lt;br /&gt;First up. Controllers are called the same as models! Example:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;$ script/generate controller monkey&lt;br /&gt;Started merb_init.rb ...&lt;br /&gt;Loading Application...&lt;br /&gt;Compiling routes..&lt;br /&gt;Loaded DEVELOPMENT Environment...&lt;br /&gt;      exists  app/controllers&lt;br /&gt;      create  app/controllers/monkey.rb&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;and &lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;$ script/generate model monkey&lt;br /&gt;Started merb_init.rb ...&lt;br /&gt;Loading Application...&lt;br /&gt;Compiling routes..&lt;br /&gt;Loaded DEVELOPMENT Environment...&lt;br /&gt;  exists  app/models&lt;br /&gt;  create  app/models/monkey.rb&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So if you create a controller for monkeys and a model for monkeys, the two class names will both be called Monkey, except one will inherit from controller and the other from model.&lt;br /&gt;&lt;br /&gt;In fairness to MERB the generators do warn you about this.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;"The name 'Monkey' is reserved."&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But it doesn't explain why it is reserved and maybe I'm just thick but it stumped me for longer than it should have. &lt;br /&gt;&lt;br /&gt;You never have a chance to make that mistake in Rails because controllers are always like "MonkeyController". (I don't know why merb didn't follow suit... DRYer? simpler?)&lt;br /&gt;&lt;br /&gt;What I did to get around that was to make the controller plural. monkeys.rb&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-2167196449231401916?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/2167196449231401916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=2167196449231401916' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/2167196449231401916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/2167196449231401916'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2008/01/merb-gotchas.html' title='Merb Gotchas'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-6528888872269498873</id><published>2008-01-09T10:11:00.000Z</published><updated>2008-01-11T12:55:50.839Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='merb'/><category scheme='http://www.blogger.com/atom/ns#' term='sessions'/><title type='text'>Enabling Sessions in MERB</title><content type='html'>Sessions are disabled by default in MERB (because it makes the performance numbers look great! ;) ). To enable sessions, just set the variable :session_store: in merb.yml to one of activerecord, sequel, datamapper, memory, cookie or mem_cache.&lt;br /&gt;&lt;br /&gt;Because I want to use memory for my development sessions and mem_cache for my production environment, I set up config/environments/development.yml and put in:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;:session_store: memory&lt;br /&gt;:memory_session_ttl: 3600&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and config/environments/production.yml and put in:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;:session_store: mem_cache&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you're using memcached with MERB, you need to put &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;require 'memcache'&lt;br /&gt;CACHE = MemCache.new('127.0.0.1:11211', { :namespace =&gt; 'my_app' })&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;in your merb_init.rb (http://merb.rubyforge.org/classes/Merb/MemCacheSession.html)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-6528888872269498873?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/6528888872269498873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=6528888872269498873' title='292 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/6528888872269498873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/6528888872269498873'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2008/01/enabling-sessions-in-merb.html' title='Enabling Sessions in MERB'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>292</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-2125644542681846115</id><published>2008-01-08T17:21:00.000Z</published><updated>2008-01-09T10:10:33.255Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='merb'/><category scheme='http://www.blogger.com/atom/ns#' term='http authentication'/><title type='text'>HTTP Authentication for MERB</title><content type='html'>I've just started working on a new web application. It's going to be quite a simple app but speed and responsiveness is important so I decided to try &lt;a href="http://merbivore.com/"&gt;Merb&lt;/a&gt;. I'm going to blog about some of the difficulties and (hopefully) solutions I discover as I go through the process. One of the main problems with MERB is the lack of documentation so hopefully with these blog posts, I can help with that.&lt;br /&gt;&lt;br /&gt;First up, HTTP authentication. In the merb.yml it says the following:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# If you want to protect some or all of your app with  HTTP basic auth then&lt;br /&gt;# uncomment the following and fill in your credentials you want it to use.&lt;br /&gt;# You will then need to set a 'before' filter in a controller.  For example:&lt;br /&gt;#   before :basic_authentication&lt;br /&gt;#:basic_auth:&lt;br /&gt;#  :username: ezra&lt;br /&gt;#  :password: password&lt;br /&gt;#  :domain: localhost&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;All well and good, but what if you want to validate the authentication against a database of users?&lt;br /&gt;&lt;br /&gt;Well the answer is to overwrite the authenticated? method in &lt;a href="http://merb.rubyforge.org/classes/Merb/AuthenticationMixin.html"&gt;BasicAuthenticationMixin&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is easy to do, in your application.rb, do something like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class Application &lt; Merb::Controller&lt;br /&gt; before :basic_authentication&lt;br /&gt;&lt;br /&gt; private&lt;br /&gt;   def authenticated?&lt;br /&gt;     # if you want get the username and password that was inputted via http use:&lt;br /&gt;     # username, password = *credentials&lt;br /&gt;     # then validate the user by authenticating against a datbase or whatever&lt;br /&gt;     # make sure the return value is true or false&lt;br /&gt;   end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Note:&lt;/span&gt; You still have to uncomment the basic_auth configuration in merb.yml. But it doesn't matter what the username/password is there since you'll be overriding them anyways.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-2125644542681846115?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/2125644542681846115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=2125644542681846115' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/2125644542681846115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/2125644542681846115'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2008/01/http-authentication-for-merb.html' title='HTTP Authentication for MERB'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-4752897995131560000</id><published>2007-02-03T12:53:00.000Z</published><updated>2007-02-07T21:51:14.773Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='jruby'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>Using Rails with JRuby</title><content type='html'>In this post I'm going to discuss how to get a rails application running using JRuby. It's not actually not that difficult to just get it running. (The real difficulties arrive when you get to databases and other areas of rails that arent fully covered by JRuby) I'm only going to be launching the application using the WEBrick server at script/server. If you were putting this into production mode you would want to use one of the many many deployment solutions like using glassfish, tomcat and stuff like that. I'm not going to get into that stuff in this post. WEBrick is good enough for development work and as a first step.&lt;br /&gt;&lt;br /&gt;If you don't already have JRuby installed, have a look at my &lt;a href="http://dermological.blogspot.com/2007/02/installing-jruby-on-ubuntu.html"&gt;previous post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If you've just installed JRuby and stroll into a rails application and type&lt;br /&gt;&lt;pre&gt;# jruby script/server&lt;br /&gt;&lt;/pre&gt;You will get this error&lt;br /&gt;&lt;pre&gt;Cannot find gem for Rails ~&gt;1.2.1.0:&lt;br /&gt;Install the missing gem with 'gem install -v=1.2.1 rails', or&lt;br /&gt;change environment.rb to define RAILS_GEM_VERSION with your desired version.&lt;br /&gt;&lt;/pre&gt;This is what I did and I was stumped by it at first because I already had version 1.2.1 or rails installed on my system. What was wrong with JRuby? Why didn't it realise this?&lt;br /&gt;&lt;br /&gt;I then discovered that actually JRuby has its own gem system. You need to install rails as a JRuby gem.&lt;br /&gt;&lt;br /&gt;Check out &lt;a href="http://www.headius.com/jrubywiki/index.php/JRuby_on_Rails"&gt;http://www.headius.com/jrubywiki/index.php/JRuby_on_Rails&lt;/a&gt; for more detail but basically you use&lt;br /&gt;&lt;br /&gt;&lt;code&gt;# $JRUBY_HOME/bin/gem install rails -y --no-ri --no-rdoc&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;to install rails as a gem for JRuby. This should produce this (assuming you have JRUBY_HOME defined):&lt;br /&gt;&lt;pre&gt;Bulk updating Gem source index for: http://gems.rubyforge.org&lt;br /&gt;Successfully installed rails-1.2.1&lt;br /&gt;Successfully installed rake-0.7.1&lt;br /&gt;Successfully installed activesupport-1.4.0&lt;br /&gt;Successfully installed activerecord-1.15.1&lt;br /&gt;Successfully installed actionpack-1.13.1&lt;br /&gt;Successfully installed actionmailer-1.3.1&lt;br /&gt;Successfully installed actionwebservice-1.2.1&lt;br /&gt;&lt;/pre&gt;Great!&lt;br /&gt;&lt;br /&gt;Now go into a rails app:&lt;br /&gt;&lt;pre&gt;$ cd ~/webprojects/mygreatnewrailsapp.com&lt;br /&gt;$ jruby script/server&lt;br /&gt;=&gt; Booting WEBrick...&lt;br /&gt;=&gt; Rails application started on http://0.0.0.0:3000&lt;br /&gt;=&gt; Ctrl-C to shutdown server; call with --help for options&lt;br /&gt;[2007-02-03 13:48:03] INFO  WEBrick 1.3.1&lt;br /&gt;[2007-02-03 13:48:03] INFO  ruby 1.8.5 (0) [java]&lt;br /&gt;[2007-02-03 13:48:03] INFO  WEBrick::HTTPServer#start: pid=29324282 port=3000&lt;/pre&gt;&lt;br /&gt;Woohoo!&lt;br /&gt;Go http://localhost:3000/ in your browser and if its a brand new application you should see the "Welcome to Rails page"&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;WEBrick is OK, but what about Mongrel?&lt;/span&gt;&lt;br /&gt;While Mongrel is mostly Ruby, but it also contains some C (for speed reasons). JRuby can't do anything with C so for now Mongrel is out (More about that &lt;a href="http://headius.blogspot.com/2006/06/mongrel-in-jruby.html"&gt;here&lt;/a&gt;.). What is necessary is the conversion of the C components in Mongrel to Java but as far as I know no-one has done that yet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-4752897995131560000?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/4752897995131560000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=4752897995131560000' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/4752897995131560000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/4752897995131560000'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2007/02/using-rails-with-jruby.html' title='Using Rails with JRuby'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-8860901839460378531</id><published>2007-02-03T11:58:00.000Z</published><updated>2007-02-07T21:50:51.301Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='jruby'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Installing JRuby on Ubuntu</title><content type='html'>This post is going to detail the steps I had to take in installing &lt;a href="http://jruby.codehaus.org/"&gt;JRuby&lt;/a&gt; on my Ubuntu system. Note: these steps would probably work just fine on most other Linux systems but I haven't tried it so I cant say for sure.&lt;br /&gt;&lt;br /&gt;You will probably need to install all this as root.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Prerequisites&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The first thing you need is Java. You need the Java JRE and JDK (at least version 1.4 according to this &lt;a href="http://svn.codehaus.org/jruby/trunk/jruby/README"&gt;http://svn.codehaus.org/jruby/trunk/jruby/README&lt;/a&gt;). I'm not going to go through the details so Ill just point you towards some tutorials&lt;br /&gt;&lt;a href="https://jdk-distros.dev.java.net/ubuntu.html"&gt;https://jdk-distros.dev.java.net/ubuntu.html&lt;/a&gt; - the easy way&lt;br /&gt;&lt;a href="http://java.sun.com/javase/downloads/index.jsp"&gt;http://java.sun.com/javase/downloads/index.jsp&lt;/a&gt; - the less easy way&lt;br /&gt;&lt;br /&gt;To verify you have Java, just check the version. You should get something like this:&lt;br /&gt;&lt;pre&gt;# java -version&lt;br /&gt;java version "1.5.0_08"&lt;br /&gt;Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)&lt;br /&gt;Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)&lt;br /&gt;&lt;/pre&gt;Next thing to install is &lt;a href="http://en.wikipedia.org/wiki/Ant"&gt;Ant&lt;/a&gt;, its a prerequisite for building JRuby.&lt;br /&gt;&lt;pre&gt;# apt-get install ant&lt;/pre&gt;Verify you have ant:&lt;br /&gt;&lt;pre&gt;# ant -version&lt;br /&gt;Apache Ant version 1.6.5 compiled on July 5 2006&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;Building JRuby&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;If you have &lt;a href="http://en.wikipedia.org/wiki/Subversion_%28software%29"&gt;Subversion&lt;/a&gt; you can just go&lt;br /&gt;&lt;pre&gt;# svn co http://svn.codehaus.org/jruby/trunk/jruby&lt;/pre&gt;If you dont have Subversion you can download it here: &lt;a href="http://dist.codehaus.org/jruby/"&gt;http://dist.codehaus.org/jruby/&lt;/a&gt; and extract it using:&lt;br /&gt;&lt;pre&gt;# tar -xzvf jruby-src-LATEST.VERSION.tar.gz&lt;br /&gt;&lt;/pre&gt;(At this point it might be a good idea to move the jruby folder to somewhere like /usr/local/lib just to make it more globally available and less specific to any particular user. This location, where ever you decide, will be called JRUBY_HOME)&lt;br /&gt;&lt;br /&gt;Then:&lt;br /&gt;&lt;pre&gt;# cd ./jruby&lt;br /&gt;# ant clean jar&lt;br /&gt;&lt;/pre&gt;You should get output like this:&lt;br /&gt;&lt;pre&gt;Buildfile: build.xml&lt;br /&gt;&lt;br /&gt;init:&lt;br /&gt;&lt;br /&gt;clean:&lt;br /&gt;[delete] Deleting directory /usr/local/lib/jruby/build&lt;br /&gt;[delete] Deleting 2 files from /usr/local/lib/jruby/lib&lt;br /&gt;[delete] Deleting directory /usr/local/lib/jruby/docs/api&lt;br /&gt;&lt;br /&gt;init:&lt;br /&gt;&lt;br /&gt;prepare:&lt;br /&gt;[mkdir] Created dir: /usr/local/lib/jruby/build&lt;br /&gt;[mkdir] Created dir: /usr/local/lib/jruby/build/classes&lt;br /&gt;[mkdir] Created dir: /usr/local/lib/jruby/build/classes/jruby&lt;br /&gt;&lt;br /&gt;blahblahblabh java ant creation stuff filler text blahblahblah&lt;br /&gt;&lt;br /&gt;jar-jruby:&lt;br /&gt;[jar] Building jar: /usr/local/lib/jruby/lib/jruby.jar&lt;br /&gt;&lt;br /&gt;jar-openssl:&lt;br /&gt;[jar] Building jar: /usr/local/lib/jruby/lib/jruby-openssl.jar&lt;br /&gt;&lt;br /&gt;jar:&lt;br /&gt;&lt;br /&gt;BUILD SUCCESSFUL&lt;br /&gt;Total time: 11 seconds&lt;br /&gt;&lt;/pre&gt;If you didn't get a Build Successful, you've got problems, loser! Woah, thats probably a bit harsh. But seriously, you're on your own.&lt;br /&gt;&lt;br /&gt;Ok, great you've built JRuby but you can't run it from the commandline yet!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Add JRuby to the path&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;# jruby&lt;br /&gt;bash: jruby: command not found&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Duh-oh! You need to add jruby to your path. I'm going to assume you use Bash, but it should be similar enough for whatever shell you use.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# vi ~your_username/.bashrc&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Add this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;JRUBY_HOME=/usr/local/lib/jruby   # or where ever you put it.&lt;br /&gt;PATH=$PATH:$JRUBY_HOME/bin&lt;/pre&gt;to the end of the file.&lt;br /&gt;&lt;br /&gt;Now reload your bash profile&lt;br /&gt;&lt;pre&gt;# source ~yourusername/.bashrc&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;(Note to add JRUBY_HOME to the global path, add&lt;br /&gt;&lt;pre&gt;JRUBY_HOME=/usr/local/lib/jruby   # or where ever you put it.&lt;br /&gt;PATH=$PATH:$JRUBY_HOME/bin&lt;/pre&gt;to /root/.profile and (/root/.bash_profile or /root/.bashrc)&lt;br /&gt;&lt;a href="http://www.troubleshooters.com/linux/prepostpath.htm"&gt;http://www.troubleshooters.com/linux/prepostpath.htm&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Now try this:&lt;br /&gt;&lt;pre&gt;# jruby -v&lt;br /&gt;ruby 1.8.5 (0) [java]&lt;br /&gt;&lt;/pre&gt;As Millhouse says: Radical!&lt;br /&gt;&lt;br /&gt;Well thats about it. JRuby is now installed and you can use it as a ruby interpreter in the same way that you would use the official ruby interpreter.&lt;br /&gt;&lt;pre&gt;# jirb&lt;br /&gt;irb(main):002:0&gt; puts "moo!"&lt;br /&gt;moo!&lt;br /&gt;=&gt; nil&lt;br /&gt;irb(main):003:0&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-8860901839460378531?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/8860901839460378531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=8860901839460378531' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/8860901839460378531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/8860901839460378531'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2007/02/installing-jruby-on-ubuntu.html' title='Installing JRuby on Ubuntu'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5393915095624425190.post-4763220434985066043</id><published>2007-01-25T10:43:00.000Z</published><updated>2007-01-25T23:02:39.793Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='subversion'/><title type='text'>Installing Subversion 1.4.3 from source on linux</title><content type='html'>This compiled version does NOT link into apache for webdav and is probably not suitable as an svn server, only as a client. For that you need apxs and configure with --with-apxs and blahblahblah...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Download subversion and the dependencies from tigris.org&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;wget http://subversion.tigris.org/downloads/subversion-1.4.3.tar.gz&lt;br /&gt;wget http://subversion.tigris.org/downloads/subversion-deps-1.4.3.tar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span&gt;Extract them from .tar.gz&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;tar -xzf subversion-1.4.3.tar.gz&lt;br /&gt;tar -xzf subversion-deps-1.4.3.tar.gz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Then run configure and make&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# ./configure --with-ssl&lt;br /&gt;# make&lt;br /&gt;# make install&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I think --with-ssl is necessary if you want to use https&lt;br /&gt;&lt;br /&gt;And done! To test you've got the right version:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# svn --version&lt;br /&gt;svn, version 1.4.3 (r23084)&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5393915095624425190-4763220434985066043?l=dermological.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dermological.blogspot.com/feeds/4763220434985066043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5393915095624425190&amp;postID=4763220434985066043' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/4763220434985066043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5393915095624425190/posts/default/4763220434985066043'/><link rel='alternate' type='text/html' href='http://dermological.blogspot.com/2007/01/installing-subversion-143-from-source.html' title='Installing Subversion 1.4.3 from source on linux'/><author><name>Dermot</name><uri>http://www.blogger.com/profile/09948791642285800617</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_Du5otp9RjAU/SVI-7gqvyzI/AAAAAAAABLU/YQDgZ2f55FI/s1600-R/19daa847a78292a021738d7a0876cb85%3Fs%3D100'/></author><thr:total>1</thr:total></entry></feed>
