Re: Sort bug

2023-08-31 Thread Brian Milby via use-livecode
I just tried this in 10dp5 and the sort didn’t completely bail (it put the 
error value first) but it did error when including inline (as in the bug 
report).  If I add a try, then it will stop on the throw.  Not sure how much 
this would slow down execution though.

function myVal pStr
   local tResult
   try
  put item 1 of pStr + item 2 of pStr into tResult
   catch errorVariable
  throw "Bad data"
   end try
   return tResult
end myVal

Brian Milby
br...@milby7.com

> On Aug 31, 2023, at 7:53 PM, Alex Tweedly via use-livecode 
>  wrote:
> 
> 
>> On 01/09/2023 00:37, Bob Sneidar via use-livecode wrote:
>> The function is adding the value of two chunks together and returning the 
>> result. How does that even compute? Unless the + operator is doing something 
>> totally different here…
> 
> The code said:
> 
>> sort lines tVariable by myVal(each)
>> 
>> where the function is for example
>> 
>> function myVal pStr
>>return item 1 of pStr + item 2 of pStr
>> end myval
> since it's sorting the lines of the container, it calls the custom function 
> with each line in turn. The function simply adds together the first two items 
> from the passed-in line, and returns that. The returned value is associated 
> with the corresponding line - and then the container is sorted by those 
> associated values.
> 
> This works fine if the input variable is well formatted (i.e. first and 
> second items of each line are numeric), but fails to give an error when 
> something goes wrong - such as a non-numeric item.
> 
> (and, yes - the dictionary description is misleading, if not simply 
> incorrect. However, the "Tip" at the end describes the use of ustom 
> functions).
> 
> Alex.
> 
> 
> ___
> 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
___
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: Sort bug

2023-08-31 Thread Alex Tweedly via use-livecode


On 01/09/2023 00:37, Bob Sneidar via use-livecode wrote:

The function is adding the value of two chunks together and returning the 
result. How does that even compute? Unless the + operator is doing something 
totally different here…


The code said:


sort lines tVariable by myVal(each)

where the function is for example

function myVal pStr
return item 1 of pStr + item 2 of pStr
end myval
since it's sorting the lines of the container, it calls the custom 
function with each line in turn. The function simply adds together the 
first two items from the passed-in line, and returns that. The returned 
value is associated with the corresponding line - and then the container 
is sorted by those associated values.


This works fine if the input variable is well formatted (i.e. first and 
second items of each line are numeric), but fails to give an error when 
something goes wrong - such as a non-numeric item.


(and, yes - the dictionary description is misleading, if not simply 
incorrect. However, the "Tip" at the end describes the use of ustom 
functions).


Alex.


___
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: Sort bug

2023-08-31 Thread Bob Sneidar via use-livecode
The function is adding the value of two chunks together and returning the 
result. How does that even compute? Unless the + operator is doing something 
totally different here…

Bob S


On Aug 31, 2023, at 3:38 PM, J. Landman Gay via use-livecode 
 wrote:

Actually, the syntax is correct. It uses a custom sort function. The function 
call includes the "each" which means it passes the correct parameter to the 
custom function, which then acts on it and sends the result back to the calling 
handler for sorting. It's a nice way to customize the built-in sort. You can do 
some pretty extravagant things with it.


On 8/31/23 10:25 AM, Bob Sneidar via use-livecode wrote:


___
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: Sort bug

2023-08-31 Thread J. Landman Gay via use-livecode
Actually, the syntax is correct. It uses a custom sort function. The function call includes the 
"each" which means it passes the correct parameter to the custom function, which then acts on 
it and sends the result back to the calling handler for sorting. It's a nice way to customize 
the built-in sort. You can do some pretty extravagant things with it.



On 8/31/23 10:25 AM, Bob Sneidar via use-livecode wrote:

To be more clear, the argument to “by” needs to be a chunk statement, not a 
value, followed by “of each”. Your function *might* work if you returned the 
chunk expression instead of the actual value the chunk resolves to.

But why? I am not sure what the myVal() function accomplishes. Does the chunk 
expression change on the fly? Even so, pStr needs to be a list of numbers 
because you are adding them together, so it won’t return a chunk expression.

Your method as it stands would resolve to “sort lines tVariable by 3” when it 
needs to resolve to something like “sort lines of tVariable by item 3 of each”.

Further it looks like you are sorting by multiple items. You cannot do that in 
one statement. Instead run multiple sorts, by the last element first, down to 
the first element.

Bob S



On Aug 31, 2023, at 8:06 AM, Bob Sneidar via use-livecode 
 wrote:

I think you have to append “of each”. Sort lines of tVar by item 3 of each

Bob S



On Aug 30, 2023, at 9:11 PM, Neville Smythe via use-livecode 
 wrote:

There is a bug in sorting a container using a function, as in

sort lines tVariable by myVal(each)

where the function is for example

function myVal pStr
   return item 1 of pStr + item 2 of pStr
end myval

If the function myVal encounters a run-time error (in the example if one of the 
items is not a number) the sort command fails silently: the script exits at 
that code line and the user is unaware that the sort (and the rest of the 
handler) were not executed.

If you sort directly with

sort lines tVariable by (item 1 of pStr + item 2 of pStr)

the handler will throw an error dialog, as expected.

QC has confirmed this is a bug ( bug 24321 
 ) that evidently has been 
around for a long time.

Neville Smythe



___
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


___
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


___
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


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
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


Shutdown on Android

2023-08-31 Thread Dan Friedman via use-livecode
Does the shutdown message (or shutdownRequest message) work on Android?   I am 
playing a song using androidStartAudioPlayingInBackground.   However, if the 
app is closed (swiping up to exit it), then the audio continues to play.  So, I 
added an androidStopAudioPlayingInBackground command in the shutdown message to 
stop playing the audio.  But doesn’t seem to work – audio continues to play.

Any thoughts?

-Dan

___
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: Sort bug

2023-08-31 Thread Bob Sneidar via use-livecode
To be more clear, the argument to “by” needs to be a chunk statement, not a 
value, followed by “of each”. Your function *might* work if you returned the 
chunk expression instead of the actual value the chunk resolves to. 

But why? I am not sure what the myVal() function accomplishes. Does the chunk 
expression change on the fly? Even so, pStr needs to be a list of numbers 
because you are adding them together, so it won’t return a chunk expression. 

Your method as it stands would resolve to “sort lines tVariable by 3” when it 
needs to resolve to something like “sort lines of tVariable by item 3 of each”. 

Further it looks like you are sorting by multiple items. You cannot do that in 
one statement. Instead run multiple sorts, by the last element first, down to 
the first element. 

Bob S


> On Aug 31, 2023, at 8:06 AM, Bob Sneidar via use-livecode 
>  wrote:
> 
> I think you have to append “of each”. Sort lines of tVar by item 3 of each
> 
> Bob S
> 
> 
>> On Aug 30, 2023, at 9:11 PM, Neville Smythe via use-livecode 
>>  wrote:
>> 
>> There is a bug in sorting a container using a function, as in
>> 
>> sort lines tVariable by myVal(each)
>> 
>> where the function is for example
>> 
>> function myVal pStr
>>   return item 1 of pStr + item 2 of pStr
>> end myval
>> 
>> If the function myVal encounters a run-time error (in the example if one of 
>> the items is not a number) the sort command fails silently: the script exits 
>> at that code line and the user is unaware that the sort (and the rest of the 
>> handler) were not executed.
>> 
>> If you sort directly with
>> 
>> sort lines tVariable by (item 1 of pStr + item 2 of pStr)
>> 
>> the handler will throw an error dialog, as expected.
>> 
>> QC has confirmed this is a bug ( bug 24321 
>>  ) that evidently has 
>> been around for a long time.
>> 
>> Neville Smythe
>> 
>> 
>> 
>> ___
>> 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
> 
> ___
> 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

___
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: Sort bug

2023-08-31 Thread Bob Sneidar via use-livecode
I think you have to append “of each”. Sort lines of tVar by item 3 of each

Bob S


> On Aug 30, 2023, at 9:11 PM, Neville Smythe via use-livecode 
>  wrote:
> 
> There is a bug in sorting a container using a function, as in
> 
> sort lines tVariable by myVal(each)
> 
> where the function is for example
> 
> function myVal pStr
>return item 1 of pStr + item 2 of pStr
> end myval
> 
> If the function myVal encounters a run-time error (in the example if one of 
> the items is not a number) the sort command fails silently: the script exits 
> at that code line and the user is unaware that the sort (and the rest of the 
> handler) were not executed.
> 
> If you sort directly with
> 
> sort lines tVariable by (item 1 of pStr + item 2 of pStr)
> 
> the handler will throw an error dialog, as expected.
> 
> QC has confirmed this is a bug ( bug 24321 
>  ) that evidently has 
> been around for a long time.
> 
> Neville Smythe
> 
> 
> 
> ___
> 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

___
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


HTML5 failure / javascript console

2023-08-31 Thread Eller, Roger via use-livecode
My first try of saving a simple stack as HTML5... When it tries to run, it says 
to check the Javascropt console, which shows the following.  As a LiveCode 
Script only developer, none of this gives me a clue.  This is on Windows, using 
Chrome.

Failed to load resource: the server responded with a status of 404 (Not Found)
TEST_STACK.html:155 run() called, but dependencies remain, so not running
printErr @ TEST_STACK.html:155
standalone-9.6.10.js:48 a problem seems to have happened with 
Module.memoryInitializerRequest, status: 404, retrying 
standalone-9.6.10.html.mem
useRequest @ standalone-9.6.10.js:48
standalone-9.6.10.html.mem:1 Failed to load resource: the server responded 
with a status of 404 (Not Found)
standalone-9.6.10.js:48 Uncaught could not load memory initializer 
standalone-9.6.10.html.mem
TEST_STACK.html:155 still waiting on run dependencies:
printErr @ TEST_STACK.html:155
(anonymous) @ standalone-9.6.10.js:1
TEST_STACK.html:155 dependency: memory initializer
printErr @ TEST_STACK.html:155
(anonymous) @ standalone-9.6.10.js:1
TEST_STACK.html:155 (end of list)


___
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


[[ ANN ]] Release 10.0.0 DP-6

2023-08-31 Thread panagiotis merakos via use-livecode
Dear list members,

We are pleased to announce the release of LiveCode 10.0.0 DP-6.

LiveCode 10.0.0 DP-6 comes with more than 30 bugfixes and exciting new
features.

You can find more details on this new release here:

https://livecode.com/livecode-10-dp-6-web-fonts-and-api-33/

You can find the release in your LiveCode account area or get it via the
automatic updater.

Enjoy!

Kind regards
The LiveCode Team
___
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