Search found 810 matches

by Thierry
Tue Mar 02, 2021 1:18 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 40
Views: 3590

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: 40
Views: 3590

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: 40
Views: 3590

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: 40
Views: 3590

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: 40
Views: 3590

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: 40
Views: 3590

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: 40
Views: 3590

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: 40
Views: 3590

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: 40
Views: 3590

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 ...
by Thierry
Tue Feb 23, 2021 2:14 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: If, else, endif problem
Replies: 21
Views: 867

Re: If, else, endif problem

Take away messages: - NEVER use a number as a field name call it 'f1', or 'field 1' or 'spaceship1' instead of '1', or you WILL get unexpected results - You can only use 1 'else' statement , for multiple options use 'else if' - if you have a large number of alternatives, use a switch statement inst...
by Thierry
Tue Feb 23, 2021 10:24 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Close & Remove From Memory hangs
Replies: 6
Views: 265

Re: Close & Remove From Memory hangs

stam wrote: I think they fixed that ages ago (i'm running 9.6.2 RC2 and certainly don't have this problem any more).
I think you said you'r using 9.6.1 -- upgrade your version :)
Happy ending story.... the best :)
by Thierry
Tue Feb 23, 2021 9:52 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Close & Remove From Memory hangs
Replies: 6
Views: 265

Re: Close & Remove From Memory hangs

Thanks for the reply. You are right. It is not LC that hangs. It is the dialog. Cmd-c does close the dialog. That’s better. I have to actually quit LC to switch to a different project. :( But, LC seems glitchy under Big Sur. I might decide to downgrade. Well, guess it's a good candidate for a bug r...
by Thierry
Tue Feb 23, 2021 9:44 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: If, else, endif problem
Replies: 21
Views: 867

Re: If, else, endif problem

Hi, What's been said above. Actually, I'm a bit puzzled with your multiple else statement in your if ... end if. the 2nd else should be a dead code; means we never execute this part. The 'else if ...' syntax is the way to go. I think the error you have is because of these extra else statement in lin...
by Thierry
Tue Feb 23, 2021 9:05 am
Forum: Databases
Topic: Regex removing/replacing before DB in practice...
Replies: 3
Views: 239

Re: Regex removing/replacing before DB in practice...

liveme wrote:
Tue Feb 23, 2021 8:54 am
Thanks a lot Thierry for showing me the correct way !
...
You're welcome.

If you find anything wrong or unclear, please let us know...

Regards,

Thierry
by Thierry
Mon Feb 22, 2021 10:32 am
Forum: Databases
Topic: Regex removing/replacing before DB in practice...
Replies: 3
Views: 239

Re: Regex removing/replacing before DB in practice...

Hi liveme, Your orignal regex: [-$&~'#%?!@°,*+=></\(){} ] The new one: [-$&~'#%?!@°,*+=></\(){} \\ [\] \x22 ] I've added some spaces to draw attention, please drop them in your code. \\ will match any \ [\] will match [ and ] \x22 is the hex value for the double quote not tested! HTH, Thierry

Go to advanced search