LC Server & Server Based Stack?

Mike Bonner bonnmike at gmail.com
Fri Jan 20 22:20:02 EST 2017


You can modify a stack using lc server, and save it, but that won't update
an already open stack in memory.  And if you don't add code to save the
stack from lc server, even if you do reload the stack, the change won't be
there.

One way to update a field in an open stack would be to have the stack
running a send in time loop that checks for changes to a file. (text file,
or whatever)  If the last modified stamp has changed (or if the file
exists, or however you want to do it)  read and parse the file, to get the
info and put it wherever it goes then clear or delete the file.  You'd
still have to think about concurrency issues, but it should work.
the jacque standalone cgi method (as I mentioned in a different email)
would be cool because you could hit the webserver, open a socket to your
open stack to pass data from the server to the running stack.

On Fri, Jan 20, 2017 at 8:06 PM, Rick Harrison via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Hi Mike,
>
> Sorry I was out for dinner..
>
> > How do you know it didn't work?
>
>
> I know it didn’t work because I looked at the stack and no changes
> had occurred in the stack.  (As in nothing new was put into the field.)
> I’m not looking for the change to occur in the browser, that’s not
> where I’m expecting to find any change thus far.
>
> Should I not have the stack open that I’m trying to send the
> messages to?  Should it be a standalone that gets saved
> after every change?
>
> > Mind if I ask what you're looking to accomplish?
>
>
> I’m just trying to explore various possibilities and directions
> project-wise.
> I don’t have a definite plan at the moment.  I’m just trying to see what
> capabilities exist in using the server to communicate with stacks.
>
> Thanks,
>
> Rick
>
> > On Jan 20, 2017, at 7:27 PM, Mike Bonner via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> >
> > How do you know it didn't work?
> > Well ok.. first.. On the server you have to make sure that the stack you
> > are on is the one you think you're on.
> > If you put the name of "this stack" you can see where you are when it
> > happens.
> > Second, the server first loads the stack.  Then if you "put" something
> into
> > the field of the stack (especially if you are explicit so that you know
> > exactly WHAT stack and field you're putting it into,) it most likely does
> > it, but you wouldn't be able to see it in the browser, because you aren't
> > looking at the stack.  So you'd have to check the stack itself (while the
> > lc script is running, if you put something into a field, and then
> > immediately  "put the text of field blah blah blah" so that it grabs the
> > text and puts it onto the web page, you can see that it is indeed there.
> > Since each hit to the web server is a new instance, the next time you hit
> > the page, the text would not be in that field, UNLESS you told the lc
> > script to save the stack.
> >
> > This is how I created the test stack I'm using.  I had the lc script
> create
> > the stack, set the script of the stack, set the filename of the stack,
> then
> > saved the stack.  IF I had also created and populated fields in the stack
> > and then saved it, the fields would still be populated and the text could
> > then be extracted from them.  (It would get much more complex with
> multiple
> > users of course, due to concurrency poblems)
> >
> > Mind if I ask what you're looking to accomplish?
> >
> > On Fri, Jan 20, 2017 at 5:00 PM, Rick Harrison via use-livecode <
> > use-livecode at lists.runrev.com> wrote:
> >
> >> Hi Mike,
> >>
> >> Ok, the put message in the stack showed up in my browser
> >> so that worked fine.  My next line of code I tried was:
> >>
> >> put "I hope this worked!" into field "TestFirstNameField1" of card 1 of
> >> this stack
> >>
> >> It didn’t put anything into that field.  I also put the same code into a
> >> button
> >> on the stack to test it, and the button works fine with the same code.
> >> Why doesn’t this work?
> >>
> >> Thanks,
> >>
> >> Rick
> >> _______________________________________________
> >> use-livecode mailing list
> >> use-livecode at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list