Re: Sorting Arrays

2023-08-11 Thread Bob Sneidar via use-livecode
Send me what you have. Thanks. 

Sent from my iPhone

> On Aug 11, 2023, at 17:02, Alex Tweedly via use-livecode 
>  wrote:
> 
> 
>> On 11/08/2023 23:00, J. Landman Gay via use-livecode wrote:
>> On 8/10/23 2:29 PM, Alex Tweedly via use-livecode wrote:
>> [ ... code from earlier posting ...]
> 
>> I couldn't get this to work until I altered it, but I was using a very 
>> simple array. What type of array data did you use? I think I'm missing 
>> something.
>> 
>> I just did this:
>> 
>>   put the weekdayNames into tDataA
>>   split tDataA by cr
>>   simpleSortNumberedArray tDataA, "descending,text"
>> 
> What you're missing is that this (simpleSortNumberedArray) is only intended 
> for "numbered array"s (which LC is calling "sequences" in some places); i.e. 
> an array where the (top-level) keys are all consecutive integers, from 1  
> n
> 
> Also, the pSortkeys should be a number of comma-separated items, each of 
> which consists of a key by which you want to sort the array followed 
> optionally by an order and type.
> 
> So you might do something like :
> 
>> on mouseup
>>local tCounter, tDataA
>> 
>>repeat for each line L in the weekdayNames
>>   add 1 to tCounter
>>   put L into tDataA[tCounter]["dayname"]
>>   put the number of chars in L into tDataA[tCounter]["charcount"]
>>end repeat
>> 
>>-- sorts ascending by name (i.e. F, M, Sa, Su, Th, Tu, W)
>>simpleSortNumberedArray tDataA, "dayname"
>>repeat with I = 1 to 7
>>   put tDataA[I]["charcount"] && tDataA[I]["dayname"] & CR after msg
>>end repeat
>> 
>>put "-" &CR after msg
>> 
>>-- sorts descending numeric by number of characters in name
>>--  NB within each char count value, they remain in alphabetical order of 
>> name
>>simpleSortNumberedArray tDataA, "charcount numeric descending"
>>repeat with I = 1 to 7
>>   put tDataA[I]["charcount"] && tDataA[I]["dayname"] & CR after msg
>>end repeat
>> end mouseup
> and get as output
> 
>> 6 Friday
>> 6 Monday
>> 8 Saturday
>> 6 Sunday
>> 8 Thursday
>> 7 Tuesday
>> 9 Wednesday
>> -
>> 9 Wednesday
>> 8 Saturday
>> 8 Thursday
>> 7 Tuesday
>> 6 Friday
>> 6 Monday
>> 6 Sunday
> 
> So - it would be worth adding a check that the array passed in is indeed a 
> sequence, at the start of simpleSortNumberedArray:
> 
> if NOT (pArrayDataA is an array AND \
>item 2 of extents(pArrayDataA) is the number of elements in 
> pArrayDataA) then \
>  return pArrayData
> 
> I'm now going to add this to my personal library, but I'll rename it to
> 
> seqSortMultipleKeys
> 
> 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: Sorting Arrays

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


On 11/08/2023 23:00, J. Landman Gay via use-livecode wrote:

On 8/10/23 2:29 PM, Alex Tweedly via use-livecode wrote:
[ ... code from earlier posting ...]


I couldn't get this to work until I altered it, but I was using a very 
simple array. What type of array data did you use? I think I'm missing 
something.


I just did this:

  put the weekdayNames into tDataA
  split tDataA by cr
  simpleSortNumberedArray tDataA, "descending,text"

What you're missing is that this (simpleSortNumberedArray) is only 
intended for "numbered array"s (which LC is calling "sequences" in some 
places); i.e. an array where the (top-level) keys are all consecutive 
integers, from 1  n


Also, the pSortkeys should be a number of comma-separated items, each of 
which consists of a key by which you want to sort the array followed 
optionally by an order and type.


So you might do something like :


on mouseup
   local tCounter, tDataA

   repeat for each line L in the weekdayNames
  add 1 to tCounter
  put L into tDataA[tCounter]["dayname"]
  put the number of chars in L into tDataA[tCounter]["charcount"]
   end repeat

   -- sorts ascending by name (i.e. F, M, Sa, Su, Th, Tu, W)
   simpleSortNumberedArray tDataA, "dayname"
   repeat with I = 1 to 7
  put tDataA[I]["charcount"] && tDataA[I]["dayname"] & CR after msg
   end repeat

   put "-" &CR after msg

   -- sorts descending numeric by number of characters in name
   --  NB within each char count value, they remain in alphabetical 
order of name

   simpleSortNumberedArray tDataA, "charcount numeric descending"
   repeat with I = 1 to 7
  put tDataA[I]["charcount"] && tDataA[I]["dayname"] & CR after msg
   end repeat
end mouseup

and get as output


6 Friday
6 Monday
8 Saturday
6 Sunday
8 Thursday
7 Tuesday
9 Wednesday
-
9 Wednesday
8 Saturday
8 Thursday
7 Tuesday
6 Friday
6 Monday
6 Sunday


So - it would be worth adding a check that the array passed in is indeed 
a sequence, at the start of simpleSortNumberedArray:


if NOT (pArrayDataA is an array AND \
   item 2 of extents(pArrayDataA) is the number of elements in 
pArrayDataA) then \

 return pArrayData

I'm now going to add this to my personal library, but I'll rename it to

    seqSortMultipleKeys

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: Sorting Arrays

2023-08-11 Thread J. Landman Gay via use-livecode

On 8/10/23 2:29 PM, Alex Tweedly via use-livecode wrote:
Combining my "traditional" way as above, and your example, I came up with a  simpler way to do 
the same thing:



on simpleSortNumberedArray @pArrayDataA, pSortKeys
   local tKeys, tSeq, tOneSortKey, tSortCommand
   put seqAsLines(pArrayDataA) into tKeys
   repeat with I = the number of items in pSortKeys down to 1
  put item I of pSortKeys into tOneSortKey
  put "sort lines of tKeys" && word 2 to -1 of tOneSortKey && \
    "by pArrayData[each][" && word 1 of tOneSortKey && "]" into 
tSortCommand
  do tSortCommand
   end repeat
   rebuildSeq pArrayDataA, tKeys
end simpleSortNumberedArray

function seqAsLines pSeq
   local tRes
   repeat with i = 1 to the number of elements in pSeq
  put i & CR after tRes
   end repeat
   return tRes
end seqAsLines

command rebuildSeq @pSeq, pList
   local tResQ, tCount
   repeat for each line L in pList
  add 1 to tCount
  put pSeq[L] into tResQ[tCount]
   end repeat
   put tResQ into pSeq
end rebuildSeq 


I couldn't get this to work until I altered it, but I was using a very simple array. What type 
of array data did you use? I think I'm missing something.


I just did this:

  put the weekdayNames into tDataA
  split tDataA by cr
  simpleSortNumberedArray tDataA, "descending,text"

For that array, this worked:

on simpleSortNumberedArray pArrayDataA, pSortKeys
  local tKeys, tSeq, tOneSortKey, tSortCommand
  put seqAsLines(pArrayDataA) into tKeys
  repeat with I = the number of items in pSortKeys down to 1
put item I of pSortKeys into tOneSortKey
--put "sort lines of tKeys" && word 2 to -1 of tOneSortKey && \
--  "by pArrayDataA[each][" && word 1 of tOneSortKey && "]" into 
tSortCommand
put "sort lines of tKeys" && tOneSortKey into tSortCommand
do tSortCommand
  end repeat
  rebuildSeq pArrayDataA, tKeys
end simpleSortNumberedArray

function seqAsLines pSeq
  local tRes
  --  repeat with i = 1 to the number of elements in pSeq
  repeat for each element e in pSeq
put e & CR after tRes
  end repeat
  return tRes
end seqAsLines

command rebuildSeq @pSeq, pList
  local tResQ, tCount
  repeat for each line L in pList
add 1 to tCount
--put pSeq[L] into tResQ[tCount]
put L into tResQ[tCount]
  end repeat
  put tResQ into pSeq
end rebuildSeq

--
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


Re: Android black screen again...

2023-08-11 Thread J. Landman Gay via use-livecode

On 8/11/23 3:12 AM, Klaus major-k via use-livecode wrote:

The problem is that this is not reproducable, it happens out of a sudden if it 
happens.
Even the hardware BACKKEY does not work in that situation, only the HOMEKEY so 
I can
at least quit the app.


That's called an ANR ("Application Not Responding"). Something in the app is causing a hang. If 
you wait long enough, Android should put up a dialog asking if you want to wait or close the 
app. If you choose to wait, sometimes it comes back. However, the wait can be 10-20 seconds or 
more so people often just quit before the dialog appears.


The problem here is figuring out what causes it. Is it always the same PDF file? Or maybe it 
happens after opening a certain number of files, or the length of a file, or the cumulative 
length of several files, or...? If it isn't reproducible, it's very difficult to find the cause.


If it happens to you at home some day, see if waiting 15 seconds or more puts up that dialog. 
That would confirm it's an ANR.


--
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


Tab Widget Go command

2023-08-11 Thread Bob Sneidar via use-livecode
In the dictionary, there is a Go command for widgets. I assumed this meant I 
can do something like: 

Go forward in widget “TabBar”

But that does not work. Any ideas? I can kludge it. I would rather not have to. 

Bob S

___
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: Rectangles on Windows?

2023-08-11 Thread Paul Dupuis via use-livecode
If you want to send me a link to your Windows standalone, I would be 
happy to download it (Windows 11 HP laptop) and see if I see the same 
thing. Or a link to your stack and I can see if it appears in the LC 
9.6.9 IDE if you want.



On 8/11/2023 10:19 AM, Dar Scott via use-livecode wrote:

Hmmm. Maybe few use rectangles. I could try a polyline or a group. — Dar


On Aug 10, 2023, at 4:45 PM, Bob Sneidar via use-livecode 
 wrote:

Sorry Dar, I do not use rectangles for anything.

Bob S



On Aug 10, 2023, at 3:30 PM, Dar Scott via use-livecode 
 wrote:

Anybody else seeing missing rectangles on Windows?  — Dar


On Aug 8, 2023, at 12:14 PM, Dar Scott via use-livecode 
 wrote:


I have some rectangles that work just fine in development on my Mac.

However, there are problems in my Windows standalone.

Not Showing Up
Two sets of rectangles are not visible in Windows. One set is opaque and one 
set is not. The opaque set is made visible or not invisible with a wipe effect. 
Both sets have a non-zero border thickness

Showing Up
Other rectangles have opaque true, backgroundColor red, and border thickness 0. 
They are visible on Windows. They are also within a group. These are made 
visible and not visible with a same wipe effect.

___
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: Rectangles on Windows?

2023-08-11 Thread Dar Scott via use-livecode
Hmmm. Maybe few use rectangles. I could try a polyline or a group. — Dar

> On Aug 10, 2023, at 4:45 PM, Bob Sneidar via use-livecode 
>  wrote:
> 
> Sorry Dar, I do not use rectangles for anything. 
> 
> Bob S
> 
> 
>> On Aug 10, 2023, at 3:30 PM, Dar Scott via use-livecode 
>>  wrote:
>> 
>> Anybody else seeing missing rectangles on Windows?  — Dar
>> 
>>> On Aug 8, 2023, at 12:14 PM, Dar Scott via use-livecode 
>>>  wrote:
>>> 
>>> 
>>> I have some rectangles that work just fine in development on my Mac.
>>> 
>>> However, there are problems in my Windows standalone. 
>>> 
>>> Not Showing Up
>>> Two sets of rectangles are not visible in Windows. One set is opaque and 
>>> one set is not. The opaque set is made visible or not invisible with a wipe 
>>> effect. Both sets have a non-zero border thickness
>>> 
>>> Showing Up
>>> Other rectangles have opaque true, backgroundColor red, and border 
>>> thickness 0. They are visible on Windows. They are also within a group. 
>>> These are made visible and not visible with a same wipe effect. 
> 
> ___
> 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: Android black screen again...

2023-08-11 Thread Klaus major-k via use-livecode
Hi Jacque,

> Am 10.08.2023 um 22:34 schrieb J. Landman Gay via use-livecode 
> :
> 
> I looked up the Samsung Tab A and it says it runs Android 9, upgradable to 
> 11. There are multiple RAM options. Is this the one you have? 
> 
> 
> I'm just guessing, but memory may be too low to allow the browser widget to 
> work, since it does work after a reboot and the problem only happens 
> occasionally. But Android 5 is almost 10 years old and I'd be surprised if 
> that is what your tablet is running. Have you checked for an update? You have 
> much more control of memory usage with a newer OS.

sorry, my fault, I obviously have an older version of the tablet and it does in 
fact run Android 8.1.
However it is not upgradable.

> In any case, you can keep memory usage lower if you delete or disable all 
> apps and processes you don't need. You can do that in Settings/Apps. Samsung 
> installs a lot of bloatware and if you don't use those things, turn them off 
> or remove them. You can't always uninstall these but you can disable some of 
> them. Also uninstall any extra apps you don't use. I have a newer Samsung 
> tablet and I disabled or deleted almost half the software it shipped with. 
> Many of these run in the background and use memory. Launcher widgets also run 
> constantly so remove the ones you don't need from your launch screens.

I already did that, snice I only need the device for displaying PDF leadsheets.
But if it would be a memory issue, then it would happen more often, I think.

The problem is that this is not reproducable, it happens out of a sudden if it 
happens.
Even the hardware BACKKEY does not work in that situation, only the HOMEKEY so 
I can 
at least quit the app.

> --
> Jacqueline Landman Gay | jac...@hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
> On August 10, 2023 5:03:24 AM Klaus major-k via use-livecode 
>  wrote:
> 
>> Hi friends,
>> 
>> maybe you remember my problem, that my app
>> turns into a black screen occacionally.
>> 
>> This has happened again about four or five times since
>> I reported it here.
>> 
>> This never happens at home, only when I am at a band
>> rehearsal, but never at a gig (fingers crossed).
>> 
>> Restarting the dveice definitively cures this, thank you Panos,
>> but sometimes, especially at a gig, I do not have the time to
>> do so. :-/
>> 
>> So any further hints highly appreciated!
>> 
>> macOS 12.6.8, LC 9.6.9, android 5.1 on a SAMSUNG TAB A tablet.
>> I'm mainly using the PDF widget if that matters...

Best

Klaus

--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
kl...@major-k.de


___
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