26th Ruby Kansai Workshop in Kyoto

On 17-May-2008 there was 26th Ruby Kansai Workshop in Kyoto. A lot of fun like always :) The chatlog from the presentations is available on lingr.

I gave a presentation "Ruby off Rails" about developing web applications in Ruby, but without Rails - Sequel, Rack, Ramaze etc. talk. The presentation slides:

The sources from the talk (plus some extras - rack middleware examples) are available on Google sites for download.
There was no time to speek about Tamanegi - my feeds aggregator in Ramaze, but maybe on some other meeting...

There are also another two presentations:

Benchmarking CGI, FastCGI, mod_ruby, mod_rails and mongrel_cluster. Received very good documentation with configs for all mentioned deployment options.
Okkez-san is using Rabbit - very cool presentation tool, written in Ruby! Just needed ruby-gnome. Will try it soon maybe.
Some notes:

  • ebb is still a pain to install
  • mod_ruby is not bad deployment option
  • webrick overperforms fastcgi for simple installs (still a valuable option for intranet for example)
  • thin is fast

I think thin is faster because of the underlaying EventMachine TCP stack implementation in C. The others are just pure Ruby-based, so there is nothing to compare for simple requests (ab benchmarks).

There are sooooo many web services around. Can the posting to them be automated, using Ruby-based tools?

!!! Big Fat Warning: The presented tools will make you very 'productive'. Maybe your friends will stop following you. Use on your own risk! ;)

Main working horse - www:mechanize ruby port:

gem install mechanize

So far so good. But can you post directly from VIM? Seems there is vimscript - i way to customize vim in different languages. Try:

vim --version

and if you see +ruby you can use ruby in vimscripts like:

# ~/.vim/plugins/some_plugin.vim
...
VIM.evaluate(’..’) evaluate %[sdfsds]
...

And even better: there are already a lot of ready ruby-based VIM plugins in the CodeRepos vim repository

There was also the 20th "Ruby for beginners" lesson after that. With a 'little' help from google my answers was:

  • FizzBuzz variation ('Aho','Bow' and also say 'Aho' for numbers that contain '3'):
 puts (1..100).map { |i| (s=(i%3==0?'Aho':'')+(i%5==0?'Bow':'')+(i.to_s =~ /3/?'Aho':''))==""?i:s }
#!/usr/bin/env ruby

def expensive
  @expensive ||=
    begin
      n = 99
      buf = ""
      begin
        buf << "#{n} bottle#{n>1?'s':''} of beer on the wall\n"
        n -= 1
      end while n > 0
      buf << "no more bottles of beer"
    end
end

puts expensive