Wednesday, April 18, 2007

[browser technique] print a web page without print dialog box popup

Thousands of materials in web are talking about this topic, but I found none of them works..
So I just trying that all by myself..
just copy and paste the following html code into your web page and test, then you can get a fancy result..
(PS. Please don't ask me why javascript counterpart cannot hide the print dialog box, since I also don't know.. Orz)
* I guess maybe that's M$ strategy to force you to write stuff on VBScript instead of Javascript..

Sunday, April 1, 2007

[Zaurus] Zope in Zaurus pdaXrom, a OO database and web server

Owing to my one of the recent project requirements, I need to investigate a system called Zope (and its ZODB which is a OO database). It is easily installed in XP environment, but surprisingly, I found that the zaurus support to this is quite less….. Therefore, that triggers me to try to install this Zope inside my lovely pdaxrom….
All in all, the experiment is in vain (how come my recent trials are all in vain?…. ), but I would like to share my experiences during the trials, and hope (maybe) any interested parties to play around this stuff on their spare time.
1/ Since the python in pdaxrom is 2.4.1, which is quite out-dated in view of Zope current environment, we need to grab the previous versions of zope source code to compile - the one i chose is zope-2.9.1.tar.gz. During the compilation process, I stopped at a step which reports the python header is not fully satisfied, and using some others experiments certifying the header is really not fully satisfied. Therefore I gave up that direct compilation approach.
2/ searching thru google i found that there is a version called something related to zope-2.5.1-python_2.1 to zaurus environment. that means previously zaurus should support this zope server; and surprisingly, debian also support zope server as well! and found a package called zope_2.5.1-1woody1_arm.deb for arm processor debian….
3/ based on these observations, I tried to convert that deb to ipk. This is easy to be done by a simple script called deb2ipk.sh. When I really tried this converted ipk installation (my installation destination path is in /mnt/ide, which is not in the NAND area), I have encountered the following missing python scripts (and create a directory called /usr/lib/python2.1 linked to /usr/lib/python2.4): -
a. glob.py, fnmatch.py, shutil.py, compileall.py - all can be easily obtained the python script code from the internet. However, for compileall.py, add a '-q' option do exactly the same as '-f' option (to fool the compiler seems the debian python compileall.py has another option -q which is for quiet mode, but i don't know how to make it, therefore I used -f as the substitute. (line 103 added for description, line 112 added for force endorsement)
b. fcntl.py. This is obsolete (desperated in python term) in python 2.4.1 but still exists in python 2.1. on searching the web, you should be able to find the declaring as 'desperated' script, and apply it …. however, since there is a DOS version of FCNTL.py, you need to find that one for bullet-proofing. I adopt the one generated by h2py from /usr/include/sys/fcntl.h and put it in /usr/lib/python2.4 directory (together with fcntl.py).
c. when you do that, you need to compile those .py files to .pyc, search google on related topic for python compilation to .pyc [should be something like import py_compilepy_compile.compile(”your.py”)]
d. since the installation trials may involve the missing directory in /usr/lib/zope, you need to symbolic link the /usr/lib/zope to /mnt/ide/usr/lib/zope between installation failures so that you can pass the installation trials.
after you have done the following remedial actions, you should be able to install the converted ipk successfully.
4/ starting the zope server is simple : zope-z2 -w80 (port 80 for web, default is 9673, as seen in the help page when you carries -h parameter), then you should see your pdaxrom CPU time is nearly 100% ! And some warning messages shown up repeatedly in the terminal screen….. Therefore, I tried using telnet 80 port as a trial, can still cannot catch the port authentication…. therefore, I certified although the server is up and running in pdaxrom, the server processes cannot be utilized in the appropriate manner….
Hope these sharings can ignites some zope users investigations to Zaurus, and can be able to make the zope server be used in Zaurus. I really don't mind if anyone can share me a full set of python 2.4.1 headers in pdaxrom so that I can compile the zope server directly on board, in order to alleviate such a tedious repeated trials….