<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Brainspl.at: BackgrounDRb updated.</title>
    <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Brainspl.at</description>
    <item>
      <title>"BackgrounDRb updated." by bang bros</title>
      <description>I use psvn as my Subversion client: it’s not perfect but it’s more than good enough!</description>
      <pubDate>Sat, 05 May 2007 15:05:40 +0000</pubDate>
      <guid>urn:uuid:76de2f69-077d-4400-97ab-73d1d52cd81e</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-4338</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by nice ass</title>
      <description>How to include PHP using smarty tags?</description>
      <pubDate>Fri, 04 May 2007 23:02:03 +0000</pubDate>
      <guid>urn:uuid:acf0f3bd-e4fd-451e-a463-4d671065a96c</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-4327</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by big tits</title>
      <description>Ruby block with link adding in a line seems to be useless, imho.</description>
      <pubDate>Fri, 04 May 2007 12:41:06 +0000</pubDate>
      <guid>urn:uuid:5856ea25-3905-4125-90a7-7342e3c50bfa</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-4287</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Jarszon</title>
      <description>DRbObject is what you get when you access an object over drb that includes DRbUndumped.</description>
      <pubDate>Mon, 19 Feb 2007 15:48:28 +0000</pubDate>
      <guid>urn:uuid:f2f5beee-893b-4d43-ae5e-f16bb9232b07</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3990</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Matt White</title>
      <description>What's the best way to debug Workers? For some reason I'm not getting any errors thrown back when code fails in my workers, so debugging is quite a pain. The script just terminates on the failing line, but with no explanation. I've tried wrapping the code in rescue, but that doesn't always work.

It seems that everyone else that has posted hasn't had any issues with this, so perhaps something isn't configured correctly on my end. I'm running Tiger, and I've been scanning the backgroundrb.log and the backgroundrb_server.log files, but they never seem to give me any reason why my code is failing.

Aside from that, it's working quite well! Thanks for the excellent work, Ezra!</description>
      <pubDate>Sun, 19 Nov 2006 07:33:14 +0000</pubDate>
      <guid>urn:uuid:5e0c398f-2c65-4047-bd72-06a62323e991</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3773</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Ezra</title>
      <description>I have never tried this on cygwin and I think it should work fine but I don't have cygtwin to test this out with. Make sure the rake tasks exist in the plugin your downloaded, they are in there and should work fine. Do you have an old version of rake perhaps?</description>
      <pubDate>Fri, 13 Oct 2006 01:14:02 +0000</pubDate>
      <guid>urn:uuid:53a080d1-1a98-4241-9b98-64a7b33964bd</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3718</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by kodecharlie</title>
      <description>I am using a version of Ruby 1.8.4
installed as a cygwin package on
Windows XP.&lt;br /&gt;&lt;br /&gt;

I tried installing backgroundrb like this:&lt;br /&gt;
&lt;pre&gt;
  script/plugin install svn://rubyforge.org//var/svn/backgroundrb
&lt;/pre&gt;
This failed with this error report:&lt;br /&gt;
&lt;pre&gt;
svn: '\home\Charlie\cdd\ruby\vendor' is not a working copy
svn: '\home\Charlie\cdd\ruby\vendor' is not a working copy
./script/../config/../vendor/rails/railties/lib/commands/plugin.rb:257: warning: Insecure world writable dir /usr/local/bin, mode 040777
svn: Can't create directory '\home\Charlie\cdd\ruby\vendor\plugins\backgroundrb'
: The system cannot find the path specified.
&lt;/pre&gt;
I assume the path problem is caused by
some cygwin-specific issue.  So, I then
tried this:&lt;br/&gt;
&lt;pre&gt;
  cd vendor/plugins
  svn co svn://rubyforge.org/var/svn/backgroundrb
&lt;/pre&gt;
This retrieved the backgroundrb package.
I then tried running unit tests:&lt;br/&gt;
&lt;pre&gt;
  cd backgroundrb
  rake
&lt;/pre&gt;
It appears one unit-test is failing:&lt;br/&gt;
&lt;pre&gt;
$ rake
(in /home/Charlie/cdd/ruby/vendor/plugins/backgroundrb)
/usr/bin/ruby -Ilib:lib "/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_te
st_loader.rb" "test/test_backgroundrb.rb" "test/test_helper.rb" "test/test_worke
rs/cron_worker.rb" "test/test_workers/test_worker.rb"
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:728: warning: Insecure world
writable dir /usr/local/bin, mode 040777
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader
Started
.F.......
Finished in 1.397 seconds.
  1) Failure:
test_caching(BackgrounDRbTest) [./test/test_backgroundrb.rb:105]:
&lt;false&gt; is not true.
9 tests, 65 assertions, 1 failures, 0 errors
rake aborted!
Command failed with status (1): [/usr/bin/ruby -Ilib:lib "/usr/lib/ruby/gem...]
&lt;/pre&gt;
I then tried this:&lt;br/&gt;
&lt;pre&gt;
  rake --trace backgroundrb:setup
&lt;/pre&gt;
This also had problems:&lt;br/&gt;
&lt;pre&gt;
(in /home/Charlie/cdd/ruby/vendor/plugins/backgroundrb)
rake aborted!
Don't know how to build task 'backgroundrb:setup'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1449:in `[]'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:455:in `[]'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
/usr/bin/rake:18:in `load'
/usr/bin/rake:18
&lt;/pre&gt;
Is there anything special I need to do
for the cygwin/Ruby/backgroundrb setup?&lt;br/&gt;&lt;br/&gt;

Thanks,&lt;br/&gt;
kodecharlie

</description>
      <pubDate>Wed, 11 Oct 2006 23:05:54 +0000</pubDate>
      <guid>urn:uuid:02dbc229-d057-4abd-bfbc-534191d71483</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3717</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Andrew</title>
      <description>What would be the implications of say, having a timer_sleep of 1.

The reason I ask is, if I leave it at 60, some screwy stuff happens. For instance, in the following code,
I get the correct result if I have a timer_sleep of 1, however I get a nonsense result if I leave it at 60 (more updates than are rows in the database, rows updated more than once).


class ReminderWorker &lt; BackgrounDRb::Rails

  repeat_every 10.minutes
  first_run Time.now
  

      @secondreminders = ExampleItem.find(:all, :conditions=&gt;["emailconfirmed=0 and confirmation_reminders=1"])

      @secondreminders.each do |secondreminder|
          @logger.info "Second reminder"
          secondreminder.update_attribute(:confirmation_reminders,2)
      end


      @firstreminders = ExampleItem.find(:all, :conditions=&gt;["emailconfirmed=0 and confirmation_reminders=0"])
  
      @firstreminders.each do |firstreminder|
          @logger.info "First reminder"
          firstreminder.update_attribute(:confirmation_reminders,1)
      end

end


thanks for your help</description>
      <pubDate>Mon, 18 Sep 2006 16:47:19 +0000</pubDate>
      <guid>urn:uuid:fcba7ba5-50c9-4467-948d-37c98d57e441</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3674</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Kaszuby</title>
      <description>It,s something wrong with this side.
Best regards.</description>
      <pubDate>Tue, 12 Sep 2006 09:25:48 +0000</pubDate>
      <guid>urn:uuid:bb02a4a1-68ae-4a81-b4e7-7d71069081f6</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3635</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Ezra</title>
      <description>DRb::DRbObject is what you get when you access an object over drb that includes DRbUndumped. So that is actually your AR object there, inspect just says that because of the way drb works. you can still call your methods on it like it was an ar instance. You can also just pass id's over the wire as well. Either way works fine.</description>
      <pubDate>Sun, 20 Aug 2006 23:35:38 +0000</pubDate>
      <guid>urn:uuid:75bae846-1316-4c02-99f5-6e734de9eb77</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3539</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by John</title>
      <description>I know it's been kind of mentioned before, but I'm trying to send an AR object to a worker.  I get none of the above errors, but in the worker when I do:
&lt;br/&gt;
@logger.warn args[:test].inspect
&lt;br/&gt;
I get a DRb::DRbObject.  I'm not sure what to do with this.
&lt;br/&gt;
I've already put DRbUndumped in the model in question (and restarted everything), but this didn't change anything.
&lt;br/&gt;
Am I missing something obvious, or should I just be sending an ID and loading the AR object from the database inside the worker?</description>
      <pubDate>Thu, 17 Aug 2006 07:38:45 +0000</pubDate>
      <guid>urn:uuid:db77a08a-265a-46c6-a72e-9e66311b04d9</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3536</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by akshat</title>
      <description>Hi,

I want to start Backgroundrb when my system(linux) boots up.....but am unable to do so from my rc.local script....any idea how i could do so

thanks,
akshat</description>
      <pubDate>Tue, 11 Jul 2006 18:09:11 +0000</pubDate>
      <guid>urn:uuid:4f5f8e2d-5833-42d3-a90d-911eb6415707</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3478</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Ezra</title>
      <description>If you get these errors it means that you are trying to send something to the drb server that cannot be marshalled over drb. This is the case when you want to send an active record to a worker as an arg. To get around this you need to add include DRbUndumped into the class def of whatever model you want to send as and arg. like so:&lt;br /&gt;&lt;br /&gt;

&lt;pre&gt;
class Post &lt; ActiveRecord::Base
  include DRbUndumped
  # rest of code...
end
&lt;/pre&gt;
&lt;br /&gt;
If you still have errors then please send them to me on the backgroundrb maling list with code samnples and error traces.&lt;br /&gt;&lt;br /&gt;
Damien- Its unclear if you are trying to send AR objects in the has as args. If you look in the test cases for the plugin you can see that sending hashes and arrays work fine. To get this error it means you are trying to send something across the wire that cannot be marshalled. So try to track down what that is and include DRbIUndumped in it and you will be fine.</description>
      <pubDate>Mon, 10 Jul 2006 02:33:16 +0000</pubDate>
      <guid>urn:uuid:f6ae159c-1fab-4570-9556-393091788604</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3474</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Damien Tanner</title>
      <description>Yo Ezra,

I'm getting the same error as Max. When I set :args to a hash or array (string is fine) it throws back with "undefined method `[]' for #&lt;DRb::DRbUnknown:0x242d758&gt;"

http://pastie.caboo.se/3963 has the full trace.

Using ruby 1.8.

Damien.</description>
      <pubDate>Mon, 10 Jul 2006 00:59:33 +0000</pubDate>
      <guid>urn:uuid:786eff5c-1f80-4cbb-83b1-37ba8f8b3d55</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3473</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Max</title>
      <description>Sorry, the comment ate the brackets. Its "undefined method [] for #&amp;lt;DRb::DRbUnknown:0x12345%gt;"</description>
      <pubDate>Fri, 07 Jul 2006 13:57:08 +0000</pubDate>
      <guid>urn:uuid:64c3f2e4-9e60-4cf7-b6ae-0b1183d085c1</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3469</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Max</title>
      <description>Good work!
That's exactly what I've searched for.


Unfortunately I keep getting


"undefined method `[]' for #&lt;DRb::DRbUnknown:0x3347dc0&gt;" ...


My worker does heavily us my ActiveRecord Models. I've already tried to name them all in application.rb through "model :user, :account ..." but with no luck.
Any ideas?</description>
      <pubDate>Fri, 07 Jul 2006 13:55:45 +0000</pubDate>
      <guid>urn:uuid:b93e437f-ff77-4757-a7cb-9a5379b41fea</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3468</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by Ezra</title>
      <description>dvdplm-&lt;br /&gt;&lt;br /&gt;
Thanks for the kind words ;) The caching feature probably won't help you with the cvs parsing your talking about. The main use of the cache is to store complex queries in memory so that you don't have to hit the database everytime someone requests that data. You can also cache views that have been render_to_string. Its kind of like a very simple version of memcached. You only use the caching from the rails side of thing. So as an example, say you have a huge tag cloud that you need to render on every page. And you want it to expire and get rebuilt every 5 minutes. So you cache it using cache_as and then this big query only runs once every 5 minutes and all requests for it get served from an in memory cache. And when you use the block form of cache_get you can specify a query that happens when the cache is deleted. So your tag cloud gets automatically updated every 5 minutes but gets served from the cache on all other requests.&lt;br /&gt;&lt;br /&gt;
For example:&lt;br /&gt;
&lt;pre&gt;
# fill cache, expire in 5 minutes
@tags = MiddleMan.cache_as :tags_cache, 300 do
  Tag.find(:all, :include =&gt; :meta_tags)
end

#retrieve_cache, if the cache for the :tags_cache key
# is empty, rebuild it with the data inside the block
# and return the query to fill @tags. 
@tags = MiddleMan.cache_get : tags_cache, 300 do
  Tag.find(:all, :include =&gt; :meta_tags)
end
&lt;/pre&gt;



</description>
      <pubDate>Tue, 04 Jul 2006 20:12:13 +0000</pubDate>
      <guid>urn:uuid:9e781425-a030-4210-93e8-49476a53ea2b</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3365</link>
    </item>
    <item>
      <title>"BackgrounDRb updated." by dvdplm</title>
      <description>Upgraded today and it works seamlessly! Nice nice nice...
:-)

I use BackgrounDRb to do some heavy CSV parsing. Some files contain some about 10 000 rows and for each row there are quite a bunch of SELECTs (through AR) and, if needed, a few INSERTs. Processing times are around 5 to 15 minutes and I do some AJAX stuff to poll progress and show some feedback to users.

I'm very new to rails and to ruby, so it might just be me, but I'd very much appreciate some more details/tutorials regarding theBackgrounDRb caching meccanism: why should I use the cache? Would the scenario outlined above benefit from caching in any way? Isn't A-R already caching some of my stuff?

Great job. I do plan to use this for other projects as well. My compliments.</description>
      <pubDate>Tue, 04 Jul 2006 06:58:20 +0000</pubDate>
      <guid>urn:uuid:30a6a0c9-4abd-4a39-a110-b78647211c67</guid>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated#comment-3329</link>
    </item>
    <item>
      <title>BackgrounDRb updated.</title>
      <description>Howdy Folks-&lt;br /&gt;&lt;br /&gt;

	I'm happy to announce a new release of BackgrounDRb! I have added quite a few new features and included some nice patches from folks on the list.
&lt;br /&gt;
&lt;pre&gt;
$ script/plugin install svn://rubyforge.org//var/svn/backgroundrb
&lt;/pre&gt;&lt;br /&gt;
Click through for the details.
</description>
      <pubDate>Sun, 02 Jul 2006 01:44:00 +0000</pubDate>
      <guid>urn:uuid:1ac80383-2f71-4e30-8fab-1362a89d7f02</guid>
      <author>ezmobius</author>
      <link>http://brainspl.at/articles/2006/07/02/backgroundrb-updated</link>
      <category>drb</category>
      <category>background</category>
      <category>task</category>
      <trackback:ping>http://brainspl.at/articles/trackback/3168</trackback:ping>
    </item>
  </channel>
</rss>
