ScotRubyConf 5K
Stephan Kaag wo 24 mrt 10
As you might know already a small part of the HoR crew will attend this year’s ScottishRubyConference which happens to start next friday.
We will all participate in a local Run for Charity.
The run will take place in the early evening of 26 March, when many of the Scottish Ruby Conference Delegates and speakers will decamp to Portobello to take part in the 5k race.
The ScotRubyConf5k is inspired by last year’s RubyConf5k, which raised over $1,300 for the Leukemia & Lymphoma Society.
38 runners have now registered for the SRC 5k race. That’s quite a pack! Whatever your pace, you won’t feel alone. The route1 follows the Portobello promenade, which is as flat as can be. If you’ve never raced before, it will be a gentle introduction, or if you’re trying to set a new personal best then this could be the place to do it.
Gepost in hor | 0 reacties
Debugging under Passenger
Jeroen Bulters do 18 mrt 10
Sometimes… you just have to debug something in a ‘live’ (i.e. staging) environment. Or you just enjoy using Passenger as a development platform. Either way, when using Passenger, you lose the plain-old “—debugger” option which – in my opinion – has proven itself to be indispensible to debug Rails applications. Luckily, there is a solution: ruby-debug.
To use ruby-debug with passenger, we specify the following in our environment file (be it production or development):.
if File.exists?(File.join(Rails.root,'tmp', 'debugger.txt')) require 'ruby-debug' Debugger.wait_connection = true Debugger.start_remote File.delete(File.join(Rails.root,'tmp', 'debugger.txt')) end
Starting a debugger waiting for a remote connection if the debugger.txt file exists in our tmp directory. Just touch both the tmp/debugger.txt file and the tmp/restart.txt file and a debugger session will be waiting for you as soon as the Passenger process has respawned.
Connect with the debugger with “rdebug -c”; et voila!
One drawback, the incredibly handy irb function of rdb is not available in remote-mode.
Gepost in hor | 0 reacties
Adding Hoptoad support to Delayed::Job
Stephan Kaag di 16 mrt 10
Altough Hoptoad might be installed in your Rails application, the errors that are raised within delayed-jobs will not be reported to this excellent service.
Why is that? Delayed-job has it’s own exception rescuing mechanism and the Hoptoad hook isn’t called by default. If you want to report all delayed-job’s exceptions to Hoptoad you can use a hook-script like this.
begin Delayed::Job.logger.info "Adding Hoptoad support to Delayed::Job" begin module Delayed class Job def invoke_job_with_hoptoad if defined?(HoptoadNotifier) Delayed::Job.send(:define_method, :invoke_job_with_hoptoad) do begin invoke_job_without_hoptoad rescue Exception => e HoptoadNotifier.notify(e, :cgi_data => self.attributes) raise e end end else Delayed::Job.send(:define_method, :invoke_job_with_hoptoad) do invoke_job_without_hoptoad end end invoke_job_with_hoptoad end alias_method_chain :invoke_job, :hoptoad end # Job end # Delayed rescue Exception => e Delayed::Job.logger.error(e) raise e end end
Gepost in hor | 0 reacties
VirtualBox and Ruby
Gawin Dapper do 11 mrt 10
Over the last few years I worked with a lot of different virtualisation products. Ranging for VMware ESX and XEN clusters to simpeler solutions like VMware Workstation and Fusion, Parallels, but also with VirtualBox. Innotek introduced VirtualBox 3 years ago, and since that has been bought by Sun Microsystems, which was recently bought by Oracle.
I have been using VirtualBox since the Beta, and I’m still a big fan. Over the periode of 3 years it has grown into a very rich feature set, and works on most operating systems. Features I really like are Snapshots, the Public API, Raw hard disk access and the abillity to use VMware VMDK and Microsofts VHD disk images. Since 3.1 it also supports Teleportation, which lets you migrate your VM live (with no downtime) from one physical machine to an ohter.
Now you might wonder why I would write this on a Ruby blog?
Well, there is a very nice VirtualBox gem which allows you to manage your VM’s using Ruby. It is modeled after ActiveRecord, so most of you should feel right at home.
To get started, just follow the Getting Started Guide
Gepost in | 0 reacties
Webservices in RubyOnRails
Chiel Wester wo 10 mrt 10
Since the launch of rails 2.0, the standard support for generating soap services with rails was removed. SOAP was replaced for standard REST support. This was done because Rails became entirely resource driven and uses REST as the architecture to accomplish that. SOAP on the other hand implements specific method names and sends all calls all these methods using a POST request.
So what if your client application requires a soap service and you therefore have the need to develop a soap service in your rails application? You will need actionwebservice for that. Luckily actionwebservice was not lost entirely when rails dropped support for SOAP. Simply install the pantzel-actionwebservice gem and you are ready to generate a basic SOAP service.
The good thing of actionwebservice is that you don’t have to worry about creating a WSDL. Simply define the structure of your webservice, start the application and go to http://localhost:3000/webservicename/wsdl and the wsdl is presented to you generated from the webservice api definition!
For examples of how to use the actionwebservice gem, there are some good examples in the example directory of the gem itself.
Gepost in hor | 0 reacties
config.scoping == :important => true
Chris Brandhorst ma 01 mrt 10
Last week I realised that using the config scope in your Rails environment files can be quite important.
We had the situation that we needed a different SMTP configuration for different environments.
In the environment.rb I found the following lines:
Rails::Initializer.run do |config| ... end ActionMailer::Base.smtp_settings = { :address => "127.0.0.1", :port => 25, :domain => "hollandonrails.nl" }
For the develoment environment I needed something else, so I proceeded to add the following to development.rb:
ActionMailer::Base.smtp_settings = { :address => "mail.google.com", :port => 25, :domain => "bla.com" }
But then the emails were not sent in the dev environment. Not knowing the cause, I spent an hour or two figuring this out.
Finally, I found out that the ActionMailer settings given in development.rb were not used. Some more investigation revealed the following things:
- ActionMailer is not defined within the Rails::Initializer block in environment.rb
- Using ActionMailer inside development.rb does NOT raise an error, but the scope of development.rb seems to be the same Rails::Initializer block
- Setting ActionMailer settings using config.action_mailer (like below) does allow overriding of these settings
config.action_mailer.smtp_settings = { :address => "127.0.0.1", :port => 25, :domain => "hollandonrails.nl" }
Gepost in | 0 reacties
jQuery voor Meisjes!
Gawin Dapper ma 01 mrt 10
Om de vrouwelijke opmars binnen onze ICT industrie verder te stimuleren is er nu een heuse cursus jQuery: is voor meisjes ontstaan. Ken je toevallig vormgeefsters, webdesigners of andere geïntereseerde, informeer ze dan omtrent deze cursus ;-)
$(document).ready(function(){ $(".girls").show(); });
Gepost in hor | 0 reacties
Let God help you!
Chiel Wester do 25 feb 10
Yesterday i posted about implementing Resque. With Resque you can easily implement background jobs and put them in a queue. After that, you can start some resque workers to do perform all the enqueued jobs.
Obviously there is a need to make sure that all your workers are running and when they go down (for any reason at all) you should be notified about it, and you want the workers to restart automatically.
In this case you can ask God for help. God is a monitoring tool written in ruby which makes it easy to implement. Simply install god with:
gem install god
The config files of god (in the config files you define the processes god needs to watch for you) are written entirely in ruby. After configuring your watches (see example on the god homepage) you need to start god and load the config file:
$ god $ god load /path/to/config/file
or shorter:
god -c /path/to/config/file
After that, you can ask god for the status of the processes it is watching (god status) and also restart processes (god restart name_of_group)
Resque ships with a predefined god configuration that can be found in the examples folder on GitHub.
In case you want to let god automatically restart your processes after a deploy, you can use the san_juan gem which is a capistrano plugin.

Gepost in hor | 0 reacties
Implementing Resque
Chiel Wester wo 24 feb 10
A while ago i posted an article with the announcement that Github’s new background worker library ‘Resque’ had made its way to the public community.
Now that i’m working with resque myself for some jobs, it’s time to give you a little summary of the way resque works and how you should implement it.
Background jobs
With resque, every Ruby class with a perform method can be used as a background job. So all you have to do to implement a background job is creating a class and add the self.perform method!
Remember that you need to set the queue name of the queue the job should be put in:
class Archive @queue = :queue_name ... def self.perform(args = {}) end end
Startup Redis
Before you can add any jobs to the queue, you need to start the queue manager for resque: redis. After installing redis, you can simply start is with the command ‘redis-server’.
Queueing jobs
To add a new job to the queue you simply need to make a call to Resque.enqueue with the class name of the job you want to enqueue and some additional arguments:
Resque.enqueue(Archive, arguments)
Keep in mind that it must be possible to marshal the additional arguments to json format! (This is because the queues of Resque are saved in json format in the redis server)
Now let’s do some work!
After adding jobs to the queue, all there’s left to do is start a worker to work through the queue and perform all the jobs you have put in the queues. This can be done with a simple rake task. First put the following line in the Rakefile of your application:
require 'resque/tasks'
After that, run the following command:
QUEUE=* rake environment resque:work
Workers for all existing queues will start and run all enqueued jobs!
Resque-web
With resque-web you can watch all running processes in resque. resque-web is a simple web interface that shows you information about queues, running workers and failed jobs. Just run ‘resque-web’ and open the url in your browser!

Gepost in hor | 0 reacties
Why You Should Be Grateful for Coding in Ruby
Dax Huiberts ma 22 feb 10
Wees blij dat je iedere dag in Ruby kan programmeren in plaats van in PHP. Het is voor mij een tijd geleden dat ik PHP code heb aangeraakt, maar ik weet wel dat als ik er al naar kijk, dat ik dan spontaan kiespijn krijg.
Kan jij jouw laatste keer nog herinneren dat jij PHP code heb geschreven? Hoe voelt dat? Pijnlijk hè?
Laten we daarom eens een momentje rust nemen om eens te realiseren dat we het eigenlijk goed te makken hebben en dat we heel trots mogen zijn met wat wij doen.
Denk je dat dit propaganda is? Nee joh, dit is gewoon een uiting van liefde. Wil je nog meer redenen hebben waarom Ruby zo tof is? Check dan deze 37 redenen voor onvoorwaardelijke Ruby liefde.
XOXO
Gepost in hor | 0 reacties
Welcome to Holland On Rails
This weblog is the official Ruby techblog from the guys at Holder, a Ruby development company. Holder is also the company behind the RubyAndRails Europe Conference in Amsterdam.Recente Jobs
Bekijk alle jobs »»
Gereedschapskist
Onmisbare tools vooriedere developer!
- Ruby On Rails
Framework voor de web 2.0 developer. Eindelijk vooruitgang! - TextMate
Editor for true pro's
Typ, tab, top :-)
Nee, niet voor Win. - Made On A Mac
En nou is het over met die saaie grijze Windows bak van je!
Auteurs op deze site
Chris Obdam
'Less is more' evangelist, past dit ook dagelijks toe op zijn tandenborstel.Chiel Wester
Snelheidswonder op Ruby wielen. Leuk om mee te pair-programmen ;-)