Deleting stacks on the fly
I'm trying to optimize for minimal RAM usage on mobile. The app is modular with many stacks that are opened from the mainstack. I had this before in a global library: command portal_GoStack stackName -- goes to the new stack -- closes the current stack # But we want to delete it to clear RAM -- safely ignores if we are alrady in the new stack put the short name of this stack into oStackName if oStackName = stackName then return oStackName go to stack stackName --close stack oStackName -- test deleting the stacks to save on RAM delete stack oStackName return oStackName end portal_GoStack This is called from a button on a navigation bar of the stack we want to close and delete, as it opens a different stack. This works if we just use "close stack oStackName" but if I change this to "delete stack oStackName" we get an error: stack "lib_SivaSivaPortal": execution error at line n/a (Object: stack locked, or object's script is executing) near "widget "go-home-portal" of group "homeScreensBottomNav" of card "images-quotes" of stack "/Users/Brahmanathaswami/Documents/_Siva-Siva-App/modules/gems/gems.livecode"" Obviously this means that the stack "gem.livecode" which has the button which is trying to "navigate" back to the home/main stack, cannot be deleted because the button script that calls the library handler is considered to be executing. Closing it first before deleting does not help. so I tried using "send in 10 milliseconds" And this *does* work.. I'm just trying to see if this is best practice. both stacks will occupy RAM briefly, but there is no other way that I know of to avoid this without a "flash" of some empty screen. command portal_GoStack stackName -- goes to the new stack -- closes the current stack -- safely ignores if we are alrady in the new stack put the short name of this stack into oStackName if oStackName = stackName then return oStackName go to stack stackName send "removeStack oStackName" to me in 10 milliseconds return oStackName end portal_GoStack command removeStack stackName delete stack stackName end removeStack Stack A opens Stack B opens on top Stack B want to close itself, be deleted (removed from memory) and open stack A Anyone has gone through this loop already and discovered best practices to accomplish this? BR ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: PUT method where is returned data?
On Feb 10, 2017, at 9:52 AM, Trevor DeVore via use-livecode wrote: > > I much prefer reading ’the urlresopnse’ in my code than > dealing with ‘it’ which is meaningless until put into another variable. In my defense — it was my attempt at figuring out where PUT put the response data. I was desperate to figured it out and thought it might contain my JSON response. It is not part of my regular coding. But I'll admit. I was using Hypercard at v1.0 so it is my fall back when all else fails. Old habits are hard to break ;-) Thanks for the help and reminding me about urlResponse. My API wrapper is working like a charm! Bob Hall ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Windows and OSX 64-bit builds?
This is a well known visual phenomena: When I'm tired I also switch sometimes 'in between reading' the temporarily memorized decimal point from the beginning to the end of a three-digit-block (did it recently in the forum). It mostly works for me (if not 'computing') to force myself to obey the rule, for the decimal prefixes, starting from Byte: Kilobytes = 10^3 Bytes => cut most right three MegaBytes = 10^6 Bytes => cut most right 6 (another three) GigaBytes = 10^9 Bytes => cut most right 9 (another three) TeraBytes = 10^12 Bytes => cut most right 12 (another three) As Phil hints, to use number words may be misleading here because 'billion' has different meanings in Europe (1 billion = 10^12) and in the USA (1 billion = 10^9). >> Bob S. wrote: >> Isn't it kBytes not bits? So 32,000 * 32000 Bytes (a pixel takes up >> one Byte in 8 bit color) which comes to 1,024,000,000 BYTES. That's >> 1.024 terabytes, unless my faculties have wholly abandoned me. >> Of course, a black and white image is 1,024,000 BYTES, or 1.023 GIGS, >> but are we talking about black and white images? > > Phil D. wrote: > Your labels are one order of magnitude off the actual values, Bob. Say > it with me: 1,024,000,000 BYTES is "one billion bytes" (and change, > depending on whose standard you use). Of course one billion bytes is a > gigabyte. > Same with the labeling of 1,024,000 BYTES = 1000kb = a megabyte, not a gig. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode