Where have Ruby/Tk examples gone?

I have previously been able to access Hidetoshi NAGAI’s examples of
Ruby/Tk code with the following URL:

http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/ext/tk/sample/

Now I’m getting a 404 Not Found error when I point my browser there.
I think this happens because the CVS archives are no longer
available. However, I can’t find equivalent examples in the SVN
archives. Does anybody know where these examples can now be found?

Regards, Morton

I have a method doing I/O stuff which takes quite a long time.
While this method is processed,
I want the user of my tool to be informed of the current execution
state.

For example,
if the method opens a file,
I want my RJS template to render a message such as “opening file
XYZ…”,
if the method changes to a directory, message would be “cd to …”.

As far as I can tell,
RJS templates are rendered AFTER the corresponding method is executed.
But I want them to run (sort of) synchronously.
Or at least have a way to trigger messages while a method is executed.

Cheers,
Tom.

From: Morton G. [email protected]
Subject: Where have Ruby/Tk examples gone?
Date: Sun, 1 Apr 2007 01:08:03 +0900
Message-ID: [email protected]

I have previously been able to access Hidetoshi NAGAI’s examples of
Ruby/Tk code with the following URL:
(snip)
archives. Does anybody know where these examples can now be found?

http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/sample/

On Apr 3, 2007, at 6:13 AM, Hidetoshi NAGAI wrote:

tk/sample/
Thank you very much for supplying the URL I was looking for.

Regards, Morton

Hey Matt,

what I still don’t understand is
where to turn “poll_message” on and off using your JS-code?
Or: what do you mean with “…in a RJS update…”?

-> Inside the RJS-template of “my_io_process”?
That throws quite a few errors.

-> Using inline RJS rendering inside my controller?
(which shouldn’t work while also using an RJS template)

-> somewhere else…?

Also:
Do I need to specify a “:update => ‘my_div’”
within periodically_call_remote?
When I put this call inside my layout,
Firebug yells at me: “poll_message not defined”…
Is a “var poll_message = false” fine?

Thanks for your help!
Cheers,
Tom.


On Sun, 1 Apr 2007 04:43:45 +0900

On 4/2/07, Matthieu S. [email protected] wrote:

Ah… In that case you need to start you long running routine outside of
rails. Something like backgroundrb, http://backgroundrb.rubyforge.org/

This is what we do in the Rails app I’m working on. We call a long
running series of SOAP API calls from BackgrounDRb and then a periodic
executor on the page calls a “progress” function which queries the
BackgrounDrb worker to get the current progress. This works pretty
well.

Though I was very annoyed to see the latest version of BackgrounDrb is
not supported on Windows. We deploy on Linux but develop on Windows so
we are stuck on the last release. If you are listening Ezra, it would
be nice if you could fix this :slight_smile:

Ryan

On Apr 2, 2007, at 9:37 AM, Ryan L. wrote:

well.

Though I was very annoyed to see the latest version of BackgrounDrb is
not supported on Windows. We deploy on Linux but develop on Windows so
we are stuck on the last release. If you are listening Ezra, it would
be nice if you could fix this :slight_smile:

Ryan

Ryan-

I’d love to be able to get the new version to run on windows but I
wasn’t ever able to get it to work except for in cygwin. The reason
being is the new version uses a multi process arch instead of a
single process multi threaded. I rely heavily on ara’s slave gem for
this which handles forking child processes with drb handles from the
parent -> child and child -> parent. As far as I know slave just
can’t work on windows yet.

I will however soon be releasing a bdrb lite that is a revamped
version of the old plugin that will be windows compatible. It’s just
inherently limited by ruby’s green threading model. So running many
concurrent jobs degrades the performance of all jobs :confused:

I would love to be proven wrong and shown how I could get the newest
version with the slave dep to run on windows though.

Cheers-
– Ezra Z.
– Lead Rails Evangelist
[email protected]
– Engine Y., Serious Rails Hosting
– (866) 518-YARD (9273)

If anyone still cares…

I just used the callbacks available for link_to_remote, form_remote_tag
etc…
It works well and easy to use:

<%= image_tag(“ajax-loader-darkblue.gif” , :id => ‘loader’, :style =>
‘display:none’) %>
<%= content_tag(:div, content_tag(:p, “An error occurred. Please try
again”), :id => ‘failure’, :class => ‘strong’, :style => ‘display:none’)
%>

<% form_remote_tag(:url => {:action => :create_project, :id => @project}, :loading => "Element.show('loader'); Element.hide('project_name')", :failure => "Element.show('failure')") do %>

Project Name:  <%= text_field 'project', 'p_name' %> <%= submit_tag "create" %>

<% end %>

On Tue, 3 Apr 2007 01:21:35 +0900

My suggestion: run your task using BackgrounDrb or something similar.
Use periodically_call_remote to poll the execution’s status until it’s
completed.

–Jeremy

On 4/2/07, [email protected] [email protected] wrote:

session[:message] = “starting io…”
}
the template messages get rendered after the controller method is done.

Hi Tom,

<% else %>
session[:message] = "let's get it started.."
            }

-> somewhere else…?
Tom.

def my_io_process

<%= periodically_call_remote(
//<![CDATA[

  • matt.

Cheers,
Tom.


http://www.jeremymcanally.com/

My free Ruby e-book:
http://www.humblelittlerubybook.com/book/

My blogs:
http://www.mrneighborly.com/
http://www.rubyinpractice.com/

Hi Matt,

As you suggested I put the “poll_message”-div + JS-code +
periodically_…
inside a partial rendered at startup.

I also got rid of the RJS-template in exchange for your “respond_to”
thing
But here is the thing:
my io_process-method looks sort of like this:

def io_method
session[:message] = “starting io…”

if (blah)
session[:message] = “finished”
else
session[:message] = “an error occurred!”
end
respond_to do |format|
format.js { render :update do |page|
page.insert_html :bottom, ‘poll_message’, :partial => ‘message’
end
}
session[:message] = nil
end

my partial “_message.rhtml” just calls “<%= session[:message] %>”

So when the interpreter gets to “respond_to”,
it only renders the last message defined by the io_method.

Also the message is rendered after io_method is done.
So I am actually where I started from:
the template messages get rendered after the controller method is done.

Thanks for your help!

Cheers,
Tom.


On Mon, 2 Apr 2007 19:57:54 +0900

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs