Hundreds of source files, forgot the copyright statement…….

So your new super project is all ready to go live. Add the licence file, check the copyright. Oh wait, you mean you forgot to add the copyright statement to your eclipse template. Never fear, the linux command line to the rescue, no need for hours of cut and paste:
find . -name "*.java" -print | xargs sed -i '1s/^/\/* Copyright (c) 2013 The University of Manchester, UK. *\/\n/'

Don’t forget to replace Copyright (c) 2013 The University of Manchester, UK with your own statement.

handle_asynchronously missing method with delayed job and passenger: ‘require’ needed

We use delayed job in lots of our applications to handle long running tasks but we came across a weird issue when deploying our explorer2 rails app on apache using passenger. Passenger would throw out a 500 with ‘missing method handle_ayncronously’ whenever the application was accessed. Commenting out the handle_asynchronously part in the class (one of the models) and all would work fine. Running in development all was perfect and delayed job worked without a hitch. To see if we could replicate it we created the most basic rails app possible with one model with a method that used handle_asynchronously and guess what……it did not work either. Really left us a bit stumped how to solve it until I had the idea to use require 'delayed_job' in the model class using it. Then everything worked again.
So, we have the solution but we are not really sure what the cause is. The problem occurs in ruby 1.8 or 1.9 with rails 2.3.12 or 2.3.13 and delayed job 4.0.0 or 3.0.5 (via delayed job active record). However, we have code that uses handle_asynchronously (eg the original openPHACTS gui) in the exact same way without a hitch! Anyway, I thought that bundler etc meant that ‘require’ was no longer required but be warned….