Rev cgi question

Andre Garzia andre at andregarzia.com
Wed Apr 9 10:42:26 CDT 2008


Richard,

thats not the way to do it. Most browsers will timeout if you try to
work like that. The idea is to send back a page with a <META REFRESH>
tag in it, this tag allows you to put a time trigger in the page that
will redirect the page to some other url in a given time.

So what you do is you keep redirecting to a cgi that checks the
process and answer with the current status.

Take notice that the cgi will close the connection, so when the new
request to the status cgi (or the same cgi, whichever you choose)
fires, it must have some way to detect that the request is being
processed somehow. One way to do it is to use a database to store
statuses or to use plain text files, when the cgi launches it checks
these records to see in which step it is.

suppose your task should take between 5 and 10 seconds and it all
handled by a file called pumba.cgi and the current status is managed
by a text file called pumba.txt, this text file can be a number
between 1 and 100 denoting the percentage value of the task. So you go
like this?

Step #1: Client browser calls pumba CGI.
Step #2: Pumba.cgi checks for pumba.txt, if not found go to step #3,
if found go step #4.
Step #3: put 0 into pumba.txt and start working, each time a new
milestone is reached in the task, increment the value in pumba.txt
till it reaches 100 when the task is completed. Redirect browser to
step #2.
Step #4: check the value in pumba.txt, if below 100, display a
progress bar with value. and redirect in 2 seconds to step #2. if the
value is 100 go step #5.
Step #5: show feedback on task completed and delete pumba.txt

This is a simple workflow that works for a single user, you need
something more robust for multiple users.

Cheers
andre


On Wed, Apr 9, 2008 at 12:26 PM, Richard Miller <wow at together.net> wrote:
> The last line of a typical Rev cgi script is often something like "put
> buffer", where the data is sent back to the user. Is it possible to wait,
> say, 5 seconds after that, then use another "put buffer" command to send
> back another page of data?
>
> What I'm trying to do is have the user press Submit, see an intermediary
> page come up right away (such as "Processing your request"), then have the
> final results show up several seconds later.
>
> Will this work?
>
> Thanks.
> Richard Miller
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



-- 
http://www.andregarzia.com All We Do Is Code.



More information about the use-livecode mailing list