<?xml version="1.0" encoding="UTF-8"?>
<articles type="array">
  <article>
    <active type="boolean">true</active>
    <author-id type="integer">2</author-id>
    <content>Since the &quot;launch of rails 2.0&quot;:http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done, 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. &quot;SOAP on the other hand&quot;:http://www.developerfusion.com/article/7991/rest-and-net-35-part-1-why-rest-based-services/ 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 &quot;pantzel-actionwebservice&quot;:http://github.com/panztel/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.</content>
    <created-at type="datetime">2010-03-10T09:58:43+01:00</created-at>
    <id type="integer">482</id>
    <publication-date nil="true" type="datetime"></publication-date>
    <title>Webservices in RubyOnRails</title>
    <updated-at type="datetime">2010-03-10T10:00:35+01:00</updated-at>
  </article>
  <article>
    <active type="boolean">true</active>
    <author-id type="integer">1251</author-id>
    <content>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:

&lt;code&gt;
Rails::Initializer.run do |config|
  ...
end

ActionMailer::Base.smtp_settings = {
  :address =&gt; &quot;127.0.0.1&quot;,
  :port    =&gt; 25,
  :domain  =&gt; &quot;hollandonrails.nl&quot;
}
&lt;/code&gt;

For the develoment environment I needed something else, so I proceeded to add the following to development.rb:

&lt;code&gt;
ActionMailer::Base.smtp_settings = {
  :address =&gt; &quot;mail.google.com&quot;,
  :port    =&gt; 25,
  :domain  =&gt; &quot;bla.com&quot;
}
&lt;/code&gt;

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

&lt;code&gt;
config.action_mailer.smtp_settings = {
  :address =&gt; &quot;127.0.0.1&quot;,
  :port    =&gt; 25,
  :domain  =&gt; &quot;hollandonrails.nl&quot;
}
&lt;/code&gt;</content>
    <created-at type="datetime">2010-03-01T08:29:50+01:00</created-at>
    <id type="integer">481</id>
    <publication-date type="datetime">2010-03-01T08:30:02+01:00</publication-date>
    <title>config.scoping == :important =&gt; true</title>
    <updated-at type="datetime">2010-03-01T08:30:02+01:00</updated-at>
  </article>
  <article>
    <active type="boolean">true</active>
    <author-id type="integer">1252</author-id>
    <content>Om de vrouwelijke opmars binnen onze ICT industrie verder te stimuleren is er nu een heuse cursus &quot;jQuery: is voor meisjes&quot;:http://jquery.isvoormeisjes.nl/ ontstaan. Ken je toevallig vormgeefsters, webdesigners of andere ge&#239;ntereseerde, informeer ze dan omtrent deze cursus ;-)

&lt;code&gt;
  $(document).ready(function(){
     $(&quot;.girls&quot;).show();
  });
&lt;/code&gt;</content>
    <created-at type="datetime">2010-03-01T08:01:20+01:00</created-at>
    <id type="integer">480</id>
    <publication-date type="datetime">2010-03-01T08:01:20+01:00</publication-date>
    <title>jQuery voor Meisjes!</title>
    <updated-at type="datetime">2010-03-01T08:01:20+01:00</updated-at>
  </article>
  <article>
    <active type="boolean">true</active>
    <author-id type="integer">2</author-id>
    <content>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 &quot;God for help&quot;:http://god.rubyforge.org/. God is a monitoring tool written in ruby which makes it easy to implement. Simply install god with:

&lt;code&gt;
gem install god
&lt;/code&gt;

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 &quot;god homepage&quot;:http://god.rubyforge.org/) you need to start god and load the config file:

&lt;code&gt;
$ god
$ god load /path/to/config/file
&lt;/code&gt;

or shorter:

&lt;code&gt;
god -c /path/to/config/file
&lt;/code&gt;

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 &quot;examples folder on GitHub&quot;:http://github.com/defunkt/resque/tree/master/examples/god/.

In case you want to let god automatically restart your processes after a deploy, you can use the &quot;san_juan gem&quot;:http://github.com/jnewland/san_juan which is a capistrano plugin.

!http://healmenow.files.wordpress.com/2008/03/iloveyoumorethananything.jpg!</content>
    <created-at type="datetime">2010-02-25T11:51:30+01:00</created-at>
    <id type="integer">479</id>
    <publication-date nil="true" type="datetime"></publication-date>
    <title>Let God help you!</title>
    <updated-at type="datetime">2010-02-25T11:54:16+01:00</updated-at>
  </article>
  <article>
    <active type="boolean">true</active>
    <author-id type="integer">2</author-id>
    <content>A &quot;while ago i posted an article&quot;:http://hollandonrails.nl/articles/429-Resque-another-background-library with the announcement that Github's new background worker library &quot;'Resque'&quot;:http://github.com/defunkt/resque had made its way &quot;to the public community&quot;:http://github.com/blog/542-introducing-resque.

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:

&lt;code&gt;
class Archive
  @queue = :queue_name
  ...
  
  def self.perform(args = {})

  end
end
&lt;/code&gt;

*Startup Redis*
Before you can add any jobs to the queue, you need to start the queue manager for resque: &quot;redis&quot;:http://code.google.com/p/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:

&lt;code&gt;
Resque.enqueue(Archive, arguments)
&lt;/code&gt;

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:

&lt;code&gt;
require 'resque/tasks'
&lt;/code&gt;

After that, run the following command:

&lt;code&gt;
QUEUE=* rake environment resque:work
&lt;/code&gt;

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!

!http://hollandonrails.nl/system/Resque.jpg!</content>
    <created-at type="datetime">2010-02-24T10:46:20+01:00</created-at>
    <id type="integer">478</id>
    <publication-date nil="true" type="datetime"></publication-date>
    <title>Implementing Resque</title>
    <updated-at type="datetime">2010-02-24T10:46:20+01:00</updated-at>
  </article>
  <article>
    <active type="boolean">true</active>
    <author-id type="integer">903</author-id>
    <content>&quot;Wees blij dat je iedere dag in Ruby kan programmeren&quot;:http://www.adaruby.com/2010/02/03/be-grateful-coding-ruby-on-rails/ 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&#232;?

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 &quot;37 redenen voor onvoorwaardelijke Ruby liefde&quot;:http://rubyhacker.com/ruby37.html.

XOXO</content>
    <created-at type="datetime">2010-02-22T21:14:22+01:00</created-at>
    <id type="integer">477</id>
    <publication-date nil="true" type="datetime"></publication-date>
    <title>Why You Should Be Grateful for Coding in Ruby</title>
    <updated-at type="datetime">2010-02-22T21:14:22+01:00</updated-at>
  </article>
  <article>
    <active type="boolean">true</active>
    <author-id type="integer">440</author-id>
    <content>The guys at &quot;Phusion&quot;:http://www.phusion.nl just released a bugfix version of &quot;Passenger&quot;:http://blog.phusion.nl/2010/02/22/phusion-passenger-2-2-10-released/ with version number 2.2.10.

Part of the changelog:

* Fixed some Bundler compatibility problems.
* Fixed some file descriptor passing problems, which previously could lead to mysterious crashes.
* Fixed some compilation problems on newer GCC versions. Issue #430.
* Support #size method in rack.input.

Upgrading is easy:
&lt;code&gt;
gem install passenger
passenger-install-apache2-module
&lt;/code&gt;

And copy paste the snippet the installer generates into your apache configuration.</content>
    <created-at type="datetime">2010-02-22T17:22:02+01:00</created-at>
    <id type="integer">476</id>
    <publication-date nil="true" type="datetime"></publication-date>
    <title>Passenger 2.2.10 released</title>
    <updated-at type="datetime">2010-02-22T17:22:55+01:00</updated-at>
  </article>
  <article>
    <active type="boolean">true</active>
    <author-id type="integer">3</author-id>
    <content>HollandOnRails crew members &quot;Paul&quot;:http://twitter.com/archan937, &quot;Dax&quot;:http://twitter.com/daxhuiberts, &quot;Chiel&quot;:http://twitter.com/chiel and &quot;myself&quot;:http://twitter.com/stephankaag will be attending this year's &quot;Scottish Ruby Conference&quot;:http://scottishrubyconference.com.

The Scottish Ruby Conference rebrands the successful Scotland on Rails conference. It is the same team organizing the same event that ran in 2008 and 2009, but with a more accurate name and an exciting new venue: The Royal College of Physicians in the centre of Edinburgh.

At this moment there are less than 15 tickets left for the event so be quick when you want to join the event or drink a whisky with the HoR crew.

The &quot;program&quot;:http://scottishrubyconference.com/sessions.</content>
    <created-at type="datetime">2010-02-18T09:06:27+01:00</created-at>
    <id type="integer">475</id>
    <publication-date nil="true" type="datetime"></publication-date>
    <title>Scottish Ruby Conference</title>
    <updated-at type="datetime">2010-02-18T09:07:01+01:00</updated-at>
  </article>
  <article>
    <active type="boolean">true</active>
    <author-id type="integer">1252</author-id>
    <content>There are those days when you would like to edit the gem that you are using.
Usually, the best way is just to checkout the gem at &quot;github&quot;:http://github.com or &quot;gemcutter&quot;:http://gemcutter.org, but if you want to edit a specific version, or just a quicklook this can become somewhat time consuming.

Instead of searching the web for the source, you could always just look at your gem locally. Mine are installed at:
&lt;code&gt;
/Library/Ruby/Gems/1.8/gems/
&lt;/code&gt;

But, there is, off course, also a *gem* to edit gems!

&lt;code&gt;
gem install gemedit
&lt;/code&gt;

And then you can just edit your executing a command like this:

&lt;code&gt;
gem edit gemname
&lt;/code&gt;

Sinds a lot of developers use &quot;textmate&quot;:http://macromates.com :

&lt;code&gt;
gem edit devise -e mate
&lt;/code&gt;

Or you could just add *$GEMEDITOR* to your profile. If you have *$EDITOR* already set, it will pickup that, or fall back to &quot;vi&quot;:http://en.wikipedia.org/wiki/Vi if no editor is specified.</content>
    <created-at type="datetime">2010-02-12T10:38:55+01:00</created-at>
    <id type="integer">474</id>
    <publication-date type="datetime">2010-02-12T12:00:00+01:00</publication-date>
    <title>Editing gems</title>
    <updated-at type="datetime">2010-02-12T15:13:40+01:00</updated-at>
  </article>
  <article>
    <active type="boolean">true</active>
    <author-id type="integer">1251</author-id>
    <content>Met ActiveRecord heb je als Rails-ontwikkelaar een hoop nuttige methoden in handen om het werken met modellen en het aanpassen van een database te vergemakkelijken.

Het is echter niet altijd de snelste manier... AR voegt uiteraard een hoop overhead toe dat niet nodig is bij het uitvoeren van basale taken op de database, zoals in migrations.

Zo hadden wij een Customers-tabel met daarin een telefoonnummer en een mobiel telefoonnummer. Dit moest er 1 worden, en de mobiele telefoon had prevalentie. Dus wat doe je dan: je maakt een backup-kolom van de mobiele telefoon info, kopieert het originele mobiele nummer naar deze kolom en zet daarna het mobiele nummer gelijk aan het telefoonnummer als er geen mobiel nummer was. In de AR-based migration staat dan het volgende:

&lt;code&gt;
add_column :customers, :mobile_number_old, :string, :length =&gt; 50
Customer.reset_column_information
Customer.all.each do |c|
  c.mobile_number_old = c.mobile_number
  c.mobile_number = c.phone_number if c.mobile_number.nil? || c.mobile_number.strip.blank?
  c.save
end
&lt;/code&gt;

Ziet er goed uit. Echter, op de tabel met 33.100 records was de migration na 10 minuten nog niet klaar.

Een andere aanpak was nodig, dus werd gewoon raw SQL geprobeerd:

&lt;code&gt;
add_column :customers, :mobile_number_old, :string, :length =&gt; 50
execute &quot;UPDATE customers SET mobile_number_old = mobile_number&quot;
execute &quot;UPDATE customers SET mobile_number = phone_number WHERE mobile_number IS NULL OR TRIM(mobile_number) = ''&quot;
&lt;/code&gt;

Deze query was na 3 seconden klaar.

Probeer dus goed te bedenken of je een operatie op grote aantallen records niet beter met raw SQL kan doen!</content>
    <created-at type="datetime">2010-02-10T09:01:55+01:00</created-at>
    <id type="integer">473</id>
    <publication-date nil="true" type="datetime"></publication-date>
    <title>ActiveRecord is nice, maar soms is raw SQL beter</title>
    <updated-at type="datetime">2010-02-10T16:43:18+01:00</updated-at>
  </article>
</articles>
