Re: [AOLSERVER] How to determine adp that does inclusion
ns_adp_argv 0 tells you the *callee*. In the below example, ns_adp_argv 0 would always return "foo.adp". In the code example, "index" and "processing" would be in ns_adp_argv 1. -- michael In a message dated 1/28/2004 12:26:07 PM Eastern Standard Time, [EMAIL PROTECTED] writes: simple way is to use the ns_adp_argv's...index.adp:...ns_adp_include foo.adp "index"...processing.adp:...ns_adp_include foo.adp "processing"...foo.adp...set caller [ns_adp_argv 0]switch -exact $caller { index { # do something } processing { # do something else } default { # page might have been called by browser or other file }}let me know if that works for ya...Mike _michael richman princ software engineeraol technologies610.668.6569 -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] How to determine adp that does inclusion
In a message dated 1/28/2004 12:18:07 PM Eastern Standard Time, [EMAIL PROTECTED] writes: I think I asked this wrong.I am not concerned w/ processing foo.adp 2x. I need to do that.What I am looking for is for foo.adp to know that index.adp or processing.adp included it, so I can alter the code in foo.adp based on what page includes it. so you're saying that index.adp includes foo.adpprocessing.adp includes foo.adp and you want foo to know who included it lindex[ns_conn urlv] end will work with one major caveat: If foo.adp includes another .adp, that subsequent .adp cannot get "foo.adp" in the same manner. -- michael _michael richman princ software engineeraol technologies610.668.6569 -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] more on special characters: smart quotes
This is one particular implementation (a little different than what you're asking for, but could be modified to catch things you need to catch). This method replaces chars in question with the HTML equivalent, as Carson's mail mentions, which may or may not be what you're wishing to do: proc replaceSpecialChars {oldStr newStrVar} { upvar $newStrVar newStr set newStr "" set nrepl 0 set strlen [string length $oldStr] for {set i 0} {$i $strlen} {incr i} { set char [string index $oldStr $i] scan $char %c c if {$c 127} { append newStr "#$c;" incr nrepl } else { append newStr $char } } return $nrepl} This could get slow if you're dealing with large strings, but it could be written in C for optimization if need be. -- michael In a message dated 10/17/2003 3:57:34 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: I have solved this problem on quite a few CMS implementations in bothVignette and AOLServer using regsub's. I suggest replacing them with theHTML equivilant rather than with replacement ascii, but that's more amatter of opinion. The translation method is the best route, but sometimesa lot of processing. Regsub is fine if you're willing to accept the factthat occassionaly a special char you haven't identified yet (like verticalTAB!) might slip in. So, I was a little unclear on the problem my coworker was facing- apologies for sort of repeating myself. We've built a CMS allowing editors to paste in stories, and we're having problems with them pasting in smart quotes- primarily, that apparently smart quotes aren't within the unicode set and are proprietary to Msoft. We're looking for an efficient way to substitute smart quotes for regular quotes. Has anyone dealt with this (pesky/annoying) problem before? Thanks a ton, Scott P.S. If you're unclear what a smart quote is, open up Msoft Word and type {blah "blah"} and note that one is a "left quote" and the other is a "right quote"... -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank. __michael richman princ software engineeraol web svcs publishing -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Bug: namespaces and ns_eval
In a message dated 3/24/2003 2:39:21 PM Central Standard Time, [EMAIL PROTECTED] writes: 1. start 2 nscp sessions, and load above code snippet into 1 of them with "ns_eval source ..." command 2. in 2nd session, run command "info command mytest::*". It is expected to return mytest::mytest, but returns nothing. This is wrong. 3. start 3rd nscp session and run command "info command mytest::*". This time return is correct. Actually, what is happening here is that what you're describing as "2nd session" is a running thread at the time of the ns_eval of the first. It won't get your update until it exits. The same would be true of any code you ns_eval-ed there. -- michael __ michael richman princ software engineer aol infrastructure dev 214.442.6048 -- 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_mutex is likely causing our AOL web server to hung
In a message dated 1/27/2003 10:43:28 AM Central Standard Time, [EMAIL PROTECTED] writes: foreach i_index [array names counter_A] { set temp_counter_A($i_index) $conter_A($i_index) set temp_counter_B($i_index) $conter_B($i_index) unset $conter_A($i_index) unset $conter_B($i_index) } Is the above the actual snippet from the code? If so, my guess is the typos ($conter_A, $conter_B instead of $counter_A $counter_B) are throwing errors and the mutex is not getting freed, causing deadlocking in your app. Removing the ns_mutex lines from the code wouldn't fix the errors, but the deadlocks would not occur. Are there any errors in your server log during the times the proc_doc Y runs? I'm guessing the code above is not the actual code, but in addition to Rich's comment, your "unset" lines should not have var substitution ($), but rather should just be the varname itself: unset conter_A($i_index) unset conter_B($i_index) ^-- should be no "$" -- michael __________ michael richman princ software engineer aol infrastructure dev 214.442.6048
Re: [AOLSERVER] Multiple Domains with one IP
In a message dated 1/3/2003 1:05:34 PM Central Standard Time, [EMAIL PROTECTED] writes: #ns_section ns/modules #ns_section nssock nssock.so The second line of this sample config snippet should read ns_param nssock nssock.so __ michael richman princ software engineer aol infrastructure dev 214.442.6048
Re: [AOLSERVER] AOLserver Core Team (ACT) Nominees
I was wondering who would be the first to send their vote to the listserv. Careful, folks! :) -- michael _ michael richman princ software engineer aol technologies 214.442.6048
Re: [AOLSERVER] [Newbie] Using two psql databases
Hello, Your problem is that your second pool appears WITHIN the ns_section that preceeds it. you need to add a second ns_section ns/db/pools right BEFORE ns_param osu OSU db Alternatively, you could move ns_param osu OSU db to follow your first (and only) ns_section ns/db/pools hope that helps, michael In a message dated 1/17/02 2:18:13 PM Central Standard Time, [EMAIL PROTECTED] writes: On my Debian 2.2 (potato) system, I'm running Aolserver 3.2-5 und Postgresql 7.1r3. My default database mir::germdb is accessible, my alternate database mir::osu is not. Here's the relevant part [least I think it's the relevant part :)] of my configuration: ## # # Database Pools # ns_section ns/db/pools ns_param main The main database pool ns_section ns/db/pool/main ns_param Driver postgres ns_param Connections 4 ns_param MaxOpen 10 ns_param MaxIdle 10 ns_param DataSource mir::germdb ns_param User aolserver ns_param connections 1 ns_param maxidle 600 ns_param maxopen 3600 ns_param passwordx ns_param verbose false ns_param logsqlerrorsfalse ns_param extendedtableinfo true ns_param osu OSU db ns_section ns/db/pool/osu ns_param Driver postgres ns_param Connections 4 ns_param MaxOpen 10 ns_param MaxIdle 10 ns_param DataSource mir::osu ns_param User aolserver ns_param connections 1 ns_param maxidle 600 ns_param maxopen 3600 ns_param passwordx ns_param verbose false ns_param logsqlerrorsfalse ns_param extendedtableinfo true ns_section ns/server/${server}/db ns_param Pools * ns_param DefaultPool main So I should be able to connect to database osu, right? set db [ns_db gethandle] ns_adp_puts [ns_db datasource $db] ns_adp_puts [ns_db poolname $db] returns mir::germdb main. I've tried ns_db release_handle set db [ns_db gethandle osu] ns_adp_puts [ns_db datasource $db] which results in: [17/Jan/2002:20:44:13][11272.652293][-conn632-] Error: no access to pool: osu no access to pool: osu while executing ns_db gethandle osu and error messages about $db not being a variable. Can somebody please help me here, I'm stuck. Many thanks in advance. ___ michael richman sr. software engineer aol technologies - local 214.442.6402
Re: [AOLSERVER] Calling Tcl functions from C.
In a message dated 8/30/01 12:00:42 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: If I've got a detached thread running some C code, how might I go about executing a Tcl procedure. Ns_TclEval looks like what I'm looking for, but it needs a server connection (as far as I can tell from the documentation). If anyone has done this before, or could give me some pointers/examples it'd be much appreciated. You could use Tcl_Eval. If you have a detached thread, then you have a Tcl interpreter (the one calling the C). You could pass that interp pointer to Tcl_Eval as shown below. NOTE: completely untested code (that has no error checking): MyTclCmd(ClientData unused, Tcl_Interp * interp, int argc, char **argv) { Tcl_DString tclscript; /* assuming in this example that argv[1] is the tcl script */ Tcl_DStringInit(tclscript); Tcl_DStringAppend(tclscript, argv[1], strlen(argv[1])); if (Tcl_Eval(interp, tclscript.string) != TCL_OK) { /* handle the error */ Ns_TclLogError(interp); } else { /* handle result, if wanted, which is in interp-result */ ... } Tcl_DStringFree(tclscript); } -- michael ___ michael richman sr. software engineer aol technologies - local 214.954.6204
Re: [AOLSERVER] Error Handling
In a message dated 8/22/01 2:55:07 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: Is there any way in AOLServer to register an exception handler? What I would like to avoid is going over all the pages in my site and adding a catch statement so that if an exception is thrown, either through the tcl interpreter or or a postgresql query or action, I could catch it with a proc or page. You could also simply put a catch in your startpage around the include. % if {[catch { ns_adp_include [ns_url2file [ns_conn url]] } err]} { ns_adp_puts An error occurred: $err # or whatever else you wanna do with the error } % -- michael ___ michael richman sr. software engineer aol local technology 214.954.6204