Search found 816 matches

by Thierry
Fri Mar 05, 2021 6:07 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

I suspect the sortIndex approach will be very helpful if dealing with a large array of BLOBs for example, but in most 'normal' use cases there isn't much of a difference True, absolutely true ! Here is a benchmark for an array of 4609 entries, full size of the json input data > 3 Mbytes. First numb...
by Thierry
Fri Mar 05, 2021 4:55 pm
Forum: Teaching with LiveCode
Topic: is a numeric value ECMA-404
Replies: 5
Views: 121

Re: is a numeric value ECMA-404

Hi, in fact, I didn't check the validity of your function; I did trust you :) just rewriting your code a tiny bit.... this time, I drop the last part "is false" and add not before ( function _isNumericValue pValue return pValue is a number \ and not ( char 1 of pValue is 0 \ and char 2 of pValue is ...
by Thierry
Fri Mar 05, 2021 3:38 pm
Forum: Teaching with LiveCode
Topic: is a numeric value ECMA-404
Replies: 5
Views: 121

Re: is a numeric value ECMA-404

.... So this is how the new version looks it is considerably smaller and faster. function _isNumericValue pValue if pValue is not a number then return false if char 1 of pValue is 0 and char 2 of pValue is not "." and the length of pValue is not 1 or char 1 of pValue is not in "-0123456789" then re...
by Thierry
Thu Mar 04, 2021 1:41 pm
Forum: Talking LiveCode
Topic: Hide custom plugins opening Script Editor
Replies: 16
Views: 439

Re: Hide custom plugins opening Script Editor

i just need to hide plugins when the script editor window comes to the foreground, so i need to identify the state changes of the window itself Hi Paul, Here is a plugin (actually, I did edit the revExample.rev plugin for this purpose) which will detect if the SE is open or closed. See bottom-left ...
by Thierry
Wed Mar 03, 2021 11:43 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

bogs wrote:
Wed Mar 03, 2021 11:25 am
I'm beginning to think that Craig is right, "DO" is the answer to everything ;)
DO NOTHING is the answer to everything ;)
by Thierry
Wed Mar 03, 2021 11:31 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

Sorry, was working from memory and goofed... I think I see now why this won't work. Merge requires a string, and tSortText isn't one. Mmm, sorry but - tSortText IS a string - the result of merge() IS a string too. - the sort command IS NOT expecting a string as a parameter Checking sort in the dict...
by Thierry
Tue Mar 02, 2021 1:18 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

Thanks Thierry - but that confuses me more :) (easily done mind you...) Welcome to the club :) Or maybe i'm doing something wrong? Sure :) From my previous post, how to use it: on test_sorting_array ... put sortArray( X, "ascending", "text") into I put X[ I[ 1]] && X[ I[ 2]] &cr after fld 1 --> aaa...
by Thierry
Tue Mar 02, 2021 11:19 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

Here is a variant which is slightly faster and using less memory,.... However that won't sort multidimensional arrays i don't think? you don't make use of [pKey] and the code looks fairly identical to the previous one you posted:) Ok, some misunderstanding.... :evil: I've edited my previous post, u...
by Thierry
Tue Mar 02, 2021 10:54 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

Hi Stam, Here is a variant which is slightly faster and using less memory, but of course this has to be proved :) function sortArray @pArray, pDirection, pSortType, pKey local tNextIndex, tSortText, tSortedIndex get the keys of pArray put "sort lines of IT [[pDirection]] [[pSortType]] by pArray[each...
by Thierry
Tue Mar 02, 2021 10:00 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

...there was an issue with using the "do" command.... ...somehow related to Apple not liking programs that have potentially self-altering code in their App Store.... I must say, that seems unlikely.... I’d be surprised if Apple did a code-level review of apps (but really have no idea). .... I do be...
by Thierry
Tue Mar 02, 2021 9:56 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

The main speed problem was caused by passing a copy of the complete data variable to a function that was being called over a million times. Hi Simon, I'm on the same board as you, and I often use this little @ gremlin, but not always as, like everything, it has its pros and cons. However, in this t...
by Thierry
Mon Mar 01, 2021 6:22 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

Good to know about lock screen i've used it but haven't seen a massive increase in speed but maybe i've not been doing stuff that was taxing enough to make it obvious (and haven't bothered time-logging) Well, I don't believe this will change the speed at all in this use case, plus I think using or ...
by Thierry
Mon Mar 01, 2021 12:54 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

Yep, you did indeed. As always i'm ever so grateful for all your advice and contributions which i've found absolutely invaluable during my short time on this forum (especially with regex!) - didn't mean anything by my comment, just that that was needed for multidimensional array sorting. You're wel...
by Thierry
Mon Mar 01, 2021 12:06 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

@Thierry - great code- was unaware of the merge() function, works a charm but you were missing the [pKey] after pArray[each] in the merge() statement. Works like a charm once added :) Mmm sure but actually I told you about this: But be careful as I did a test with only a 1 dimensional array... Glad...
by Thierry
Mon Mar 01, 2021 9:54 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 68
Views: 4600

Re: Sort multidimensional array

This now works and is fully generalisable for array sorting - specifying a key, sort direction and sort type as parameters... but the code is now is so much longer and unpleasant. Grateful on suggestions to refactor this and get rid of the nested conditional statements Hi Stam, As you ask, here is ...

Go to advanced search