Re: disabled buttons still receive events, they just process them, later?

2024-02-21 Thread Mark Waddingham via use-livecode
It’s because of the wait - ‘blocking’ waits (those which aren’t ‘with 
messages’) queue any (low level) events so they are handled at the next wait 
(in this case the global one the engine does implicitly when there are no 
handlers executing).

Flushing events after the wait as Jacque suggests will ensure they aren’t there 
to handle.

Warmest Regards.

Mark.

Sent from my iPhone

> On 21 Feb 2024, at 21:59, Mike Kerner via use-livecode 
>  wrote:
> 
> i did.
> i have both a button, and a power button.
> script:
> 
> *local* count
> 
> *on* mouseUp
> 
> *if* the disabled of me *then* *put* cr & "disabled" after msg
> 
> *add* 1 to count
> 
> *set* the enabled of me to false
> 
> *put* count
> 
> *wait* 2 second
> 
> *set* the enabled of me to true
> 
> *end* mouseUp
> 
>> On Wed, Feb 21, 2024 at 4:47 PM Craig Newman via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>> 
>> Mike.
>> 
>> In a new stack I placed a button with this:
>> 
>> on mouseUp
>>  beep 2
>> end mouseUp
>> 
>> If I click on the button I hear two clicks. I disabled the button and
>> clicked on it. I enabled the button. No clicks. I did this all by hand. Did
>> you?
>> 
>> Craig
>> 
>>> On Feb 21, 2024, at 4:07 PM, Mike Kerner via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>>> 
>>> alright, i'm a little surprised to notice this:
>>> i have a button. i disabled the button.
>>> then i clicked on the button
>>> then i re-enabled the button
>>> the click, from the period while the button was disabled, is received and
>>> processed by the button.
>>> that seems problematic, to me. how would one cause clicks to be
>> discarded,
>>> permanently? hide the button? overlay it with a transparent control that
>>> will absorb and ignore the clicks?
>>> 
>>> --
>>> On the first day, God created the heavens and the Earth
>>> On the second day, God created the oceans.
>>> On the third day, God put the animals on hold for a few hours,
>>>  and did a little diving.
>>> And God said, "This is good."
>>> ___
>>> 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
>> 
> 
> 
> -- 
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>   and did a little diving.
> And God said, "This is good."
> ___
> 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: AW: Re: macOS window maximization weirdness

2024-02-12 Thread Mark Waddingham via use-livecode

On 2024-02-10 21:16, Paul Dupuis via use-livecode wrote:

My desktopChanged handler, at one point, executes either a:

  set the effective width of window tWindow to tMontiorWidth
OR a
  set the effective height of window tWindow to tMonitorHeight

Either of which sends a resizeStack message to the stack/window. 
However, when it is sent this 2nd time as a result of the window 
maximization (which does a successful resizeStack, then desktopChanged, 
which sets teh effecting width/height, that causes a resizeStack) the 
resizeStack parameters, pNewWidth and pNewHeight are EMPTY, so any 
placement of controls based on the parameters use empty, which gets 
treated as zero.


As far as I can see, the engine only ever sends resizeStack with all 
parameters - so if your stack is getting a resizeStack with only two 
arguments - that's being sent from your code or a library you are using 
I think.


The work-around is the do Example 2 for resizeStack, but I think is 
might be considered an ENGINE BUG that on macOS, not Windows, 
maximization sends a resizeStack and then a desktopChanged message. No 
monitor has been added or removed, nor has the resolution of any 
monitor been changed, therefore I don't think a desktopChanged message 
SHOULD be sent on macOS window maximization. I think this is a bug?


Does anyone have a valid reason why macOS should receive a 
desktopChanged message on window maximization when Windows does not?


So the engine hooks into the notification from the OS for a change in 
screen parameters... The engine then checks the new ones against the old 
and sends desktopChanged if there are any differences.


In the case of maximization on macOS - using (what is now!) the 
fullscreen gadget on the titlebar of windows causes the OS furniture to 
ebb away - i.e. the *working* screenRect changes - and thus the engine 
sends the desktopChanged notification.*


(You can test this by creating a stack and 'answer the screenRect & 
return & the working screenRect' - click before and after the fullscreen 
gadget on the title bar, and there will be a difference.)


Warmest Regards,

Mark.

P.S. The message is also sent when the dock is adjusted in size too - so 
presumably you would see the same problem then (assuming your handling 
of the desktopChanged message is causing the errant resizeStack with 
only two arguments to be sent from script somehow).


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Which is faster...

2023-12-15 Thread Mark Waddingham via use-livecode

On 2023-12-14 21:22, Paul Dupuis via use-livecode wrote:
Which is faster or more efficient (from an engine performance 
perspective)?


To retrieve an array from a property?
As in:
command someHandler -- in an objects script
  get the cMyArray from me -- cMyArray is some multi-dimensional array
  ...
end someHandler

OR

To retrieve an array from a script local variable?
As in:
local sMyArray -- script local variable in some objects script

command someHandler -- in an objects script
  get sMyArray
  ...
end someHandler

Anyone know?


Fetching a value directly from a variable will always be faster than any 
other method - as it essentially reduces to fetching or storing a value 
from a (integer indexed) table.


In contrast, fetching a custom property will require a message send 
unless lock messages is set, and then an array lookup (to actually get 
the property's value).


Custom property sets are stored using the same data structure internally 
as livecode arrays so getting `the cMyArray of me` eventually reduces to 
the same as objectsCurrentPropertySet["cMyArray"] - the latter lookup is 
more work than just fetching a value from an internal table.


UPSHOT:

Fetching a value directly from a variable is a constant time operation.

If lock messages is false, then the time it takes to fetch a custom 
property value will be somewhat proportional to the length of the 
message path from the point of view of the object you are accessing - 
i.e. how many frontscripts, backscripts, stacks in use, and parent 
objects/behaviors the object has.


If lock messages is true, then the time it takes to fetch a custom 
property value will be pretty much the same as doing an LC array key 
lookup.


Now whether or not this actually matters in any one case will largely 
depend on how often such access is being done - if its a few times in 
the context of UI-related code then it probably won't be appreciable; 
if, however, you are fetching a custom property 10's of times in a 
tight loop and the rest of the loop is only doing small amounts of work, 
you'll definitely notice a difference.


SIMPLE BENCHMARK:

```

on mouseUp
local sMyArray

on mouseUp
   set the cMyArray of me to [ 1, 2, 3 ]
   put empty

   local tTime
   put the milliseconds into tTime
   repeat 100 times
  get the cMyArray of me
   end repeat
   put "CUSTOM PROP:" && the milliseconds - tTime & return after msg

   put the milliseconds into tTime
   lock messages
   repeat 100 times
  get the cMyArray of me
   end repeat
   unlock messages
   put "CUSTOM PROP (LOCKED OUTSIDE):" && the milliseconds - tTime & 
return after msg


   put the milliseconds into tTime
   repeat 100 times
  lock messages
  get the cMyArray of me
  unlock messages
   end repeat
   put "CUSTOM PROP (LOCKED INSIDE):" && the milliseconds - tTime & 
return after msg


   local tMyProps
   put [ 1, 2, 3 ] into tMyProps["cMyArray"]
   put the milliseconds into tTime
   repeat 100 times
  get sMyArray["cMyArray"]
   end repeat
   put "ARRAY ELEMENT:" && the milliseconds - tTime & return after msg

   put the milliseconds into tTime
   lock messages
   repeat 100 times
  get sMyArray
   end repeat
   unlock messages
   put "SCRIPT LOCAL:" && the milliseconds - tTime & return after msg
end mouseUp
end mouseUp
```

RESULTS (1 million iterations):

CUSTOM PROP: 2006
CUSTOM PROP (LOCKED OUTSIDE): 116
CUSTOM PROP (LOCKED INSIDE): 125
ARRAY ELEMENT: 80
SCRIPT LOCAL: 38

ANALYSIS:

The above results are run in the IDE which is important to mention 
because the message path in the IDE is typically longer than that in 
standalones (as the all extension libraries are loaded, and the IDE 
inserts its own front/back/stacks into the message path).


Accessing custom properties with messages locked is nearly 10x faster 
than without (again that multiplier will be vary with the length of the 
message path).


Using lock/unlock messages for every custom property access has a (quite 
negligible) 10% overhead - and the message path overhead (in the IDE) is 
about 40% of the total (the array element fetch will be the rest).


Accessing a script local is
  - about 50x faster than accessing a custom property when messages are 
sent
  - about 3x faster than accessing a custom property when messages are 
not sent

  - about 2x faster than accessing an array element

Just to reiterate - these figures are for 1,000,000 accesses done in a 
tight loop (in the IDE). If you do it for (say) 1000 iterations then the 
differences are within the margin of error of measuring a millisecond.


Overall, my suggestion would be probably to do a combination of both - 
if you are only reading from a custom property in a given loop, but are 
doing so multiple times for the same property (and the loop actually has 
a very high number of iterations!) then fetch into a local variable 
before the loop and then use that value (the same, to be fair, is true 
of calling functions 

Re: Property Inspector bug for keys with commas in the key name

2023-11-05 Thread Mark Waddingham via use-livecode
Indeed you can indirect through a variable - but you can’t do, e.g:

get the foo,bar,baz of me

Which was my point :)

Warmest Regards,

Mark.

P.S. Of course an obvious syntactic extension would be allowing quoting of the 
property keyword: the “foo,bar,baz” of me.

Sent from my iPhone

> On 5 Nov 2023, at 16:14, Curry Kenworthy via use-livecode 
>  wrote:
> 
> 
> Mark:
> 
> > to access your custom properties with `the X of` syntax -
> > it is *this* kind of access which is *not* possible
> > if the custom property name is not an identifier
> 
> Discussion is perception - Code is reality:
> 
>   put "I,love,commas*etc" into X
>   set the X of me to "Hi, Mark!"
>   answer the X of me
> 
> https://quality.livecode.com/show_bug.cgi?id=23512
> 
> Best wishes,
> 
> Curry Kenworthy
> 
> Radically Innovative Christian LiveCode Development
> "PASSION for Elegant, Efficient Code!"
> http://livecodeconsulting.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


___
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: Property Inspector bug for keys with commas in the key name

2023-11-05 Thread Mark Waddingham via use-livecode

On 2023-11-03 20:21, Paul Dupuis via use-livecode wrote:
You do make a good point about the documentation regarding custom 
properties. Assuming people read the documentation. At the same time, 
you used to be able to use commas in custom property names. As Curry 
noted, Livecode even used to use them in the standalone setting 
properties, so the mothership set a precedence.


The user guide's comments are really good advice *if* you want to access 
your custom properties with `the X of` syntax - it is *this* kind of 
access which is *not* possible if the custom property name is not an 
identifier (i.e. something you can use as a variable or handler name). 
(Remember that you can set the 'current' custom property set of an 
object and use `the X of` syntax to access the keys of that too - and if 
you do that, then any non-identifier keys are similarly not accessible).


So we haven't set a precedent by using commas in custom property names - 
its in a custom property set *and* they are never accessed via `the X 
of` syntax (only via `the SET[X] of` syntax) - and with such things 
(where you are using the custom property set as an array of data) I 
don't think the rule applies.


It's not really a problem since I can do updates by script. It is more 
of just an annoyance.


I agree its an annoyance - and is something which is resolvable (i.e. by 
adding a variant of the hilitedElement property of the treeview with one 
which returns a sequence rather than a string).


Feel free to file a bug report about it and we'll put it on the list to 
look at.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Crashing on M2 Mac

2023-11-03 Thread Mark Waddingham via use-livecode
Dan, could you file a bug with the offending line of code which crashed ios17 
with 9.6.10… Just so we can check it isn’t still there in 9.6.11 :)

Thanks!

Mark

Sent from my iPhone

> On 3 Nov 2023, at 16:48, Dan Friedman via use-livecode 
>  wrote:
> 
> To all,
> 
> Oops!  I am mistaken…. It wasn’t MacOS that had the issue, it was iOS 17 that 
> was problem.   iOS app built with 9.6.10 running on iOS 17 crashes when the 
> convert command is called.  I can (in my experience) absolutely confirm this. 
>  Debugged it down to the single line of code.  Rebuilt the app with 10.0.0 
> (dp 6) and the issue was solved.
> 
> Apologies for posting the wrong platform.
> 
> -Dan
> 
> 
> From: use-livecode  on behalf of 
> panagiotis merakos via use-livecode 
> Date: Friday, November 3, 2023 at 9:23 AM
> To: How to use LiveCode 
> Cc: panagiotis merakos 
> Subject: Re: Crashing on M2 Mac
> Hello all,
> 
> We are not aware of any bug in the "convert" command, and I think it is
> highly unlikely such a bug to affect M2 machines but not M1 ones.
> 
> We have a M2 machine running Sonoma which is used in the prerelease testing
> so my feeling is that if there was such a bug, we would have caught it in
> the prerelease testing of 9.6.11 rc1, which included a fix related to the
> system date on Sonoma. Also, a related report we got about the convert
> command - but turned out to be not a bug, is this one:
> 
> https://quality.livecode.com/show_bug.cgi?id=24362
> 
> BTW, the crash report that is attached in the first post indicates that the
> app was running under Rosetta (> Code Type:X86-64 (Translated))
> 
> @Peter
> If you have a reproducible recipe please do file a bug report and include
> your app or a sample stack - I can give it a try in my Sonoma M2 mac mini.
> 
> Kind regards,
> Panos
> 
> 
>> On Fri, 3 Nov 2023 at 14:05, Paul Dupuis via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>> 
>> Also, have you (or could you) try LC 9.6.11rc-1 and see if that has a
>> fix for the convert issue you found?
>> 
>> We use convert a lot (currently under LC 9.6.10) and can't take out app
>> to LC 10, so a 9.6.11 that addresses this convert bug is needed.
>> 
>>> On 11/2/2023 6:33 PM, Dan Friedman via use-livecode wrote:
>>> Peter,
>>> 
>>> I recently discovered (from one of my own apps) that a Mac app built
>> with 9.6.10 running on Sonoma crashes when the convert command is called.
>> I rebuilt the app in 10.0.0 (dp 6) and the app no longer crashes.   Hope
>> that helps!
>>> 
>>> - Dan
>>> 
>>> 
>>> From: use-livecode  on behalf of
>> Peter Bogdanoff via use-livecode 
>>> Date: Thursday, November 2, 2023 at 3:23 PM
>>> To: Paul Dupuis via use-livecode 
>>> Cc: Peter Bogdanoff 
>>> Subject: Crashing on M2 Mac
>>> A user is reporting crashing on his M2 Sonoma Mac.
>>> 
>>> This was a build of LC 9.6.10, with both Intel and Apple chosen in the
>> Standalone settings.
>>> 
>>> It did not crash with only Apple chosen, though there were script errors
>> that did not happen with non-M2 users (M1 is OK). I haven’t been able to
>> debug that since I don’t have an M2 Mac.
>>> 
>>> Has anyone used LC with M2?
>>> 
>>> Peter Bogdanoff
>>> 
 Process:   MITA [10810]
 Path:  /Applications/MITA.app/Contents/MacOS/MITA
 Identifier:com.artsinteractiveinc.mita
 Version:   3.0 (3.0)
 Code Type: X86-64 (Translated)
 Parent Process:launchd [1]
 User ID:   501
 
 Date/Time: 2023-11-02 13:22:17.1555 -0400
 OS Version:macOS 14.1 (23B74)
 Report Version:12
 Anonymous UUID:982CECFD-B763-4068-2C69-6639836A03DF
 
 Sleep/Wake UUID:   DAD13568-D6D9-4419-BF53-FA013DE5385B
 
 Time Awake Since Boot: 11 seconds
 Time Since Wake:   1041 seconds
 
 System Integrity Protection: enabled
 
 Notes:
 PC register does not match crashing frame (0x0 vs 0x1026B9E58)
 
 Crashed Thread:0  Dispatch queue: com.apple.main-thread
 
 Exception Type:EXC_BAD_ACCESS (SIGSEGV)
 Exception Codes:   KERN_INVALID_ADDRESS at 0x0004
 Exception Codes:   0x0001, 0x0004
 
 VM Region Info: 0x4 is not in any region.  Bytes before following
>> region: 140722906071036
   REGION TYPESTART - END [ VSIZE]
>> PRT/MAX SHRMOD  REGION DETAIL
   UNUSED SPACE AT START
 --->
   mapped file  7ffc9ad4-7ffcc03e8000 [598.7M]
>> r-x/r-x SM=COW  ...t_id=60eeba9b
 
 Error Formulating Crash Report:
 PC register does not match crashing frame (0x0 vs 0x1026B9E58)
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> 

Re: decrypt error junk

2023-11-02 Thread Mark Waddingham via use-livecode

On 2023-11-02 02:06, Tom Glod via use-livecode wrote:
I have found a "wrong decryption key" that does not return a bad 
decrypt

error, but returns garbage into "the result".
Every other wrong key correctly gives the usual error.
The right key works to decrypt.


What exact error do you get with a wrong key vs the not-so-wrong key?


the length of the encryption/decryption key is always 64 characters
it is always alphanumeric, because its a hash derivative, no weird
characters, always the correct length.
and the salt is the same for every key i tried.

I can program around it, but its unsettling.
I will report it, but in the meantime has anyone ever come across this
garbage in "the result" as a result of an incorrect. decryption key?


So I don't think this is a bug, but expected behavior.

The encrypt/decrypt operations are very low-level they 'simply' apply 
the specified

algorithm to the data.

Encryption/decryption is 'just' a mathematical function which uses the 
'key bytes'
and 'input data' to derive an output - in particular, decryption does 
not include
any validation checks to ensure the provided decryption key is what was 
used to

encrypt in the first place - that's something you have to do yourself.

There's a huge variety of ways to do this - but perhaps the simplest is 
to add your
favorite (simple) hash of the encryption key before the data being 
encrypted:




(pseudo encryption code - I don't know exactly what form of encrypt you 
are using!):


  local tKey, tHash
  put deriveMyEncryptionKey(tPassword) into tKey
  put md5Digest(tKey) into tHash

  encrypt tHash & tData using ... with password tKey

(pseudo decryption code - I don't know exactly what form of encrypt you 
are using!):


  decrypt tEncryptedData using ... with password tKey

  if byte 1 to 16 of tData is not md5Digest(tKey) then
throw "incorrect password"
  end if



Of course I'm now slightly intrigued as to what checks OpenSSL *can* 
actually do to
be able to generate a 'bad decrypt' message - so by all means file a 
bug/send a test
stack to support and we can at least advise on that (and potentially 
update the

docs).

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Modify timeout for shell function

2023-11-01 Thread Mark Waddingham via use-livecode

On 2023-11-01 11:20, Ben Rubinstein via use-livecode wrote:
An install which runs daily and makes a number of calls using the shell 
function occasionally reports

The process "..." exceeded the timeout of 10 seconds.

I'm not sure where this timeout is defined; I'm not totally sure where 
this message is coming from (the shell? LiveCode? the process that was 
invoked through the shell command?).


Definitely not LiveCode - LiveCode runs the shell process until it ends 
on all platforms its implemented on (I'll leave it for another day to 
ponder whether there should be some sort of timeout to account for 
rogue/hung processes!)


Assuming for a moment that this isn't a timeout internal to the process 
that I happen to be invoking, is there a way in LiveCode, or in shell 
configuration, to modify this timeout?


Doing a quick google for variants of "The process ... exceeded the 
timeout of 10 seconds" - then there are various results relating to 
Laravel - which is a PHP framework. So are you shell'ing to PHP? If so 
my guess is that whatever PHP script you are running is using 
sub-processes too, and has a process timeout set to 10s.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Filter with wildcards

2023-10-30 Thread Mark Waddingham via use-livecode
The filter command has had a ‘with[out] regex’ form for a long time - so I’d 
use a regex instead :)

(I’m pretty sure [ ] is a set of characters to match, rather than a list of sub 
strings, in wildcard expressions)

Warmest Regards,

Mark.

Sent from my iPhone

> On 30 Oct 2023, at 17:19, David Glasgow via use-livecode 
>  wrote:
> 
> Hi folks,
> 
> I am doing the above and struggling with an oddity that I can’t find guidance 
> on on Livecode or wider wildcard stuff
> 
> A simple example is I am searching text messages for 'with you' or 'with u’
> 
> so I use the wildcard form
> 
> *with [you,u]*
> 
> That finds all examples of both just fine.  However, it also finds ‘with 
> unlimited cheese’ and 'with us’, ‘with yours’ etc.  so I want a space after 
> both u
> 
> When I put two spaces inside the square brackets after each string, the 
> search still works but spaces seem to be ignored (so still finds the above 
> resamples I don’t want).
> 
> If I put a single space after the brackets the first bracketed string is 
> ignored and the filter only finds “with u “
> 
> Hope someone can help me stop pulling my baffled face
> 
> Cheers
> 
> David Glasgow
> 
> 
> ___
> 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: Oddity in 'currentCard' function?

2023-10-26 Thread Mark Waddingham via use-livecode

On 2023-10-25 13:57, Paul Dupuis via use-livecode wrote:

On 10/25/2023 12:34 AM, Mark Waddingham via use-livecode wrote:


If you want to do stuff with the current card of a stack, then don't 
use the currentCard property - 'this card of stack ...' *is* a chunk 
reference and thus it doesn't care whether the card has a name or not.




Okay, I get that  id  is a legacy return value when 
there is no name.


I'd just like to confirm that:

this card of stack "X"
and
the currentCard of stack "X"

refer to the same card, even if in different ways (actual object 
reference vs short name)?


Yes - 'the currentCard of stack "X"' is equivalent to 'the short name of 
this card of stack X'.


The currentCard property was added a very long time ago to be used by a 
project which never saw the light of day (I'm not sure I remember what 
it was now!)...


There was (apparently!) a need at that time to be able to switch cards 
in a stack *without* the stack coming to front (which is what happens 
when you use the only alternative 'go card ... of stack').


It was added as a property as that was the quickest/fastest way to do 
so, for something which I don't remember being entirely convinced by at 
the time - it wasn't documented for a long time, but then I think 
someone asked about it and it had been there long enough and it doesn't 
do any harm really so it was documented.


Basically, its main use was for changing card (i.e. as a settable 
property); rather than finding out what card was current (since that was 
already catered for via interrogating 'this card of this stack').


With hindsight, if the ability to switch cards without bringing the 
stack to front is indeed useful then it should probably be provided via 
a new command, or an augmentation of the 'go' command (like we have go 
visible / go invisible).


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Oddity in 'currentCard' function?

2023-10-26 Thread Mark Waddingham via use-livecode

On 2023-10-25 15:41, Craig Newman via use-livecode wrote:

Paul.

The construction "answer this card of stack “X” does not work if you 
are not on stack “X”:


answer the  currentCard of stack  “X”  —works

answer the name of this card of stack “X —works

answer this card of stack “X”—Nope


'this card of this stack' is an object reference - when evaluated in 
contexts which don't expect an object reference, object references 
return the *content* of the object, or an error (if the object has no 
content)... Only buttons and fields have content - in which case 
evaluating them returns the 'text' of the object.


Most things *don't* expect an object reference - places that do are 
where an object needs to be acted on, rather than a value being needed.


For example:

  set the X of 
  put exists()
  put there is an 
  answer 

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Oddity in 'currentCard' function?

2023-10-24 Thread Mark Waddingham via use-livecode

On 2023-10-24 18:00, Paul Dupuis via use-livecode wrote:

I think I found a oddity in the "currentCard" property.

The documentation states that the currentCard property return the short 
name of the current card of a stack:


for example: put the currentCard of stack "Untitled 1" into tCardName

You can then execute code such as: set the myProperty of cd tCardName 
of stack "Untitled 1" to tValue


...

But again, breaking that example above (set the myProperty of the 
currentCard of stack "Untitled 1" to tValue) into 2 lines:

put the currentCard of stack "Untitled 1" into tCardName
set the myProperty of cd tCardName of stack "Untitled 1" to tValue
FAILS if the card has no name.

Something just seems off here?


As Jacque said, if an object has an empty name then the short name 
returns ` id ` (i.e. an id chunk) - this is long standing 
behavior and one which I'm not sure is entirely helpful (it should 
perhaps just return empty!).


You see the same effect in other properties which return a 'short name' 
- e.g. the menubar of a stack. So its entirely consistent with 'object 
name' properties. (In these cases there is no string which such 
properties could return which would help distinguish unnamed things and 
that could be used to resolve them in some sort of chunk in a consistent 
manner as object names can be arbitrary strings).


If you want to do stuff with the current card of a stack, then don't use 
the currentCard property - 'this card of stack ...' *is* a chunk 
reference and thus it doesn't care whether the card has a name or not.


If you want the long id of the current card of a stack to manipulate 
'out of context' then use the long id:


   put the long id of this card of stack ... into tCardId

Of course, if you really want to use the currentCard (for whatever 
reason), then you need to make sure all your cards have names (which to 
be fair, is a good habit to get into - as is naming all objects with 
some, unique, name!).


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: OS X document icon missing

2023-10-19 Thread Mark Waddingham via use-livecode

On 2023-10-18 20:54, J. Landman Gay via use-livecode wrote:

On 10/18/23 10:35 AM, Paul Dupuis via use-livecode wrote:
If you have identified the document extension in the Standalone 
setting for macOS and set an ics file of icons (or the appropriate 
sizes required by Apple) than documents created by that app should 
display the icon.


No go. Here is the relevant part of the plist:

CFBundleDocumentTypes


CFBundleTypeExtensions

.rbox



The extension shouldn't have an initial `.` - I suspect that is the 
problem :)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Livecode 10dp6 and web fonts

2023-10-04 Thread Mark Waddingham via use-livecode

On 2023-09-27 15:49, Paul Dupuis via use-livecode wrote:
I get the value of web font support in LC10dp6 for WEB based 
applications.


However, if you making a multi-platform application, you still have the 
issue of UI consistency across platforms as web fonts can't be used in 
desktop standalones (or, I assume, phone standalones)


It is true that web fonts are a 'browser' thing - however, you can still 
download the underlying TTF files from the web font service and include 
them in native standalones if you want to use the same fonts across web 
and native apps (obviously, you need to check the license the fonts are 
served under - but that's true with any non-system fonts you might 
include at the moment).


In the future we could look at making font inclusion easier in 
standalones cross-platform (i.e. allow specifying fonts in the s/b at a 
higher-level and then it doing the right thing) - however, there are 
some engine improvements to font selection across the different 
platforms we need to do first (in particularly, 'fixing' the font 
enumeration properties and allowing specification of different weights 
and stretches via the textStyle properties!).


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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 ANR (App not responding | Jacque was right :-)

2023-09-15 Thread Mark Waddingham via use-livecode

On 2023-09-14 18:49, Klaus major-k via use-livecode wrote:
But I'm using a Mac and it looks like that tool is not available here 
in the SDK tools folder.

Maybe available somewhere in "Android Studio".

And my problem NEVER happened when I'm at home, only during band 
rehearsals and gigs! :-D


So this is perhaps the most useful observation...

This could suggest there is a either a difference in usage, or 
environment between the two places. e.g.


  - is the app used more / for longer at gigs compared to home?
  - how is the tablet powered at home vs at gigs?
  - how does the tablet connect to the internet at home vs at gigs? 
(even if the app does not use the internet, lots of background stuff on 
Android *does*)
  - when the problem happens is there anything specific you can think of 
in common with what you were doing / the app was doing / the device was 
doing just before? (e.g. does it happen just after the device has gone 
to sleep).


The fact it is 'hanging' suggests there is something (on startup?) which 
is failing and causing an infinite loop.


Is there anything in the startup code for the app which waits for 
something to happen? e.g. an network request, something to initialize 
etc.?


Warmest Regards,

Mark.

P.S. If you send your app's source to supp...@livecode.com with a rough 
outline of where to look for startup code etc. then Panos and I can take 
a quick look and see if we can see anything which may be causing your 
issue.


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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 by item ... of each and item ... of each

2023-09-03 Thread Mark Waddingham via use-livecode

On 2023-09-03 10:26, panagiotis m via use-livecode wrote:

Hello Matthias,

I do not think that the syntax "sort  by sortKey1 and 
sortKey2"

is supported


Heh technically it 'is' - and does do something but it won't be what you 
expected...


So the syntax for sort in this case is:

   sort  by 

This works by iterating over the elements in , passing each 
through the expression to generate a sort key list, sorting that list 
and then reordering the original list.


Expressions can contain the boolean 'and' operator, so:

   sort  by X and Y

Means that the sort key is evaluated as 'X and Y' for each element - 
meaning sort ends up sorting a list of 'true' and 'false' values.


As Panos says, if you want to sort by separate fields with decreasing 
priority you need to do multiple sorts from least priority to most - 
this works because 'sort' is stable (if two elements compare the same, 
then the order of them in the output list is the same as the first).


The alternative is to work out a sort expression which combines the two 
parts of the element you want to sort so that the sort keys sort in that 
order. This can be quite tricky, but (for example) - let's say your 
container has elements of the form:


   ,

So you want things in the 'obvious' sorted order - then you could use:

   sort tSections ascending text by format("%08d%08d", item 1 of each, 
item 2 of each)


Here the sortkey is defined so that the text sort of the sort keys is 
that same as sorting first by sub-section number and then by section 
number.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Pasting text and images together?

2023-09-02 Thread Mark Waddingham via use-livecode
You could poke around the raw clipboard data - this is platform specific (in 
terms of the keys) but gives a complete reflection of the system clipboard:

lock clipboard
put the keys of the rawClipboardData
unlock clipboard

This will dump what raw data types are present - then you can fetch using ‘the 
rawClipboardData[key]’.

Note that you need to lock and unlock the clipboard around ‘raw’ access.

Warmest regards,

Mark.

Sent from my iPhone

> On 1 Sep 2023, at 20:33, David Epstein via use-livecode 
>  wrote:
> 
> To clarify my original question:
> 
> I'm not expecting the built-in paste command to handle this task; I'm
> wondering if I can script my own paste command to handle it.
> 
> Richmond, I can write a script to "paste" an image by itself (by creating
> an image and setting its text to clipboardData["image"]).
> 
> But is there some way I can access both the text and the image that are on
> the clipboard after I have copied a combination of those from, e.g., a web
> browser?  (Pasting to Apple Notes confirms that the clipboard contains both
> text and image.)
> ___
> 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: is strictly a name

2023-09-01 Thread Mark Waddingham via use-livecode

On 2023-09-01 17:44, Paul Dupuis via use-livecode wrote:
I may just be experiencing a brain fart, but I have read the release 
notes several times, and I don't understand the purpose of the new:


is strictly a name

operator? Can someone explain its purpose in really basic terms or 
examples?


Its purposes is so that it is possible to tell when a value is a 'name' 
rather than a 'string' when the distinction is important. The cases 
where this is true are few and far between - indeed, the use-case it was 
added for was so that the exact runtime type of constant values 
generated when parsing script (e.g. from constant initializers) is 
preserved.


There are two kinds of strings internally - strings and names. All names 
are strings, but not all strings are names.


The difference is that there is only ever one instance of a name with a 
given string in memory - e.g. if two variables hold a name whose string 
is "foo", then they will hold the same pointer.


As to what names are - they are an optimization for cases where the 
engine will often do comparisons between them.


Names are implemented in a global hash table in such a way that caseless 
and case-sensitive comparisons are constant time (when both values being 
compared are names).


The keys of an array are names - which means the engine never has to 
compare the actual characters of a key in an array as it does a lookup.


Literals in scripts are stored as names - so if you have 100 instances 
of the string constant "foobar" throughout all your scripts as literals 
- there will only actually be one instance of "foobar"


Similarly, internally, object names, handler names and variable names 
are all stored as, well, names (again - because they are commonly 
compared against each other).


Some examples of where you can observe a name are:

   put "foo" is strictly a name => true

   put ("foo" & empty) is strictly a name => false

   repeat for each key tFoo in { "foo": true }
 put tFoo is a strictly a name => true
   end repeat

There might be a few other places where you could see a name rather than 
a string, but as mentioned above - its unlikely that 99.9% of people 
would ever need to worry about it :)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: [[ ANN ]] Release 9.6.10 RC-1

2023-08-20 Thread Mark Waddingham via use-livecode

On 2023-08-19 21:57, Tom Glod via use-livecode wrote:

Hello,

Does this mean we have JSON support in SQLite?

This is from the documentation.:

 In other words, the JSON functions went from being opt-in with SQLite
version 3.37.2 and earlier to opt-out with SQLite version 3.38.0 and 
later.


The SQLite JSON support was included in dbsqlite in 9.0.3 - 
https://quality.livecode.com/show_bug.cgi?id=21821


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Detecting when resizeStack is completed

2023-08-18 Thread Mark Waddingham via use-livecode

On 2023-08-18 17:03, David Epstein via use-livecode wrote:
How can I redraw objects after the user has resized the stack, but not 
continuously during the resize?  Releasing the mouse at the end of a 
resize does not appear to send a mouseUp message.


Normal window resizing is handled by the OS, so doesn't generate mouse 
events.


One way to get close to what you request is to only relayout your 
objects if the user has not changed the size within a short period. 
Something like:

```
local sPendingResizeId
constant kResizeTimeout = 20

on resizeStack pWidth, pHeight
   /* If there is already a deferred request to resize then cancel. */
   if sPendingResizeId is not empty then
  cancel sPendingResizeId
   end if

   /* Defer the request to resize for a further period. */
   send "_doResizeStack pWidth, pHeight" to me in kResizeTimeout 
milliseconds

   put the result into sPendingResizeId
end resizeStack

on _doResizeStack pWidth, pHeight
   lock screen
   ... do relayout ...
   unlock screen
end _doResizeStack
```

This defers the relayout code until a resize stack message has not been 
sent for the timeout interval.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Linux filenames in LC Server

2023-08-16 Thread Mark Waddingham via use-livecode

On 2023-08-16 06:37, Neville Smythe via use-livecode wrote:
So I misunderstood, I thought we were talking about Apache environment 
variables. Indeed the Terminal app reports


LANG=C

as a system env variable. But if this is not specifically a server 
problem, wouldn’t
that mean we could see the same behaviour with LC Desktop on Linux 
machines running
vanilla Ubuntu or Debian (which is what Dreamhost uses)? I haven’t 
tried this yet,

as it is a bit of pain to fire up my Linux emulator machine.


So the situation here is similar to that which you get on macOS. If you 
open Terminal, then the (UNIX) environment (variable-wise) which you get 
will be different from that you get when you double-click on an app to 
launch it. In the latter case, the executable is launched via the 
desktop environments 'launcher' process and will inherit the environment 
provided by that. Presumably, as Linux desktops mandate various things 
(like language settings), the locale and environment vars will be set 
appropriately.


An experiment, which make me wonder if this counts as a configuration 
problem or an actual bug in LC Server:


 In Terminal I type (actually paste) and execute

 echo “éü” > Carré.txt

(for Forum users like me who just see ? everywhere, that is 
[e-acute][u-umlaut][happyface emoji] in the content to be written to a 
file with [e-acute] in its name)


   This works without problem. The contents of the file are utf-8 
encoded, which I didn’t
need to specify, but I guess that is what the pasteboard provided. 
Terminal had no problem
creating or finding the file without needing those env settings. Of 
course it cannot *display*
the file name without knowing the encoding, so ls reports the filename 
as 'Carr'$'\303\251''.txt’
( readable as an ascii encoding, though not one I have seen before; 
note the single quotes)


I'm guessing here that this is a remote ssh session to your Linux 
server, and you are using macOS Terminal app to run and connect? If that 
is the case then the reason this works is because Terminal on macOS is 
UTF-8 (which is the *only* encoding macOS supports in its UNIX subsystem 
so you don't get the variance problem you do with Linux). This means 
that pasting text from somewhere else will paste the UTF-8 bytes - i.e. 
they will get transmitted over SSH to the remote linux machine.


As filenames are just sequences of bytes on Linux this works fine - 
however when you ask the remote terminal to list the files, it can only 
interpret the ascii chars (as the LANG is C) and thus emits octal 
escapes for the others - here this ix 0xC3 0xA9 which is the utf-8 
encoding of e-acute.



If I setup the env variables Mark suggests in the Terminal session

export LC_ALL="en_US.UTF8"
export LANG=“en_US.UTF8”

then Terminal is able to display the filename á la française.


So now the remote terminal knows how to interpret the sequences of bytes 
present in the filenames, and thus can emit them appropriately.


Cyberduck reports this filename correctly using the [e-acute] without 
having to set encoding
knowledge. And I can also create the file using Cyberduck with no 
problems. So IT knows about/expects/sets
up the encoding as needed. I bet other Linux-aware apps would also open 
or list such files without

drama or special configuration.


IT doesn't know - it assumes. I suspect that if you used Cyberduck to 
connect to a Linux server which is setup to *not* be utf-8 (so filenames 
are encoded with some other encoding), then it would display things 
incorrectly.


Of course, if the protocols it deals with specify the text encoding as 
utf-8 *and* the daemons running on said server are setup correctly (i.e. 
so that they process the filenames and such relative to the server's 
encoding) *and* they correctly convert the filenames from that encoding 
to the encoding mandated by the protocol then it would display fine.


Certainly FTP treats filenames as sequences of bytes - so at least for 
that protocol the client would have to assume UTF-8 or be told the 
correct encoding to do the correct thing.


However: in LC Server when I call "the long files" for the enclosing 
folder: crash!
(Actually an in-line error reported for this code line). To my mind 
that qualifies as

bug, even if the source of the crash is the same as for open file.


I take it by crash you mean a runtime error is logged, and that this 
only happens if the LANG / LC_ALL environment variables are not set?


This is the same issue as opening a file - the low-level text encoding 
from ASCII to the internal encoding used by strings in the engine will 
be failing because it encounters non-ASCII.


   On the other hand hopefully setting the environment variables as 
Mark suggests will
fix everything . Mark, could I clarify exactly how that “launcher 
script” is to be used…
I’m guessing the cgi configuration should point to that file to be 
executed when it wants
to open myscript.lc instead of pointing to the livecode-server 

Re: Browser widget: "Navigation request cancelled"

2023-08-15 Thread Mark Waddingham via use-livecode

On 2023-08-15 12:08, Ben Rubinstein via use-livecode wrote:

Is it possible to get any more detail about what's going on?


I'm guessing you are using 10-dp-5 :)

The issues here are regressions caused by the switch to WKWebView in 10 
(previously we used the older WebView system web browser API):


The missing progressChanged messages issue is 
https://quality.livecode.com/show_bug.cgi?id=24271


The missing other messages issue is 
https://quality.livecode.com/show_bug.cgi?id=24247


The latter is related to server vs local redirects in the web page.

Both should be fixed in the upcoming 10-dp-6.

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Linux filenames in LC Server

2023-08-15 Thread Mark Waddingham via use-livecode

On 2023-08-15 08:42, Neville Smythe via use-livecode wrote:
So if I understand Mark correctly, while one can create utf-8 encoded 
filenames directly in a terminal
session,  LC Server internally accesses Apache environment variables to 
encode/decode the filename
before opening a file rather than directly using the shell. Presumably 
this has something to do with

the engine being a server app having to respect the server environment.


So what is actually happening here is that there is a notion of a 
'SysString' in the engine. A 'SysString' is a string represented as a 
sequence of bytes in whatever encoding the host platform understands in 
its APIs. The engine converts its internal string representation to a 
sys string whenever it accesses a system API - e.g. for opening files.


In the case of Linux what encoding such 'sys strings' need to use 
depends on the environment - the encoding *could* be anything and thus 
the engine uses the UNIX 'iconv' library to convert from internal 
representation to the encoded bytes needed. I think this is what is 
causing the failure of the file APIs - iconv is refusing to convert a 
string with non-ascii characters to the 'default' 'C' locale as it can't 
(there is no mapping from, say, e-acute to ascii).


I should point out that textEncode/Decode do not use system APIs - the 
conversions between UTF* forms and 'native' are all built into the 
engine - so that part is fine - its the low-level connection between 
commands like 'open file' and calling the UNIX open API which is 
throwing an error on file name conversion.


On Dreamhost, as far as I can determine, the LANG and LC-ALL variables 
are *not* set (though WordPress
is running and it adds support for a swathe of languages, so surely has 
support for non-ascii filenames?)
The site is a shared hosting, so I do not have permissions to change 
the Apache conf files. I tried adding
the SetEnv commands in the .htaccess file but that didn’t work, 
although I could well be doing it wrong,

I am fumbling around in the dark here.


The only thing I've found so far is SetEnv which does look like it can 
only be configured in the host config for a domain which is slightly 
irksome. However, there is a way to launch the CGI engine with any vars 
needed.


I'm not sure how Dreamhost sets things up - indeed it might be worth 
asking their support if there is a way to configure environment 
variables which are passed through to CGI executables.


If there isn't then it can be done with a launcher script:

```
#!/bin/sh
export LC_ALL="en_US.UTF8"
export LANG="en_US.UTF8"
exec livecode-server
```

This would be a text file which has been made executable - and needs to 
be configured as the executable which is launched when a livecode server 
script is launched (livecode-server in the above needs to be the 
location of the livecode-server executable in the hosting setup).


I know others here use (or have used) Dreamhost in the past - so they 
might know more about how the above could be configured (although, 
again, Dreamhost support can probably help).



Unless there is some way to fix the configuration, it would seem that 
not only will opening files
fail but the detailed files (the long files) command will also fail if 
non-ascii characters are
encountered since it uses textEncode. I presume that using shell 
commands could be used as a workaround
for accessing the filesystem, as long as LC doesn’t do an internal 
textEncode as it passes the

variables to the shell!
However it also means one cannot use textDecode/Encode at all, not just 
for the filenames but also
content; and that could be a bummer. I haven’t encountered this so far 
because to this point I have
encoded content before uploading binary files to the server, but I can 
envision situations where I

would want to encode or decode server-side.


The problem isn't with textEncode/Decode - they work fine as mentioned 
above - its just the engine doesn't have the necessary information (due 
to lack of env vars) to know how to interpret/create the filenames the 
system APIs need.


I’m puzzled that this problem hasn’t been raised before. Surely the 
vast majority of website host
providers use Linux servers, and the Dreamhost configuration for shared 
hosting is most likely
standard. So has no-one in Europe (or Asia..) using LC Server wanted to 
create native-language
filenames? I think LC Server is a magnificent tool, but perhaps it is 
not as widely used as it

deserves! Or: they all found the fix and haven’t told us.


This is almost certainly a server setup/config thing - I guess apache 
(by default) runs CGIs in the most 'raw' environment possible by 
default.


The observation about Wordpress is interesting - certainly before PHP 
was 'unicodified' - the encoding of filenames was up to the script - 
i.e. you had to to encode/decode filenames appropriately yourself and I 
guess utf-8 was just assumed. With PHP7 I believe it handles unicode 
transparently a 

Re: Linux filenames in LC Server

2023-08-14 Thread Mark Waddingham via use-livecode

On 2023-08-14 12:30, Mark Waddingham via use-livecode wrote:
So assuming that the defaultFolder is accessible in your above script 
(as a read-only folder would also cause the same error) then there does 
appear to be something up here...


Okay so I'm pretty sure the linux server engine is doing the right 
thing.


As mentioned previously, Linux filesystems don't actually care what the 
encoding of a filename is - to linux its just a sequence of bytes


The interpretation is given by the 'locale' settings which are in effect 
for any given program.


So, when you run lc-server from a terminal session directly, its almost 
certainly the case that the LC_ALL and LANG environment variables are 
set to en_US.UTF-8 (or some other language code DOT UTF-8 - it is the 
UTF-8 which is the important bit).


On Linux, a C API nl_langinfo() is used to fetch the encoding to use 
when talking to the system APIs (e.g. filesystem APIs) - this (I 
believe) derives its information from LANG/LC_ALL.


If the latter *are not set* then it will likely default to the 'C' 
locale which has no interpretation of any non-ascii chars, and thus 
attempts to encode/decode utf-8 encoded filenames will fail.


My theory is that these variables are not set in the configuration for 
running CGIs in Apache (or whatever web server is being used in this 
instance).


Digging around it looks like Apache (at least) has a `SetEnv` directive 
which would allow these environment variables to be set, e.g.


  SetEnv LC_ALL en_US.UTF-8
  SetEnv LANG en_US.UTF-8

Although I'm not 100% sure where such things go, perhaps someone more 
conversant with apache config could chime in to suggest.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Linux filenames in LC Server

2023-08-14 Thread Mark Waddingham via use-livecode

On 2023-08-14 12:12, matthias rebbe via use-livecode wrote:

Hi Mark,

when i read Neville's post i thought also about normalize, although i 
really do not have a clue about the whole unicode stuff, but i 
remembered that the standalone builder make use of the normalize 
function. ;)


So i used this script on LC Server to write the seconds to a file 
containing an a-umlaut in its name.


put  normalizeText("testä.txt", "NFC") into tFile
put the seconds into URL ("binfile:")
put the result
put ""
put the files
put ""
put tFile

But that does not work. "The result" returns 'can't open file'.


Hmmm - I must confess that I misread Neville's post - he did explicitly 
mention 'creating' files... The normalization would only arise if the 
file already existed, but the requested (incoming) filename was 
normalized differently (thus resulting in the file not being found).


So assuming that the defaultFolder is accessible in your above script 
(as a read-only folder would also cause the same error) then there does 
appear to be something up here...


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Linux filenames in LC Server

2023-08-14 Thread Mark Waddingham via use-livecode

On 2023-08-14 02:45, Neville Smythe via use-livecode wrote:
OK, so the macOS *is* using utf-8 for its file names - the [e-acute] in 
the filename Carré.txt is rendered with two bytes [C3A9] not the single 
byte MacRoman encoding. I got tricked by copying the terminal listing 
into another program rather than hex dumping within the terminal, and 
somewhere in the process the native encoding was preferred.


So one must *not* textEncode a filename to utf-8 before writing a file 
to disk, LC deals with the encoding, although you *should” textEncode 
its contents.


Which leaves the problem of why I can’t get LC Server on Linux to write 
non-ascii filenames


So I suspect the problem here is normalization, rather than the 
inability of Linux to write non-ascii filenames.


Characters such as e-acute / e-grave have *two* representations in 
unicode - the decomposed and composed form.


The composed form is a direct mapping from the native encodings and is a 
single codepoint, the decomposed form will be two codepoints - (e, 
combining-acute/grave)


Depending on where the string comes from it might either be composed or 
decomposed - macOS filenames are stored decomposed in the FS, but the 
higher-level parts of the OS make either form work (in a similar fashion 
to how macOS filesystems are case-insensitive by default).


Linux filesystems, however, are both case-sensitive and form-sensitive - 
a filename must match byte to byte with what it was created with 
(indeed, linux filesystems care nothing for encodings, they see 
filenames as a sequence of bytes which are interpreted relative to the 
user's current locale - the default locale on linux these days is 
utf-8).


If your app is managing the files completely on Linux (i.e. it is 
creating / deleting them and the filenames are not user-editable) then 
(if this is the caseu) the problem should be fixable by choosing a 
normalization form when you create / lookup the file - i.e. pass all 
filenames on the server through `normalizeText(, )` - here 
you want form to be either "NFC" (composed) or "NFD" (decomposed).


Warmest Regards,

Mark.

P.S. For all the gory details about Unicode normalization forms see - 
https://unicode.org/reports/tr15/


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: LC 9.6.9 App uses too much memory!

2023-08-14 Thread Mark Waddingham via use-livecode

On 2023-08-13 14:29, harrison--- via use-livecode wrote:

Hi LiveCoders,

Clearly this is a bug in LC 9.6.9, but I don’t know what is causing the 
problem.
I noticed that others in the past have run into a similar problem.  Was 
this

ever reported as a bug?


Could you file a bug report with recipe and attach (or send to 
supp...@livecode.com if its sensitive) the stack and recipe for 
reproducing the problem so we can take a look.


Thanks in advance,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: charIndex property

2023-07-27 Thread Mark Waddingham via use-livecode
Oh those pesky chunks which don’t ‘cover’ the target string (which is actually 
all of them except codeunit/point/char come to think of it). I should have run 
through a few more examples in my head before posting….

Alternative attempt:

Put null into word N to -1 of S
Delete codeunit (codeunitoffset(null, S) to -1 of S
Return the number of chars in S + 1

The problem before was the chars which do not form part of the last chunk and 
remain after deletion.

The above puts in a sentinel char which can be searched for to find where the 
requested chunk started.

Second time lucky? ;)

Mark.

Sent from my iPhone

> On 27 Jul 2023, at 21:23, Paul Dupuis via use-livecode 
>  wrote:
> 
> On 7/27/2023 4:31 AM, Mark Waddingham via use-livecode wrote:
>>> On 2023-07-26 18:02, Paul Dupuis via use-livecode wrote:
>>> If I have some text in a field, I can use the "charIndex" property (see 
>>> Dictionary) to obtain teh character position of the first character of a 
>>> chunk.
>>> 
>>> Does anyone know of a clever way to do the equivalent of the charIndex for 
>>> an arbitrary chunk expression for a container/variable (i.e. not an actual 
>>> field object)?
>> 
>> This should work I think:
>> 
>>function charIndexOfWord pWordIndex, pTarget
>>   delete word pWordIndex to -1 of pTarget
>>   return the number of characters in pTarget + 1
>>end charIndexOfWord
>> 
>> Deletion of chunks works from the first char that makes up the computed 
>> range, so you are left with all the characters which sit before it.
>> 
>> The index of the character immediately before the start of the specified 
>> word is the just the number of characters which sit before it; and so the 
>> index of the first char of the specified word (which is what charIndex gives 
>> you in a field) is that +1.
>> 
>> The above should work for both +ve and -ve indices, and the obvious changes 
>> will make it work for other string chunks (i.e. change 'Word' for ).
>> 
> 
> Mark,
> 
> Thank you very much. This was a brilliant approach and I should have thought 
> of it myself. However, it is not quite an accurate substitute for the 
> charIndex property of a field. The following example illustrates the issue:
> 
> pTarget is [The quick brown fox jumps over the lazy dog. The lazy dog was 
> named "Oz".]
> pWordIndex is 8 (having been derived from searching for 'lazy', the 8th word)
> 
> Using [] to quote strings.
> delete word 8 to -1 of pTarget -- deletes [lazy] to ["Oz"] but not the period 
> (.) at the end since it is not considered part of word -1.
> This leaves pTarget as [The quick brown fox jumps over the .]
> The number of characters in pTarget + 1 is actually not the position of the 
> [l] in [lazy], which is character 36, but the [a] in [azy], character 37, due 
> to the period being left.
> 
> There are some similar issues, being off by  or more, with sentences and 
> paragraphs in longer text.
> 
> Thank you very much for chiming in with a good direction to try.
> 
> Paul Dupuis
> Researchware
> 
> 
> ___
> 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: LC on Sonoma beta

2023-07-27 Thread Mark Waddingham via use-livecode

On 2023-07-26 21:20, Marty Knapp via use-livecode wrote:
Anyone have any input regarding LC apps running on the Apple Sonoma 
beta? I have not installed it but have some customers who have and 
saying my app crashes.


Unfortunately LC does currently crash on startup on the macOS Sonoma 
beta releases - https://quality.livecode.com/show_bug.cgi?id=24278


We've investigated and have a fix.

As this essentially blocks any sort of testing of LC and LC apps on 
macOS Sonoma we are currently working on back-porting the fix to 9.6.9 
and doing a 'hotfix' release of that version (the fix will obviously 
then flow into the upcoming 9.6.10-rc-1 and 10.0.0-dp-6 releases).


I can't guarantee that there won't be other issues in macOS Sonoma as 
yet of course (as it is still beta software and a couple of months away 
from release), but at least we will actually be able to find out!


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: charIndex property

2023-07-27 Thread Mark Waddingham via use-livecode

On 2023-07-26 18:02, Paul Dupuis via use-livecode wrote:
If I have some text in a field, I can use the "charIndex" property (see 
Dictionary) to obtain teh character position of the first character of 
a chunk.


Does anyone know of a clever way to do the equivalent of the charIndex 
for an arbitrary chunk expression for a container/variable (i.e. not an 
actual field object)?


This should work I think:

   function charIndexOfWord pWordIndex, pTarget
  delete word pWordIndex to -1 of pTarget
  return the number of characters in pTarget + 1
   end charIndexOfWord

Deletion of chunks works from the first char that makes up the computed 
range, so you are left with all the characters which sit before it.


The index of the character immediately before the start of the specified 
word is the just the number of characters which sit before it; and so 
the index of the first char of the specified word (which is what 
charIndex gives you in a field) is that +1.


The above should work for both +ve and -ve indices, and the obvious 
changes will make it work for other string chunks (i.e. change 'Word' 
for ).


Hope this helps!

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Livecode 10.0.0dp5 new reserved words

2023-07-11 Thread Mark Waddingham via use-livecode

On 2023-07-11 13:26, Mark Waddingham via use-livecode wrote:
Anyway, we'll try and figure out what has changed to cause the change 
in behavior - at the very least we can go back and add a 'breaking 
change' warning to the release note for the change which caused the 
issue.


Okay so after a bit of digging I can confirm that this is down to an 
unintended consequence of implementation constant expressions.


The behavior prior to that feature was:

You are allowed to assign and evaluate variables whose name is the same 
as property keywords which can only appear as object properties (i.e. 
require an OF afterwards) and are not also constant keywords ('left' and 
'right' I think are the only two which are object properties and 
constants).


Further, if explicitVariables is true then you cannot declare such 
variables, but you can evaluate them. (In this case, they would act as 
unquoted literals - you can still assign indirectly using do with 
explicitVars turned off at the time of the do).


The reason it was changed was to fix a problem with the constants 'left' 
and 'right' being used in constant initializer expressions - but at the 
expense of object only properties not being able to be variables. That 
problem needs to be resolved in a different way.


So this is a bug/regression - not so much because of the use of 'tExt' 
(text) but because scripts which use any object property keyword as a 
variable name will break. As many object property keywords are not 
dictionary words - but compounds or contractions - this means that even 
scripts which conform to the long standing rule could fall foul.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Livecode 10.0.0dp5 new reserved words

2023-07-11 Thread Mark Waddingham via use-livecode

On 2023-07-11 13:20, Paul Dupuis via use-livecode wrote:
Thank you! Bug filed: 
https://quality.livecode.com/show_bug.cgi?id=24266


I am fine changing 'tExt'. As Martin just posted, ‘All words in the 
English Dictionary should be considered reserved words.’ is not a bad 
rule. Just to illustrate how the eyes and mind can play tricks, I have 
been using the variable 'tExt' for parsing file extensions for DECADES 
and ONLY TODAY realized that it was the word 'text'! I never saw it as 
a dictionary word until today!


Yeah - Martin is correct that the rule about words in the English 
dictionary should all be considered reserved is still very much in 
force, and has been around longer than I've worked here!


Cases of using 'tExt' is not uncommon - as it is really difficult to see 
that it is 'text'... Another one (which bit Ali recently) is `pLayer'. 
I'm sure there are a fair few other examples.


Anyway, we'll try and figure out what has changed to cause the change in 
behavior - at the very least we can go back and add a 'breaking change' 
warning to the release note for the change which caused the issue.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Livecode 10.0.0dp5 new reserved words

2023-07-11 Thread Mark Waddingham via use-livecode

On 2023-07-11 12:28, Paul Dupuis via use-livecode wrote:
Does anyone, including folks at the mothership, have a list of new 
reserved words in Livecode 10?


I have used a variable called "tExt" (t for temp, Ext for extension)  
to pull of the file extension from file paths. i.e. if tFile contains 
"C:/users/paul/desktop/image.png"


set itemDel to "."
put last item of tFile into tExt -- tExt contains "png"

However, in LC 10.0.0dp5, the word "tExt" (which is "text") now appears 
to be a reserved work and you can not use it as a variable. This is not 
true in LC 9.6.9.  This has me asking: Are there any other new reserved 
words I should refactor out of my code before I get mysterious errors?


I don't think we knowingly made 'text' not be allowed as a variable in 
non-explicitVariables mode...


You cannot explicitly declare `tExt` as a variable in 10 or 9.x or (I 
think) ever - but it obviously worked in 9.6.x and before if you don't 
use explicitVariables.


I'm not sure what change we've made which has caused that - file a bug 
and we'll look into it - its probably a regression, but could be a 
(necessary, but unrealized) side-effect of another change we've made 
internally.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Different default bg color of stacks Mac/Win

2023-05-11 Thread Mark Waddingham via use-livecode

On 2023-05-11 15:51, Klaus major-k via use-livecode wrote:

Hi Mark,

Am 11.05.2023 um 16:49 schrieb Mark Waddingham via use-livecode 
:


On 2023-05-11 15:45, Klaus major-k via use-livecode wrote:
See screenshot of a stack with two OPAQUE (and white) text fields 
created

on Mac and opened on Windows. Surprise, surprise...
<https://www.dropbox.com/s/n58ahwlivvzygmy/windows_grey_bg.png?dl=0>
Is this a bug or feature?
If a bug, should I create a report for that?


Not a bug - the default is to use 'native' themes on desktop 
platforms, and that also

influences the background color of a stack.


aha, thanks for the quick answer. Is this documented somewhere?


Yes - in the dictionary entry for the backgroundColor property of 
objects:


```
Cross-platform note: On Mac OS, OS X, and Windows systems, if the 
backgroundColor of all objects in the object hierarchy is empty, the 
background color set by the system is used.

```

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: generate an Array using value for naming the keys?

2023-05-11 Thread Mark Waddingham via use-livecode

On 2023-05-11 15:47, matthias rebbe via use-livecode wrote:

Mark, thank you very much!

i didn't know or remember that the key name of an array can be created 
directly using strings and variables


Maybe i even did that in the past, but could not remember anymore. I 
really thought i have solved it that time with value()  :)


No problem - of course, I used & in my example - but when I'm doing 
stuff like that I tend to use format:


put tFoo[format("wp_%s_%s", tMiddlePart, tSuffix)] into 
tMiddlePartSuffixValue


It does the same job, but I find it more readable (as the structure of 
the string can be seen immediately without having to wade through quotes 
and ampersands :)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Different default bg color of stacks Mac/Win

2023-05-11 Thread Mark Waddingham via use-livecode

On 2023-05-11 15:45, Klaus major-k via use-livecode wrote:
See screenshot of a stack with two OPAQUE (and white) text fields 
created

on Mac and opened on Windows. Surprise, surprise...



Is this a bug or feature?
If a bug, should I create a report for that?


Not a bug - the default is to use 'native' themes on desktop platforms, 
and that also

influences the background color of a stack.

If you don't want that - then you need to explicitly set the background 
color.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: generate an Array using value for naming the keys?

2023-05-11 Thread Mark Waddingham via use-livecode

On 2023-05-11 14:36, matthias rebbe via use-livecode wrote:
The middle part of the key names changes and there can be about 50 
different "middle parts" and there are 10 main keys (after the middle 
part)

_content, _text _html and so on.

So without an idea i would have to create the code to fill all values 
for the array keys with the middle part aa and then the code  for the 
middle part cd and so on.


Is there a way to use value for this. So i could just add the middle 
part of the key name to a variable and use that then with value() to 
create and file the array?


Perhaps I'm misunderstanding what you are trying to do as you mention 
using value() for something which doesn't sound like it needs it...


Array keys can be arbitrary (string-valued) expressions - i.e. they 
don't have to be literal strings:


e.g. put tFoo["wp_" & tMiddlePart & "_" & tSuffix] into 
tMiddlePartSuffixValue


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Custom property retrieval incorrect

2023-04-28 Thread Mark Waddingham via use-livecode

On 2023-04-27 23:32, J. Landman Gay via use-livecode wrote:
Those are exactly the two values I get too. The earliest version of LC 
I currently have installed is 9.6.7 and it happens there and in three 
newer versions after that.


A custom property named "cVers" works okay. But I've been using 
"cVersion" for years and years, so not sure what the ripple effect may 
be if I update my older apps (which is how I found this one.) For now I 
can change the name of the property, I guess.


Thanks for tracking it down, Mark. I'm not crazy after all.

On 4/27/23 5:09 PM, Mark Wieder via use-livecode wrote:


The 1.0.4 cVersion comes from com.livecode.library.i18n.1.0.4
The 3.0.9 cVersion comes from 
com.livecode.library.smartcrumbsvcw.3.0.9


Unfortunately the scripts for both are locked, so there's no 
workaround other than not using the cVersion custom property.




@MarkW : Thanks for tracking down which libraries it is.

@Jacque (and anyone else): You can just remove those two 
libraries/extensions from My LiveCode for now (assuming you aren't using 
them).


I've poked the developers of them and asked them to remove the offending 
getProp handlers from those libraries - hopefully an update will go out 
next week :)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Problem using AppleScript of "system events" to click a location on screen

2023-04-27 Thread Mark Waddingham via use-livecode
You didn’t mention the kind of mac you are running and whether either the 
standalone or ide is running in rosetta or not :)

To be fair, that part was about the exec error rather than the expected outcome 
though…

The reason you are seeing the effect you are when not doing the request from a 
separate process is that executing applescript is a modal operation (Ie you 
can’t get an application to use AppleScript to control itself) - and I suspect 
the accessibility framework is timing out internally and just doing the best it 
can in that situation.

Warmest Regards,

Mark.

Sent from my iPhone

> On 27 Apr 2023, at 19:22, Ben Rubinstein via use-livecode 
>  wrote:
> 
> Update to note:
> 
> 1) Difference in LiveCode versions.
> 
> Under the IDE in LiveCode 9.6.7 behaviour is as per the standalone; no click, 
> and 'the result' is the path to the control.  Under the IDE in LiveCode 9.6.8 
> or LiveCode 10.0.0dp5, 'the result' is "execution error".
> 
> 2) The browser widget is a red herring; relevant only insofar as if it was 
> some other spot on the stack, I could just the LiveCode "click at ". 
> Whether over the browser widget or some other part of the stack window, 
> invoking the applescript returns the identity of the control at that 
> location, rather than clicking it (in LC 9.6.7 IDE, or standalone built from 
> any version); or execution error in later IDEs.
> 
>> On 27/04/2023 16:42, Ben Rubinstein via use-livecode wrote:
>> I had a need to click on an element in a web page loaded in a browser widget 
>> on a card.
>> There might be an elegant way to do this using javascript injected into the 
>> widget, but I'm too ignorant to figure it out.
>> So to save time (hah!), I though I could use the accessibility functionality 
>> to just click on that bit of the screen. I could get the location to click 
>> within the stack, then use globalLoc to convert it to screen coordinates.
>> (This is just a personal stack to achieve an objective, nothing that's ever 
>> going to be shared with anyone else, so any filthy/fragile method is OK if 
>> it works.)
>> I tested this in Script Debugger:
>> tell application "System Events"
>> click at {917, 667}
>> end tell
>> It worked fine.
>> So then I tried the same script in my stack, via
>> do ... as "applescript"
>> And after a brief spinning pizza, got the dry result "execution error".
>> I expected that this would happen because I needed to give it permission to 
>> control the computer; but after granting that in System Preferences, there 
>> was no change.
>> Just for fun, I tried building a standalone from my stack. This demonstrated 
>> a different effect: first I got the same result "execution error". Then I 
>> granted it permission for this standalone app to 'control the computer'. 
>> Now, there's still no evidence that it sends a click; but it gives a 
>> different result, which I think is the path to the UI element corresponding 
>> to that location. If the point is over a native control in the stack, it's 
>> something like
>>  window "Ben Test Stack (1)" of application process "Ben Test Stack"
>> of application "System Events"
>> (I don't think LiveCode controls are recognisable by the accessibility 
>> system.) If the point is over the browser widget, 'the result' is something 
>> like:
>> group 2 of UI element 1 of scroll area 1 of group 1 of group 1
>>  of window "Ben Test Stack (1)" of application process "Ben Test Stack"
>> of application "System Events"
>> ("Ben Test Stack" is the name of my stack and of the standalone. My guess 
>> about the complicated control path is that it reflects the complicated web 
>> page loaded in the browser widget.)
>> So that does suggest that there is something which doesn't quite work about 
>> giving the IDE permission to use the Accessibility Framework, but which does 
>> for a standalone. But still doesn't explain what the problem is.
>> I finally solved my problem with an even uglier hack: compiling the script 
>> from Script Debugger as an 'application', and then in my stack, instead of 
>> executing the applescript directly, using "launch" on that application. 
>> Yeuchh.
>> Can anyone shed light, either on how to grant the IDE permission to use the 
>> Accessibility controls; or on why the applescript wouldn't work?
>> TIA,
>> Ben
>> ___
>> 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

Re: Weird window behavior

2023-04-27 Thread Mark Waddingham via use-livecode
Okay that is strange - but the fact it is happening when levure is loaded 
suggests it is some property or mechanism it is adding.

The engine only really has three things (that I can think of) which change 
window stacking order…

The backdrop - which makes the engine *try* to keep all the windows next to 
each other, with the backdrop window immediately behind the bottom one; 

The ‘raiseWindows’ global property which is basically the same as the backdrop 
feature - except the backdrop has zero width and height.

The go command which raises a stack to the top (amongst those with same mode).

So i’m not sure how a script in levure could cause that effect - unless it’s 
setting ‘the raiseWindows’ to true (thus making the problem you are seeing the 
same as the backdrop issues that others are on Ventura).

Anyway, the fact it requires levure to be loaded for it to happen means we can 
track it down!

Warmest Regards,

Mark.

Sent from my iPhone

> On 27 Apr 2023, at 19:58, Marty Knapp via use-livecode 
>  wrote:
> 
> No, not using the backdrop feature. I did try the suggestion on bug 24200 to 
> change the system setting "Group Windows By Application" in the "Desktop and 
> Dock System Setting" preference pane to true. Same behavior, even after a 
> restart. And it is happening in both the IDE and in a standalone. The 
> standalone is built with the Levure framework. In the IDE the issue only 
> happens *after* I’ve loaded the Levure framework.
> ---
> Marty Knapp
> 
>> On Apr 27, 2023, at 9:39 AM, Mark Waddingham via use-livecode 
>>  wrote:
>> 
>>> On 2023-04-19 19:25, Marty Knapp via use-livecode wrote:
>>> Ever since I updated to Ventura on my Mac I've had this weird behavior both 
>>> in the IDE and in two different standalones - if I have more than one stack 
>>> open, when I click on a stack that is behind another stack to bring it to 
>>> the front, it very briefly comes to the front (flashes), then goes back 
>>> behind everything, even windows from other apps. If I click on the title 
>>> bar it does not do this. In the menubar is still indicates that I'm in my 
>>> app. It's not happening with any non-Livecode apps and it's occurring on 
>>> two different Macs. I’m not seeing this behavior on OSes previous to 
>>> Ventura.
>>> Am I going crazy?
>> 
>> Do you (or anyone else who has chimed in on this list) have the backdrop 
>> feature enabled?
>> 
>> The reason I ask is that the behavior you describe is similar to this report 
>> https://quality.livecode.com/show_bug.cgi?id=24199 (I think at least) - 
>> which has now reduced to being due to the backdrop - 
>> https://quality.livecode.com/show_bug.cgi?id=24200.
>> 
>> Warmest Regards,
>> 
>> Mark.
>> 
>> -- 
>> Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
>> LiveCode: Build Amazing Things
>> 
>> ___
>> 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: Custom property retrieval incorrect

2023-04-27 Thread Mark Waddingham via use-livecode
Intriguing - my guess is that something in the message path in your IDEs has a 
getProp cVersion handler.

Now it could be something built into the IDE - although I’m not sure what - or 
it could be a plug-in or extension.

An easy way to find out is to temporarily rename the ‘My LiveCode’ folder and 
restart the IDE to see if it still happens…

Warmest Regards,

Mark

Sent from my iPhone

> On 27 Apr 2023, at 20:51, J. Landman Gay via use-livecode 
>  wrote:
> 
> I have a custom stack property called "cVersion" that is used to determine 
> update availability and is shown in an About stack. In LC 9.6.7, 9.6.9, and 
> 10.0.0 dp 5 the custom property is returned incorrectly.
> 
> I set the cVersion of the stack to 3.0.0 in the property inspector and also 
> tried from the message box and from a handler. In both the message box and in 
> a script it returns 3.0.9. I saved the stack, quit LC, relaunched and opened 
> the stack and it then reported 1.0.4. I don't know where these numbers are 
> coming from.
> 
> There are three substacks but none of them have any custom properties at all. 
> When I open the stack property inspector it does correctly say "3.0.0".
> 
> I deleted the custom property completely and then re-entered it. It still 
> says 3.0.9 on a new launch.
> 
> I created a new custom property called "cVers" and it does report 3.0.0 as 
> specified. Other custom stack properties also retrieve correctly, it is only 
> this particular one that fails.
> 
> Anyone seen this? Is there something special about a custom prop named 
> "cVersion"? This used to work fine, but that was about 2 years ago.
> 
> -- 
> 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


___
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: Weird window behavior

2023-04-27 Thread Mark Waddingham via use-livecode

On 2023-04-19 19:25, Marty Knapp via use-livecode wrote:
Ever since I updated to Ventura on my Mac I've had this weird behavior 
both in the IDE and in two different standalones - if I have more than 
one stack open, when I click on a stack that is behind another stack to 
bring it to the front, it very briefly comes to the front (flashes), 
then goes back behind everything, even windows from other apps. If I 
click on the title bar it does not do this. In the menubar is still 
indicates that I'm in my app. It's not happening with any non-Livecode 
apps and it's occurring on two different Macs. I’m not seeing this 
behavior on OSes previous to Ventura.


Am I going crazy?


Do you (or anyone else who has chimed in on this list) have the backdrop 
feature enabled?


The reason I ask is that the behavior you describe is similar to this 
report https://quality.livecode.com/show_bug.cgi?id=24199 (I think at 
least) - which has now reduced to being due to the backdrop - 
https://quality.livecode.com/show_bug.cgi?id=24200.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Problem using AppleScript of "system events" to click a location on screen

2023-04-27 Thread Mark Waddingham via use-livecode

On 2023-04-27 16:42, Ben Rubinstein via use-livecode wrote:
Can anyone shed light, either on how to grant the IDE permission to use 
the Accessibility controls; or on why the applescript wouldn't work?


Not immediately - no :)

However, three questions... What version of LC are you using? Are you 
using an Apple architecture mac? If so, is the IDE running under 
Rosetta, and the standalone native, or vice-versa (or both the same)?


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: more then 1 browser widget in a web standalone?

2023-04-24 Thread Mark Waddingham via use-livecode

On 2023-04-24 15:46, matthias rebbe via use-livecode wrote:
I can now confirm that more than one Browser Widget will work in Web 
standalones, but not all URLs that work in LC IDE or Desktop 
standalones will work in Web standalones.

For example this one here fails in Web Standalones.

https://www.whatismybrowser.com/de/


The web browser widget is implemented as an IFrame - this comes with it 
a fair amount of security restrictions unless the website being embedded 
has appropriate cross-origin settings (or comes from the same host as 
the surrounding page).


In this case, I suspect the website is just refusing to be embedded - 
indeed if you go to:


   
https://www.w3schools.com/html/tryit.asp?filename=tryhtml_iframe_height_width


Then change the src to the website above then it won't work there 
either.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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 13?

2023-04-23 Thread Mark Waddingham via use-livecode
But building standalones for minimum Android version 13 is not 
possible, correct? At least only 5 to 12 are currently possible options 
in the standalone builder.


We really need to make that drop-down work out its values from the built 
engine somehow :)


The min-version controls the lowest version of Android the app will 
install on - not whether it will run. i.e. You don't set to in order to 
make the app run on (say) Android 13, but to say that it *only* runs on 
that version.


(If you do need to make an app only run on Android 13, for some reason 
right now, you would need to use a custom manifest)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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 13?

2023-04-23 Thread Mark Waddingham via use-livecode

On 2023-04-22 20:41, J. Landman Gay via use-livecode wrote:
I believe this is an error relating to the target version embedded in 
the app. Google's policy says that new and updated apps must target an 
Android API no earlier than 2 versions behind the current one. Since 
API 33 is current, your app must target at least API 31. Android 14 
will be released very soon (in a couple of weeks I think) and any apps 
submitted after that will need to target API 32+. Note that the target 
API is not the same as the minimum supported version which can be much 
lower.


Google have now made it so that the effects on appstore submission are 
on a fixed date each year - August 31st - 
https://support.google.com/googleplay/android-developer/answer/11926878?hl=en.


So the release of Android 14 won't affect the ability to submit apps or 
updates.


We'll update the engine and s/b appropriately by the August deadline 
though :)


LC 9.6.9 targets API 31. I don't think LC 10 has updated the target 
yet, so 9.6.9 is your best bet. The target API has to be an LC engine 
update, we can't change it ourselves.


So 10-dp-5 includes all (maintenance related changes) in 9.6.9 - so also 
contains the updates to Android (and iOS) version targets.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: [[ ANN ]] Release 10.0.0 DP-5

2023-04-20 Thread Mark Waddingham via use-livecode

On 2023-04-18 20:58, Mark Wieder via use-livecode wrote:

I would so like to like this release:
script widgets
expression constants (finally!)
etc...

but it's so wonky on linux that I'd have to write up a slew of bug 
reports. Essentially unusable for me in ways that dp4 behaves.


I'm looking forward to dp6.


Heh - well if there is a Linux specific issue that we haven't seen but 
you do - then its not likely to be fixed in dp-6 unless we know what it 
is :D


We've already identified a problem with the 'after' message which causes 
the layout of the IDE palettes to not update correctly - and are fixing 
:)


Beyond that, do you get (as many) problems if you run the IDE without 
any plugins and such? (i.e. an empty 'My LiveCode' folder)


The reason I ask is that we have (unusually) made two 
backwards-incompatible script changes in dp-5 in order to accommodate 
constant initializer expressions - both touch on edge-cases, but hey, 
edge-cases happen. There is a small possibility that a plugin or similar 
which contains such an edge case could break and thus be causing errors 
and thus destabilize the IDE.


Specifically:

The tokenization of numeric literals (i.e. numbers) is now much more 
strict - https://quality.livecode.com/show_bug.cgi?id=23653. Previously 
a numeric token which had an 'error suffix' would encompass the suffix 
into the token rather than treat it separately.


The right-hand side of an initializer is no longer treated as a token 
(this is key to having them as expressions at all!) - 
https://quality.livecode.com/show_bug.cgi?id=19413. Previously if you 
had an initializer which was an engine constant, then the initialized 
value would be the name of the constant and not its value (e.g. local 
tFoo = empty => tFoo = "empty" and not "").


The fix to both is to quote the offending token.

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Which sqlite?

2023-04-17 Thread Mark Waddingham via use-livecode

On 2023-04-15 12:13, Neville Smythe via use-livecode wrote:
Is it possible to direct LC to use a custom version of sqlite3 rather 
than its default?


I ask because the installed version of sqlite which come installed with 
macOS, and which I assume LC uses when it initialises its database 
library, is crippled ---arithmetic functions which come with the 
standard augmentation of sqlite (such as floor(), log() etc) are not 
enabled, similarly regular expressions are not enabled. It is easy 
enough to install a more capable version of sqlite on the Mac, but I 
don’t see a way to get LC to use it.  Possibly there is an environment 
variable or an initialisation handler which can be edited? (Note that 
Apple goes to some lengths to make it difficult to overwrite the 
installed sqlite in the system, and such a change would be lost on the 
next os update anyway.)


If LC is using its own built-in sqlite and dylib rather than the 
os-provided package, then is there a way to update that to one own 
version?


The version of sqlite we use is compiled in to the dbsqlite driver and 
thus is independent of any installed libraries. We've already got a 
pending request (https://quality.livecode.com/show_bug.cgi?id=24051) to 
update it to a newer version so if you just drop a note on there 
reminding us to enable the math functions and REGEXP extension then 
we'll enable those at the same time.


The update will likely go into the next 9.6 maintenance release 
(9.6.10), and also appear in a subsequent 10dp.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: 9.6.9 iOS compile error

2023-04-13 Thread Mark Waddingham via use-livecode
On 2023-04-14 03:48, Andrew at MidWest Coast Media via use-livecode 
wrote:
When compiling the same app using 9.6.9 and Xcode 14.2, my submissions 
are getting rejected by Apple when attempting to upload with 
Transporter:


ERROR ITMS-90502: "Invalid Bundle. Your binary, 
'com.midwestcoastmedia.link', has a 64-bit architecture slice, so you 
must include the "arm64" value for the UIRequiredDeviceCapabilities key 
in your Xcode project. Learn more 
(https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW3).”


I’m guessing I could just update the info.plist manually but I was 
really trying to avoid that long term.


So with the move to Xcode14.2 we can no longer build 32-bit slices in 
iOS so we have had to remove those from the engines in 9.6.9 - however 
we did miss the fact that currently the S/B will only include the 
`arm64` capability *if* the min iOS version is 11.0 and above (the arm64 
capability is required as there is only a 64-bit slice!).


Thus you can either change the min version to 11.0 - or just tweak the 
revsaveasiosstandalone script - at around line 1771 there is:


   -- Building for iOS 11.0 or more only builds the 64bit slice, so 
update the plist

   if pSettings["ios,minimum version"] >= 11.0 then
  put "arm64" after it
   end if

Removing the 'if' and making this unconditional will ensure that the 
arm64 key is always present.


Sorry for the inconvenience.

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Unable to load Preferences LC 9.6.9rc3 and Levure 9.0.5

2023-04-10 Thread Mark Waddingham via use-livecode

On 2023-04-08 14:58, bob--- via use-livecode wrote:

I'm wondering if anyone might be able to help me out. I’m trying to
use LC 9.6.9rc3 with an app built with Levure. With LC 9.6.9rc2 I am
able to open the app in the IDE with no issue.

When I try to open the app with LC 9.6.9rc3 I get “An error occurred
while initializing the application [unable to load external
Preferences]”. I’m tracing through the Levure script now and can see
in fact the Preference stack is not being loaded. I’ve confirmed
Preferences.bundle is at the location referenced in the script.

Can anyone steer me in a direction for a fix to this?


So you'll need to (for now) use `Get Info` on LiveCode.app in Finder, 
and ask it to 'open in rosetta'... Then when building any standalones, 
disable generating a the arm64 slice (you can do this in the MacOS pane 
of standalone settings).


The reason is isn't working is that the preferences external included in 
Levure does not have a ARM64 slice - so won't load when the engine is 
running using that architecture.


The preferences external will need to be rebuilt with an arm64 slice and 
included in Levure.


(When looking at this the other day, I did notice that Levure has an LCB 
extension which can do preferences stuff on macOS - bypassing the need 
for an external, but I couldn't see how you opt to use that instead of 
the external).


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: running platform-native by default

2023-03-24 Thread Mark Waddingham via use-livecode

On 2023-03-22 19:45, Phil Davis via use-livecode wrote:
I'm using LC 9.6.8 to build some macOS Intel/Silicon ("dual-native") 
apps.


Upon first launch of these apps on my Silicon test machine, I always
get the OS dialog that says "To open '', you need to install
Rosetta. Do you want to install it now?" I always click the "Not Now"
button because I want the apps to run native by default, wherever they
are running. (I'm avoiding installing Rosetta on that machine.)

I discovered I can avoid getting the Rosetta dialog this way: After
installation and before first launch, do a "get info" on the installed
app. In the macOS Info dialog, check AND uncheck the "Open using
Rosetta" checkbox. Close the dialog and now the app will launch in
native (Silicon) mode.

MY QUESTION:
Is there a way to pre-set my apps so their first launch uses the
engine that's native to the platform they're installed on? It seems
like there ought to be a way. I can't expect all my users to jump
through this manual hoop - and it just looks unprofessional to me.


Yes - you just need to tweak the plist - there's an 
LSArchitecturePriority (or similar!) entry which determines the order 
the slices in the executable are considered.


We made x86-64 the primary architecture in 9.6.8 to ensure by default 
people didn't potentially use an architecture (i.e. arm64) which hadn't 
been well tested (i.e. making it optin).


In 9.6.9-rc-3 (which is, hopefully, imminent!), we'll be removing the 
experimental tag from the arm64 slice and make the priority the default 
- i.e. on arm macs LC and its standalones will run using the native 
(arm64) architecture by default.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: ChatGPT examples

2023-01-20 Thread Mark Waddingham via use-livecode

On 2023-01-20 13:05, Alex Tweedly via use-livecode wrote:

We need a better algorithm. If we use a "linear scan", we can change
it from essentially Order(N**2) to approx Order(N).


Slightly pedantic point (I appreciate that you did say 'approx')...

Sorting can not be done in any less time than O(N*log N) - so the 
revised algorithm is O(N*log N) as you have to sort the input for it to 
be able to scan linearly.


:D

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Standalone riddle

2023-01-20 Thread Mark Waddingham via use-livecode

On 2023-01-17 21:39, J. Landman Gay via use-livecode wrote:

That's true, but is there a way to avoid including the remote debugger
in a test app when the device is cabled to the computer?


I think you just need to ensure 'Script Debug Mode' is turned off before 
clicking Test. (The remote debugger adds and removes itself from an 
internal list of things to include when using test as the 
preference/option changes).


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things

___
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: Lock screen and animated gif

2022-12-21 Thread Mark Waddingham via use-livecode

On 2022-12-20 18:27, Paul Dupuis via use-livecode wrote:

If someone switches to another applications (so a suspendStack is
executes and does the currently executing script get suspended?) and
then back to a different window/stack, could that also change the
defaultStack for the currently executing script when it resumes? It's
just another real=world user behavior we see with people using our
research tool.


No that shouldn't affect things - the way the engine calls handlers 
responding to an event is such that the defaultStack will always be 
restored to what it was before the handler is called.


The way pending messages are dispatched is such that it will only 
restore the defautlStack if it is the same as the stack it was when the 
handler was entered.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Lock screen and animated gif

2022-12-20 Thread Mark Waddingham via use-livecode

On 2022-12-20 15:48, Paul Dupuis via use-livecode wrote:

I'm just using this post to raise awareness on the list (if anyone
reading this doesn't know this already)

When using 'wait 0 with messages' any messages in the pendingMessages
(who are not delayed in time) get processed. This includes
(potentially) user clicks (mouseDown and mosueUp events). In a
multi-window application, this can be a click on another window,
changing the defaultSTack. If the original script with the 'wait 0
with messages' does not use fully qualified object references, script
execution errors can result. Example:


My (admittedly quick!) tests indicate that this isn't entirely 
accurate...


Engine generated messages (e.g. mouseUp) behave differently in this 
regard to pending messages - and even in that case it requires specific 
action in script for it to occur.


So imagine you have a button on stack "S1" which has a single field on 
it. The button has script:


   on mouseUp
  repeat forever
 local tStackIds
 put the defaultStack into tStackIds
 wait for 10 milliseconds with messages -- the time doesn't 
matter here

 put space & the defaultStack after tStackIds
 put tId into field 1
  end repeat
   end mouseUp

Along with this, there is a button with mouseUp script 'go stack "S2"'

Then stack S2 has another button B1 which does:

  on mouseUp
 set the defaultStack to "S3"
  end mouseUp

And then another button B2 which does:

  on mouseUp
 send "_mouseUP" to me in 0 seconds
  end mouseUp

  on _mouseUp
 local tOldDefaultStack
 put the defaultStack into tOldDefaultStack
 set the defaultStack to "S3"
 --set the defaultStack to tOldDefaultStack
  end _mouseUp

Then, finally, there is a third stack S3.

Start the wait loop by clicking on the button in stack S1 - observe that 
the field contains S1 and S1 - i.e. the target of the original mouseUp 
which started the wait loop.


Now click the button on stack S1 (the one which changes focus to stack 
S2) - notice that the field in stack S1 does not change - i.e. focus is 
not preserved. This shows that engine generated events do not (in this 
case at least) change the defaultStack.


Then click button B1 on stack S2 - the one which explicitly changes the 
defaultStack as a result of a mouseUp message - again observe that the 
ids in the field on stack S1 do not change. This shows that engine 
generated events always preserve the defaultStack - even if it is 
explicitly changed while running the handler the engine event causes to 
run.


Finally click button B2 on stack S2 - the one which changes the 
defaultStack in a pending message... Then observe an error - this is the 
case Paul describes.


Now comment out the restorative 'set' line in the pending message 
handler and try the process again - notice that, this time - in the 
final case, the defaultStack in the root wait mouseUP handler is 
preserved.


TL;DR version: If the defaultStack is *explicitly* changed and then not 
restored before exit in a pending message handler then the defaultStack 
will remain as the value it was changed to even after the return from 
the `wait` which caused it to run.


I haven't had any time to dig into the engine code that deeply as yet to 
see why this is the case - although I'm pretty sure it has been this way 
forever.


Interestingly though - this is exactly the behavior of normal send... 
Contrast:


  on mouseUp
send "changeDefault" to me
answer the defaultStack
  end mouseUp

  on changeDefault
set the defaultStack to "SomeOtherStack"
  end changeDefault

Here - the dialog will show "SomeOtherStack" - whereas if you change 
send to call, it will show whatever the stack is which has the button 
which is handling the mouseUp.


Upshot: pendingMessages are truly deferred sends - they are identical to 
send, except that the send occurs at the next wait point and not at the 
point the send is invoked. Specifically, `send "foo" to tTarget in 0` is 
'as if' `send "foo" to tTarget` has been executed in the handler calling 
the 'wait with messages'.


[ As an aside - the trick with changing send to call when you have an in 
time clause *does not* change this behavior - `call "foo" to me in 0` 
*does* parse, but it identical to 'send in time' ]


Outcome: So assuming that my brief reading of the engine code is correct 
(and, indeed, my not complicated but somewhat convoluted example is also 
correct) then the question is whether the 'sendiness' of pending 
messages should be changed to 'calliness' - i.e. whether pending 
messages should always preserve the defaultStack of the calling context. 
I'm inclined to say probably it should - however I'm always aware that 
changing (even rather esoteric?) semantics of things which have been 
that way for as long as time has a huge risk of breaking existing 
code...


Advice: So, anyway, regardless of whether the current behavior is 

Re: [OT} Sunsetting Atom Editor 12/15/2022

2022-12-09 Thread Mark Waddingham via use-livecode

On 2022-12-08 18:30, Mike Kerner via use-livecode wrote:

mark - what have you fond compelling about vscode? i have never really
liked it



Three immediate things:
  1) it has a terminal pane
  2) its find in all files is a right hand tree view and is updated live
  3) there is a C/C++ extension which uses Microsoft's Intellisense tech

Most of my work involves a combination of LiveCode Script and C/C++, and 
unit tests - the latter being entirely terminal based. Therefore having 
it all in one window is a huge efficiency improvement (although it has 
taken me about a month to *stop* clicking in the dock on terminal, or 
alt-tabbing to it when I want to run things!).


The intellisense stuff and live right hand find in files is much better 
for navigating large code bases too :)


Admittedly I'm probably a very special-case on this list (in terms of 
doing both C/C++ and LCS dev side by side, mostly to be run from 
terminal).


However, I think VSCode definitely has the edge if you are doing 
LiveCode scripting in script-only-stacks to use server-side/in lc-server 
from the terminal due to the integrated command-line... There's also a 
host of other integrations with online services for development through 
terminal stuff - e.g. stripe comes to mind.


If you are doing LiveCode scripting in concert with the IDE / GUI type 
stuff - then VSCode vs something else pretty much comes down to personal 
taste :)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Crash on launching LC server version > 9.6.7 using terminal

2022-12-08 Thread Mark Waddingham via use-livecode

Hi Ralf,


have any of you ever experienced that a version of LC Server
newer than 9.6.7 crashes on launching using hashbangs?
This is the case for me on a MacBook Pro M1 running
macOS Monterey 12.6.


Oh! I thought it was something that had changed in recent macOS Monterey 
versions, rather than something we had changed on our end... 
Intriguing...



I suspect this is related to incorrect code signing, as the
crash report shows that the kernel sends the exception
"Exception Type: EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))".

Unsigned LC versions (LC server version < 9.6.8) are not affected.

It would be nice if someone had a recipe to solve the issue.


See this forum post for details of how to resolve:

https://forums.livecode.com/viewtopic.php?f=9=37437

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: [OT} Sunsetting Atom Editor 12/15/2022

2022-12-08 Thread Mark Waddingham via use-livecode

On 2022-12-06 19:15, Ralph DiMola via use-livecode wrote:
I was wondering what editor the LC community is migrating to? I like 
Atom

with the LCS and LCB packages.


I've recently migrated to VSCode (albeit from Sublime Text, rather than 
Atom) - I have not looked back :)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: RANT (Mild): revZIP library

2022-10-12 Thread Mark Waddingham via use-livecode

On 2022-10-11 20:37, Paul Dupuis via use-livecode wrote:

We just got bit by a 4+ year old bug (See
https://quality.livecode.com/show_bug.cgi?id=20859) where the revZIP
library on macOS can create and read ZIP archives over 2GB, BUT the
Windows library can not.


Do you ship your app as a 64-bit windows exe?

I wonder if its just a limitation of the library we use when compiled 
for 32-bit archs...


Warmest Regards,

Mark.


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: PDF Printing

2022-10-04 Thread Mark Waddingham via use-livecode

On 2022-10-04 16:20, Dan Friedman via use-livecode wrote:

Here are examples of the printouts (the PDFs):
Print to PDF - https://www.clearvisiontech.com/WORKING/PrintToPDF1.pdf
Print to Printer - 
https://www.clearvisiontech.com/WORKING/PrintToPDF2.pdf


Any thoughts or ideas?


Someone had a similar problem in the past (Paul or Klaus maybe?) - it 
turned out that it was because no explicit font was set on the stack (or 
controls) - meaning that it was using the macOS 'theme' font.


This isn't actually a 'discoverable' font in the various font related 
APIs - and appears to be (somewhat!) hard-coded in the various low-level 
Apple graphics rendering APIs.


The PDF printer does use the correct fonts and metrics - and CoreText 
(on macOS) to do font layout - but the actual PDF generation is done 
using a cross-platform library (so the output is the same on all 
platforms) which relies on getting the 'real' font data for the given 
font (which it does not in this case) and not macOS (CoreGraphics-based) 
printing. The latter appears to be able to deal with the 'magic' fonts 
(unsurprising as its all Apple stuff), but our pdf printer cannot.


If you set the stack to an explicit font then the problem should go 
away.


Alternatively, if this is a mac-only product, you can use macOS's PDF 
printing capability by setting the printerOutput property to 
"file:" - on macOS the latter will generate a PDF (i.e. its 
the same as choosing 'Save As PDF' from the printer dialog).


Hope this helps!

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: LC converts phone number to scientific notation

2022-09-10 Thread Mark Waddingham via use-livecode

On 2022-09-09 11:40, Klaus major-k via use-livecode wrote:

Hi Panos,

Am 09.09.2022 um 12:27 schrieb panagiotis m via use-livecode 
:


Hello Klaus,

I guess what happens here is that if you fetch item X of line Y and 
use it
directly, LC treats it as a number and displays it in scientific 
notation.


obviously!


Panos isn't correct here...

None of the code you posted would cause a string to be converted to a 
number - the engine only does that when you pass a string to something 
which expects a number (and returns one).


Specifically the 'item' chunk is a string chunk - it just manipulates 
fetches or stores sequences of characters into other sequences of 
characters.


So the problem you are having is elsewhere - and not in the code which 
reorders the strings of the lines you have imported.


It is either happening when you import the data, or when you are 
displaying it.


Indeed, LCS doesn't use scientific notation when converting numbers to 
strings implicitly - you need to use `format()` to get numbers in that 
string form.


However, LCB *does* use scientific format when converting numbers to 
strings (currently at least - we've got an item on the todo list to 
improve that behavior). For example, the variable viewer in the SE is a 
treeview widget, so if a variable holds a number that will display in 
scientific notation if it has above a certain number of significant 
digits.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Livecode SQLite

2022-08-11 Thread Mark Waddingham via use-livecode

On 2022-08-11 16:16, Tom Glod via use-livecode wrote:

I was interested in implementing a relatively new feature where you can
index and query json documents and read the keys directly.

https://dgl.cx/2020/06/sqlite-json-support

I guess, if this is true, is there any documentation about which 
features

of sqlite are implemented and which are not?


The version of SQLite is currently 3.34 built with FTS3, 
FTS3_PARANTHESIS, FTS4, FTS5, RTREE and JSON1 options.


So the JSON features (at least as far as those included in 3.34) should 
be included - perhaps the queries you are trying rely on features 
(perhaps not JSON related) included in more recent versions?


If you file a bug report with what examples of what isn't working, then 
we'll look into updating to the latest version of the library.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Tree Widget: hilitedValue?

2022-07-11 Thread Mark Waddingham via use-livecode

On 2022-07-10 21:33, Richard Gaskin via use-livecode wrote:

Brian Milby wrote:


You could also turn the path into an array (but lose the error
checking above):

function getValue pArray, pPath
  split pPath by comma
  return pArray[pPath]
end getValue


Thanks, Brian. I keep forgetting we can use an array as an element 
specifier.


Has that been around the whole time, or was it added in recent years?


I added it before 6.0 - probably in 4.5 or 5.

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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


On API keys...

2022-06-24 Thread Mark Waddingham via use-livecode
So this is mainly aimed at Tom Glod due to a question he asked in this 
afternoon's Feature Focus session which I perhaps did not answer 
particularly well (and given that it is security related, I figured I 
should expand on what I said).


The question was whether putting an API Key as a LiveCode 'constant', 
rather than anything else, made it 'more secure' - the answer is 'no 
more than putting it anywhere else in a password protected script'.


However, what I should have probably expanded on is what my 
understanding on the best practice for API keys in general is...


I have come across three kinds of API key in practice:

  1) API keys intended to be used from web pages (in client-side code)

  2) API keys intended to be used in deployed apps

  3) API keys intended to be used for doing secure things

How I would advise using them (based on my current understanding, at 
least) is:


TYPE 1

In (1) above you have things like Google Analytics 'product ids' (which 
aren't strictly API keys I guess, but are similar enough to warrant 
inclusion) and Google Maps JS keys.


As these are intended to be used in client side JavaScript - there is 
very little, if anything, you can do to protect them directly.


For Analytics, since the worse that can happen is that someone can 
generate fake analytics it doesn't really matter - and the data can be 
relatively easily filtered and processed to eliminate any dodgy looking 
submissions.


For Maps, it can cost you money if someone else tries to use yours - 
however, you can restrict the key by the referring website and IP 
addresses, as well as what the key can do.


TYPE 2

In (2) you have things like Google Maps App keys (for Android/iOS) - and 
all manner of other 'cloud type' services which have (native) app 
bindings for mobile (and desktop).


Many services offer restrictions for these keys too - for example Google 
Services API keys can be restricted by Android app signing hashes and 
ids, and iOS app bundle ids.


However, in general, these services generally suggest that you ensure 
that the API key is not extractable directly from the app bundle (after 
decompressing in general) - i.e. that the key be obfuscated in some 
fashion and does not appear in plaintext.


It is important to note that they do not require any more than this 
because, at the end of the day, any API key has to be in memory at some 
point, and indeed has to be transmitted 'over the wire'. If someone has 
enough access to access memory, then they have enough access to 
intercept the HTTP requests (even if encrypted - if they really know 
what they are doing) so obfuscating in the on-disk files of the app is 
as good as you can get.


If these keys are compromised then it is a pain - it might cost you 
money (as all these services which have them tend to charge by use) - 
and, if embedded in an app, will require an app update to replace.


TYPE 3

Certain services require (sometimes in the TOS!) that their API keys 
*never* leave a secure bubble which you control - this means they must 
never appear in deployed apps or in files transmitted to the browser. 
Payment gateway API keys will pretty much always fall into this category 
- Stripe is a good example.


The only way to use these keys is from server scripts running on a 
server which you do your best to maintain the security of. Ideally these 
keys should be stored in files which are only readable by specific users 
- usually the web-server user which is running the backend scripts which 
needs to make the requests.


Indeed, services which require this tend to design their APIs for the 
intention of being used on a server.


WHAT TO DO IN LIVECODE

If you are dealing with a type 1 key then you really don't have to worry 
- they are designed to be used in a context which offers zero ability to 
protect them, so including them in a deployed app (in particular) is 
more secure out of the gate than in their intended use in a webpage.


[ Of course, whether you are actually *allowed* to use their services 
from anything other than websites is another matter - and entirely 
defined by their TOS - but I digress! ]


If you are dealing with a type 2 key then the requirements put on their 
use in deployed (native) apps is more than catered for by having the key 
in script, in a password protected stack - for example, as a constant 
return value of a function, or indeed as a constant defined in the 
script which is talking to the API. With this, the key will not appear 
in plaintext in any of the files included in the built app (even after 
the container is unzipped).


[ I should note here that custom properties values also do not appear in 
plaintext in any of the files of a built app - however, having them in a 
password protected script offers an extra level of protection ].


If you are dealing with a type 3 key then you must only use that key via 
a server - this means you need to set up server side scripts which your 
app then talks 

Re: {OT} Are there any ffmpeg "experts" on this list?

2022-06-24 Thread Mark Waddingham via use-livecode

On 2022-06-24 17:05, Paul Dupuis via use-livecode wrote:

I was unaware of the mediaFoundation library - I had thought that we'd
not see support under LiveCode 10 switches from DirectShow to
MediaFoundation.


Its actually been buried in the product (business/pro features) for a 
long time - I had forgotten about it until relatively recently...



That said, our application is macOS and Windows and the appeal of
ffmpeg via shell is that the same code will work across platforms for
us.


FWIW, I *think* mergAV can do similar things on macOS* to the 
mediafoundation external on Windows - although the APIs, while similar, 
do require different code.


However, if you are using ffmpeg for things other than concatenating 
tracks/movies (i.e. the features those libraries provide) then the 
separate code needed wouldn't be worth it to save inclusion of ffmpeg.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: How to color a "cell"?

2022-06-23 Thread Mark Waddingham via use-livecode

On 2022-06-23 23:54, Richard Gaskin via use-livecode wrote:

Thanks Mark - works. I could have sworn I'd tried "line" earlier when
attempting to set the backgroundColor, and when it failed was when I
switched to trying "paragraph". But it works now so I don't mind being
mistaken.

Oddly, "paragraph" appears to be synonymous with "line" for the
borderWidth, borderColor, firstIndent, leftIndent, textAlign,
spaceAbove, hGrid, vGrid, and tabs paragraph properties.


I suspect you have dontWrap set and possibly 'table-mode'.


Near as I can tell backgroundColor is the only paragraph properties
where the "paragraph" chunk type isn't synonymous.


If you check the htmlText you can easily see the difference between
using 'paragraph' and 'line' to set the aforementioned properties.

When set on 'line' - the properties appear on the 'p' tags, and they
have an effect on a per (wrapped) paragraph basis.

When set on *all other string chunks* (which reduce to char chunks) -
the properties appear as runs in the 'p' tags, and they have an effect
on runs of text.

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: How to color a "cell"?

2022-06-23 Thread Mark Waddingham via use-livecode
IIRC you need to use ‘line’ to set ‘paragraph‘ properties of fields…

Sent from my iPhone

> On 23 Jun 2022, at 19:29, Richard Gaskin via use-livecode 
>  wrote:
> 
> Craig wrote:
> 
> > Richard wrote:
> >> I had hoped the paragraph-level formatting options introduced in
> >> v5.x would help, but alas as far as I can tell I can only set the
> >> backgroundColor of a run of text, not the full cell.
> >
> > I think this was discussed on the forum a while back. I do not believe
> > you can do what you want without another control overlying the “rect”
> > of the “cell”.
> 
> Thanks. I could get away with setting the backgroundColor of the whole line, 
> but that does the same as setting the backgroundColor of a "cell": it draws 
> the color only beneath the portion of the line that contains text, leaving 
> the rest blank.
> 
> The borderWidth and borderColor paragraph properties work as expected, 
> affecting the full line whether it's filled with text or has no text at all.
> 
> But backgroundColor as a paragraph setting feels broken, as it works the same 
> as setting that property for a chunk rather than for the field.
> 
> From the v5.5.4 Release Notes:
> 
> - The backgroundColor property allows the color of the content area
>  (inside any paragraph border) to be filled (note that strictly
>  speaking this property is not inherited, but the effect is the same
>  as if it was as the background of the field is rendered before the
>  paragraphs are so the background color at the field level will
>  ‘show through’ to the paragraph if the paragraph has no background
>  color).
> 
> - The borderWidth property determines the width of the border to draw
>  around the paragraph.
> 
> Pretty much all the other paragraph-level formatting options work just their 
> their field-level counterparts, but of course limited to the specified 
> paragraph.
> 
> So I'm surprised the backgroundColor was added in such a way that it appears 
> to do nothing we didn't already have with setting backgroundColor of chunks.
> 
> I was hoping I was just using it wrong.
> 
> Here's how I set it in my tests:
> 
>set the backgroundcolor of paragraph 2 of fld 1 to yellow
> 
> Unless there's a different syntax I should be using, it would appear the 
> paragraph-level implementation of backgroundColor is unfinished, no?
> 
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> 
> ambassa...@fourthworld.comhttp://www.FourthWorld.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


___
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: M1 Macs and LC 9.6.8 RCs and 10.0.0 RCs

2022-06-21 Thread Mark Waddingham via use-livecode

On 2022-06-21 12:18, matthias rebbe via use-livecode wrote:
Am 21.06.2022 um 11:56 schrieb Mark Waddingham via use-livecode 
:

Why?



First, it's more convenient for the developer.


I think the end user is more important (in this case) ;)


The Intel only and Apple only builds are smaller ins size than the
universal build.


True - universal builds are double the size essentially (well, resources 
in copy files are *not* duplicated) - however how important is that 
really?


There's a high chance a user might download an app twice from a page 
offering two architectures - because they aren't necessarily sure which 
one they need - at which point, you've lost any advantage in splitting 
them (and just caused user consternation). [ Similar argument holds when 
users upgrade their machines, and restore from a full backup - which is 
what the majority of users do ].


Besides, if size is a real concern here then there are a couple of 
tweaks we could do to reduce the size of universal binaries (and indeed, 
Android APKs) which would see the size difference between universal and 
non-universal drop to maybe 3-4Mb (and probably only 1-2Mb when 
compressed - i.e. transmission size). [ This would be a *much* better 
use of time, than adding an edge-case option to the S/B, IMHO ].



So if i want to build those single platform apps to offer the smaller
sized apps  i have to run the standalone building process twice,
right? And before i run the 2nd build process i even have to switch
the settings, right?
That's not very convenient.


Offering two separate downloads to users is not very convenient to them 
;)



And btw why did this option exist in previous LC versions for an
Universal app with PPC and Intel support?


Well that was getting on for a decade ago - so can't really remember 
what the exact rationale was back then. However, I dimly recall that 
universal PPC+Intel binaries would not run on some earlier versions of 
'MacOS X' which we still supported (and people still had!) at the time - 
so you actually *needed* to offer a separate PPC download if you still 
needed to support those really old 'MacOS X' versions.


These days that's not a problem as there's been a 32-bit -> 64-bit 
architecture switch since then which means all the macOS versions we 
currently support work correctly with universal binaries containing 
slices the OS does not understand.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: M1 Macs and LC 9.6.8 RCs and 10.0.0 RCs

2022-06-21 Thread Mark Waddingham via use-livecode

On 2022-06-20 20:55, matthias rebbe via use-livecode wrote:

Anyway, the macOS Apple support is currently experimental, i am pretty
sure there will be such an option in future. At least i hope so. ;)


Why?

The idea of universal binaries is to ensure that a single app/installer 
can be shipped to users and that will then use the 'best' it can for 
their machine. They provide a much better end-user experience than 
Windows or Linux provide in this regard.


Whilst you might not have many users using Apple architecture machines 
right now, you don't know when they might upgrade, so universal binaries 
mean that when a user upgrades their machine, their apps they already 
have (backed up, more than likely, and re-imaged on the new machine) 
will continue to take advantage of their hardware.


Warmest Regards,

Mark.

P.S. I should point out that Apple architecture support *is* 
experimental, so its fine to include and seed to users for testing 
purposes, but I wouldn't include one in final shipping releases just 
yet.


P.P.S. That being said, the only Apple architecture related bug we have 
had reported recently is related to standalone building itself (and is 
related to macOS High Sierra - 10.13 - and below *not* supported arm64 
slices in some of the command-line tools the S/B uses) - and I fully 
expect the experimental tag to be removed by final release of 10 (and 
the corresponding 9.6.x maintenance release just after that).


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: M1 Macs and LC 9.6.8 RCs and 10.0.0 RCs

2022-06-20 Thread Mark Waddingham via use-livecode

On 2022-06-18 21:27, matthias rebbe via use-livecode wrote:

So, the question now is, is this a macOS problem or is it possible
that a standalone could show the wrong setting due to a wrong
configuration or so when it is created.


It is a macOS (Finder) bug - I think it was the same when they added 
32-bit vs 64-bit, and probably Intel vs PowerPC.


There's a plist entry 'LSArchitecturePriority' which is the order in 
which the different slices should be used - currently we have x86-64 
then arm64 and it seems the Finder doesn't use this to determine whether 
to show the Rosetta box as checked or not when the user hasn't 
explicitly prodded it in the past (which obviously they won't have done 
for new apps / those which didn't have the option before!).


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: char as word boundary

2022-06-13 Thread Mark Waddingham via use-livecode

Hi Jean-Jacques,

On 2022-06-03 14:56, Jean-Jacques Wagner via use-livecode wrote:

Hi,
Version 6.7word boudary are char number 09,10,11,12,13,32
version 9.67  word boudary are char number 09,10,11,12,13,32,202

Hypercard and livecode 6.7:  the number of chars (numtochar(32)&
numtochar(202)(32)& numtochar(202)(32)) = 2
livecode 9.67  :   the number of chars
(numtochar(32)& numtochar(202)(32)&
numtochar(202)(32)) = 0

Is it a change or a bug considering now numtochar(202) as word
boundary, as it is with numtochar(32)


This is something we will need to consider - please do file a bug about 
it at quality.livecode.com (so you can track any further discussion 
about it).


I can see how this change occurred, and it is perhaps more a 
'side-effect of implementation' rather than an intended change.


Prior to 7.0 - the word chunk used the C library 'ctype' isspace 
function - which returns true if a character is 'whitespace'. However, 
the engine *also* tweaked the C library character tables to make it so 
that NBSP (202 on MacRoman - something else on Windows/Linux - 160 
maybe?) was *not* a space character. This was primarily a very dirty 
hack (which was done before my time!) to allow non-breaking spaces to 
prevent word breaks in fields (I strongly suspect the effect on the word 
chunk was never considered!).


When we moved to Unicode - we changed the word-breaking detection in 
fields to use a simplified version of the Unicode algorithm and Unicode 
character properties (NBSP has the, unsurprisingly, no-break property!). 
Similarly, we changed the word chunk to use the Unicode 'whitespace' 
property. In the unicode world - being whitespace, and non-breaking are 
two separate properties... Hence the difference in behavior since 7.


The reason this is 'of interest' is that the word chunk has had quite a 
hefty performance regression since 7.0 due to the switch to Unicode, so 
re-looking at what it should *actually* do (taking into account what it 
would be most useful in the widest possible circumstances) is definitely 
on the cards.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Would anyone miss convertOctals?

2022-06-10 Thread Mark Waddingham via use-livecode

On 2022-06-09 20:54, Craig Newman via use-livecode wrote:

Mark.

Gong the other way, is your task made much simpler by losing
“converOctals”? I assume so, or the issue would never have come up.
Are there other similar language elements that also are on the block?


I'm not sure it makes things 'much simpler' - but it does remove one 
thing to have to think about. Further it removes a case where script is 
ambiguous at parse-time - i.e. the token 0123 could mean one of two 
different things depending on a runtime property.


Given the responses so far, it looks to me like convertOctals is an 
exceptionally rarely used feature (the number of years of LC experience 
amongst those who have responded is in excess of two centuries, and >80% 
of the respondents didn't know what the property was).


Thus any added complexity caused by having this feature seems a waste of 
time/effort/mind-space - particularly as there is a more-than-adequate 
replacement which has none of its problems (i.e. 0o123) - and moreover 
one which other languages (e.g. JS) adopted a long time ago.


In terms of other things which are 'on the block' - then no explicit 
features per-se but there are a couple of extreme 'edge cases' which 
will likely be removed.


For example, the ability to use 'msg' (which is aliased to the content 
of the message box) and '$' implicit variables as referenced 
parameters in handlers. Currently you can do:


  on mouseUp
fillVars msg, $FOOBAR
  end mouseUp

  on fillVars @pA, @pB
put "foo" into pA
put "bar" into pB
  end fillVars

The ability to pass these 'quasi-variables' as references will 
potentially reduce the potential performance gains of moving to a 
bytecode-based VM when referenced parameters are used in general, and 
thus (like convertOctals) their existence seems too high a price to pay 
for what is almost certainly a rarely used (if used at all) feature.


Note: I should stress that the above is *just* removing the ability to 
pass 'msg' and environment variable globals as reference parameters to 
handlers *not* removing 'msg' or environment variables in general!


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Would anyone miss convertOctals?

2022-06-09 Thread Mark Waddingham via use-livecode

On 2022-06-09 16:33, Devin Asay via use-livecode wrote:

Wait, you said three questions. But no.


What are those two hard problems of computer science again? ;)

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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


Would anyone miss convertOctals?

2022-06-09 Thread Mark Waddingham via use-livecode
So I'm currently sitting here about to embark on fixing 
 (which is the final 
thing to sort out before being able to merge my constant expression 
patch) and I was reminded of 'convertOctals'.


Now, generally, I am somewhat averse to actually removing any language 
feature (even those we have deprecated, unless we absolutely have to!) - 
however, I would really like to make convertOctals have no effect at all 
in 10.0+ as it adds a disproportionate amount of complexity compared to 
(what I think, at least) its utility is (particularly in the context of 
things 'coming next' like the script compiler).


So three questions:

  1) Do you know what convertOctals is, and what it does?

  2) If you do, have you ever actually used it in any scripts which are 
actually still in use?


  3) If you do use it in any scripts which are still in use, would you 
be willing to change them to not use it?


  4) If you do use/have used it, had you ever noticed that it has been 
slightly broken for years?


Now, its always better to offer a carrot when there is a stick (or in 
this case, an axe) being wielded and the carrot in this case would be to 
expand the numeric literal syntax to add both explicit octal and binary 
number literals alongside hexadecimal:


0xabcdef - hex literal
0o777 - octal literal
0b101110101

The key difference between 0o777 and using 0777 (with convertOctals 
true) is that the former is not ambiguous at parse time, it doesn't 
require a runtime property set to true in order for the engine to 
convert the string to a number correctly.


Please let me know your thoughts :)

Warmest Regards,

Mark.

P.S. In the scheme of 'breaking changes' - we've already made a number 
of them for 10 already, and my gut tells me removing convertOctals is 
likely to cause less consternation than those we already have - but I 
could be wrong!


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Generating Random numbers to conform a distribution

2022-06-08 Thread Mark Waddingham via use-livecode

On 2022-06-07 21:51, David V Glasgow via use-livecode wrote:

Quite a lot of stats and maths packages offer a feature whereby the N,
the Mean and the SD are variables specified by the user, and N random
numbers are then generated with the required mean and SD.  I remember
the venerable and excellent Hypercard  HyperStat
 (1993)
by David M Lane doing exactly that.

Or is there an elegant formula?  I have Googled about and can’t see
one, but maybe I don’t know the magic words.  And if someone wanted to
script this in LC what would be the best approach? (just general
guidance here, wouldn’t want anyone to invest their valuable time in
what is at present just vague musings)

Any hints from the stats gurus?


I'm not a stats guru but...

I think all you need to do here is to use some of the intrinsic 
'properties' of the Mean and SD.


Lets say you have a collection X of numbers then the following things 
are always true:


  P1: Mean(c * X) = c * Mean(X)
  P2: Mean(X + k) = k + Mean(X)
  P3: SD(c * X) = abs(c) * SD(X)
  P4: SD(X + k) = SD(X)

In English, scaling a set of numbers scales their mean by the same 
amount, and offsetting a set of numbers offsets their mean by the same 
amount, Similarly, scaling a set of numbers scales their SD by the same 
amount, and offsetting a set of numbers makes no difference to the SD 
(as the SD is a relative quantity - it cares about distance from the 
mean, not magnitude).


Now, hopefully we can agree that if you generate a set of a random 
numbers, then scaling and offsetting them still uniformly does not 
reduce the randomness (randomness means the numbers form a uniform 
distribution over the range of generation, if you scale and offset then 
all you are doing is changing the range - not the distribution).


So with this in mind, let TMean and TSD be the target mean and target 
SD. Then:


  1. Generate N random numbers in the range [0, 1] - S0, ..., SN

  2. Compute SMean := Mean(S0, ..., SN)

  3. Compute SSD := SD(S0, ..., SN)

Now we take a small diversion from a sequence of enumerated steps to ask 
"what offset and scale do we need to apply to the set of numbers so that 
we get TMean and TSD, rather than SMean and SSD?".


The amount we need to scale by is mandated by the SD, specifically:

 c := TSD/SSD

If we scale our source numbers by c and apply SD then we see:

 SD(c * S0, ..., c * SN) = c * SD(S0, ..., SN) [P3 above]
 = c * SSD
 = TSD / SSD * SSD
 = TSD

i.e. Our scaled input numbers give us the desired SD!

So now we just need to play the same 'game' with the Mean. We have:

 Mean(c * S0, ..., c * SN) = c * Mean(S0, ..., SN)
   = c * SMean

However we really want a mean of TMean so define:

 k := TMean - c * SMean

Then if we translate our (scaled!) source numbers by k and apply Mean 
then we see:


Mean(c * S0 + k, ..., c * SN + k) = c * Mean(S0, ..., SN) + k [P1 
and P2 above]

  = c * SMean + k
  = c * SMean + TMean - c * SMean
  = TMean

i.e. Our scaled and offset input numbers give us the desired Mean!

Note that SD is invariant under offsetting (P4) so SD(c * S0 + k, ..., c 
* SN + k) = SD(c * S0, ... c * SN) = TSD!


We can now return to our sequence of steps:

  4. Compute c := TSD/SSD

  5. Compute k := TMean - c * SMean

  6. Compute the target random numbers, Tn := c * Sn + k

So, assuming my maths is correct above T0, ..., TN, will be still be 
'random' (for some suitable definition of random), but have Mean of 
TMean and SD of TSD as desired.


In LiveCode Script, the above is something like:

   function randomNumbers pN, pTMean, pTSD
  local tSource
  repeat pN times
 put random(2^31) & comma after tSource
  end repeat

  local tSMean, tSSD
  put average(tSource) into tSMean
  put stdDev(tSource) into tSSD

  local tC, tK
  put pTSD / pSSD into tC
  put pTMean - tC * tSMean into tK

  local tTarget
  repeat for each item tS in tSource
put tC * tS + tK & comma after tTarget
  end repeat

  return tTarget
   end randomNumbers

Hope this helps!

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Case sensitivity in Livecode ??

2022-06-07 Thread Mark Waddingham via use-livecode

On 2022-06-07 17:16, Mark Wieder via use-livecode wrote:

1. Because it's a function, not a constant.
  put gkMyMagicValue() into tVar
is cognitively different from
  put gkMyMagicValue into tVar

Something like 17 is a trivial case. Something more like real world
usage would be

constant kRootURL="http://example.com/aUrlThatMightChange/api/v2;


I see and what is kRootURL the Url for? If I were writing a library for 
a web-service and needed (for some reason) to expose the underlying URL 
to callers of the library, then I'd have simply define a function as 
part of its public API:


  function myRestLibraryGetRootUrl
return "http://example.com/aUrlThatMightChange/api/v2;
  end myRestLibraryGetRootUrl

I don't buy the 'cognitively different' argument - different languages 
have different patterns. I really don't see that getting into the habit 
of using 'constant functions' instead of 'constant variables' is any 
different from getting into the habit of doing assignment as 'source 
into target', rather than 'target = source'; or getting your head around 
the message path.


It is definitely *not* unusual for libraries in any language to expose 
*all* that they do via functions - whilst you can use enums and 
preprocessor defines in C/C++ for global constants - they make your 
library unwrappable easily by higher-level languages. Indeed, you tend 
to find that as published low-level (C/C++) libraries have evolved they 
have changed to ensure their interfaces are entirely function based ones 
(indeed, oftentimes C++-based libraries gain a C function wrapper to 
make this easier - as C++ is a nightmare to wrap stuff from due to the 
immensely complicated semantics, these days, of C++ classes).



2. Because the server already build supports the "include" keyword
which would neatly solve the issue, but none of the other platforms
do. Why?


You can't really compare the features of the PHP (C preprocessor) style 
operation of the server engine with the object-based scripting of the 
normal LiveCode engine.


In that PHP-likeness, 'include' makes sense as the server engine is 
essentially doing a continuous 'merge' - emitting interleaved blocks of 
content (text) with content generated from code.


The include which is present there makes sense for that form of coding - 
i.e. for generating text documents from a mixture of prewritten text, 
and evaluated script. I don't think it makes sense when scripts are 
attached to objects where more structure is needed and they exist in a 
dynamic environment.


Critically, the server engine loads and parses files in a linear fashion 
- emitting the text, and executing the interleaved script. Everything is 
completely transient - when the document has finished being emitted, the 
engine terminates.


It raises too many edge-cases and questions as to what should happen in 
various different scenarios (as well as being a very large noose with 
which people could hang themselves) when you try to add its 'include' 
operation to the normal LiveCode environment.


Remember that in the server engine include operates on a file so  what 
would you expect to happen if you change the file? Does the engine have 
to track changes and recompile any object scripts including it when they 
change? (Remember that object scripts are compiled on being set, or when 
first tickled by a handler lookup if already set and loaded from disk).



3. Because every other language I've used has global constants and
makes this easy. It's only xtalk that makes this hard. If an LC goal
is to provide a tool for learning coding then multiple definitions of
the same constant is a paradigm that is not transportable to other
languages, and indeed will probably result in a compiler error.


xTalk does not make it hard - see above - its just different because of 
its model.


Of the languages you've used how many are object-based, where objects 
have scripts which can be dynamically (re-)attached continuously 
throughout the lifetime of a programs execution and, moreover, can be 
dynamically created at runtime; and more specifically, where a script is 
a defined set of handlers and other definitions which are completely 
independent (from the point of view of compiling) of any other script?


For those which you have found which fit that pattern, do any of them 
have global constants?



4. Because it gets tiresome having to explain to new developers that
you have to declare constants in multiple scripts even though it's the
same constant you already declared and the workaround is to use a
getter function as you described.


Then tell new developers that the xTalk way to do global constants is 
constant functions in the message path!


Saying that is a workaround is akin to telling them that:

  "The workaround for not being able use the syntax 'X := Y' is to use 
the syntax 'put X into Y'"


Or telling someone learning Java that:

  "The workaround for defining a global function is to make it a static 

Re: Case sensitivity in Livecode ??

2022-06-07 Thread Mark Waddingham via use-livecode

On 2022-06-01 19:54, Alex Tweedly via use-livecode wrote:

Also, you'll be able to do things like:

    constant kPiBy2 = pi / 2
    constant kPiBy2Squared = kPiBy2 * kPiBy2
    constant kPiBy2String = format("%f", kPiBy2)
    local sPiMap = { "pi-by-2": kPiBy2, "pi-by-2-sq": kPiBy2Squared }


Very good. In fact, great !! Thank you!

Would you be ale to do something like

constant kPiMap = { ... as above ... }


Yes - the initializers in both constant and local keywords are the same 
- both can use arbitrary constant expressions (any local properties are 
assumed to be the default values when evaluating).


And now I'll push my luck and ponder the possibility of 'global' 
constants.


Haha...


OK - 'global constant' is likely counter to the scope concepts. But
perhaps they could be done as "write-once" variables, or as a more
general "write-protected' variable.

   put 17 into gkMyMagicValue
   writeprotect "gkMyMagicValue"

and any *subsequent* attempt to change the value would fail.


How is that any better than putting something like this in a library or 
back script:


function gkMyMagicValue
return 17
end gkMyMagicValue

Including the global declaration its the same number of lines (indeed 
less, as you'd need to put a global declaration in every script which 
wanted to use said global constant...).


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Reporting Apple Silicon anomalies (Re: [[ ANN ]] Release 9.6.8 RC-1)

2022-06-06 Thread Mark Waddingham via use-livecode

On 2022-06-06 15:50, Ben Rubinstein via use-livecode wrote:

This is very exciting, thank you. If we find anomalies in the Apple
Silicon side, should we raise them in the first instance
 - to you directly?
 - on this list?
 - straight into LQCC?


Just file a bug in the LQCC - indicating that the discrepancy is between 
Apple and Intel architectures :)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Case sensitivity in Livecode ??

2022-06-01 Thread Mark Waddingham via use-livecode

On 2022-06-01 17:44, Alex Tweedly via use-livecode wrote:

I was surprised to find that

   constant K = TRUE

produces an error, though

  constant K = true

is fine. In other contexts, you can say

   put TRUE into myVar
   put true into hisVar
   etc.

but in a constant statement, it seems to be case sensitive.

Anyone got an interesting story (or theory) on why ?   :-)


Its a small mitigation of 
https://quality.livecode.com/show_bug.cgi?id=19413 - i.e. where the 
initializer of constants (and locals) is currently treated as a single 
literal.


In explicitVariables mode, unquoted literals are allowed on the RHS only 
if the literal is a (builtin) constant *and* the constants value is 
identical to the token you have provided.


That extra check is there to ensure that the constants (and 
initializers) you have used are actually what you intended.


Currently - the following does not do what you think:

   constant kEmptyString = empty

Indeed, this isn't allowed in explicitVariables mode, as the constant 
empty's value is "" and not "empty" - which is what kEmptyString will 
actually be with explicitVariables turned off.


Anyway, this rather odd and obscure facet of the language will disappear 
in 10 as we've made it so that initializers for constants and locals can 
be constant expressions. Thus:


constant kTrue = TRUE
local sEmptyString = empty

Will do precisely what they look like they should do...

Also, you'll be able to do things like:

constant kPiBy2 = pi / 2
constant kPiBy2Squared = kPiBy2 * kPiBy2
constant kPiBy2String = format("%f", kPiBy2)
local sPiMap = { "pi-by-2": kPiBy2, "pi-by-2-sq": kPiBy2Squared }

Warmest Regards,

Mark.

P.S. Amusingly, your question came up on exactly the same day I 
'finished' my patch for the above - it now awaits review which may 
result in it not being quite finished ;)


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Set HTMLText and Get Effective HTMLText

2022-05-18 Thread Mark Waddingham via use-livecode

On 2022-05-18 17:43, Rick Harrison via use-livecode wrote:

I wish it worked with variables though
because execution would be faster.


If variables could manipulate styled text (aka htmlText) then they 
wouldn't be any faster than fields ;)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: drawingSvgCompileIcon(pIconName) always BLACK

2022-04-06 Thread Mark Waddingham via use-livecode

On 2022-04-06 18:16, Klaus major-k via use-livecode wrote:

Hi all,

so sorry, looks like I completely f. up here.
Sorry for the confusion, not may day...

See:



Hehe - no worries.

So in answer to your original query about wanting to be able to color 
the icons - the drawing library supports the 'currentColor' attribute in 
SVG - and this is tied to the 'backgroundColor' property of the image 
object the drawing is set on.


It would only take a small tweak to Brian's extension to make this work 
- adding `fill="currentColor"` to the path node it generates.


Brian's extension works by fetching the path data from the IconSVG 
library, wrapping it in the necessary SVG XML, and then compiling it 
with drawingSvgCompile.


Irksomely, there does not seem to be any support for marking colors in 
SVGs as 'currentColor' in any SVG editor we've come across (unless its 
deeply buried in it). So one strategy there is making sure the colors 
you want to be configurable in the SVG are set to a known unlikely 
random color (e.g. #ABCDEF), exporting as SVG XML from the editor and 
then just doing a global find/replace of (e.g.) #ABCDEF with 
currentColor.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Weird Standalone Builder issue

2022-03-25 Thread Mark Waddingham via use-livecode

On 2022-03-24 21:07, Paul Dupuis via use-livecode wrote:

I'm on Windows 10, using LC 9.6.6, and building for macOS and Windows
...
This is not a problem form me as I can use revDeleteFolder to remove
Contents\Resources\_MacOS\Utilities\ on the mac build and
revDeleteFile to remove "ffmepeg" from the Utilities folder on Windows
and I am left with the right utility for the right platform. I could
also just copy the utilities from the project folder each build during
the "on standaloneSaved" message handler.

I am mostly curious as to why the Standalone Builder splits the
files/folder for macOS and leaves them together for Windows?


So this is by design although its been so many years since this was done 
my memory is a little hazy!


I think the evolution of this was as follows:
   - originally copy files were put next to the executable (i.e. 
Contents/MacOS on macOS)
   - Apple made that path read-only and things had to be put in 
.app/Contents/Resources
   - the s/b started doing that, but we added internal redirects to the 
low-level file functions in the engine so code wouldn't see a difference
   - Apple then made it so that Apple executables could not be launched 
from anywhere except from Contents/MacOS
   - so we made it so the s/b sniffed the header of all files copied for 
Mach-O files and left those in Contents/MacOS


Basically, we've tried to make changes to Apple's structuring 
requirements transparent to developers all the way along - and its 
worked fine up until now, but admittedly looks a little strange if you 
dig around into things!


I've been pondering whether we should ditch the mechanism soon though:

   - remove the magic redirection
   - require code to use specialFolderPath("resources") to find 
non-executable resources
   - require code to use (a new) specialFolderPath("executable 
resources") to find executable resources (which would only be different 
to the above on macOS systems)
   - keep the magic sniffing of files in the S/B so executables still go 
in Contents/MacOS


This may break some really old code - but would remove some rather 
fiddly code in the engine which does the magical redirection - and mean 
things would be structured as expected (with the new definition of 
expected).


FWIW, even with the above you would still have to branch code to do what 
you want as the macOS exes would be in a different place (because they 
need to be!) so it wouldn't resolve that - but at least you wouldn't 
have been 'surprised' by what you found!


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: debugging javascript in html5

2022-03-18 Thread Mark Waddingham via use-livecode

On 2022-03-18 10:44, Bernard Devlin via use-livecode wrote:
Considering the html5 enhancements might well be the biggest thing in 
LC

10, I can foresee a whole world of pain when it comes to us debugging
Javascript interactions.


Yes - this is somewhat painful at present - and we do hope to make 
debugging web standalones in general less painful in time.


However, if you 'Test' your web standalone in a browser you can then 
open up the Developer Tools for the browser you are testing in - which 
gives you access to the JS console and all the other tools.


In JS you can use `console.log(...);` to have messages emitted to the JS 
console.


Additionally, I *think* you can use `debugger;` to have JS code break 
into the debugger in said browser's developer tools. I must confess I've 
not tried this myself (as our debugging is usually debugging the engine 
running in the browser, rather than debugging JS executed from the 
engine running the browser) - but I can't see why it wouldn't work.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: debugging javascript in html5

2022-03-18 Thread Mark Waddingham via use-livecode

On 2022-03-18 11:19, Bernard Devlin via use-livecode wrote:
Here's a peculiarity I haven't seen mentioned before.  I am trying to 
test

the viability of the idea of a function to call back to LC and provide
debugging info.

Assume you create a LC function lclog(pmsg,pval) and you put a 
breakpoint
in the IDE inside that function body.  Set the htmltext of a browser 
widget
to the code below, set the javascriptHandlers of the browser to contain 
the

word: lclog . Your browser widget will have a button 'clickme'.
1) On clicking that button the JS alerts ALL trigger first.
2) After they have fired the first call to lclog() runs, and the second
call to lclog() never runs.



function lcxhr(method, url) {

alert('lcxhr called');

var json = JSON.stringify({ name: "John", surname: "Smith"});

liveCode.lclog('json created', json);

alert('you see this alert before the above call to lclog()');

liveCode.lclog('exit js function','');

}


So this is quite separate from what happens in the web engine which 
works very differently.


Embeddable browsers are inherently asynchronous in their execution (not 
necessarily in a multi-thready way, although that does play a part) - 
but more in the sense that you can't get an embedded browser to do 
anything and have it 'block' until it is done.


The converse is also true - the request to call an LC handler from the 
browser widget is basically a post - not a send - which means that 
(really) you can only call LC handlers as tail calls - i.e. as the last 
thing on a handler.


Warmest Regards,

Mark.

P.S. The web engine is (essentially) the running the LC script 'as 
JavaScript' so the same limitation does not apply - calling LC handlers 
from JS in the web engine is synchronous.


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: 10.0.0-dp-2 html5 and liburlLastRHHeaders()

2022-03-18 Thread Mark Waddingham via use-livecode

On 2022-03-17 13:07, Bernard Devlin via use-livecode wrote:
So there is something else going on between LC's libUrlLastRHHeaders() 
and
LC's interaction with the JS XMLHttpRequest().  This something is 
stripping

out most of the headers.


As I said, LC is not stripping anything - we are returning what JS 
returns.


However, the difference is that (currently) we use the synchronous mode 
of XMLHttpRequests (as prior to 10, due to the lack of wait using async 
wasn't viable apart from for `load url`). I wonder if that might be the 
difference.


Your sample code and example is useful - if you could post to a bug 
report, then we will look into whether that is the case, or there is 
something else going on.


Warmest Regards,

Mark.

P.S. We are hoping to move to the async version of XMLHttpRequest now 
that we can wait - so that might well be the solution.


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: :MEMORY: databases and Windows

2022-03-17 Thread Mark Waddingham via use-livecode

On 2022-03-16 22:07, Bob Sneidar via use-livecode wrote:

Once again you nailed it. Still, this is a bug, minor though it may
be. In the past I was told that it MUST be capitalized. Now it seems
capitalized only works on the mac while all lowercase works on both
platforms.  squared.


FWIW I don't think this is a bug.

In the SQLite documentation it explicitly states ':memory:' lowercase.

We don't process the filename we pass to the SQLite library, so I can't 
explain the difference between macOS and Windows.


Looking at the sqlite sourcecode - it does a case-sensitive comparison 
between the filename passed and ':memory:'.


So, I suggest using ':memory:' as stated by SQLite and all will be well 
:)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: 10.0.0-dp-2 html5 and liburlLastRHHeaders()

2022-03-17 Thread Mark Waddingham via use-livecode

On 2022-03-16 14:15, Bernard Devlin via use-livecode wrote:
If one could get hold in Livecodescript of the Javascript Request 
object

that was sent to the server, then one might be able to get hold of the
Response headers.

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders

My guess is that the shim is getting hold of this information but for 
some

strange reason it is stripping out most of the headers.


We already use that JS API to implement lastRHHeaders - we just return 
the value it returns verbatim.


Therefore, I'm guessing this is something the API is doing. The only 
thing which may give a hint is (in that doc):


  'For multipart requests, this returns the headers from the current 
part of the request, not from the original channel.'


Not sure whether that applies in this case or not (except that POST is 
generally used in multipart requests I think...)


Anyway, file a bug with an example if you can and we'll take a look.

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Speed up a slow loop

2022-03-02 Thread Mark Waddingham via use-livecode

On 2022-03-02 21:57, J. Landman Gay via use-livecode wrote:

The loop takes forever. Here it is (sDictFile is a script local):

  repeat for each line l in pList -- pList is the user word list
if sDictFile[l] = true then put l & cr after tCheckedList
else put l & cr after tNonWords
wait 0 with messages  -- prevent ANRs
  end repeat

I added the wait because my Android phone was putting up an "app not
responding" warning while the loop was running (or just after, hard to
tell.) The loop should be much faster than that. When I added some
timing checks though, the timer says the loop takes between 0 and 1
millisecond, and yet the wait on screen remains.


If the difference between `the milliseconds` before the loop, and then 
after is 0 or 1 millisecond - then that is how long it is taking. This 
means the issue is somewhere else. Are you sure there isn't anything you 
are doing either before that loop or after that loop which doesn't wait 
for ages (due to the ANRs you mentioned).



With a 3-word user list, the loop takes 4 seconds. With an 8 word user
list the loop takes 6 seconds. The more user words, the longer the
wait.


If there are only 3 reasonable length words in pList (I.e. 3 lines) then 
there's no way that loop can take 4 seconds. Of course if the words are 
multiple megabytes long then it might be possible (however the timing 
you already stated above suggests the loop isn't actually taking 4 
seconds!).



Even stranger: on my cheapo Android tablet with 4 megs of RAM running
Android 9 the response is nearly instantaneous, even if the user list
has 200+ words. On my Pixel phone with 8 megs of RAM and Android 12
the response is slow enough to trigger the ANR with only 3 words. I'm
building for ARM 64.


This strongly suggests it is something else either on your phone, or in 
your code which your phone doesn't like I think.


Warmst Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Have we lost the Oracle driver?

2022-03-01 Thread Mark Waddingham via use-livecode

On 2022-03-01 15:51, Ben Rubinstein via use-livecode wrote:

Hi Matthias,

Good spot! Thanks for checking.

I wonder whether this is an accidental omission, in that Oracle was at
one time only available at a certain higher level of license; maybe
now that there is only level, perhaps someone forgot to tweak whatever
bit of code checked that the 'correct' license was in place?


All business-only features were moved to be part of the pro features 
pack - the oracle driver included.


If it isn't working in your current version of LC, check that the 
license you have licensed LC with does have the pro features pack in 
it...


If you do `put the revLicenseInfo` it should say professional, rather 
than commercial.


If it doesn't say professional, Relicense your IDE using the menu item 
in Help and flick through the licenses you have available until one says 
'pro' in the title.


If the revLicenseInfo does say professional then something odd has 
happened somewhere which will need to look into more deeply!


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: resetall?

2022-02-22 Thread Mark Waddingham via use-livecode

On 2022-02-21 20:17, Mark Wieder via use-livecode wrote:

On 2/21/22 10:37, Mark Waddingham via use-livecode wrote:

Put another way - if you have done 'close socket i', then it is then 
it should be logically impossible for i to be in the openSockets 
immediately afterwards.


Ah. Sorry - after issuing a closeSocket call the socket does *not*
appear in the opensockets. But the socket seems not to be responding
until a reboot. And I'm thinking that I may have a blocking read still
in play at that point, and the close socket command doesn't affect it.


Can you clarify what you mean by the 'socket seems to not be 
responding'?


When you 'close socket', the engine immediately cancels all pending 
reads, but will not actually close the file descriptor until all pending 
writes have finished.


I'm puzzled by the idea of 'blocking writes' - write to socket without 
message will block script execution (and messages) until the timeout or 
the data is sent; so you can't close socket while that is happening (as 
script will not be executing).


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Loading a LONG list with images

2022-02-22 Thread Mark Waddingham via use-livecode

On 2022-02-21 23:47, Tom Glod via use-livecode wrote:

This is how i did it .  I hope this helps.

First to use the "numberofrecords" way of setting the datagrid data.
This is key, that way you only ever trigger loading of visible rows.


So I've not got much to add to Tom's method

i.e. make sure the datagrid is only creating rows on demand, rather than 
up front, and then requesting images and updating them when they arrive


Beyond a suggestion to ensure the images which are being downloaded are 
already suitably sized/thumbnailed for display.


Decompressing images is a relatively expensive operation - decompressing 
and then downsizing them (thumbnailing) even more so.


So, if you control the webservice that is providing the images it would 
probably be worth making it so that the server can send you images at 
the size needed and do the thumbnailing on the server (caching the 
results alongside the original image on the server).


For maximum fidelity you want the width/height * the device pixel scale 
(which can vary from 1 to 3 these days).


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: resetall?

2022-02-21 Thread Mark Waddingham via use-livecode

On 2022-02-21 18:09, Mark Wieder via use-livecode wrote:

On 2/21/22 08:57, Mark Waddingham via use-livecode wrote:


If you want to brute force close all sockets then I suggest:


     repeat for each line i in the openSockets
   close socket i
     end repeat

:)


Yeah, that's what I'm doing now since resetall doesn't do anything
useful. Displaying the opensockets after a resetall still shows the
same sockets as before issuing the command.

And the repeat loop works maybe 50% of the time. It seems that maybe
if I have an active blocking read on a socket it doesn't get closed.
Could that be the case?


So I think there's something else going on in your scripts (or in the 
environment!) as from what I can see...


When `close socket` is performed, the socket is marked as `closing`, and 
`the openSockets` never includes sockets which are marked as `closing`.


The closing flag on a socket is only ever changed in two places - on 
socket creation/open, when it is set to false, and then on `close 
socket` where it is set to true.


Put another way - if you have done 'close socket i', then it is then it 
should be logically impossible for i to be in the openSockets 
immediately afterwards.


i.e. Based on my reading of the engine code:

  get line 1 of the openSockets
  close socket it
  put it is among the line of the openSockets

Will always put false.

Of course, it is possible after closing a socket, and if the event loop 
has run for a handler to have opened the same socket again (bearing in 
mind sockets are named for their address and port; unless an explicit 
tag is provided)...


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: resetall?

2022-02-21 Thread Mark Waddingham via use-livecode

On 2022-02-21 16:51, Mark Wieder via use-livecode wrote:

Before I report this one...

I thought resetall was supposed to close open sockets. There's even a
warning in the docs about it being a brute force close. But it doesn't
seem to do anything useful. Am I missing something?


Its a synonym for libUrlResetAll - and was only really intended to reset 
libUrl state I think (so its not clear to me why it didn't only ever 
touch the sockets libUrl was using).


These days if tsNet is loaded then it will just reset tsNet's state:

on libUrlResetAll
  local i

  -- CW-2016-06-11: [[ External driver support ]] Call driver specific 
reset command if external driver is in use.

  if lvExtDriver is not empty then
ulDeleteLocals
ulExtResetDriver
  else
if there is a stack "libUrl" then put empty into fld "log1" of stack 
"libURL"

repeat for each line i in the openSockets
  close socket i
end repeat

ulDeleteLocals
put true into lvJumpOut
send "ulDeleteLocals" to me in 5 milliseconds
  end if
end libUrlResetAll

If you want to brute force close all sockets then I suggest:


repeat for each line i in the openSockets
  close socket i
end repeat

:)

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Encrypting long text

2021-12-16 Thread Mark Waddingham via use-livecode

On 2021-12-16 17:09, Sean Cole via use-livecode wrote:

Thanks Mark,

New problem. Trying to use aes-256-ctr instead. I'm following the 
syntax in

the dictionary but it throws a red cross on it:

encrypt tData using "aes-256-ctr" with key tMyKey and salt tMySalt


I think you can either specify a key, or a password with an optional 
salt.


If you specify a password it uses the provided salt (or a random one if 
one is not provided) to generate a key of the correct length (the bit 
length of the cipher).


If you provide a key then it uses that verbatim to encrypt the data (in 
this case the key must be the correct number of bits as defined by the 
chosen cipher - 256 in this case).


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Encrypting long text

2021-12-16 Thread Mark Waddingham via use-livecode

On 2021-12-16 16:23, Sean Cole via use-livecode wrote:

Hi all,
I'm trying to use RSA to encrypt data from a text field like an address 
or
notes. When I try to use the encrypt command I get a result 'message 
too

long'. What is the method for encrypting long or large data?

My current line of code:
   encrypt tData using rsa with public key tMyKey and
passphrase tMyPass


RSA encryption can only encrypt data up to a certain length (I can't 
remember off the top of my head the exact relation, but it is related to 
the size of the key) so it isn't designed to be used on arbitrary length 
messages.


Encrypting arbitrary length messages is the domain of symmetric 
encryption functions - like AES and friends.


The solution, therefore, is to combine the two:

  1) Generate a random (using randomBytes()) fixed length encryption key 
FixedKey


  2) Encrypt the actual data using a symmetric algorithm with FixedKey 
as password


  2) Use RSA to encrypt the (fixed length!) key FixedKey

  4) Make you message the RSA-encrypted FixedKey followed by the 
encrypted data


The RSA encrypted FixedKey will be a constant length, and thus you can 
just split that off of the combined data, decrypt it using RSA and then 
use the result to decrypt the payload.


Hope this helps!

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: [ANN] Release 10.0.0 DP-1

2021-12-14 Thread Mark Waddingham via use-livecode

On 2021-12-14 13:50, Rolf Kocherhans via use-livecode wrote:

First of all thanks for the WebAssembly HTML5 implementation. This is
really great stuff !

For instance all my URL stuff (loading a stack on same domain) is
unfortunately not working anymore.

Also, all the PHP scripts which I used to access, which downloaded
stuff from other domains and then displayed
the result in the Browser don't work anymore.


Is this just me - or is it just not implemented yet ?


I don't think it is only you - at least one other person has mentioned 
on the forums that their URL operations are not working either.


What url operations are you using?

The reason I ask is because the engine only has built-in support for 
`load url` currently - the other syntax is implemented by a libURL 
'driver' and I have a suspicion that the latter may be currently broken.


Warmest Regards,

Mark.

P.S. And yes, this is high on the list to investigate in more depth and 
fix!


--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: How to paste into a form element in the browser widget

2021-12-14 Thread Mark Waddingham via use-livecode

On 2021-12-14 11:41, Tore Nilsen via use-livecode wrote:

I have a problem pasting into a form element on a web page in the
browser widget. This works well in the IDE, but not in a standalone
application. The application has no menus, but I have included a
pasteKey script to handle paste shortcuts. This does not seem to do
the trick in the browser widget. I have tried to put the script in the
stack script, the card script and even in the widget itself, although
I wouldn’t expect the latter to work. Are there anyone who has run
across this problem before and may offer a solution?


I think you'll need to include an Edit menu with the normal shortcuts 
(Cut/Copy/Paste) - make sure the tag of the items is correct as the 
engine uses those to map them to the internal (Cocoa) references. e.g.


  (Cu /X|cut
  ( /C|copy
  ( /V|paste

Cocoa-based controls (which the browser widget uses the WebView variant 
of) don't respond to shortcuts directly, but only via menu item 
accelerators - so the browser widget needs the menu items present for 
such shortcuts to work.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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 tap location doesn't match visual location

2021-11-20 Thread Mark Waddingham via use-livecode
Hi Scott - the touch coords being wrong sounds like a bug to me - can you file 
a report (with example stack if possible).

Thanks!

Mark.

Sent from my iPhone

> On 20 Nov 2021, at 12:04, scott--- via use-livecode 
>  wrote:
> 
> Just answering my own question in case anyone searches this later. 
> 
> This was kind of a forehead slapper when I finally saw it. There was a native 
> UIScroller over part of the screen. None of the other buttons on the screen 
> were inside the rectangle of the scroller, so they weren’t effected. The 
> scroller was being disabled while the fake dialog was on the screen and this 
> worked fine for iOS but in my case at least, it is problematic for Android. 
> My solution for now is to either leave the scroller active on Android (not a 
> great UI but tolerable) or delete the scroller while the fake dialog is 
> showing and rebuild the scroller after the fake dialog is dismissed… which is 
> probably the better solution. I’m not sure why the disabled Android scroller 
> is offsetting the touch when the iOS scroller is not. Maybe it is a bug and 
> I’m the first person to put a disabled scroller over a button…more likely it 
> is something that I’m doing wrong when I create the scroller.
> — Scott Morrow
> 
>> On Nov 20, 2021, at 1:05 AM, scott--- via use-livecode 
>>  wrote:
>> 
>> Jacque, that is pretty much what I’m doing (except that my semi-transparent 
>> screen graphic is separate from the fake dialog group.) I agree that this 
>> approach normally works well. I don’t have as much experience on Android so 
>> I wondered if it had something to do with the platform. Apparently it is 
>> something I’m doing.
>> 
>> Brian, I will try your suggestion of isolating and breaking the process down 
>> in order to determine where the issue lies. I was just feeling lazy and 
>> hoping to save myself some work.  :-)
>> 
>> 
 On Nov 19, 2021, at 10:45 PM, J. Landman Gay via use-livecode 
  wrote:
>>> 
>>> I've done several fake dialogs. The trick is to group the dialog with a a 
>>> semi-transparent full screen graphic layered behind the dialog group. 
>>> Greying the screen is normal behavior on Android and works on iOS too. The 
>>> graphic has blocker mouse handlers so clicking it does nothing. That way 
>>> you can script the dialog buttons to respond themselves. The user needs to 
>>> click one of the buttons to make the dialog go away, at which point you 
>>> hide the group.
>>> 
>>> The buttons can put the response in the dialogData, which is a built in 
>>> mechanism to transfer custom messages to a script, or else you can put the 
>>> response in a global or a custom property.
>>> 
>>> --
>>> Jacqueline Landman Gay | jac...@hyperactivesw.com
>>> HyperActive Software | http://www.hyperactivesw.com
 On November 19, 2021 10:49:57 PM scott--- via use-livecode 
  wrote:
>>> 
 I’m having trouble with an app that up until now has just been for iOS. 
 Most of the changes have been pretty straight forward but I’ve encountered 
 a specific case where touching a button doesn’t pass the touch message to 
 the button being tapped… unless I touch significantly below the button (I 
 also had to switch from mouse messages to touch messages in this 
 particular case.) This is not a general issue. It only happens when I show 
 a group  containing the buttons in question and while this group is 
 displayed there is repeat loop running that includes  “wait with messages” 
 (I’m faking a modal dialog.) I encountered this once before under the same 
 circumstances (a fake modal dialog while moving an iOS app to Android) and 
 simply switched to using the built in dialog. Unfortunately, that won’t 
 work in this case.  Any thoughts?
 
 --
 Scott Morrow
 
 Elementary Software
 (Now with 20% less chalk dust!)
 web   https://elementarysoftware.com/
 email sc...@elementarysoftware.com
 booth1-360-734-4701
 --
>> 
>> 
>> ___
>> 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: The Dreaded tsNet "Error Previous request not completed" iOS app

2021-11-19 Thread Mark Waddingham via use-livecode

On 2021-11-19 17:20, Ralph DiMola via use-livecode wrote:
I just wanted to thank Jacqueline Landman Gay and Charles Warwick for 
this

thread
https://www.mail-archive.com/use-livecode@lists.runrev.com/msg113554.html

I still wonder how more than one synchronous operation can be in play 
at the

same as synchronous operations are blocking. Oh well I works now with
tsNet-Pro. Well worth the price...


So technically 'synchronous' libURL operations are not blocking - they 
use a nested wait. As libURL is a script library, and uses engine 
sockets (and thus messages), they need to get messages and so all 
messages also occur. Indeed, this also means you can handle progress 
notifications, and whatever means you choose to show the UI is currently 
'blocked' because your script is busy.


It does mean you do have to be somewhat careful with `get url` and 
friends - since you can end up in a bit of a recursive mess (i.e. if a 
message fires while a get url is going on, and you do another get url 
etc. etc.).


There is a request in BZ to make tsNet's synchronous calls truly 
blocking - however that would probably need to come with some sort of 
automatic 'busy' indicator over all currently open windows to prevent UI 
events getting queued / lost (and users being confused why things don't 
work at certain points!). The upside of that is that it might prevent 
'mysterious' problems with accidental recursive waits which can happen 
at the moment.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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: Broken: November use-livecode Archive!

2021-11-18 Thread Mark Waddingham via use-livecode

On 2021-11-18 18:13, Curry Kenworthy via use-livecode wrote:

The November use-livecode Archive has been broken
for around 20 hours:




Its a side-effect of deleting a recent post which contained sensitive 
information (obviously we can't get rid any copies elsewhere, but can on 
our server). We are aware of the issue and will endeavour to rectify the 
problem tomorrow.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
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


  1   2   3   4   5   6   7   8   9   10   >