Yeah, unfortunately it seems to be the only way to do anything like this.
I was really hoping that one of the many progress bars had a web
output, but I'll keep searching for one that's easy to hook into (easy
for somebody that's JS challenged so to speak).
···
On Wed, 15 Sep 2004 12:43:20 +0900, trans. (T. Onoma) <transami@runbox.com> wrote:
On Tuesday 14 September 2004 11:18 pm, Bill Guindon wrote:
> Trying to display output from a ruby script that has a command line
> interface with a progress bar.
>
> I'd like to convert that progress bar to something web-based using
> javascript or dhtml. Just wondering if anyone has anything like that
> already.
>
> On the Ruby side, I've found a ton of text and GUI progress bars, but
> none that have a web interface. Did I miss a gem somewhere?
>
> thx in advance.
give you a fiver if you can do a smooth one of those in pure ruby
....
in other words, you will probably need an additional tool, like javascript at
he very least.
But buddy, what I wouldn't give to script my browser in ruby instead of js!
You just need to make a page refresh for a easy
progress bar, its really easy to do.
<META HTTP-EQUIV="Refresh" CONTENT="1">
Point it to a page which can give back data, etc.
there are several ways to contruct the bars, gifs,
tables with many cells, etc. just change color of
cells by adding to the new page on refresh, etc. Its
really easy to perform.
Actually you just need JS to make sure some IEs
refresh
<Script language="Javascript">
# add the if browser == IE here because some IEs turn
# off the META REFRESH
--- "trans. (T. Onoma)" <transami@runbox.com> wrote:
On Tuesday 14 September 2004 11:18 pm, Bill Guindon > wrote:
> Trying to display output from a ruby script that
has a command line
> interface with a progress bar.
>
> I'd like to convert that progress bar to something
web-based using
> javascript or dhtml. Just wondering if anyone has
anything like that
> already.
>
> On the Ruby side, I've found a ton of text and GUI
progress bars, but
> none that have a web interface. Did I miss a gem
somewhere?
>
> thx in advance.
give you a fiver if you can do a smooth one of those
in pure ruby
....
in other words, you will probably need an additional
tool, like javascript at
he very least.
But buddy, what I wouldn't give to script my browser
in ruby instead of js!
--
( o _ カラチ
// trans.
/ \ transami@runbox.com
I don't give a damn for a man that can only spell a
word one way.
-Mark Twain
Note that you do not need to re-call the reload function, as the act of reloading the page will unload any such timeout you make.
If you're progressively writing the response, one way to make a progress bar is to use CSS to progressively overlap longer and longer elements on top of one another. For example (untested):
<style type="text/css">
.progressbounds, .progressbar {
position:absolute;
height:1em;
top: 50%; margin-top:-0.5em
left: 20%;
}
.progressbounds {
width:60%;
margin:0 auto;
border:1px solid black;
}
.progressbar {
background:green;
color:white;
font-weight:bold;
font-size:80%;
text-align:center;
overflow:hidden
}
</style>
If you're not writing the page but want to show progress of a server-task, you'll need to use a cross-browser XMLHTTP library like XHConn ( http://xkr.us/code/javascript/XHConn/ ) to repeatedly make client-server queries to get the progress, and then just use JS to manipulate the DOM to change the width of your progress bar.
···
On Sep 15, 2004, at 6:29 AM, David Ross wrote:
<Script language="Javascript">
# add the if browser == IE here because some IEs turn
# off the META REFRESH
So far... I'm outputting the page header before I call the app (to get
the javascript out there), then I'm trying to capture and parse the
output from $stdout which looks like this:
It'd be pretty trivial to turn that into a function that spits out a
single percentage, but I'm still stuck on how to "drive" the progress
bar level with html that's showing up one line at a time.
On Sep 15, 2004, at 6:29 AM, David Ross wrote:
> <Script language="Javascript">
> # add the if browser == IE here because some IEs turn
> # off the META REFRESH
>
> window.setTimeout('refresh()', 1*2500);
> function refresh(){
> window.location.href = window.location.href;
> window.setTimeout('refresh()', 1*2500);
> }
> </Script>
Note that you do not need to re-call the reload function, as the act of
reloading the page will unload any such timeout you make.
If you're progressively writing the response, one way to make a
progress bar is to use CSS to progressively overlap longer and longer
elements on top of one another. For example (untested):
<style type="text/css">
.progressbounds, .progressbar {
position:absolute;
height:1em;
top: 50%; margin-top:-0.5em
left: 20%;
}
.progressbounds {
width:60%;
margin:0 auto;
border:1px solid black;
}
.progressbar {
background:green;
color:white;
font-weight:bold;
font-size:80%;
text-align:center;
overflow:hidden
}
</style>
If you're not writing the page but want to show progress of a
server-task, you'll need to use a cross-browser XMLHTTP library like
XHConn ( http://xkr.us/code/javascript/XHConn/ ) to repeatedly make
client-server queries to get the progress, and then just use JS to
manipulate the DOM to change the width of your progress bar.
I've done some DHTML stuff like this, and the smoothest (i.e., least
visible redraw lag to the user) way to do it is with the
XmlHttpRequest object, which most modern browsers (IE,
Mozilla/Firefox, Konqeror, Safari) support for at least GET requests.
Your JS code uses that object to fetch some server-side URL, then grab
the result and use it to dynamically update an onscreen element, like
your progressbar.
If you want something similar, just use an iframe element which points
to the server-side "progress bar" page; you should even just be able
to set the "refresh" meta tag the in header of the HTML the iframe
loads, and have the browser refresh it every second or so. Otherwise,
it's a pretty trivial amount of Javascript to refresh just that
element periodically.
I love the fact that this setup means I can run _any_ shell routine,
and display the output on a web page, but I'm wondering if there's a
cleaner way to do the server side of it.
The dance I'm doing with STDOUT and $stdout is a bit ugly, but I'm not
sure what the alternatives are. I want the display to be as close to
'real time' as possible. I'm not sure I'm achieving that now, but
it's certainly not for lack of trying
···
On Thu, 16 Sep 2004 01:38:53 +0900, Lennon Day-Reynolds <rcoder@gmail.com> wrote: