You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Massimo Manghi <ma...@biol.unipr.it> on 2006/04/07 18:59:04 UTC

globals

Hi, I have a problem trying to correctly understand the docs
in the section where the ::request::global is explained (Internals).

The question  (attempt to preserve functioning tcl scripts
when they are "cut'n'pasted" into rivet pages) is put in a
way that (seems to me) it warns the developer that "global" is meant
for persistence whereas the ::request::global command is for making
into Rivet traditional "global scope" variables.
(I don't see any other possible reason for bringing up the problem
in the documentation). Am I misunderstanding the whole stuff?
I wrote a sample script using  ::request::global, global, ::global in turn
trying to have persistence, but obtained only variables that are created
every time I reload the page.

<?
    global visits #or ::request::global visits or ::global visits

    set visits([clock seconds]) [env REMOTE_ADDR]
    foreach {t ip} [array get vists] {
       puts "-> $t $ip <br  />"
    }
?>

My comprehension of the docs is maybe unadequate, but
I suggest to reformulate the paragraph in a more schematic
form.

cheers.

 -- Massimo




---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: globals

Posted by Massimo Manghi <ma...@biol.unipr.it>.
Quoting "David N. Welton" <da...@dedasys.com>:

> > ok, I'm going to expose my vast ignorance in web programming: what
> > do you mean for 'request' in this context? Apache child processes
> > have no knowledge of concepts as 'session', so when the link
> > (and the 'request' context) between client and server's child
> > process is dropped?
>
> A request is one client to server round trip.  For example:
>
> GET /index.rvt HTTP/1.0
>
> That asks for just that one page, no pictures, nothing else - all that
> is fetched separately.
>
> This looks like an ok description, and has some promising links.
>
> http://en.wikipedia.org/wiki/HTTP
>
> In any case, that's correct, there is no state unless you create it
> artificially, by using the session package for instance.
>

thank you, the first part of your explanation made
it clear.

-- Massimo Manghi



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
----------------------------------------------------------------
Imp3 - Webmail del Dipartimento di Biologia Evolutiva e Funzionale

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: globals

Posted by "David N. Welton" <da...@dedasys.com>.
>>Persistent in the case of globals in Rivet means that, in one particular
>>child process, a variable will not be deleted between requests.  Since
>>it's tied to a system process and not a user, it's not useful for user
>>information.  On the other hand, it is useful for things like database
>>handles - you can define a proc to check if it exists, create it if it
>>doesn't, and return it in either case.

> ok, I'm going to expose my vast ignorance in web programming: what
> do you mean for 'request' in this context? Apache child processes
> have no knowledge of concepts as 'session', so when the link
> (and the 'request' context) between client and server's child
> process is dropped?

A request is one client to server round trip.  For example:

GET /index.rvt HTTP/1.0

That asks for just that one page, no pictures, nothing else - all that
is fetched separately.

This looks like an ok description, and has some promising links.

http://en.wikipedia.org/wiki/HTTP

In any case, that's correct, there is no state unless you create it
artificially, by using the session package for instance.

-- 
David N. Welton
- http://www.dedasys.com/davidw/

Linux, Open Source Consulting
- http://www.dedasys.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: globals

Posted by Massimo Manghi <ma...@biol.unipr.it>.
Quoting "David N. Welton" <da...@dedasys.com>:

> Massimo Manghi wrote:
> > Quoting "David N. Welton" <da...@dedasys.com>:
> >
> >
> >>Remember that they are persistent *within the particular instance of
> >>Apache* - and since Apache usually runs with several child processes,
> >>you can't count on something like a counter working reliably.
>
> Persistent in the case of globals in Rivet means that, in one particular
> child process, a variable will not be deleted between requests.  Since
> it's tied to a system process and not a user, it's not useful for user
> information.  On the other hand, it is useful for things like database
> handles - you can define a proc to check if it exists, create it if it
> doesn't, and return it in either case.
>

ok, I'm going to expose my vast ignorance in web programming: what
do you mean for 'request' in this context? Apache child processes
have no knowledge of concepts as 'session', so when the link
(and the 'request' context) between client and server's child
process is dropped?

ok...to many questions...sorry, but I'm growing eager to understand


>
> 'conversational'.  Colloquial is something else in english.
>

'false friends'

> > Something more 'brutal' but effective would be
> > a simple statement of the shift in the meaning of
> > the keyword in connection with the issue of
> > persistence. But what is 'persistence' in Rivet anyway?
>
> As described above - at least with regards to 'global'.
>
> Writing manuals for software you know intimately is often difficult,
> because it's hard to imagine what it's like to not know everything about
> it:-)
>

yes, this is related also the general problem of 'teaching'

-- Massimo Manghi



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
----------------------------------------------------------------
Imp3 - Webmail del Dipartimento di Biologia Evolutiva e Funzionale

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: globals

Posted by "David N. Welton" <da...@dedasys.com>.
Massimo Manghi wrote:
> Quoting "David N. Welton" <da...@dedasys.com>:
> 
> 
>>Remember that they are persistent *within the particular instance of
>>Apache* - and since Apache usually runs with several child processes,
>>you can't count on something like a counter working reliably.

> child processess? No shared memory that can be handled by a
> module? I don't know a bit about apache internals. How the
> word 'persistent' is meant for in this context?

Persistent in the case of globals in Rivet means that, in one particular
child process, a variable will not be deleted between requests.  Since
it's tied to a system process and not a user, it's not useful for user
information.  On the other hand, it is useful for things like database
handles - you can define a proc to check if it exists, create it if it
doesn't, and return it in either case.

>>><?
>>>   global visits #or ::request::global visits or ::global visits
>>>
>>>   set visits([clock seconds]) [env REMOTE_ADDR]
>>>   foreach {t ip} [array get vists] {
>>>      puts "-> $t $ip <br  />"
>>>   }
>>>?>
>>>
>>>My comprehension of the docs is maybe unadequate, but
>>>I suggest to reformulate the paragraph in a more schematic
>>>form.
>>
>>Such as...?  Want to have a try?:-)

> I think this paragraf is too convoluted. It is in
> a 'conversation style' (I don't have a dictionary
> at reach,  what is the english word for 'colloquiale'?)

'conversational'.  Colloquial is something else in english.

> but I had to read it twice in order to squeeze out
> the message (clearly I don't speak or understand
> english as a native speaker does)

> Something more 'brutal' but effective would be
> a simple statement of the shift in the meaning of
> the keyword in connection with the issue of
> persistence. But what is 'persistence' in Rivet anyway?

As described above - at least with regards to 'global'.

Writing manuals for software you know intimately is often difficult,
because it's hard to imagine what it's like to not know everything about
it:-)

-- 
David N. Welton
- http://www.dedasys.com/davidw/

Linux, Open Source Consulting
- http://www.dedasys.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: globals

Posted by Massimo Manghi <ma...@biol.unipr.it>.
Quoting "David N. Welton" <da...@dedasys.com>:

>
> Remember that they are persistent *within the particular instance of
> Apache* - and since Apache usually runs with several child processes,
> you can't count on something like a counter working reliably.
>

child processess? No shared memory that can be handled by a
module? I don't know a bit about apache internals. How the
word 'persistent' is meant for in this context?

> > <?
> >    global visits #or ::request::global visits or ::global visits
> >
> >    set visits([clock seconds]) [env REMOTE_ADDR]
> >    foreach {t ip} [array get vists] {
> >       puts "-> $t $ip <br  />"
> >    }
> > ?>
> >
> > My comprehension of the docs is maybe unadequate, but
> > I suggest to reformulate the paragraph in a more schematic
> > form.
>
> Such as...?  Want to have a try?:-)
>

I think this paragraf is too convoluted. It is in
a 'conversation style' (I don't have a dictionary
at reach,  what is the english word for 'colloquiale'?)
but I had to read it twice in order to squeeze out
the message (clearly I don't speak or understand
english as a native speaker does)

Something more 'brutal' but effective would be
a simple statement of the shift in the meaning of
the keyword in connection with the issue of
persistence. But what is 'persistence' in Rivet anyway?

-- Massimo Manghi



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
----------------------------------------------------------------
Imp3 - Webmail del Dipartimento di Biologia Evolutiva e Funzionale

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: globals

Posted by "David N. Welton" <da...@dedasys.com>.
Massimo Manghi wrote:
> Hi, I have a problem trying to correctly understand the docs
> in the section where the ::request::global is explained (Internals).

> The question  (attempt to preserve functioning tcl scripts
> when they are "cut'n'pasted" into rivet pages) is put in a
> way that (seems to me) it warns the developer that "global" is meant
> for persistence whereas the ::request::global command is for making
> into Rivet traditional "global scope" variables.
> (I don't see any other possible reason for bringing up the problem
> in the documentation). Am I misunderstanding the whole stuff?
> I wrote a sample script using  ::request::global, global, ::global in turn
> trying to have persistence, but obtained only variables that are created
> every time I reload the page.

Remember that they are persistent *within the particular instance of
Apache* - and since Apache usually runs with several child processes,
you can't count on something like a counter working reliably.

> <?
>    global visits #or ::request::global visits or ::global visits
> 
>    set visits([clock seconds]) [env REMOTE_ADDR]
>    foreach {t ip} [array get vists] {
>       puts "-> $t $ip <br  />"
>    }
> ?>
> 
> My comprehension of the docs is maybe unadequate, but
> I suggest to reformulate the paragraph in a more schematic
> form.

Such as...?  Want to have a try?:-)

-- 
David N. Welton
- http://www.dedasys.com/davidw/

Linux, Open Source Consulting
- http://www.dedasys.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org