Re: [AOLSERVER] ns_atstartup?
On Sunday 16 March 2003 05:33, you wrote: On 2003.03.14, Zoran Vasiljevic [EMAIL PROTECTED] wrote: So, I've extended the command set with the ns_atstartup command. This registers scripts to be executed immediately before server is going into operation and just after the last initialization script was finished. How does this differ from putting a script in your tcl library named zzz_execute_this_last.tcl ... since scripts get processed in alphabetical order by filename? At that point in the server's life aer it's evaluated all its initialization but before it goes into normal operation, are there elements of the server available to you that aren't available during the actual initialization phase? What are those elements? Simple. The problem is inter-dependency of the code within scripts executed from shared/private library and the order how they are executed. It is quite difficult, and in some circumstances impossible to desing the order of the execution to fit the alphabetical order. The problem gets even more complex when you're making changes to an existing installation (i.e adding and/ot removing files) and have intermixed shared/private setup of tcl loaders. Sometimes you can't just put everyting in the .tcl script because you want to keep things nicely modularized. Sometimes you have to put the code in the file A.tcl which needs proc definitions from B.tcl and you can't just rely on the file naming to keep the right order. Things start to be very interesting when you start to use some OO-like systems. We're using XOTcl and 98% of our app is written like that. So, we must really make sure all those classes are loaded *before* we can start to use them. So, althouth it may seem at the first spot that this is doable with simple naming convention, you pretty soon find out that it is just not flexible enough. The real solution would be a FIFO queue where you can post scripts to run, after loading all proc definitions, modules, etc. The server will just run those scripts one after another and at the end enter the normal state. Now, on the C-level, there are API provisions for that. They are just not opened on the Tcl-level. Cheers, Zoran -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ns_cache and virtual hosting ...
On Saturday 15 March 2003 19:28, you wrote: Zoran Vasiljevic wrote: On Saturday 15 March 2003 18:45, you wrote: Agree. I have skipped thru code and, apart from some typecasts, I see no problems. Hmmm ... I added a bunch of typecasts to avoid warnings at compile time, are you saying you had to add more or that you've taken some out? Most were to cast int to size_t - the code uses size information as a signed integer in some places (-1 as a flag) so simply changing the offending vars to size_t caused new warnings to pop up. I just had to add a couple. The warnings I was getting rid of had nothing to do with the functionality I added, I just dislike our having code that generates warnings and took the opportunity to clean it up while I was working on it. Oh yes. This is what I usually do when looking at the code after some time. Here/there I just define -Wall and quite often I'm surprised with what sneaked into :-) I would probably take the approach of adding a new command to ns_cache, using servPtr == NULL as a flag seems a bit of a kludge. Most of the code works on a cache pointer with no other context information, implementing a true global cache will just involve adding a new proc to use a static tcl hashtable to map the name to a cache pointer. You initializing that hashtable and an associated static lock the first time the module is loaded, and only the first time ... I see. Well, this is quite simple as well. I'll look into it and try to get it in the Tcl API as transparent as possible. Cheers, Zoran -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ns_cache and virtual hosting ...
On Sunday 16 March 2003 10:07, you wrote: I would probably take the approach of adding a new command to ns_cache, using servPtr == NULL as a flag seems a bit of a kludge. Most of the code works on a cache pointer with no other context information, Don, Instead of adding new cmd, I changed the API (backward-compatible) to read: ns_cache create name ?-size size? ?-timeout timeout? ?-thread boolean | -common boolean? So, now we have per-thread, per-virtual-server and common caches. The per-virtual-server is the most commonly used type, therefore it needs no extra options. Others are less important, thus need extra option (-thread or -common) Note that -thread and -common are mutualy exclusive. The name of the new option -common is the best what came to my mind. If somebody has a better idea, please step out. Cache name resolving is done by first looking into the per-virtual-server caches and if none found, into common caches. I will commit this into SF tomorrow, after checking it with Purify just to be sure. I'll tag it with the 1.5 version since it should also be usable (albeit not necessary) for 3.x servers. Cheers, Zoran -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ns_cache and virtual hosting ...
On Sun, Mar 16, 2003 at 02:33:53PM +0100, Zoran Vasiljevic wrote: ns_cache create name ?-size size? ?-timeout timeout? ?-thread boolean | -common boolean? The name of the new option -common is the best what came to my -serverwide? -global? -- Andrew Piskorski [EMAIL PROTECTED] http://www.piskorski.com -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ns_cache and virtual hosting ...
On Sunday 16 March 2003 15:18, Andrew Piskorski wrote: On Sun, Mar 16, 2003 at 02:33:53PM +0100, Zoran Vasiljevic wrote: ns_cache create name ?-size size? ?-timeout timeout? ?-thread boolean | -common boolean? The name of the new option -common is the best what came to my -serverwide? -global? -serverwide it is. Thanks, Zoran -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ADP: are if's possible?
In a message dated 3/15/2003 5:42:15 PM Eastern Standard Time, [EMAIL PROTECTED] writes: This is a legal liability for me as my web page may display without important information in the case of a coding error. In my case it is much better to display an error than to display what appears to be a complete page. Interesting - this is a good reason for ADP to work similar to ASP as you suggest. At AOL, we generally take the opposite view, that small components (an ad, small widget, etc.) could fail but we should continue to try to display the rest of the contents. Perhaps the ADP parser should be configurable to support these three modes: 1. Current simple script block isolated mode. 2. Connected script blocks via use of the Tcl_CommandComplete checks (Rob's idea) 3. Full compile into a single script in the style of ASP. -Jim -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ADP: are if's possible?
+-- On Mar 16, Jim Davidson said: 1. Current simple script block isolated mode. 2. Connected script blocks via use of the Tcl_CommandComplete checks (Rob's idea) 3. Full compile into a single script in the style of ASP. It's easy to do #3 using #2 on a per-page basis. Just put % if 1 { % at the top of the page and } % at the bottom. But a mode would be useful if you want to do it for all ADPs. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ADP: are if's possible?
This is a legal liability for me as my web page may display without important information in the case of a coding error. In my case it is much better to display an error than to display what appears to be a complete page. IANAL, but I wouldn't rely on a program to generate a legal document. Maybe a disclaimer somewhere written in plain ol' HTML would be a better solution. If you really want a page that breaks on a coding error, look at OpenACS's templating system, each 'adp' is actually compiled into a tcl script and executed. Also, isn't there an option in the adp parser to show errors or not? If you show the error, the adp wouldn't get displayed half baked. --Tom Jackson -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
[AOLSERVER] Emacs and ADP -- a solution
Greetings. I use emacs for all text editing and I was running into a problem with editing ADP's. With html-helper-mode I can do things like narrow down to a JavaScript block and edit JavaScript with a JavaScript mode (syntax highlighting, language helpers, automatic indenting, etc...). I wished to have the same thing for editing Tcl blocks in my .adp's % ... %. I made a few additions to the mode and it's now the perfect solution (I think). I have pretty HTML, HTML helpers, etc... Then when I'm in a % ... % block, I hit F10 and instantly I am in the emacs TCL mode with that block now the screen. I have all the benefits of the TCL mode, but inside of the ADP file. When I'm done, I hit F11 and it takes me back to the full file, and back into the pretty HTML editing mode. I have created a page on my wiki for more information, what you have to do, how to use it, etc... If you use emacs and do not already have a solution like this, you may want to take a peek: http://cowgar.com/wiki.adp?pagename=Programming%20AOL%20Server It would be interesting to see how many people would use this. If their is enough, maybe the authors of HTML-helper-mode will add this code into their distribution so that HTML-helper-mode would be able to edit ADP pages out of the box. Thanks, Jeremy -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ns_atstartup?
We ran into this problem a while back. The way we ended up solving was to create a policy where all initialization code was moved into an init proc. The init procs were named init.module. So for example: /tcl/mapquest/ public.tcl private.tcl init.tcl ... # init.tcl proc mapquest.init {} { nsv_set foo bar dork } We then changed the way Tcl code was sourced so that after all files were sourced in the usual way, all of the init.* functions would be called: foreach cmd [lsort [info commands *.init]] { ns_log notice loading $cmd... if [catch {set t [time {eval $cmd} 1]} err] { ns_log error $err } else { set t [expr [lindex $t 0]/100] if {$t 2} { ns_log warning $cmd took $t seconds to load } } } A similar approach might help. - Nathan On Sunday, March 16, 2003, at 03:30 AM, Zoran Vasiljevic wrote: Simple. The problem is inter-dependency of the code within scripts executed from shared/private library and the order how they are executed. It is quite difficult, and in some circumstances impossible to desing the order of the execution to fit the alphabetical order. The problem gets even more complex when you're making changes to an existing installation (i.e adding and/ot removing files) and have intermixed shared/private setup of tcl loaders. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ns_cache and virtual hosting ...
On Sunday 16 March 2003 16:14, you wrote: Yes, it will be simple, if it weren't for the fact that the OpenACS project's taking 100% of my time at the moment I would be more than glad to finish up this last remaining piece. Well, relax ;) The work is done, at least on the ns_cache. It is in the SF and I've made the 1.5 version in the Files section. The new option is set to -serverwide boolean if you ever need it. Cheers, Zoran -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ADP: are if's possible?
Tom Jackson wrote: IANAL, but I wouldn't rely on a program to generate a legal document. Maybe a disclaimer somewhere written in plain ol' HTML would be a better solution. If you really want a page that breaks on a coding error, look at OpenACS's templating system, each 'adp' is actually compiled into a tcl script and executed. Someone's working on making the templating system and the OpenACS database API available as standalone libraries that will work directly with AOLserver. Not sure when this will be finished ... -- Don Baccus Portland, OR http://donb.photo.net, http://birdnotes.net, http://openacs.org -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ns_cache and virtual hosting ...
Zoran Vasiljevic wrote: On Saturday 15 March 2003 19:28, you wrote: Hmmm ... I added a bunch of typecasts to avoid warnings at compile time, are you saying you had to add more or that you've taken some out? Most were to cast int to size_t - the code uses size information as a signed integer in some places (-1 as a flag) so simply changing the offending vars to size_t caused new warnings to pop up. I just had to add a couple. OK ... it had compiled clean here but then again the version of gcc I was using was relatively ancient, I haven't updated my laptop in the three years I've had it. I would probably take the approach of adding a new command to ns_cache, using servPtr == NULL as a flag seems a bit of a kludge. Most of the code works on a cache pointer with no other context information, implementing a true global cache will just involve adding a new proc to use a static tcl hashtable to map the name to a cache pointer. You initializing that hashtable and an associated static lock the first time the module is loaded, and only the first time ... I see. Well, this is quite simple as well. I'll look into it and try to get it in the Tcl API as transparent as possible. Yes, it will be simple, if it weren't for the fact that the OpenACS project's taking 100% of my time at the moment I would be more than glad to finish up this last remaining piece. -- Don Baccus Portland, OR http://donb.photo.net, http://birdnotes.net, http://openacs.org -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ns_cache and virtual hosting ...
Zoran Vasiljevic wrote: On Sunday 16 March 2003 15:18, Andrew Piskorski wrote: On Sun, Mar 16, 2003 at 02:33:53PM +0100, Zoran Vasiljevic wrote: ns_cache create name ?-size size? ?-timeout timeout? ?-thread boolean | -common boolean? The name of the new option -common is the best what came to my -serverwide? -global? -serverwide it is. I agree. -global would be confusing because of the existing terminology in the code and documentation. -- Don Baccus Portland, OR http://donb.photo.net, http://birdnotes.net, http://openacs.org -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/
Re: [AOLSERVER] ns_cache and virtual hosting ...
Zoran Vasiljevic wrote: On Sunday 16 March 2003 16:14, you wrote: Yes, it will be simple, if it weren't for the fact that the OpenACS project's taking 100% of my time at the moment I would be more than glad to finish up this last remaining piece. Well, relax ;) The work is done, at least on the ns_cache. It is in the SF and I've made the 1.5 version in the Files section. The new option is set to -serverwide boolean if you ever need it. Thanks, Zoran! -- Don Baccus Portland, OR http://donb.photo.net, http://birdnotes.net, http://openacs.org -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list: http://www.aolserver.com/listserv.html List information and options: http://listserv.aol.com/