473,387 Members | 1,899 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.

"Dynamic" website content

Basically I have written a cgi script to automatically download TIFF
images of patents from the US patent office.

What I want is that the user can see what is happening when the images
are being downloaded, because it takes a while to download them and
there can be anything up to 30 individual files for each image.

Is there a way of using Python or any other means, that I could it
could print on the webpage:

Downloading image 1

Downloading image 2
....
Downloading image X

as the individual pictures are being downloaded so the user doesn't
think the program is hanging?

Jan 21 '06 #1
9 1651
sophie_newbie schrieb:
Basically I have written a cgi script to automatically download TIFF
images of patents from the US patent office.

What I want is that the user can see what is happening when the images
are being downloaded, because it takes a while to download them and
there can be anything up to 30 individual files for each image.

Is there a way of using Python or any other means, that I could it
could print on the webpage:

Downloading image 1

Downloading image 2
...
Downloading image X

as the individual pictures are being downloaded so the user doesn't
think the program is hanging?


Why? In my browser, if I download a file, the browser itself shows a
nice progress-bar. I guess what you are after is a way to trigger a
download while the current page is displayed in the browser.

Looking at sf, one can see that the header of the site explaining to you
that your download now starts contains this:

<meta http-equiv="refresh" content="5;
URL=http://peterhost.dl.sourceforge.net/sourceforge/winavr/WinAVR-20050214-install.exe"
/>
That means that 5 seconds later, the URL is fetched. As the type is
neither image nor HTML, the browser will download it.

In conclusion, it should even suffice to just let the user click that
link itself. Then the browser should start downloading that image of yours.

Regards,

Diez
Jan 21 '06 #2
To give you a better explaination of what I want, you could visit
www.pat2pdf.org.

Type in 123456 as the patent number, you see what it does? It tells the
user that it is requesting the various TIFF images and then displays
the link to the PDF file that it has created.

This is exactly what I want to do, so if anyone has any idea how it is
done I would be greatful.

I'm not asking how to get the TIFF files of create the PDF etc, that is
grand, just how it updates the screen with its progress like that...

Jan 21 '06 #3
sophie_newbie schrieb:
To give you a better explaination of what I want, you could visit
www.pat2pdf.org.

Type in 123456 as the patent number, you see what it does? It tells the
user that it is requesting the various TIFF images and then displays
the link to the PDF file that it has created.

This is exactly what I want to do, so if anyone has any idea how it is
done I would be greatful.

I'm not asking how to get the TIFF files of create the PDF etc, that is
grand, just how it updates the screen with its progress like that...


It seems that they just fetch the tiff and then write "Fetched
%i<br/>\n" into the page.

The important thing then is to flush the stdout, so that the data is
actually transmitted over the network. And I guess you have to provide a
header that accounts for the number of bytes you want to write (the
total bytes of the html-page that is), by specifying something equals or
maybe greater than the overall page.

Regards,

Diez
Jan 21 '06 #4
On Saturday 21 January 2006 20:42, sophie_newbie wrote:
To give you a better explaination of what I want, you could visit
www.pat2pdf.org.

Type in 123456 as the patent number, you see what it does? It tells the
user that it is requesting the various TIFF images and then displays
the link to the PDF file that it has created.


Ah, so you are trying to get the page displayed while your CGI is still
running? Try flushing stdout after you print something. Otherwise the
output will only be sent when the CGI ends or the buffer is full.

Kindly
Christoph
--
Never trust a system administrator who wears a tie and suit.
Jan 21 '06 #5
Christoph Haas <em***@christoph-haas.de> wrote:
On Saturday 21 January 2006 20:42, sophie_newbie wrote:
To give you a better explaination of what I want, you could visit
www.pat2pdf.org.

Type in 123456 as the patent number, you see what it does? It tells the
user that it is requesting the various TIFF images and then displays
the link to the PDF file that it has created.


Ah, so you are trying to get the page displayed while your CGI is still
running? Try flushing stdout after you print something. Otherwise the
output will only be sent when the CGI ends or the buffer is full.


....unless you run Python with the -u option, which makes output
unbuffered (and, if on Windows where it matters, binary). However, it's
not sufficient to ensure the user's browser will show the messages you
want when you want. A much more reliable way to achieve that is to use
timed redirects, or an AJAX (Javascript-based) solution.
Alex
Jan 21 '06 #6
Flushing to stdout doesn't seem to work anyway.

Honestly have no idea how you'd implement it in Javascript so might
have an ask on one of their forums...

Jan 22 '06 #7
sophie_newbie schrieb:
Flushing to stdout doesn't seem to work anyway.

Honestly have no idea how you'd implement it in Javascript so might
have an ask on one of their forums...


I think you need HTTP push to update the client page. See
http://wp.netscape.com/assist/net_sites/pushpull.html for
information about HTTP push.

Peter Maas, Aachen
Jan 22 '06 #8
To be honest that doesn't seem to work. Also it seems that only Mozilla
based browsers support server push.

Maybe it is something to do with how Apache is configured?

Or is Python buffering the output? Is there a line of code to make
python unbeffered?

Jan 29 '06 #9
I am running apache on windows by the way. I think there may be issues
with unbuffered output on windows...

Jan 29 '06 #10

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

Similar topics

3
by: Michal Grabowski | last post by:
Hello, I need to have a stored procedure, which performs sorting. Something like this: CREATE PROCEDURE procname @sortby varchar(30) AS BEGIN SELECT some, columns FROM some_table
3
by: Buddy Robbins | last post by:
Hey folks, I am re-writing an ASP.Net site for a company. The client wants to be responsible for the static content and navigation of their site, and I'll be responsible for any dynamic content. ...
1
by: Razzbar | last post by:
I'm creating a site that is all on one page. The navigation of the site is enabled by a hidden iframe that fetches content from the server and re/places it in a div on the page. The problem is...
0
by: raca | last post by:
I am trying to create a generic SOA ServiceInvoker that will accept an XML string that will be used to deserialize an object generated by XSDObjectGen. The hierarchy goes like this:...
5
by: Brad | last post by:
All samples related to this see to come short of being 'truly' dynamic. For instance, after creating all the code to load/save a properties value, you turn around and save it to one you KNOW...
0
by: TaeHo Yoo | last post by:
After running my code, group tree(the left section of the report) changes but not the content in the report. My code is ---------------------------------------------------------- Private Sub...
0
by: Patrick | last post by:
hi several general webpages (more or less static, e.g. errorpage, timeoutpage etc.) i need in all kind of asp.net-applications. instead of copy this pages (the *.aspx or *.html) into every...
0
by: walterbyrd | last post by:
This according to SDTimes: http://www.sdtimes.com/article/story-20071215-13.html They don't specifically mention Python. But, I think Python qualifies as a dynamic language. "1. Dynamic...
2
AutumnsDecay
by: AutumnsDecay | last post by:
Hey there. I'm doing a website for a someone and I want to try something I've never tried before. However, I'm getting some trouble. With Javascript, I'm able to dynamically make text appear...
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: 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: 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
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?
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
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...

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.