Page 1 of 1
Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 1:22 am
by n9yty
I am seeing something strange, I can only assume that something has gotten screwed up in my stack. I was hoping to export to XML and re-import, I saw some reference to tools to do this, but they aren't available yet from what I can tell.
The stack I have been working on is to allow access to content on a web site without the user having to use a web browser, and also to alter the representation and organization of the content.
It works in LiveCode. It works in the iOS simulator. It works in the Android simulator. It works on my Android phone.
When I create a standalone Windows or Mac app (have not tried Linux) the "put URL .... into var" does not retrieve any content. And it returns immediately. The web server logs show no connection attempt was made. I have tried it on two different Macs and two different Windows computers, just to be sure it was not a system problem. I have tried in the settings to allow it to automatically include required libraries/components and I have manually picked all of them (Internet included) without any change in behavior.
I made a new stack with just a call to "put URL .... into var" and it works fine standalone. So it isn't my LiveCode install, or how it builds standalone apps, it seems to be somehow tied to the stack. Is there a way to verify the required Internet component is in the generated stack? This is where a dump to XML might be helpful to examine what is going on.
Is there any sort of debugging I can do to try to figure out what is going on? I really don't want to have to recreate the whole stack, even though it is fairly simple. This doesn't give me a good feeling about using LiveCode for larger apps if it is corruption in the short time I've been working on it, but I am at a loss as to what it could be.
Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 1:42 am
by Simon
I noticed in upgrading from LC 4.6x to 5x that I had to remove all url request from preOpenStack and preOpencard. It seems it is taking more time for the internet library to load and it must be loaded before a call to url.
I asked if there was a way to get an "internet library loaded" message so I could proceed asap but there doesn't seem to be one.
ahh... but I think the IDE gave me an error and you would have seen that.
Simon
Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 1:48 am
by n9yty
Simon, you are a genius!

THANK YOU.
I wouldn't have thought of that... It is my probably stupidity to put the call in preOpenStack. I put it in openCard and it works fine. Yay!
Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 2:50 am
by n9yty
Sorry, a dupe post.
Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 3:07 am
by Simon
Rats!
Is it possible for you to post your stack?
"put url" is so basic it shouldn't break unless there is something else acting adversely on it.
Simon
Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 3:13 am
by n9yty
Simon wrote:Rats!
Is it possible for you to post your stack?
"put url" is so basic it shouldn't break unless there is something else acting adversely on it.
I didn't think so either... But I was wrong when I posted that it broke again, which is why I edited the post to remove it. I had put something else in that caused another error that stopped the standalone app from working, the URL call has not misbehaved since moving it to openStack from preOpenStack, so I think you had that one right.
That is one caution I have to watch out for... While cleaning up I put something in the openStack handler that was wrong, but didn't cause a compile error. So, it never was called while testing in the IDE because the stack was already open, but it prevented the app from launching. Once I closed the stack and re-opened it in the IDE the error presented itself.
I wish the standalone apps could be made to complain when they have errors instead of just go into a coma.

But I suppose in many cases, for end users, you don't want them throwing errors if they can recover.
Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 3:28 am
by Simon
Good, I'm glad you got it working
Simon
Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 3:59 am
by n9yty
It might be worth noting for future reference what I just found in the documentation under "load", which would also affect "put URL xxx":
Note: When included in astandalone application, the Internet library is implemented as a hidden group and made available when the group receives its first openBackground message. During the first part of the application's startup process, before this message is sent, the loadcommand is not yet available. This may affect attempts to use this command in startup, preOpenStack, openStack, or preOpenCardhandlers in the main stack. Once the application has finished starting up, the library is available and the loadcommand can be used in any handler.
Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 4:27 am
by magice
n9yty wrote:It might be worth noting for future reference what I just found in the documentation under "load", which would also affect "put URL xxx":
Note: When included in astandalone application, the Internet library is implemented as a hidden group and made available when the group receives its first openBackground message. During the first part of the application's startup process, before this message is sent, the loadcommand is not yet available. This may affect attempts to use this command in startup, preOpenStack, openStack, or preOpenCardhandlers in the main stack. Once the application has finished starting up, the library is available and the loadcommand can be used in any handler.
Based on that note, I wonder if it might not be better to take the command out of the openStack as well, and instead put it in its own handler and use a send command in the openStack instead. I have run into issues like this as well, so I often do that with everything I want done on openStack.
Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 6:14 am
by Mag
I also start experiment with put URL, then switched to load URL in a more advanced stage of the project.
Code: Select all
put "http://www.apple.com into pageURL
load URL pageURL with message "myUrlDownloadFinished"
on myUrlDownloadFinished
put url pageURL into pageSource
unload URL pageURL -- empty cache
end myUrlDownloadFinished
You can also display the status of the loading URL with something like this
Code: Select all
put the URLStatus of pageURL into field "loadingURLStatus"
Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 6:51 am
by n9yty
Mag wrote:I also start experiment with put URL, then switched to load URL in a more advanced stage of the project.
In this particular case, "put URL" seems better because I have to wait, nothing else to do, and the application cannot work without it loading.
However, I did move to "load URL" for some other web resources it pulls later so that they will be cached, it was a VAST speed difference when using the images in a data grid.
But both of them would have failed because of where I was calling it.

Re: Corrupt stack? URL not working in desktop standalone
Posted: Sat Mar 09, 2013 8:37 am
by jacque
n9yty wrote:
I wish the standalone apps could be made to complain when they have errors instead of just go into a coma.

But I suppose in many cases, for end users, you don't want them throwing errors if they can recover.
You sort of can. In standalone settings in the last pane, set it up to send email when an error occurs. When that happens it will offer to open your email client and the body of the mail will contain the error message and error codes. You don't actually have to send the email.