/ #blog 

Did I mention that I love Ruby?

I’m busy coding an application, and I needed to find out if some value is included in one of several arrays: a = [ 1, 2, 3 ] b = [ 2, 3, 4, 5 ] x = 5 y = 6 Now the question is: Is x in either Array a or b? arrays = [a, b] arrays.inject(false) { |is_in, array| is_in or array.include?( x ) } # => true arrays.inject(false) { |is_in, array| is_in or array.include?( y ) } # => false Beautiful! (or is there a better way?) ...

Jens-Christian Fischer
/ #blog 

Back from rails-konferenz.de

Yesterdays rails-konferenz.de was quite a success. Almost 100 particpants showed up for a one day, information packed day. My presentation on “Extreme Testing” went very well. The slides should be up in a couple of days on the rails-konferenz.de web site. I had a chance to reconnect to people I met at other conferences and make quite a few new acquaintances. The personal hightlights for me were a comment about Capistrano in the Q&A section of the Capistrano talk by Ralf Wirdemann (which will allow me to use Capistrano on a server that doesn’t allow access to the SVN repository), Patrick Lenz’s take on Rails scalability and of course Rany Kedos plan for getting out of a boring job (not that I would need that, thankfully): ...

Jens-Christian Fischer
/ #blog 

Flattery or rip-off?

They say that imitation is the sincerest form of flattery… However, I don’t find any imitation in this Rails Cheat Sheet Collectors Edition but only a blatant rip-off of my Rails Reference. What is disappointing about this is, that Benjamin Gorlick has been granted a Google Summer of Code grant for Rails documentation (also mentioned on the rails blog). The license I have released the reference under specifically allows for derivative works (even commercial ones) but requires attribution to me as the original author. ...

Jens-Christian Fischer
/ #blog 

Rails, Content - Type, RJS and filters

Again - one of these “it takes several hours” to find it things: In an inherited application that I’m expanding, I was using RJS actions to handle inserts: page.insert_html :bottom, 'info_list', :partial => 'info' Because of some non-showing Umlauts, I switched on a filter to set the content type: <code> class ApplicationController < ActionController::Base before_filter :set_charset def set_charset headers['Content - Type'] = "text/html; charset=8859-1" end end </code> with the result, that all my RJS stuff stopped working. Finally I diffed against a working copy and found the line enabling the filter. I rewrote it like this, and things started to work again ...

Jens-Christian Fischer
/ #blog 

first swissRUG meeting success

The inaugural meeting of SwissRUG / Zurich.rb / bunch of geeks was quite a success, with 16 people turning up. Due to some communications gone bad, the restaurant only had reserved a table for 10, but by grabbing the employees table, we managed to squeeze all in. Quite a mixed bunch of people: The operating systems seemed neatly divided into 1/3 Windows, 1/3 Mac OS X and 1/3 Linux. About half of the people earn money using Ruby and/or Rails. There were quite a few “Ruby only” people. ...

Jens-Christian Fischer