Displaying 20 results from an estimated 50000 matches similar to: "Creating threads question"
2006 Jul 08
0
Question about killing threads
If I do the following:
threads = []
threads[0] << Thread.new do
while true
# some code
end
end
# Will this kill off the first thread?
threads[0] << Thread.new do
while true
# some more code
end
end
Will the second assignment kill off the first thread? Or will that
first thread keep going and never stop unless i explicitly kill it
using the Thread.kill method?
Thanks for
2006 Jul 09
1
Drop down menu in rails?
Does rails have a nifty utility for creating javascript drop down menus?
Thanks for the help.
Thank You,
Ben Johnson
E: bjohnson@contuitive.com
O: 800-341-6826
M: 817-229-4258
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060709/869e8e30/attachment-0001.html
2006 Jul 31
1
delete_worker doesn''t kill the thread?
I made a worker that run an infinite loop and does the following:
while true
@logger << "logging #{Time.now}"
sleep 2
end
In my secong console I did:
tail log/backgroundrb.log -f
This is so I could see the line getting added to the log every 2
seconds.
Then in my other console I started script/console and created a new
worker. Then killed it with
2006 Jul 31
1
Creating workers on server startup?
I have workers that need to be created when I run rake
backgroundrb:start. Where do I put this code?
Thanks for your help.
Thank You,
Ben Johnson
E: bjohnson at contuitive.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060731/d201c052/attachment.html
2006 Jul 22
4
Accessing the controller name in your views?
I need to know what controller and action the user is currently in
to do various things in my layouts/application.rhtml file. Isn''t
there is a better way than:
<% if params[:controller] == "whatever" && params[:action] ==
"whatever" %>some html<% end %>
I know in the controllers you can just use controller_name, but that
is not provided
2006 Jul 31
1
MySQL too many connections?
Does any have any idea why I would get:
Mysql::Error: Too many connections
I am creating new threads in my background process. I know
allow_concurrency is set to true. Does this create a new database
connection when a new thread is created? Because what I''m doing is
similar to this:
@threads[model.id] = Thread.new do
end
I also kill off these threads and over write some of the
2006 Jul 11
1
Determine if attributes changed?
Is there a way to determine if attributes were changed? Let''s say in
the before_save or after_save method?
Thanks for your help.
Thank You,
Ben Johnson
E: bjohnson@contuitive.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060711/442b20d2/attachment.html
2006 Jul 19
1
How to add validation to in_place_editor
I have a simple question, but can''t seem to figure this out.
I added an in place editor field and didn''t like how it didn''t use
the save method. It uses the update_attribute method which does not
run validation, etc. So I just added the method in my controller myself:
def set_event_url
begin
@event = Event.find params[:id]
@event.url =
2006 Aug 01
4
Creating workers from workers?
Since MiddleMan is an uninitialized constant in a worker how do you
create new workers inside a worker?
Thank You,
Ben Johnson
E: bjohnson at contuitive.com
O: 800-341-6826
M: 817-229-4258
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060731/75a77fa6/attachment-0001.html
2006 Jul 22
3
How to use variables in your layout views?
Let''s say I wanted to find 3 products from my database and put them
in the layouts/application.rhtml view. Where do I find these 3
products? Do I just do it in application.rhtml?
<% for product in Product.find(:all, :limit => 3) %>
Because I was under the impression that you really don''t want to do
this in your views. You should do this in your controllers and
2006 Jul 17
2
after_save deletes is an exception is raised?
Does after_save in a model delete if an exception is raised in there?
I simply did
def after_save
raise ''hmmm''
end
and it raised the exception but there was nothing in the database. I
removed that entire method and its in the database. Is this correct?
Thank You,
Ben Johnson
E: bjohnson@contuitive.com
-------------- next part --------------
An HTML attachment was
2006 Jul 31
1
Please help, if @jobs[key].respond_to? :thread is returning false
I noticed in the BackgroundRB class in the delete_worker method there
is a line:
if @jobs[key].respond_to? :thread
For some reason this is returning false for me, it gets down to this
line and returns false, not killing the thread. Any idea why this is
returning false?
Thanks for your help.
Thank You,
Ben Johnson
E: bjohnson at contuitive.com
-------------- next part --------------
An
2006 Jul 15
1
Is there a huge performance difference between using multiple periodically_call_remote functions or one?
My application has multiple things on the interface that need to be
updated periodically. Some things every second, others not so much.
Some of these things are global, meaning they are on the interface at
all times, and some of these things are view specific. So what I
figured I would do is add the periodically_call_remote function for
the global elements and another one for the view
2006 Jul 21
2
ActiveRecorod observers don''t work in mongrel?
Am i wrong or do ActiveRecord observers not work in mongrel? Is there
a work around for this?
I am 100% sure of this because in my observer i put raise "whatever".
Whenever I try update the model using the mongrel server I get a
successful save. If I do it in webrick I get an exception raised.
Any ideas what I should do? Because webrick is pretty annoying to
work with.
Thank
2006 Jul 19
1
Catch 22 with after_save. Please help.
I have a pretty strange problem. Here is basically what I have to
demonstrate my problem:
class Event < ActiveRecord::Base
def after_create
AnotherClass.find_event(id)
end
end
class AnotherClass < ActiveRecord::Base
def self.find_event(event_id)
e = Event.find event_id
end
end
Here is the catch 22 and it''s quite annoying. Basically ActiveRecord
puts to whole save
2006 Jul 23
6
Best way to sort the emails in a mailing list?
I know this isn''t really rails related, but I was wondering if anyone
had a clever way to sort out which mailing list threads they''ve been
involved with and which ones they haven''t. That way when a new email
comes in and its in a thread you''ve been involved with, you could
move it to another folder.
I''ve looked at the email headers and
2006 Jul 21
8
How to stop webrick daemon
How do you stop a webrick running as -d?
I did various searches on google and the mailing list forums and got
nothing. Sorry for the noob question.
Thank You,
Ben Johnson
E: bjohnson@contuitive.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060721/0408fb97/attachment-0001.html
2006 Aug 06
3
Debugging a worker?
If there is an exception raised in my worker I rescue it and throw it
into the log. This is decent, but it would really help to find out
more information. Like the line number, the stack trace, etc. Is this
possible?
Thanks for your help.
Thank You,
Ben Johnson
E: bjohnson at contuitive.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Aug 24
1
ActionMailer doesn''t work in backgroundrb
I am pretty confident that mailers do not work in backgroundrb. Can
anyone confirm this? Because when I try to do
Notifier.deliver_some_method I get an error saying it cant find the
templates for my email. The funny thing is that when I run script/
runner Notifier.deliver_some_method it works just fine. Any ideas?
Thank You,
Ben Johnson
E: bjohnson at contuitive.com
O: 800-341-6826
M:
2006 Jul 20
9
Including children''s children?
a has many b''s
b has many c''s
results = A.find params[:id], :include => :b
How do you also make sure the b''s include the c''s?
Thanks for your help.
Thank You,
Ben Johnson
E: bjohnson@contuitive.com
O: 800-341-6826
M: 817-229-4258
-------------- next part --------------
An HTML attachment was scrubbed...
URL: