[Webware-discuss] Benchmark WebWare vs. CGI, psycopg PostgreSQL, Linux
Hi, I am evaluationg using Webware instead of plain python CGI. I therefore run some benchmark tests, and discovered that there is no difference in time needed between the webware and the cgi script. I am a little bit surprised, because I thought webware must be theoretically faster, because of the cached database connection and the interpreter startup overhead with cgi. Do you have a explanantion for that? Are my benchmarks wrong, or is it just the thruth that under this circumstances cgi is as fast as webware. Python 2.2, Apache, Linux Redhat 9 (2.4.20), WebWare 0.81, Single Processor P4, 500 MB RAM Running the benchmak script, profile says for testwebware: 55254 function calls (55219 primitive calls) in 0.760 CPU seconds and testcgi: 54505 function calls in 0.800 CPU seconds Running testpsycopg says: 5356 function calls in 0.380 CPU seconds benchmark script: === #!/usr/bin/python import urllib as u import profile import psycopg import os def testcgi(): for i in range(100): u.urlopen(http://localhost/cgi-bin/perftestcgi.py;) def testwebware(): for i in range(100): u.urlopen(http://localhost/cgi-bin/WebKit.cgi/perftest.py;) def testpsycopg(): for i in range(100): c = psycopg.connect(dbname=timcos_0) os.popen2(python) c.close() profile.run(testcgi()) = The cgi script: --- #!/usr/bin/python import psycopg print content-type: text/html print c = psycopg.connect(dbname=timcos_0) cu = c.cursor() cu.execute(select * from donework;) r = cu.fetchall() print(htmlbody%s/html/body % r) c.close() === The webware servlet: --- #!/usr/bin/env python from WebKit.Page import Page import psycopg class (Page): def __init__(self, *args, **KWs): print INIT Page.__init__(self, *args, **KWs) self.c = psycopg.connect(dbname=timcos_0) def writeBody(self): cu = self.c.cursor() cu.execute(select * from donework;) r = cu.fetchall() self.writeln(%s % r) -- Greg --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Benchmark WebWare vs. CGI, psycopg PostgreSQL, Linux
On Tuesday 20 September 2005 08:50, Gregor Horvath wrote: Hi, I am evaluationg using Webware instead of plain python CGI. [...] def testcgi(): for i in range(100): u.urlopen(http://localhost/cgi-bin/perftestcgi.py;) def testwebware(): for i in range(100): u.urlopen(http://localhost/cgi-bin/WebKit.cgi/perftest.py;) As long as you invoke Webware with the CGI adapter, you can't see any speed improvement over plain CGI. From the docs (http://www.webwareforpython.org/Webware/WebKit/Docs/InstallGuide.html#python-cgi-adapter) Though it's not recommended, there is an equivalent CGI script written in Python. This script is substantially slower, as it requires a Python interpreter to be started for each request. It is located in WebKit/Adapters/WebKit.cgi -- you may wish to point the first line (#!/usr/bin/env python) to the actual path of the Python interpreter (e.g., #!/usr/local/bin/python). Otherwise, follow the instructions for wkcgi. There is no configuration, and WebKit.cgi should be able to find the host and port of the AppServer automatically. Please try mod_webware as an adapter as it is the fastest way to connect to a webware application server. Hope that helps Stephan def testpsycopg(): for i in range(100): c = psycopg.connect(dbname=timcos_0) os.popen2(python) c.close() profile.run(testcgi()) [...] --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Benchmark WebWare vs. CGI, psycopg PostgreSQL, Linux
Try reloading a quick acting cgi page 100 times over. Thats where the diference lies. On Tue, 20 Sep 2005, Gregor Horvath wrote: Hi, I am evaluationg using Webware instead of plain python CGI. I therefore run some benchmark tests, and discovered that there is no difference in time needed between the webware and the cgi script. I am a little bit surprised, because I thought webware must be theoretically faster, because of the cached database connection and the interpreter startup overhead with cgi. Do you have a explanantion for that? Are my benchmarks wrong, or is it just the thruth that under this circumstances cgi is as fast as webware. Python 2.2, Apache, Linux Redhat 9 (2.4.20), WebWare 0.81, Single Processor P4, 500 MB RAM Running the benchmak script, profile says for testwebware: 55254 function calls (55219 primitive calls) in 0.760 CPU seconds and testcgi: 54505 function calls in 0.800 CPU seconds Running testpsycopg says: 5356 function calls in 0.380 CPU seconds benchmark script: === #!/usr/bin/python import urllib as u import profile import psycopg import os def testcgi(): for i in range(100): u.urlopen(http://localhost/cgi-bin/perftestcgi.py;) def testwebware(): for i in range(100): u.urlopen(http://localhost/cgi-bin/WebKit.cgi/perftest.py;) def testpsycopg(): for i in range(100): c = psycopg.connect(dbname=timcos_0) os.popen2(python) c.close() profile.run(testcgi()) = The cgi script: --- #!/usr/bin/python import psycopg print content-type: text/html print c = psycopg.connect(dbname=timcos_0) cu = c.cursor() cu.execute(select * from donework;) r = cu.fetchall() print(htmlbody%s/html/body % r) c.close() === The webware servlet: --- #!/usr/bin/env python from WebKit.Page import Page import psycopg class (Page): def __init__(self, *args, **KWs): print INIT Page.__init__(self, *args, **KWs) self.c = psycopg.connect(dbname=timcos_0) def writeBody(self): cu = self.c.cursor() cu.execute(select * from donework;) r = cu.fetchall() self.writeln(%s % r) -- Greg --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Benchmark WebWare vs. CGI, psycopg PostgreSQL, Linux
On 9/19/05, Gregor Horvath [EMAIL PROTECTED] wrote: Hi, I am evaluationg using Webware instead of plain python CGI. I therefore run some benchmark tests, and discovered that there is no difference in time needed between the webware and the cgi script. I am a little bit surprised, because I thought webware must be theoretically faster, because of the cached database connection and the interpreter startup overhead with cgi. Do you have a explanantion for that? Are my benchmarks wrong, or is it just the thruth that under this circumstances cgi is as fast as webware. Python 2.2, Apache, Linux Redhat 9 (2.4.20), WebWare 0.81, Single Processor P4, 500 MB RAM Running the benchmak script, profile says for testwebware: 55254 function calls (55219 primitive calls) in 0.760 CPU seconds and testcgi: 54505 function calls in 0.800 CPU seconds Running testpsycopg says: 5356 function calls in 0.380 CPU seconds I tested WebKit vs. CGI a long time ago and got a *huge* speed up due to CGI's overhead such as: - launching the Python interpreter as a new process - importing various modules (sys, time, os, cgi, etc.) I didn't measure in CPU seconds for function calls. I measured in requests per seconds. I got an even bigger speed boost when there was any configurations, database records or computed values that I could cache (and there often are). Some thoughts on your speed test: - There is very little Python code in the CGI script or servlet. My own web apps have plenty of Python code to put the page together, so if I was testing I would try something that looks more typical. - I trust the profile module to help me locate bottlenecks in my Python code, but for speed tests like this I prefer wall time: (untested) import time def durationOf(run, iterations=1000): # notice bigger range r = range(iterations) start = time.time() for i in r: # multiple calls to reduce overhead from for run() run() run() run() run() run() run() run() run() run() duration = time.time() - start print 'duration of %s is %s' % (run, duration) return duration def this(): ... def that(): ... durationOf(this) durationOf(that) Also, exit email, exit all web browsers and shut down as many other programs as possible before running. What kind of results do you get then? -Chuck --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Benchmark WebWare vs. CGI, psycopg PostgreSQL, Linux
On 9/20/05, Stephan Diehl [EMAIL PROTECTED] wrote: On Tuesday 20 September 2005 08:50, Gregor Horvath wrote: Hi, I am evaluationg using Webware instead of plain python CGI. [...] def testcgi(): for i in range(100): u.urlopen(http://localhost/cgi-bin/perftestcgi.py;) def testwebware(): for i in range(100): u.urlopen(http://localhost/cgi-bin/WebKit.cgi/perftest.py;) As long as you invoke Webware with the CGI adapter, you can't see any speed improvement over plain CGI. Oh, yeah. That too. :-) Although you could still see some speedup for complex apps with many imported modules (WebKit.cgi only imports a few and the WebKit app server stays resident) and in-memory caches. -Chuck --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Benchmark WebWare vs. CGI, psycopg PostgreSQL, Linux
Gregor Horvath wrote: Do you have a explanantion for that? Are my benchmarks wrong, or is it just the thruth that under this circumstances cgi is as fast as webware. You seem to be using the Python CGI adapter with Webware. Under this circumstances, you will really see no difference. CGI programs are slow, because they have to (1) create and destroy a process and (2) start the Python interpreter every time they are used. The Python CGI adapter (WebKit.cgi) shares both of these disadvantages with ordinary CGI Python scripts. Webware comes with an adapter written in C (wkcgi, WebKit.exe) that eliminates problem (2) and is therefore much faster. Webware also contains an Apache adapter written in C (webkit_mod) that eliminates both problems (1) and (2). I really recommend using webkit_mod with Webware. Note that there are two different versions of the adapter, for Apache1.x and Apache2.x. See also: http://www.webwareforpython.org/Webware/WebKit/Docs/InstallGuide.html#adapters Try to make another benchmark comparing the various adapters. Concerning the benchmark, it also depends on how fast your servlet is. If the time for starting new processes is short in comparison with the time the servlet uses, then of course you will not measure the performance of the web framework, but the performance of the CGI programs themselves or the performance of the database. But even if you use the Python CGI adapeter, Webware still has many advantages over plain CGI. You can use the whole stuff the framework provides. You can cache data more easily using Webware. This will often make a big difference in performance. -- Christoph --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Benchmark WebWare vs. CGI, psycopg PostgreSQL, Linux
Hi Gregor, On Tuesday 20 September 2005 09:58, you wrote: Hi, Stephan Diehl schrieb: Please try mod_webware as an adapter as it is the fastest way to connect to a webware application server. I installed the mod_webware adapater and changed def testwebware(): for i in range(100): u.urlopen(http://localhost/WK/perftest.py;) Now, it es even slower! 55250 function calls (55215 primitive calls) in 1.040 CPU seconds I'm quite sure that you've tested something, but probably not what you intended to test. First of all, Benchmarking is quite difficult. The method, you are using (profile) is good, if you want to know the number of function calls and the relative times the program spends inside them. You are basicly measuring, how urllib.urlopen behaves. The measuring overhead with profile is so heavy, that the absolute numbers have no meaning whatsoever. In order to get any meaningfull numbers, you should use some Load and Performance Test Tools that have nothing to do with Python. I've never needed to do this kind of tests, so I can't recommend any, but I'm sure that several people on this list know the right kind of tools. Stephan -- Greg --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Benchmark WebWare vs. CGI, psycopg PostgreSQL, Linux
Stephan Diehl wrote: I've never needed to do this kind of tests, so I can't recommend any, but I'm sure that several people on this list know the right kind of tools. apache bench should be the right tool for this job. http://httpd.apache.org/docs/1.3/programs/ab.html regards, robert Stephan -- Greg --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss . -- the idea is to keep the green alien landing craft from taking up humans from the ground and changing them into mutants. a mutant is very dangerous to you, because it flies faster than you do and shoots at you. --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Benchmark WebWare vs. CGI, psycopg PostgreSQL, Linux
Hi everbody, thanks for your input. I changed the test function according to Chucks suggestion and the results are: duration of function testcgi at 0x401986f4 is 532.231880903 duration of function testwebware at 0x40591df4 is 127.881435156 duration of function testwebwarewkcgi at 0x40591e2c is 1289.3273561 I have also made some test with ab: ab -n 500 http://localhost/cgi-bin/perftestcgi.py Requests per second:19.33 [#/sec] (mean) ab -n 500 http://localhost/cgi-bin/WebKit.cgi/perftest Requests per second:7.54 [#/sec] (mean) ab -n 500 http://localhost/WK/perftest Requests per second:48.12 [#/sec] (mean) Now this seems to be realistic. Seems that my test funktion was not accurate. Webware (with mod_webware) is the winner, although not dramatically. But the speed gain with webware under real conditions can only be better than those unrealistic test scripts. Interesting that WebKit.cgi is much slower than plain cgi. Thanks a lot! The new used test script: #!/usr/bin/python import urllib as u import profile #import psycopg import os import time def durationOf(run, iterations=1000): # notice bigger range r = range(iterations) start = time.time() for i in r: # multiple calls to reduce overhead from for run() run() run() run() run() run() run() run() run() run() duration = time.time() - start print 'duration of %s is %s' % (run, duration) return duration def testcgi(): u.urlopen(http://localhost/cgi-bin/perftestcgi.py;) def testwebware(): u.urlopen(http://localhost/WK/perftest.py;) def testwebwarewkcgi(): u.urlopen(http://localhost/cgi-bin/WebKit.cgi/perftest;) def testpsycopg(): for i in range(100): c = psycopg.connect(dbname=timcos_0) os.popen2(python) c.close() #profile.run(testwebware()) #durationOf(testcgi) durationOf(testwebwarewkcgi) Sorry for sending some private emails, I meant to send to the list. -- Greg --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
[Webware-discuss] Printing from web application
Hi All, I have a small webware application in which I need to produce reports to be printed. Right now, html reports produce poor results (pagination is not constant). I bigger companies, we use Crystal Reports, but this is a small non-for-profit organization, so we can't afford commercial software. What are you guys using? I was checking out reportlab, but it seems a lot of work, and I couldn't find tables support. Best regards, Ed. begin:vcard fn:Eduardo Elgueta n:Elgueta;Eduardo org:Navix S.A. adr:Provicencia;;Av. Once de Septiembre 1945 Of. 502;Santiago;RM;750-0503;Chile email;internet:[EMAIL PROTECTED] title:Senior Consultant tel;work:+56 (2) 381-1467 tel;cell:+56 (9) 821-0033 x-mozilla-html:FALSE url:http://www.navix.cl version:2.1 end:vcard
Re: [Webware-discuss] Printing from web application
Hi, Eduardo Elgueta schrieb: I was checking out reportlab, but it seems a lot of work, and I couldn't find tables support. I use reportlab. Has some learning curve, but its worth it. It has tables support. Look at Platypus. I even prefer it upon Crystal Reports, which makes the easy things easy and the complicated more complicated, as most graphical tools do. -- Greg --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Printing from web application
On 9/20/05, Gregor Horvath [EMAIL PROTECTED] wrote: Hi, Eduardo Elgueta schrieb: I was checking out reportlab, but it seems a lot of work, and I couldn't find tables support. I use reportlab. Has some learning curve, but its worth it. It has tables support. Look at Platypus. I even prefer it upon Crystal Reports, which makes the easy things easy and the complicated more complicated, as most graphical tools do. There are CSS directives for inserting page breaks and doing other printer-oriented things. Your app could provide a printable version of a report which removes navigation and makes use of these directives. They are described here: http://www.w3.org/TR/REC-CSS2/page.html -Chuck --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
RE: [Webware-discuss] Printing from web application
You might try to produce a "printer-friendly" version of your HTML reports. You can use the CSS style "page-break-before: always" on a P tag to forcepage breaks where needed. For instance, if your report consists of a large HTML table, you may determine through trial and error that you can comfortably fit 20 rows on one page. Then split up the table into multiple tables with no more than 20 rows per table and insert p style="page-break-before: always" in between each one. This will require a bit of experimenting and tweaking with different browsers to get it right, and it may not always work 100% correctly, but it may be good enough depending on your use case. You can have a "view" version of the report in which all of the data is contained within one large table for online use, and provide a link to a "printable" version of the report in which you split up the tables to fit one per page, strip out navigation links, etc. The nice thing about this is that the HTML reports will probably be much nicer to use online than a PDF report would (does anyone actually like viewing reports onlineusinga PDF viewer?). They probably won't look as nice when printed though. I've used this method with some success -- it's not perfect but given the choice between nice-for-printing PDF reports that are a pain to use online, and acceptable-printing HTML reports that are a pleasure to use online, I prefer the second choice. - Geoff -Original Message-From: Eduardo Elgueta [mailto:[EMAIL PROTECTED]Sent: Tuesday, September 20, 2005 3:08 PMTo: webware-discuss@lists.sourceforge.netSubject: [Webware-discuss] Printing from web applicationHi All,I have a small webware application in which I need to produce reports to be printed. Right now, html reports produce poor results (pagination is not constant).I bigger companies, we use Crystal Reports, but this is a small non-for-profit organization, so we can't afford commercial software.What are you guys using?I was checking out reportlab, but it seems a lot of work, and I couldn't find tables support.Best regards,Ed.
Re: [Webware-discuss] Printing from web application
Chuck Esterbrook wrote: Eduardo Elgueta schrieb: I was checking out reportlab, but it seems a lot of work, and I couldn't find tables support. I use reportlab. Has some learning curve, but its worth it. It has tables support. Look at Platypus. I even prefer it upon Crystal Reports, which makes the easy things easy and the complicated more complicated, as most graphical tools do. There are CSS directives for inserting page breaks and doing other printer-oriented things. Your app could provide a printable version of a report which removes navigation and makes use of these directives. You might also be able to use a tool to render the HTML to PDF on the server, giving you predictable results (with no browser inconsistencies). There's things like a standadalone Mozilla setup for this, and tools no doubt -- I can't recommend anything (or even give good pointers), but I'd be interested in anyone else's experiences. -- Ian Bicking / [EMAIL PROTECTED] / http://blog.ianbicking.org --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
RE: [Webware-discuss] Printing from web application
--- Geoffrey Talvola [EMAIL PROTECTED] wrote: You might try to produce a printer-friendly version of your HTML reports. You can use the CSS style page-break-before: always on a P tag to force page breaks where needed. For instance, if your report consists of a large HTML table, you may determine through trial and error that you can comfortably fit 20 rows on one page. Then split up the table into multiple tables with no more than 20 rows per table and insert p style=page-break-before: always in between each one. This will require a bit of experimenting and tweaking with different browsers to get it right, and it may not always work 100% correctly, but it may be good enough depending on your use case. You can have a view version of the report in which all of the data is contained within one large table for online use, and provide a link to a printable version of the report in which you split up the tables to fit one per page, strip out navigation links, etc. The nice thing about this is that the HTML reports will probably be much nicer to use online than a PDF report would (does anyone actually like viewing reports online using a PDF viewer?). They probably won't look as nice when printed though. I've used this method with some success -- it's not perfect but given the choice between nice-for-printing PDF reports that are a pain to use online, and acceptable-printing HTML reports that are a pleasure to use online, I prefer the second choice. - Geoff If you are using Firefox (and maybe the latest Netscape and Mozilla), there is support for the THEAD, TFOOTER, and TBODY tags. Just by wrapping the heading rows of a table in thead, Firefox will print the heading rows on subsequent pages -- no need to use the page-break-before method on large tables. This, combined with liberal use of dispay: none; under the media print section to eliminate the printing of buttons and other things not relevant on a printed page creates printed output close to perfect. Firefox deserves another plug here; if you are not using Firefox to develop your application's html, you are missing out on some great tools. There are several fantastic developer extensions (click Extensions under the Firefox Tools menu). I use the Web Developer, HTML Validator, and View Formatted Source extensions every day. Roger Haase __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Printing from web application
On Tue, 2005-09-20 at 14:47 -0500, Ian Bicking wrote: You might also be able to use a tool to render the HTML to PDF on the server, giving you predictable results (with no browser inconsistencies). There's things like a standadalone Mozilla setup for this, and tools no doubt -- I can't recommend anything (or even give good pointers), but I'd be interested in anyone else's experiences. Some good info here: http://www-128.ibm.com/developerworks/linux/library/l-sc6.html .. but before you get too excited about the import_HTML function mentioned in the article make sure and read this... http://phaseit.net/claird/comp.text.pdf/PDF.html#import_HTML -Seth -- Seth Remington SaberLogic, LLC 661-B Weber Drive Wadsworth, Ohio 44281 Phone: (330)335-6442 Fax: (330)336-8559 --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Printing from web application
Thank you all for your answers. The reportlab/pdf solution doesn't seem quite easy to implement, just as I thought. Besides, I see a lot of trouble ahead downloading/compiling/configuring/learning reportlab and a bunch of other support libraries. Transforming my html into pdf, doesn't solve much, either, because the main problem, pagination, remains. I've been using the method Geoffrey recommends: through trial and error, I've worked out a pretty good (acceptable) solution. The big problem is, as I mentioned, pagination. Every time a font-size or graphic changes, I have to go through the trial-and-error nightmare again. I think the page-break-before CSS style will solve the problem. I just have to make sure I have room in every page for unusually large data in every page table. That will create a blank space at the bottom of most pages, but that's ok. Other problem the users complain about, is table column width varies from one page to the other, which is obvious, given the way browsers render html (they don't unserstand that, either :-( ). Does anybody knows if theres a CSS style or HTML property I can use to force the column width no matter what? word wrapping is acceptable. Regards, Ed. begin:vcard fn:Eduardo Elgueta n:Elgueta;Eduardo org:Navix S.A. adr:Provicencia;;Av. Once de Septiembre 1945 Of. 502;Santiago;RM;750-0503;Chile email;internet:[EMAIL PROTECTED] title:Senior Consultant tel;work:+56 (2) 381-1467 tel;cell:+56 (9) 821-0033 x-mozilla-html:FALSE url:http://www.navix.cl version:2.1 end:vcard
RE: [Webware-discuss] Printing from web application
Eduardo Elgueta wrote: Other problem the users complain about, is table column width varies from one page to the other, which is obvious, given the way browsers render html (they don't unserstand that, either :-( ). Does anybody knows if theres a CSS style or HTML property I can use to force the column width no matter what? word wrapping is acceptable. Regards, Ed. You should be able to force a column to be fixed width by applying a style like width: 300px to all of the td elements that make up the column. - Geoff --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Printing from web application
Geoffrey, I already do that, but, for some reason, some pages have a different column distribution. I think this has something to do with the browser rendering algorithm. I'll try with a more recent version (I'm not sure they have the last version). Thanks anyway, Ed. Geoffrey Talvola escribi: Eduardo Elgueta wrote: Other problem the users complain about, is table column width varies from one page to the other, which is obvious, given the way browsers render html (they don't unserstand that, either :-( ). Does anybody knows if theres a CSS style or HTML property I can use to force the column width no matter what? word wrapping is acceptable. Regards, Ed. You should be able to force a column to be fixed width by applying a style like "width: 300px" to all of the td elements that make up the column. - Geoff --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss -- Eduardo Elgueta Senior Consultant Navix correo/email: [EMAIL PROTECTED] telfono/phone: +56 (2) 381-1467 celular/mobile: +56 (9) 821-0033 web: www.navix.cl Av. Once de Septiembre 1945 Of. 502 Providencia 750-0503 Santiago, Chile begin:vcard fn:Eduardo Elgueta n:Elgueta;Eduardo org:Navix S.A. adr:Provicencia;;Av. Once de Septiembre 1945 Of. 502;Santiago;RM;750-0503;Chile email;internet:[EMAIL PROTECTED] title:Senior Consultant tel;work:+56 (2) 381-1467 tel;cell:+56 (9) 821-0033 x-mozilla-html:FALSE url:http://www.navix.cl version:2.1 end:vcard
Re: [Webware-discuss] Printing from web application
1. CSS formatting is a good idea, but most browsers don't do a good job at implementing it. For example, div style=page-break-inside: avoid works only in Opera but neither in Mozilla nor in IE; they ruthlessly cut right across even table cells and rows. So, if you don't want to count the lines of every page you are putting out and manually insert each page break, CSS is not really an option; this leaves only PDF. 2. Reportlab has a special XML source format for PDF generation, called RML, that does have table support. It should be pretty straightforward to generate RML from XHTML or the other way around, whatever looks better to you. I would probably use ElementTree to do that (look at effbot.org). The RML user guide is in the Reportlab download, but not the PDF rendering engine, which is non-free. However, there is a free (pure Python) program that does the same (and pretty fast, too). You can find it here: http://openreport.org/index.py/static/page/trml2pdf Best, Michael Eduardo Elgueta wrote: Hi All, I have a small webware application in which I need to produce reports to be printed. Right now, html reports produce poor results (pagination is not constant). I bigger companies, we use Crystal Reports, but this is a small non-for-profit organization, so we can't afford commercial software. What are you guys using? I was checking out reportlab, but it seems a lot of work, and I couldn't find tables support. Best regards, Ed. -- Michael Palmer Dept. of Chemistry, University of Waterloo 200 University Ave W N2L 3G1 Waterloo, ON Canada Phone: (519) 888-4567 ext. 5100 Fax: (519) 746-0435 e-mail: [EMAIL PROTECTED] Office: ESC-234 Lab: ESC-241 --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
RE: [Webware-discuss] Printing from web application
Pagination is always going to be a problem with webpages, so far browsers really don't make inserting page breaks an easy task. If what you want is a Crystal Reports like product why not use datavision (http://sourceforge.net/projects/datavision) its free and works ok. Jose Original Message Subject: [Webware-discuss] Printing from web application From: Eduardo Elgueta [EMAIL PROTECTED] Date: Tue, September 20, 2005 12:07 pm To: webware-discuss@lists.sourceforge.net Hi All, I have a small webware application in which I need to produce reports to be printed. Right now, html reports produce poor results (pagination is not constant). I bigger companies, we use Crystal Reports, but this is a small non-for-profit organization, so we can't afford commercial software. What are you guys using? I was checking out reportlab, but it seems a lot of work, and I couldn't find tables support. Best regards, Ed. --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] Printing from web application
Eduardo Elgueta wrote: The reportlab/pdf solution doesn't seem quite easy to implement, just as I thought. Besides, I see a lot of trouble ahead downloading/compiling/configuring/learning reportlab and a bunch of other support libraries. Just to make this clear again, ReportLab is really not difficult. No need to compile or configure anything. There is also a howto for integrating with Webware in the Wiki at: http://wiki.w4py.org/pdf-creation-with-reportlab.html I'm sure that creating CSS page styles that work with all browsers will be a lot more cumbersome than creating PDF with ReportLab. But of course it will also depends on the particular reports you want to create and the demands you make to the quality of the output. By the way, it would be nice if someone could summarize discussions such as this one on the Wiki, too. -- Christoph --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss