473,396 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Visual feedback during a lenghty operation

a
Hi everybody,

I have a form that is processed by a php script. When the user presses
Submit, the php script calls exec to start an external process that may take
from seconds to minutes to complete, and in the meantime I would like to
show the user some feedback as to the progress of the operation.

One problem is that exec is synchronous - how do I start an external process
asynchronously? The second issue is that even if I start a process
asynchronously, I don't know how to send a page to the browser without
exiting the script. For example, while waiting for the external process to
finish its work, I would be in a loop, and every X seconds I would update
the page with some new information, but I'm not sure how to do that.

I have php 5.2.2 and Apache 2 on Win XP Pro.

I would appreciate any hints.

A
Jan 18 '06 #1
3 1591
a wrote:
The second issue is that even if I start a
process asynchronously, I don't know how to send a page to the
browser without exiting the script. For example, while waiting for
the external process to finish its work, I would be in a loop, and
every X seconds I would update the page with some new information,
but I'm not sure how to do that.
Have a look at StanV's example @
http://www.php.net/manual/en/function.flush.php
I have php 5.2.2 [...]


Hey, where did you download it? ;-)
JW
Jan 18 '06 #2
a
>
Have a look at StanV's example @
http://www.php.net/manual/en/function.flush.php

Thanks, I'll check it out.
I have php 5.2.2 [...]


Hey, where did you download it? ;-)


I meant 5.1.2 :)
Jan 19 '06 #3
d
"a" <xx*****@pacbell.net> wrote in message
news:8T*****************@newssvr27.news.prodigy.ne t...
Hi everybody,

I have a form that is processed by a php script. When the user presses
Submit, the php script calls exec to start an external process that may
take from seconds to minutes to complete, and in the meantime I would like
to show the user some feedback as to the progress of the operation.

One problem is that exec is synchronous - how do I start an external
process asynchronously? The second issue is that even if I start a process
asynchronously, I don't know how to send a page to the browser without
exiting the script. For example, while waiting for the external process to
finish its work, I would be in a loop, and every X seconds I would update
the page with some new information, but I'm not sure how to do that.

I have php 5.2.2 and Apache 2 on Win XP Pro.

I would appreciate any hints.

A


Call the php script in an iframe in your web page (the iframe can be
invisible, and can be the target for your form). Have the script output
chunks of javascript at set intervals (not too often otherwise it'll send
megabytes of javascript with a lenghty operation). Every browser I've tried
will execute a <script> tag once it's been flushed in its entirity to the
browser, so you can output chunks of javascript that manipulate the parent
document (say, updates a progress bar or textual display). I've used it for
lenghty operations, and it works like a charm.

dave
Jan 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
0
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list...
18
by: Brandon Bray [MSFT] | last post by:
Shortly, the Visual C++ Tools Refresh will be available on the MSDN Visual C++ devcenter. You will need to have installed the Visual Studio 2005 Beta first. <http://msdn.microsoft.com/visualc> I...
8
by: Will Chamberlain | last post by:
I came across a rather interesting article this morning and thought I'd share. We all know that Visual Studio is a great IDE, but I think we can all agree that it is adds a dramatic change to how...
3
by: clintonG | last post by:
Regions that relocate themselves in the source when the - icon is used to contract a region? Regions that decide they want to indent themselves? When it is selected the + icon just decides to...
16
by: a | last post by:
Hi everybody, My config: Win XP (or 2003), Apache 2.0.54, PHP 5.1.2. I have been trying to handle the case of a lenghty opearation on the server while providing the user with feedback and...
1
by: Venkat | last post by:
Hi, Is there any way to give feedback to the application while a stored procedure execution is in progress? I am using sql server and my application is built using c#. The stored procedure tries...
0
by: fischermx | last post by:
Environment: Microsoft Visual Studio 2005 Version 8.0.50727.762 (SP.050727-7600) Microsoft .NET Framework Version 2.0.50727 Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack...
4
by: Alfredo73 | last post by:
Hi, I am using Visual Basic 2008 to create some databases. It reads data from textfiles and puts them in SQL databases. After the user presses the Process button I would like to give the user to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.