# Use a Progess bar, but not for upload?

**URL:** <https://www.ruby-forum.com/t/use-a-progess-bar-but-not-for-upload/81379>\
**Category:** Rails\
**Created:** [January 8, 2007, 5:24pm UTC](https://www.ruby-forum.com/t/use-a-progess-bar-but-not-for-upload/81379 "2007-01-08T17:24:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 8, 2007, 5:24pm UTC](https://www.ruby-forum.com/t/use-a-progess-bar-but-not-for-upload/81379/1 "2007-01-08T17:24:03Z")

</div>

Hi,

It is possible to use a progess bar, but not only for uploading file???  
like long calculation time or database access???

Thanks you very much!!!

sayoyo

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 8, 2007, 5:53pm UTC](https://www.ruby-forum.com/t/use-a-progess-bar-but-not-for-upload/81379/2 "2007-01-08T17:53:21Z")

</div>

If you use Ajax calls, you can specify the :before and :after  
parameters to show and hide a spinner/timer graphic.

If you need to actually show the % of work/file completed, you’ll need  
to setup a process which has the status available, and call  
perdiocally\_call\_remote to check with the server what the status is  
(assuming its taking longer then regular client/server communication).  
The returning value would be a percentage/fraction, and you display a  
graphic associated with that percentage. If you want to get  
sophisticated, you may be able to run threads to split the progress

Hope this helps.  
Bart

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 8, 2007, 6:22pm UTC](https://www.ruby-forum.com/t/use-a-progess-bar-but-not-for-upload/81379/3 "2007-01-08T18:22:10Z")

</div>

Hi, thanks you very much for the information,

Do you know where can I find the doc.(how to , examples, etc) about what  
you have told me???

Thanks you!!!

sayoyo

Bart Gajderowicz wrote:

> If you use Ajax calls, you can specify the :before and :after  
> parameters to show and hide a spinner/timer graphic.
> 
> If you need to actually show the % of work/file completed, you’ll need  
> to setup a process which has the status available, and call  
> perdiocally\_call\_remote to check with the server what the status is  
> (assuming its taking longer then regular client/server communication).  
> The returning value would be a percentage/fraction, and you display a  
> graphic associated with that percentage. If you want to get  
> sophisticated, you may be able to run threads to split the progress
> 
> Hope this helps.  
> Bart

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 8, 2007, 6:59pm UTC](https://www.ruby-forum.com/t/use-a-progess-bar-but-not-for-upload/81379/4 "2007-01-08T18:59:27Z")

</div>

If you want to execute a long-running process and not have it block  
the application, you’ll need to use something like backgroundrb  
([http://backgroundrb.rubyforge.org/](http://backgroundrb.rubyforge.org/)). Then you can use a  
periodically\_call\_remote ajax callback to grab the status and update  
the progress bar.

Mike
