Hi I’m Ruby on Rails
Tuesday, May 15th, 2007A couple of funny videos in the style of the new Apple adverts:
Rails and Java
Rails and PHP
A couple of funny videos in the style of the new Apple adverts:
Rails and Java
Rails and PHP
I needed to install rmagick over the weekend as I was playing with the file_column plugin. Rubygems has usually been good to me so I didn’t expect any problems when I issued the command:
#gem install rmagick
<snip>
/usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/misc.rb:321:in `get_type_metrics': unable to read font `/usr/share/fonts/default/TrueType/verdana.ttf' (Magick::ImageMagickError)
from /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/misc.rb:321:in `render'
from /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/misc.rb:696:in `text'
from /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/text.rb:65:in `add_primitives'
from /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/container.rb:72:in `add_primitives'
from /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/container.rb:72:in `each'
from /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/container.rb:72:in `add_primitives'
from /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
from /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/rvg.rb:264:in `each'
from /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/rvg.rb:264:in `add_outermost_primitives'
from /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.5/./lib/rvg/rvg.rb:236:in `draw'
from InitialCoords.rb:22
post-setup.rb: InitialCoords.rb example returned error code 256
Uh-oh. It seems I was missing some windows specific fonts. Well obviously, I am using Linux. With no obvious package with the missing fonts available in yum I went looking and found this windows font rpm.
After installing and linking the font dir to the place rmagick expects them:
ln -s /usr/share/fonts/msttcorefonts /usr/share/fonts/default/TrueType
That done #gem install rmagick works!
I have recently been playing with carl’s new project, http://codegolf.com/
Basically the idea is to solve given programming challenges in as few characters as possible. The output from entries is compared to a reference output and any that pass the comparison are scored by the number of characters they used. Some challenges require you to parse input aswell.
The implementation is quite neat. Code you upload is run as an unprivileged user inside a chroot inside a jail in FreeBSD, and the whole lot is re-created for every run. Four languages are available, Ruby, PHP, Perl and Python with brainfuck (wikipedia entry) support promised soon.
Anyway, if you have a spare afternoon/evening/week it is pretty good fun.
If that sounded like an advert it wasn’t meant to :)
A while back carl and I had a 99 bottles of beer on the wall one-liner competition in Ruby. I just found this in my home directory and so am claiming it as my entry:
def b(c)"#{c} bottle#{c>1?"s":""} of beer on the wall"end;99.downto(1){|x|$>< <2?"Go to the store and buy some more":"Take one down and pass it around"} #{b (x-1>0?x-1:99)}.
“}
It weighs in at a hefty 206 characters and I know it is possible to get it smaller than this, but it is way too much of a time-sink for me to try.
Ages ago Carl sent me a link to a crappy looking Ruby IDE that has one really cool feature, a visual code overview. I am not sure just how useful it would be, but it looks cool.
The Ruby Net::IMAP module has a bit of a warty interface, but it does work. It could do with a much nicer interface (perhaps a Net::IMAP::Simple equivalent?) and better docs. Here is a working example:
#!/usr/bin/env ruby
require 'rubygems'
require 'net/imap'
require_gem 'rmail'
imap = Net::IMAP.new('host')
imap.login('username', 'password')
imap.examine('inbox')
imap.search(["SUBJECT", "Some text to look for", "SINCE", "11-Sep-2005"]).each do |message_id|
message = RMail::Parser.read(imap.fetch(message_id, ["BODY[]“])[0].attr['BODY[]‘])
puts message.header.subject
end
Not too difficult once you work out what you need to be doing.
Railsday is officially over (5 days ago anyway). Carl wrote about it and our entry in more detail and you should head off there first to read a good summary of how it went. Judging has recently been extended by 8 days so we will find out how we did on the 18th June.
In general the competition was fairly well organised, especially since it was the first time it has been run, but there are improvements that could be made for next time.
But apart from those, a big thank you to the organisers for making it happen. I will hold off thanking the judges until I know how we did!
I was talking about railsday a few days ago with Carl (we are thinking about entering if we come up with a good enough idea) but it occurred to me that it is getting increasingly difficult to create a truly groundbreaking app.
When Google launched gmail everyone was wowed by the new style of user interface they provided. A large part of this was due to their use of Ajax. It didn’t take long before the number of other sites started using Ajax, and Ruby on Rails now has excellent bundled support. This has led to some excellent uses of the Ajax that are really pushing a paradigm shift in web application user-interface design, with some of the most succesfull examples being written by the folks at 37signals.
However, as more sites are being released using these new interface technologies and ideas the bar is being raised. For example sticking with 37signals ouput, we first saw Basecamp and Tadalist, some simple ideas but brought together in a well thought out way. They created a lot of buzz and rightly so, but 37signals latest offering, backpack, has not created nearly the excitement that their previous sites did, despite being a more complex and at least as effective use of the technology.
Because of this railsday will probably produce some very good apps, but it would take something very very special to recreate the initial Ajax buzz. I am not expecting miracles, the competition only allows 24 hours of work per project after all, but the bar for ’special’ apps has been raised high.
A number of people are reporting 10x faster development with Ruby on Rails, but my experience goes further than faster application turnaround time.
Carl and I have certainly seen a big reduction in the time between having an idea and seeing it implemented, we discuss an idea for Gimpu and we can put the functionality in place in an hour or two. But it doesn’t stop there. Because we get the functionality in place so quickly we can spend more time getting the user interface right, we have more time to experiment and that means the end user of the site will get something that looks and feels more polished.
Using Rails feels like the perl motto that goes something like
Making the simple things easy and the hard things possible.
Rails really does take the day-to-day drudgery out of creating web-apps and lets us concentrate on the interesting bits.