RE: Standalone riddle

2023-01-15 Thread Ralph DiMola via use-livecode
I'd be interested to see if what difference there is between the test apk
and the standalone builder apk. This has me a bit worried. If you want to
send me the 2 apks I will dive in and see at least what file(s) are
different.

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net

-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
Of J. Landman Gay via use-livecode
Sent: Saturday, January 14, 2023 6:25 PM
To: How to use LiveCode
Cc: J. Landman Gay
Subject: Re: Standalone riddle

On 1/14/23 1:55 AM, Geoff Canyon via use-livecode wrote:
> This doesn't solve the puzzle, but: use a stack property to store the 
> value instead?

The value is entered correctly and displays after I dismiss the error
dialog. I have finally found where the issue is, but I don't know why it
happens. The normal sequence is pretty simple:

1. Enter a search term and hit the return key on the virtual keyboard. This
triggers the inputReturnKey message.

2. InputReturnKey calls handler doSearch, which looks up the definition,
populates a browser widget on card 2, and goes to card 2.

What is happening is that inputReturnKey is being sent twice. The first time
it works as expected, but the second time we are already on card 2 and the
controls on card 1 are no longer available. Ergo, I get the "no such object"
error. I found this by inserting "checkCd the params" at the beginning of
doSearch. CheckCd does this:

on checkCd pParams -- track inputReturnKey error
   put pParams &cr&cr into tData -- the calling handler params
   put the executionContexts after tData
   answer tData
end checkCd

...and I got two dialogs in a row. I could see card 2 behind the second one,
which was a debug errorDialog instead of an answer dialog.

So the burning question is why does a single tap on the return key send two
duplicate inputReturnKey messages, and why does that happen only in a built
standalone?

Maybe I won't embarrass myself if I enter a bug report now.

-- 
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: Training the AI to write better LiveCode

2023-01-15 Thread Mike Kerner via use-livecode
this is feeling like it could/should become a test suite: questions posed,
and the quality of the solution

On Sat, Jan 14, 2023 at 4:16 PM Kaveh via use-livecode <
use-livecode@lists.runrev.com> wrote:

> I just tried Google to the answer to a problem. Didn't get it first time,
> so tried ChatGPT. I asked:
>
> *How do I add a button to a group in LiveCode using a script?*
>
> I got:
>
> *create button "myButton" in group "myGroup"*
>
>
> *This command creates a new button object with the name "myButton" and
> places it inside the group "myGroup".*
> Just what I needed.
>
> You can also set properties of the button
>
> On Sat, 14 Jan 2023 at 20:09, Mark Smith via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
> > Thanks for posting this Geoff. It’s the first time I've seen a ongoing
> > dialog between a programmer and Chat GPT and the first thing I am struck
> by
> > (but not the only thing) is it’s ability to deal with human ambiguity.
> For
> > example, you ask it to modify the code to be an “on mouseUp handler in a
> > button". But nowhere in its response is there any sign of a button. It
> just
> > totally ignored that part of your request. The code it provides works in
> a
> > card, a stack, a graphic image, an svg widget, in fact, in anything that
> > accepts mouseUp input. And yet, it didn’t worry itself about that. Very
> > interesting. It’s kind of like, “this works in a button, so good enough”.
> > That is not the kind of “nuance” I am used to expecting from an AI. So,
> > progress has clearly been made in interpreting what humans say (or ask)
> in
> > a very loose way.
> >
> > The 2nd, and perhaps more astounding example, is when you ask it to
> > "rewrite the code to be a function that takes an argument "n", repeats
> with
> > 1 to n, and returns the results”.
> >
> > The really clever bit here is not that it rewrites the previous code into
> > a function, but that it removes the bit about "put fizzbin into field
> > “display””. How does it know that putting the result in a field is NOT
> the
> > typical responsibility of a function? How does it know that that step
> needs
> > to occur AFTER the function call? That is so high-level that I am sure
> lots
> > of beginning programmers have made that mistake. It even comments on it
> in
> > the documentation. So there is some very deep semantic understanding of
> > programming code that is going on here. Because,  you did not ask it to
> do
> > that, but the fact that it did it anyway indicates it clearly understands
> > what the purpose of a function is.
> >
> > Quite weird for me to comprehend how it knows that. Unless of course, you
> > were somehow more specific than your examples illustrate.
> >
> > Mark
> >
> > > On 14 Jan 2023, at 3:22 am, Geoff Canyon via use-livecode <
> > use-livecode@lists.runrev.com> wrote:
> > >
> > > So just now I put this in to chatgpt:
> > >
> > > "fizz bin" is a program that counts from 1 to 100, replacing every
> number
> > > divisible by 5 with "fizz" and every number divisible by 7 with "bin";
> > and
> > > numbers divisible by both 5 and 7 with "fizz bin". Write code in the
> > > programming language livecode to execute "fizz bin"
> > >
> > > This is what ChatGPT responded with:
> > >
> > > repeat with x = 1 to 100
> > >if x mod 5 = 0 and x mod 7 = 0 then
> > >put "fizz bin"
> > >else if x mod 5 = 0 then
> > >put "fizz"
> > >else if x mod 7 = 0 then
> > >put "bin"
> > >else
> > >put x
> > >end if
> > > end repeat
> > >
> > > That works as-is, but obviously the results fly by in the message box.
> > So I
> > > put a field and a button on a card, and edited to this, and it works
> > > perfectly:
> > >
> > > on mouseUp
> > >   repeat with x = 1 to 100
> > >  if x mod 5 = 0 and x mod 7 = 0 then
> > > put "fizz bin" & cr after fld 1
> > >  else if x mod 5 = 0 then
> > > put "fizz" & cr after fld 1
> > >  else if x mod 7 = 0 then
> > > put "bin" & cr after fld 1
> > >  else
> > > put x & cr after fld 1
> > >  end if
> > >   end repeat
> > > end mouseUp
> > >
> > > Then as I was typing this email I realized I was potentially selling
> > > chatgpt short, so I put this in:
> > >
> > > Modify that code so it works as an "on mouseUp" handler in a button,
> and
> > > concatenates the results on individual lines, and puts the final result
> > > into the field "display"
> > >
> > > And it output this:
> > >
> > >
> > > on mouseUp
> > >   put "" into fizzbin
> > >   repeat with x = 1 to 100
> > >  if x mod 5 = 0 and x mod 7 = 0 then
> > >  put "fizz bin" & return after fizzbin
> > >  else if x mod 5 = 0 then
> > >  put "fizz" & return after fizzbin
> > >  else if x mod 7 = 0 then
> > >  put "bin" & return after fizzbin
> > >  else
> > >  put x & return after fizzbin
> > >  end if
> > >   end repeat
> > >   put fizzbin into field "display"
> > > end mouseUp
> > >

Re: Standalone riddle

2023-01-15 Thread J. Landman Gay via use-livecode

On 1/15/23 2:44 PM, Ralph DiMola via use-livecode wrote:

I'd be interested to see if what difference there is between the test apk
and the standalone builder apk. This has me a bit worried. If you want to
send me the 2 apks I will dive in and see at least what file(s) are
different.


I think I've figured it out; the files won't be any different. Test builds always include the 
remote debugger, standalones do not unless you specifically select it in Inclusions. I didn't 
do that, and I have an errorDialog handler in the stack, so I think that's causing the 
appearance of the error dialog in the standalone. In the test app the error seems to be ignored 
(but don't ask me why...)


I've submitted a bug report:


The stack is for my own use, a very (not so attractive) minimal LC dictionary lookup so I can 
check syntax when I'm not at my computer. You can download it from the report. Maybe someone 
else will find it useful. It uses James Hale's docset for reference. I couldn't get his Docset 
Reader to work reliably on Android, and I didn't need all the extra LC Builder and Guides 
documentation, so this is just a stripped-down list of dictionary terms.


The fix is mentioned in the report. Just comment out line 71 and uncomment the line with the 
fix. Checking the current card before initiating a search is the workaround.


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


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standalone riddle

2023-01-15 Thread Mark Wieder via use-livecode

On 1/15/23 15:58, J. Landman Gay via use-livecode wrote:



I think I've figured it out; the files won't be any different. Test 
builds always include the remote debugger, standalones do not unless you 
specifically select it in Inclusions. I didn't do that, and I have an 
errorDialog handler in the stack, so I think that's causing the 
appearance of the error dialog in the standalone. In the test app the 
error seems to be ignored (but don't ask me why...)


Here's why. From the dictionary:

*Note:* The errorDialog message is only sent while Script Debug mode 
is turned off.


--
 Mark Wieder
 ahsoftw...@gmail.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standalone riddle

2023-01-15 Thread J. Landman Gay via use-livecode

How ironic. The stack contains the LC dictionary. I should have asked it.

Riddle solved.
--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On January 15, 2023 9:06:09 PM Mark Wieder via use-livecode 
 wrote:



On 1/15/23 15:58, J. Landman Gay via use-livecode wrote:



I think I've figured it out; the files won't be any different. Test
builds always include the remote debugger, standalones do not unless you
specifically select it in Inclusions. I didn't do that, and I have an
errorDialog handler in the stack, so I think that's causing the
appearance of the error dialog in the standalone. In the test app the
error seems to be ignored (but don't ask me why...)


Here's why. From the dictionary:

*Note:* The errorDialog message is only sent while Script Debug mode
is turned off.

--
 Mark Wieder
 ahsoftw...@gmail.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: Standalone riddle

2023-01-15 Thread Mark Wieder via use-livecode

On 1/15/23 19:21, J. Landman Gay via use-livecode wrote:

How ironic. The stack contains the LC dictionary. I should have asked it.

Riddle solved.


TBF, that's buried way at the bottom of the dictionary entry.

--
 Mark Wieder
 ahsoftw...@gmail.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