go stack not working

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mikelpapamike
Posts: 32
Joined: Sat Feb 27, 2021 12:17 am

go stack not working

Post by mikelpapamike » Tue Mar 02, 2021 4:34 pm

Hi everybody,

Today I installed livecode server on a local Apache instance and managed to deploy the hello world app.

But then when I tried to run this simple code inside the <?lc tag :

Code: Select all

go stack "127001/testinglc/test
the page loads for about a minute and then nothing happens, I just see the Title being displayed.

my test lc file is

Code: Select all

<html>

<head>
   	<title>My LiveCode Server Test Page</title>
</head>
<body>
  	 <h1>My LiveCode Server Test Page</h1>
<?lc

  	go Stack  "path-to-my-server/testinglc/test-stack"
?>
</body>
</html>

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: go stack not working

Post by FourthWorld » Tue Mar 02, 2021 4:55 pm

What can a browser do with a file format it doesn't understand?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

rabit
Posts: 40
Joined: Wed May 31, 2006 8:30 am

Re: go stack not working

Post by rabit » Wed Mar 03, 2021 5:34 pm

In addition to what Richard said, you should try "start using stack".
Seems that "go stack" is unfortunately still not working properly in
the server environment.
-- Ralf Bitter

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: go stack not working

Post by FourthWorld » Wed Mar 03, 2021 7:13 pm

What is your goal? Do you want to execute code on the server that is in the stack you want to "go" to, or are you looking for a way to render the stack in the client browser window?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mikelpapamike
Posts: 32
Joined: Sat Feb 27, 2021 12:17 am

Re: go stack not working

Post by mikelpapamike » Thu Mar 04, 2021 12:01 am

FourthWorld wrote:
Tue Mar 02, 2021 4:55 pm
What can a browser do with a file format it doesn't understand?
This code is in server's documentaion .

And what I'm trying to achieve yes, is trying to load a stack inside the browser. If this is not the correct way, what is then the use of code "go stack" on LC server?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: go stack not working

Post by FourthWorld » Thu Mar 04, 2021 12:24 am

mikelpapamike wrote:
Thu Mar 04, 2021 12:01 am
FourthWorld wrote:
Tue Mar 02, 2021 4:55 pm
What can a browser do with a file format it doesn't understand?
This code is in server's documentaion .
Thank you. There's a lot of server documentation. If that's a literal example I'd like to fix it. May I ask which document that's in?
And what I'm trying to achieve yes, is trying to load a stack inside the browser. If this is not the correct way, what is then the use of code "go stack" on LC server?
LC Server is a server-side CGI used to provide additional scripting capabilities to Apache and other CGI-compatible server software.

As a server technology, "go" by itself has no functional purpose, since the go command is used to navigate among stacks and cards, and there's no one on the server to see such changes.

It may be that the full example brings certain code contained in the stack into a context where it can be called conveniently. That's just a guess. When I learn where the example of from I'll be able to better understand what it's doing.

As for your goal, that's not so easy. All browsers do support scripting, but in only one language, JavaScript. None of them understand LiveCode, or its file format, so they can neither render a stack nor execute any LiveCode scripts.

There are several solutions for delivering content made with LiveCode over the web, but none quite so simple as sending a stack to a browser.

To know which may be best for your needs, can you tell us a bit about the stack you're working with, and what led you to pursuing browser deployment?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mikelpapamike
Posts: 32
Joined: Sat Feb 27, 2021 12:17 am

Re: go stack not working

Post by mikelpapamike » Thu Mar 04, 2021 11:39 pm

Hello FourthWorld

Thanks for being s detailed on your explanation.

As i can not post the link from Livecode Lessons, I post the rest of the path. See on this link.

/m/4070/l/36656-How-do-I-use-stacks-with-LiveCode-Server-

One reason that I thought would be usefull to distribute stacks this way, is that I need a lot of users to have access to a program that I make changes very often during a week or even a day, and would be very usefull in order to all of them have always the update. Another reason is that I dont want to distribute the whole stack file for security reasons.(I know there is the option to password protect but...). Also If I make a SPLASH standalone app that loads a stack from a webserver, then I didnt manage to save the stack back after the user makes changes.

But generally was somehow a test, because I found the above lesson,and sounded quite handy to me. Sorry if I missunderstood the writings in it.

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: go stack not working

Post by liveme » Fri Mar 05, 2021 6:07 am

Hello Mikel,

1 -
is that I need a lot of users to have access to a program that I make changes very often during a week or even a day, and would be very usefull in order to all of them have always the update
2 -
to save the stack back after the user makes changes.
hmmm.....If what you want is to easely share some updated info with bunch of users...
+
give some user a way to update some of that info.
But not share that publicly on a webpage...
.
1 - You are most likely asking for a database set up where registered users with private access can read that info.

You COULDl share an auto generated "secret page link" to your "secret visitors pages" but then your link could possibly be shared from whoever receives it, unless you code a 1 time opening and destroy after that... weird, but doable ! :P

2 - beside if you also want some users to be editors, than they would need to be registered editors for that so you keep control of your content.

roughly : what you are asking for is a Blog...or a Chat App read room/Editor Room :
Telegram offers all that for a 250.000 users room so it could be your out of the box solution

else ...there is no safe way to control your info unless you create an App or a Website with Login+PW system.
LC can help you achieve all that but this involves some work... :wink:
:idea: :idea: :idea:

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: go stack not working

Post by FourthWorld » Fri Mar 05, 2021 8:45 pm

mikelpapamike wrote:
Thu Mar 04, 2021 11:39 pm
Hello FourthWorld

Thanks for being s detailed on your explanation.
...
See on this link.
How do I use stacks with LiveCode Server?
Thanks for that (I updated the link here so it can be read easily).

That discussion is as I suspected (a good thing, one less documentation element that needs updating <g>), about bringing a stack's script into the execution context on the server. It makes no attempt to deliver it to the browser, simply part of a larger discussion of options for using stacks as script containers on the server.
One reason that I thought would be usefull to distribute stacks this way, is that I need a lot of users to have access to a program that I make changes very often during a week or even a day, and would be very usefull in order to all of them have always the update.
HTML export in LC is challenged, for reasons far too complicated to get into here. If we instead focus on your goal, your option of using a standalone to download it from a web server is by far the best for both you and your users. Bonus points that it's also the simplest.
Another reason is that I dont want to distribute the whole stack file for security reasons.(I know there is the option to password protect but...)
What are those security concerns?

If you had been successful in delivering a copy of your stack to the browser, like anything else in the browser the user would have a copy of it and could save it, examine it, etc.

Let's take a look at what you need to protect and we can find a good way to handle that.
Also If I make a SPLASH standalone app that loads a stack from a webserver, then I didnt manage to save the stack back after the user makes changes.
The good news is that you don't actually want to do that. :) After all, if someone using a web browser can alter the contents of a file on your server, anyone with a web browser could do so, including the bad guys (the Internet is full of 'em).

liveme touched on that in his reply above. Good thoughts there. Let's learn more about what you want to save back to the server, and we can find a good way to make that happen safely and securely for both your user's data and your server resources.
But generally was somehow a test, because I found the above lesson,and sounded quite handy to me. Sorry if I missunderstood the writings in it.
No worries. In fact, the distinction between client and server is not clear to many in our community. Questions like yours come up all the time. I've been discussing the possibility of co-authoring a short ebook on the topic of getting oriented to LC client-server work, and if that moves forward questions like yours are very valuable in guiding our table of contents.

Please never feel shy about asking anything here. Over the years I've seen that for every question asked, there's at least 20 others with the same question who didn't post it. Every question here helps others.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “CGIs and the Server”