When is a stack "really" loaded?

Phil Davis revdev at pdslabs.net
Mon Mar 24 13:45:31 EDT 2008


Hi Len,
Here are some things I've learned. Hopefully they apply in some measure 
to what you're doing:

- getting a custom property of a stack will indeed load it. I use "get 
the fakeProperty of stack x" frequently for that need, where "x" 
contains a stack filename. I haven't tried it with a URL.

- if you want to replace an in-memory stack with a newer version that's 
on a server, one simple and reliable way to do it is download the server 
stackfile under a temp name, then (if the download was successful) 
rename the temp file to the filename of the one you want to replace, 
then use Rev's "revert" command to replace the in-memory copy with the 
downloaded one. Notice that this approach does not load the server stack 
into memory until "revert".

Also see below.


Len Morgan wrote:
> I'm trying to go through a list of stack files (whos' names and 
> versions come from a text file on the update server) to see if they 
> need to be updated.  If there is a newer version, I copy the file from 
> the update server to the local computer.  I'm using:
>
> put the cstkVersion of stack tCurrentStack into tLocalStackVersion

This should work fine as long as "tCurrentStack" contains a stack filename.
>
> That command is the first time I reference any of the stack files as 
> the program starts up.  My understanding is that by reference a custom 
> property in the local stack, it is "loaded."  These stacks do NOT 
> however show up in the Application Browser.

Was the App Browser already open when you got the stack's 
customProperty? The App Browser usually refreshes when stacks are opened 
(as in "go to" or "toplevel") but I'm not sure about loaded stacks. You 
might have to close it and reopen it to see new stacks in memory.
>
> Since  (I assume) the stack get loaded, I set a flag if any of the 
> stacks are copied (updated) from the server and then require the user 
> to restart the program.  The second time, since all of the local file 
> versions should now much the server version, it goes through the same 
> process but since no stacks are updated this time, the program 
> continues to run "normally."
>
> So my question is: Does the stack really get loaded?  If so, can it be 
> unloaded and reloaded so that the new version will be used instead?  I 
> understand that if the version of the startup stack changes (called by 
> StackRunner), I'll have to restart, but that stack is rarely changed.
>
> Would I be better off just copying the files from the server every 
> time the user starts up the program whether they are changed or not?  
> Can I use a URL stack file name instead of a local one?  Since I'm not 
> explicitly loading the stacks, I'm not sure if the checking of the 
> custom property has the same effect as "start using...." or "go stack 
> ..."  One can be used with a URL, the other can't.
>
> Thanks!!
>
> len morgan

Hope this helps.
-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net




More information about the use-livecode mailing list