Theo Verelst Diary Page

Wed 20 june 2001, 18:52 PM

I've decided after good example to write some diary pages with toughts and events.

Oh, in case anybody fails to understand, I'd like to remind them that these pages are copyrighted, and that everything found here may not be redistributed in any other way then over this direct link without my prior consent. That includes family, christianity, and other cheats. The simple reason is that it may well be that some people have been ill informed because they've spread illegal 'copies' of my materials even with modifications. Apart from my moral judgement, that is illegal, and will be treated as such by me. Make as many references to these pages as you like, make hardcopies, but only of the whole page, including the html-references, and without changing a iota or tittel...

And if not? I won't hesitate to use legal means to correct wrong that may be done otherwise. And I am serious. I usually am. I'm not sure I could get 'attempt to grave emotional assault' out of it, but infrigement on copyright rules is serious enough. And Jesus called upon us to respect the authorities of state, so christians would of course never do such a thing. Lying, imagine that.

Previous Diary Entries   |   List of Diary Pages   |   Home Page

Wed 20 june 2001, 18:52 PM

A custom web server with bwise building blocks

Could be the title of an article, which in this case it isn't, but at least a short communication about a little work I've done with the latest tcl webserver in combination with my bwise block editor.

In short, I found a way to get those running, and running together, and test a few things, and the result was that as I've done some time ago already, the server can draw actions from the bwise block diagram, which then lets some blocks activate, form a page, which is then fed into the server, and back to the browser calling for a special page.

Also, a (standard supplied) statistics page is shown, a text editor for html editing of the page body, and some block windows.

The server can be run and edited simulataneously, I've edited the server tcl script to have a console window open, and to leave the main graphics window open for in this case bwise, putting the server statistics trace data in a seperate window.

The fun of course is that is works, the whole thing runs and lets pages be generated through running bwise applications. Here there is a simple enough sequence of function blocks with one input and one output, of which the lasts gets the text out of the upper left corner text editor, adds the data on its input at the end, which comes from the entry over all the other blocks, and the output of the Proc3 is sent to the server. Every time a page is requested by the right url, the canvas is evaluated again, in this case a 'run' command is started at the entry, and progresses until all the blocks until Proc3 have been 'fired' and fed eachother the previous blocks' output data.

I've just made a few additions, where I've also dragged in the pcom package I made, which is sort of a two party AOL messenger with file transfer both directions. A block has been added which counts the number of times it is fired, which is shown on the canvas, and it also sends a line of message over an established pcom link to a pcom window which every time the bwise page is created shows 'sent the xx-th page', automatically. The server tcl shell is then connected with the pcom application running un another tcl/tk interpreter, which could be everywhere, which also allows certian versions of pcom to give tcl commands to the server, by using DO_TCL {some tcl command} at its message line, which could for instance be the command to create a new virtual page, which is generated on the fly:

% Direct_Url /test dirte
% proc dirte a {global Proc3.out; bdol {R Proc2} ; return ${Proc3.out} }
 send "Sent ${Proc5.out} th page" ; incr {Proc5.out}

These commands to the tcl server make a page http://localhost:8015/test, which also could be a more regular address, and make the page test Run the bwise canvas starting at the block Proc2, and feed the output of block Proc3 to the server to be presented to netscape as a web page.

% set Proc5.bfunc {send "Sent ${Proc5.out} th page" ; incr {Proc5.out}}

Makes the access counter work in bwise block Proc5, and uses the 'send' command from the pcom package library to use an open pcom channel to send a text message to the connected pcom party.

Fun enough.

Does it all run? Fine enough thus far, no significant delays, no messups, everything easy and clean enough. And getting the whole thing to run doesn't need to take much time, except that I've let bwise and pcom run in the same window, sharing spaces for buttons and text windows, which requires a bit of organizing around in the UI code, or just use seperate windows and hope there is no global variable and function clash, which is not often the case. The tcl server is currently offered for download on the scriptics site itself, the makers of tcl/tl, and requires only an additional library to be made available in the lib/tcl directory, which is tcllib 0.8 in this case which is easily found on the same site through a search. Then double click httpd, for unix users logically in the Bin directory, and a test server is up and running, with a quite slick set of test pages. And all that for free!

Loading my library of procedures with bwise (procsa4.tcl see a few diary pages back) is no problem after forcing the Debug option in the end of the httpd startup script to show the console when the server is started. Simply sourcing the lib and typing 'bwise' makes the bwise canvas come up, except that not the same window must be chosen as the server statistics window, which I edited in the srvui.tcl source. After that the fun starts, and seriously, this server has been in use by the scriptics guys and I think Sun themselves, and a few years back at least the had up to half a million hits a day with it performing fine enough when I tested it, which is at least good recommendation. And the speed of the datatransfer can be quite optimal, because it is possible to use tcl commands that feed data between sockets on a low level, without the interfearence of an interpreter in between, so quite good traffic rates should be obtainable.

Expert stuff? Without question not too many can try this at home with success, unless they're well aware enough of tcl, though in fact getting tcl to run, and then installing the server and running it under windows 95 or so is not too hard, the required library is the only out of the ordinary, the rest is quite a clean and straightforward install job. I think I could harnass the whole thing in a package which does most installation easy enough, which may be worth it. Both Tcl/Tk and the webserver package are freely downloadable, just like Netscape, and I've thusfar made Bwise nothing commercial either, and it is fun enough I think to play around with, with some examples and a few more decent programming additions, for instance to save canvasses with entries (now they return without the entry field on reload, so they must be manually put in place again).

A few years back I could install the previous version with my tcl libs and picture database lib and more in under half an hour, and starting the server is as simple as a double click, which all togehter can be quite powerfull, and for all those cable modem owners, it can be quite fun to define one's own webserver with little graphs.