473,387 Members | 1,493 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,387 software developers and data experts.

Long cgi page

I am writing a simple cgi app and I would like it to print the header
of an html page and "Running..." then print the results (which take
over a minute to calculate)

But...

None of the page displays until the program finishes.

Is there any way of flushing the first half of the page out before the
calculation starts?

Simon
Jul 18 '05 #1
4 1548
sys.stdout.flush()
See Python ref.

Best,
Miklós

Simon Faulkner <ne**@titanic.co.uk> wrote in message
news:nf********************************@4ax.com...
I am writing a simple cgi app and I would like it to print the header
of an html page and "Running..." then print the results (which take
over a minute to calculate)

But...

None of the page displays until the program finishes.

Is there any way of flushing the first half of the page out before the
calculation starts?

Simon

Jul 18 '05 #2
> None of the page displays until the program finishes.

it's because the http server "waits" till the cgi program finishes,
flushing stdout will not work

--
bromden[at]gazeta.pl

Jul 18 '05 #3
On Mon, 13 Oct 2003 18:35:44 +0100,
Simon Faulkner <ne**@titanic.co.uk> wrote:
Is there any way of flushing the first half of the page out before the
calculation starts?


You're better off using a redirect. On the inital request, run the
calculation in a subprocess or a subthread and return a brief page that says
"Please wait...". This page should contain a <META HTTP-EQUIV="Refresh">
element that will reload the page in some suitable time span. On reloading,
the application should check if the computation is done and either return
the results or another "Please wait" page.

Quixote pseudocode:

def calc [html] (request):
if not request.session.computation_in_progress():
# Fork off subprocess
elif request.session.computation_completed():
"Results:"
...
else:
# Computation is in process
"<html><head>"
'<meta http-equiv="refresh" content="10; %s">' % request.get_url()
'</head><body> ... </body></html>'

You'd have to write the computation_completed() and computation_in_progress()
methods.

--amk
Jul 18 '05 #4
In article <3t********************@speakeasy.net>, A.M. Kuchling wrote:
On Mon, 13 Oct 2003 18:35:44 +0100,
Simon Faulkner <ne**@titanic.co.uk> wrote:
Is there any way of flushing the first half of the page out before the
calculation starts?


You're better off using a redirect. On the inital request, run the
calculation in a subprocess or a subthread and return a brief page that says
"Please wait...". This page should contain a <META HTTP-EQUIV="Refresh">
element that will reload the page in some suitable time span. On reloading,
the application should check if the computation is done and either return
the results or another "Please wait" page.


I don't know how to translate this to Quixote, but another way to do this
would be to use an HTTP refresh header, which has the additional advantage
that it's not strictly limited to HTML.

Just a thought,
Dave

--
..:[ dave benjamin (ramenboy) -:- www.ramenfest.com -:- www.3dex.com ]:.
: d r i n k i n g l i f e o u t o f t h e c o n t a i n e r :
Jul 18 '05 #5

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

Similar topics

7
by: James o'konnor | last post by:
hello. i have the next for create one table into db2 CREATE TABLE "MYSQUEMA"."TABLADEMO" ( "ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +0 INCREMENT BY +1 MINVALUE +0...
2
by: karl_m | last post by:
I'm having trouble with unsigned long long declarations on my SCO unix 7.1.1 compiler. Can you test the following code? I'm expecting both printf functions to report 1. Thanks, karl m ...
5
by: PontiMax | last post by:
Hi, when I press the OK button of my dialog box a long-running task is initiated. Therefore I would like to make visible a div section right after clicking the button where a user-friendly...
1
by: Anonieko | last post by:
Query: How to display progress bar for long running page Answer: Yet another solution. REFERENCE: http://www.eggheadcafe.com/articles/20050108.asp My only regret is that when click the...
14
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.