Re: [OT] Poll: What does it mean for 1 rect to be 'within' a certain distance of another rect?

2021-02-16 Thread Alex Tweedly via use-livecode
Paul - if you need to do this (i.e. find pairs of rects which are too 
close) for LARGE numbers of rects, I have some code to do this very 
efficiently (somewhere in an old archive, just ready to translate from C 
to LC). It uses a 'trailing window horizontal scan' so reduces the 
complexity/time from N^2 to N log N


Alex.

On 16/02/2021 18:27, Paul Dupuis via use-livecode wrote:

On 2/15/2021 5:53 PM, Paul Dupuis via use-livecode wrote:
This is an Off Topic informal poll of sorts, but related to LiveCode 
as I am writing a LiveCode expression to determine if 2 arbitrary 
rectangles (r1,r2) are with some distance d (in px) of one another. 
In considering this problem, the questions comes up: What is meant by 
rectangles being within a distance d of one another. What is the 'd' 
measured from?


center to center? Easiest is many ways, but I don't think this is 
what most people would think of.


adjacent edge to adjacent edge? This is harder (I think), but I think 
this is what more people intuitively think of. To me, implicit in the 
visual concept of 2 rects being within some distance of one another 
is that they are NOT overlapping, but that some gap exists between 
the nearest adjacent edges?


Something else? What does 2 rects  being 'within' d pixels of one 
another mean to you, if not one of the two above options?


Maybe there is a exact mathematical definition of what 2 rectangles 
being within distance d of one another is, but, if there is, I am 
unfamiliar with it.



Okay, Poll Closed!

Thank you everyone. I think the responses (informal as this is) 
confirms the majority fo people think of distance between 2 rectangles 
as the distance between nearest edges or vertices which is the same as 
saying the *smallest* distance between any two points in the rects 
(mathematically)


I appreciate all the responses! (and the links and code examples!)

-- Paul

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

2021-02-16 Thread Alex Tweedly via use-livecode


On 15/02/2021 12:55, Andre Garzia via use-livecode wrote:
It is with this in mind, that I decided to create content for our 
community. Books are an easy value proposition. Most of our community 
is beyond their thirties and have a fondness (and experience) for the 
written word and documentation. It is easy to sell books here, way 
easier than in other communities which are younger and prefer videos. 
That doesn’t mean that I can’t provide videos as well, damn I’ve 
graduated with a BA in filmmaking, I’m geared to start filming too. 
Books were the first step. I see myself more as a storyteller than a 
developer, that is why I want to focus on content for my own career 
moving forward. But that is only my own personal journey, other people 
here have a different path. I just wish that more people here decide 
to share their knowledge (and code) so that we can become a more 
vibrant community. 


Then I have a concrete suggestion for what would, I think, be a very 
useful e-book + stack.


A sample 'skeleton' app - i.e. complete but not fleshed-out. Initially 
it would be for a desktop app (the first sequel will cover mobile). It 
would implement "good practices" for many of the common features, with 
enough code being there to do something - but the focus should be on the 
architecture rather than on doing anything useful.


It should include (most of):

 - splash stack, with checks for updated versions, background 
downloading & installing them, etc.


 - proper locations for libraries, prefs files, other config data, 
other data, etc. as well as loading the libraries.


 - simple preferences handling (i.e. library which will store, retrieve 
and allow basic user interaction to view/update preferences - given some 
description of the preferences)


 - a menu, ready to extend or remove, with abstraction of the functionality

 - maybe a status bar

 - some groups that handle resizing well

 - multiple cards should be involved

 - probably simple SQL (i.e. sqlite + your DBLib)

And of course the most difficult part will be writing the e-book that 
describes the app, what it does, and maybe why those particular methods 
were chosen over some of the alternatives.


Then the sequel would cover mobile, so adding features like a Header 
Bar, segmented control, using library to overlay controls with native 
controls as needed, ... as well as describing the hoops one needs to 
jump through to actually do mobile developments.


Further sequels could then cover additional features - again for 
architecture and example, not just to make it a more complicated app. 
For example: toolbar, pane splitter, data grid, ...


Alex.

P.S. I'd be happy to collaborate on doing the development part - but I 
suspect you'd be quicker without me :-)


P.P.S title suggestion "The Soul of a New App".



___
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] Poll: What does it mean for 1 rect to be 'within' a certain distance of another rect?

2021-02-16 Thread Alex Tweedly via use-livecode

Hi Henk,

No, it's maybe not obvious but it does take all cases into account.

If the smallest distance is between corners of each rectangle - only 
then does the 'sqrt' have real meaning. In all other cases, one or other 
of the DX and DY comes out as 0.


--
 |    |
| R1 |  --
 |    |  |    |
 |    |  | R2 |
 --  |    |
     -


So if there is an overlap in one dimension, (Y above) then DY is 
calculated as 0 - and the result is the distance in X (i.e. sqrt(DX*DX+0) ).


Alex.


On 16/02/2021 07:45, Henk van der Velden via use-livecode wrote:

Alex,
No one would challenge your definition I think, but your solution only takes 
the corner points into account, right? So this wouldn’t give correct results in 
case the rectangles have different sizes or are positioned obliquely.

Henk



On 16 Feb 2021, at 03:12, use-livecode-requ...@lists.runrev.com wrote:

For me, a more precise problem specification is:

Given two rectangles (in regular Livecode format), the distance between
them is :

?- if they touch or overlap, distance is zero.

?- otherwise, it's the smallest distance from any point in R1 to any
point in R2.

Which leads to a simple solution


function rdist R1, R2
?? local DX, DY
?? put max( item 1 of R1 - item 3 of R2, item 1 of R2 - item 3 of R1,
0) into DX
?? put max( item 2 of R1 - item 4 of R2, item 2 of R2 - item 4 of R1,
0) into DY
?? return sqrt( DX*DX + DY * DY)
end rdist


Alex.

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


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


Re: [OT] Poll: What does it mean for 1 rect to be 'within' a certain distance of another rect?

2021-02-15 Thread Alex Tweedly via use-livecode


On 15/02/2021 23:21, Sean Cole (Pi) via use-livecode wrote:

Hi,
No point reinventing the wheel..


But most of those links actually did not have this particular wheel, or 
anything like it.


The exception was the last one (programmerssought.com) which had an 
ugly, inefficient and lengthy (45 lines in Python) solution. [OK, that 
45 includs blank and comments :-) !!


For me, a more precise problem specification is:

Given two rectangles (in regular Livecode format), the distance between 
them is :


 - if they touch or overlap, distance is zero.

 - otherwise, it's the smallest distance from any point in R1 to any 
point in R2.


Which leads to a simple solution


function rdist R1, R2
   local DX, DY
   put max( item 1 of R1 - item 3 of R2, item 1 of R2 - item 3 of R1, 
0) into DX
   put max( item 2 of R1 - item 4 of R2, item 2 of R2 - item 4 of R1, 
0) into DY

   return sqrt( DX*DX + DY * DY)
end rdist


Alex.



Lots of other way. Distance between two near or far edges. distance between
corners, distance to centers, or area median, area of space between,
overal usage area minus the area used by the two rectangles. Math is fun.
Keeps us in business.

Google (distance between two rectangles):

https://stackoverflow.com/questions/4978323/how-to-calculate-distance-between-two-rectangles-context-a-game-in-lua

https://math.stackexchange.com/questions/2724537/finding-the-clear-spacing-distance-between-two-rectangles

https://www.wyzant.com/resources/answers/583373/finding-the-distance-between-two-rectangles

https://www.programmersought.com/article/44554760896/

etc

On Mon, 15 Feb 2021 at 22:53, Paul Dupuis via use-livecode <
use-livecode@lists.runrev.com> wrote:


This is an Off Topic informal poll of sorts, but related to LiveCode as
I am writing a LiveCode expression to determine if 2 arbitrary
rectangles (r1,r2) are with some distance d (in px) of one another. In
considering this problem, the questions comes up: What is meant by
rectangles being within a distance d of one another. What is the 'd'
measured from?

center to center? Easiest is many ways, but I don't think this is what
most people would think of.

adjacent edge to adjacent edge? This is harder (I think), but I think
this is what more people intuitively think of. To me, implicit in the
visual concept of 2 rects being within some distance of one another is
that they are NOT overlapping, but that some gap exists between the
nearest adjacent edges?

Something else? What does 2 rects  being 'within' d pixels of one
another mean to you, if not one of the two above options?

Maybe there is a exact mathematical definition of what 2 rectangles
being within distance d of one another is, but, if there is, I am
unfamiliar with it.


___
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: Stack check-out/check-in

2021-01-25 Thread Alex Tweedly via use-livecode
which is fine if you are OK doing manual clean-up when, not if, if the 
stack should ever exit without 'quit'ing, or become disconnected from 
the network, or ... any of which would leave the file-flag behind.


The  easiest alternative is to have the stack update the file 
periodically, and instead of checking for the file's existence, check 
how up-to-date it is. Do the update this periodically (maybe every 
minute, every 5 minutes , ...) and if the file exists but is old by more 
than 3 * the chosen interval then delete the file and continue.  (And do 
be careful of time drift between different machines).


Alex.

On 26/01/2021 01:06, Paul Dupuis via use-livecode wrote:
If the could storage the stack is on has write access, the easiest 
mechanism is a file based flag.


When the stack is launched, if checks:

if there is a file  then
  -- the stack is already open, so exit
else
   put empty into URL ("file:"&) -- creates a empty file to 
mark as open

end

and  when the stack exists remove the file

on quit
  delete file 
end quit

Or something like that. I do not have LC open to check my code above.


On 1/25/2021 7:24 PM, Marty Knapp via use-livecode wrote:
I have an app that allows user to create specialized editable 
documents (stacks) that open in my app. Some customers use Dropbox, 
iCloud, OneDrive or similar to store these documents so that they can 
be accessed from 2 different computers. Is there a way to tell if a 
stack is already open on one computer? I need to prevent them from 
opening a 2nd instance of the stack on the other computer so that 
Dropbox (or other cloud sync service) does not create a conflicted copy.


If there is not a way to tell, has anyone created some sort of stack 
check-out/check-in system that they'd be willing to share? I need 
this for Mac, PC and mixed.


Marty
___
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: opened socket in IDE prevents script changes

2021-01-15 Thread Alex Tweedly via use-livecode


On 15/01/2021 14:46, matthias rebbe via use-livecode wrote:

Alex,
for a new project which should include socket communication  i have to prototype a short 
"demo" and i was already wondering if i need to have running 2 instances of the 
LC IDE for development.

But now you wrote that you had one server and even multiple client stacks 
opened in LC.
So do i understand it correctly that both, server and client stack, can 
communicate with each other using sockets in one instance of the LC IDE?


Yes. A couple of cautions ...

 - make sure your handlers are carefully named
    I had a bad habit of using the same name (_gotpacket) each time I 
wrote a socket-handling stack,

so I had 'open socket ... with message "_gotpacket" '
and then I used the same name when I wrote the server !!

 - beware "resetall". In the server stack, I do something like


    -- would usually do
  --    resetAll
  -- but this causes problems with testing when you have both a client
  -- and a server within the IDE of Rev
  -- so here we will only reset those opensockets which have no 
'host' part

  -- intending this to be the ones which we have a current 'accept'
  repeat for each line tSock in the openSockets
 if ":" is not in tSock then close socket tSock
  end repeat

and in the client stacks I do the inverse (if ":" is in tSock ...). Note 
this is still a problem when you have multiple client stacks in the same 
IDE.


Finally,

 - when in doubt during testing - first reset the server, then the client.


Good luck,

Alex.


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


Re: opened socket in IDE prevents script changes

2021-01-15 Thread Alex Tweedly via use-livecode


On 15/01/2021 15:30, Bernard Devlin via use-livecode wrote:

I'm seeing exactly the same range of behaviours I described earlier for
9.5.1 on Win 10 but with 9.6.1 on OS X.

It's very strange that Alex is also editing scripts with sockets
opened/closed but  not losing changes made in the script editor. I also had
3 crashes on OS X within 30 minutes of working on this stack.

Alex, are you using the IDE's script editor or some external editor?  If
you are using that script editor, once you've opened a socket could you add
a comment to your stack script, apply, close the script editor, then edit
the script again to see if the comment has persisted?  I have to quit LC to
make any changes to a stack once I've opened a socket.


Yes, I'm using standard IDE script editor.

The added comment persists, both through  "apply - close - reopen" and 
"apply - save stack - close editor - reopen", and to stack and card scripts.



It seems to me that once a socket has been opened that the IDE is no longer
persisting changes.  I'm pretty sure I didn't see this behaviour on my
previous project using sockets.


Have to ask

 - do you have any plugins that might use sockets ?

 - I'm using Indy version - let me know if you're on Community / 
Business and I can try that too

  I think :-)

 - do you, or have you, used other editors / debuggers that might 
affect this ?


 - do you, or have you, used remote debugging ?

That's all the straws I can think of for now.

Alex.


Regards
Bernard

On Fri, Jan 15, 2021 at 12:21 PM Bernard Devlin  wrote:


Thanks Alex for your quick response.

I'll try with 9.6.1 on Mac.  The only other difference between us is that
my sockets are interacting with a process outside of LC. But I can't see
why that would make a difference (particularly once I've closed all
sockets, I wouldn't expect sockets to interfere with scripts being
changed).

Regards,
Bernard

On Fri, Jan 15, 2021 at 12:07 PM Alex Tweedly via use-livecode <
use-livecode@lists.runrev.com> wrote:


I've not seen any such problems - though with 9.6.1 / Mac.

I've spent most of the last week in the IDE, with two or more stacks
open (one server, one client - occasionally multiple client stacks) so I
have multiple open sockets (both 'accept'ing and 'open'ed)  almost all
the time, and had no problems with IDE or script editor.

(I know - that's no consolation, but I thought I'd mention it in case
9.6.1 was an option for you and might just help:-)



___
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: opened socket in IDE prevents script changes

2021-01-15 Thread Alex Tweedly via use-livecode

I've not seen any such problems - though with 9.6.1 / Mac.

I've spent most of the last week in the IDE, with two or more stacks 
open (one server, one client - occasionally multiple client stacks) so I 
have multiple open sockets (both 'accept'ing and 'open'ed)  almost all 
the time, and had no problems with IDE or script editor.


(I know - that's no consolation, but I thought I'd mention it in case 
9.6.1 was an option for you and might just help:-)


Alex.

On 15/01/2021 11:37, Bernard Devlin via use-livecode wrote:

This is a strange phenomenon.I wonder if anyone else has seen this.

Livecode 9.5.1 Windows 10.

If a socket is opened then changes to scripts in the IDE are not
applied/saved.  There's no error message. It *appears* from the IDE that
the changes are applied (i.e. the changes are visible in the script editor,
the "apply" button indicates the script is no longer dirty).

*Even if the socket is then closed and changes made this problem occurs.*
There are also many crashes of the IDE in working on scripts involving
sockets.  It's because of these crashes that I realised changes are not
applied.

Once a socket has been opened/closed then in the IDE the stack cannot be
closed/reopened without closing/reopening the entire IDE. Saving the stack
from the message box also results in the (not really applied) changes being
saved.

Regards
Bernard
___
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: Threads in LC

2021-01-08 Thread Alex Tweedly via use-livecode


On 08/01/2021 01:51, Bob Sneidar via use-livecode wrote:

I have thought about this a bit. If what you mean by multiprocessing is that a 
new process can be spawned while your app can go off and do other things and 
get notified later that something happened, then this is quite doable. If what 
you mean is that you want to make the app spawning the processes operate more 
efficiently by launching the same process over and over in multiple instances, 
then I don’t think so. At some point the parent process is going to have to get 
the result of each thread and do something about it.


I did something like this, but didn't spawn a new process for each 
asynch task being launched.


What I did instead was have a very general purpose 'task handler' app, 
and have multiple instances of this 'server app' running all the time; 
as long as they're not doing any task, that's a negligible "cost" in 
resources. Each instance would accept a socket connection on a different 
port (e.g. 6000, 6001, 6002, ...) and would be passed "requests" to 
handle a specific task. It would queue up multiple tasks, handle them in 
turn, and pass the result back over the connection to whichever app 
requested it.


Then there was a client library, which would handle all the "messiness" 
for the client, so the app need not be too involved. The app itself 
would simply 'start using' the library, tell it which tasks it wanted to 
be able to do (see below), and then pass in multiple requests through 
library calls. The library would determine how many task-handler apps 
were available, parcel out the requests between them, and provide the 
responses to the client (if needed).


For each task (or set of tasks) you would write a library stack, which 
would have handlers to perform the task(s), and respond.



Example (trivial and may contain typos).

(you have to imagine that generating random numbers was very time 
consuming :-),


1. Write a library stack to perform some tasks.

stack "randomstuff"
global gResultData, gResultObject   -- remember - one task at a time, so 
no race conditions


on randomint pData
   local tmp, tMin, tMax
   put word 1 of pData into tMin
   put word 2 of pData into tMax
   put random(tMax - tMin + 1) into tmp
   put tmp-1 + tMin into gResultData
   send "completedTask" to gResultObject in 1 millisec
end randomint


2. In the client app, determine the tasks to be handled

(within, say, openstack)

   taskClientLoadStack "randomstuff.livecodescript"


3. when you need a number of random integers

  repeat 1000 times
    put taskClientSendARequest("randomstuff", "randomint 12 17", the 
long ID of me) into tmp

  end repeat
   -- (the return value is a request id - often can be ignored).
...
on taskcomplete pID, pResult
   -- pID is the request ID, pResult is the returned data from that request
   put pResult  after sNumbers   -- or whatever
...
end taskcomplete

In addition, there were various 'admin' taks you could request (close 
connection, cancel pending tasks, get count of remaining tasks pending, 
...). The initial version of the client library simply round-robined the 
task requests between the task-handlers, but the 'status' request would 
allow for more intelligent load-balancing i fneeded.



I did all this many years ago (2006 ??) and had this up on the earliest 
version of revonline (which subsequently got deleted). I developed it to 
help with indexing (including md5hash) of large numbers of image files. 
Using 4 task handlers, it was able to do the indexing in around 1/3 of 
the time the single-threaded version took.


I still have the code - but unfortunately I can't find the write-up / 
documentation on how to use it. And, I admit I absolutely cringe now to 
look at the code - it *seriously* needs to be re-written, or heavily 
revised.


I'll clean up the code, write up how to use it and post it somewhere for 
anyone who wishes to try it out.


Alex.

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


Re: How to set up a library?

2020-12-31 Thread Alex Tweedly via use-livecode



On 31/12/2020 17:12, Bob Sneidar via use-livecode wrote:

Setting the behavior of something is a one time thing. Start Using is something 
that has to be done every time a stack is opened, unless another stack in the 
IDE has done so. Doing it more than once has no effect, other than pushing the 
script to the back of the stacks in use.


um - not 100% "no effect".

If you have a 'librarystack' handler it will be run each time you 'start 
using' the stack, and therefore if it does something without checking 
for having been already run, you can get unexpected effects. (For 
example, if your librarystack handler was to explicitly set some 
variable to empty then that would overwrite (i.e. lose) any value set 
since the previous occurrence.


Like others have said, I use a folder (I call it Libraries) with the 'My 
Livecode' folder to hold all my libraries (and I make sure they can be 
'start using'ed multiple times. If I have a library which depends on 
other libraries, I give it a librarystack handler which (among other 
things) will 'start using' any libraries it requires.


Alex.


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


Re: How to render a two-dimensional array correctly with empty/missing 'cell' elements?

2020-12-30 Thread Alex Tweedly via use-livecode

Hi Keith

here's a quick answer typed into email (i.e. not tested at all, sorry)

function displayArray @pArray
  # create variables that point to the line and column of the array
  local tLineItem, tColumnItem
  # create a variable that stores the output for printing
  local tPrintLine
  put empty into tPrintLine
  # loop through each row of the array
  put item 2 of line 1 of the extents of pArray into tNumItem
  repeat with I = 1 to tNumItems
# loop through each column of the array
repeat for each key K in pArray[0] -- loop through the tags
  put [pArray[0][K] into tTag
  # write content of the array to tPrintLine
  put pArray[I] & "," after tPrintLine
end repeat
# insert a return after each row we have written to tPrintLine
put return after tPrintLine
  end repeat
  return tPrintLine
end displayArray

Alex

On 30/12/2020 13:48, Keith Clarke via use-livecode wrote:

Hi folks,
I’m using LiveCode to parse a set of xml files with varying subsets of tags 
(dmarc reports) into a CSV file.

The utility iterates through the files in the folder and the lines of the 
files, to identify unique opening tags and their content, all of which get 
parsed into an array:
- Tags go into aDetails[0][tTagName]
- Values go into aDetails[tFileNumber][tTagName]

This is then displayed as a table, using the function below, borrowed from an LC 
lesson 
https://lessons.livecode.com/m/4071/l/12250-how-do-i-store-an-array-variable-inside-of-another-array-variable
 
…

function displayArray @pArray
   # create variables that point to the line and column of the array
   local tLineItem, tColumnItem
   # create a variable that stores the output for printing
   local tPrintLine
   put empty into tPrintLine
   # loop through each row of the array
   repeat for each element tLineItem in pArray
 # loop through each column of the array
 repeat for each element tColumnItem in tLineItem
   # write content of the array to tPrintLine
   put tColumnItem & "," after tPrintLine
 end repeat
   # insert a return after each row we have written to tPrintLine
   put return after tPrintLine
   end repeat
   return tPrintLine
end displayArray

However, the above function seems to assume that all array elements have 
content, so I’m getting problems where there are empty elements in the xml 
files coming from various sources.

I’m sure the loop repeating for each element can be refined to check for ‘empty 
cells’ by the tTagName key in my array but my LC array knowledge is to sparse 
to begin the search.

Dos anyone have any tips on where I should start looking?

Thanks & regards,
Keith
___
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: How to set up a library?

2020-12-29 Thread Alex Tweedly via use-livecode

I'd make it a script-only stack, and then

start using stack "..."

(probably in an openstack handler - but could be anywhere you like for 
your own use).


By far the easiest to share (and for others to accept when shared).

Alex.

P.S. And, should this library be useful in LCServer context, it means 
you can upload the stack to the server without getting annoying error 
messages about mixed line endings which Coda-2 and some others give on 
binary stacks).



On 29/12/2020 19:34, Ben Rubinstein via use-livecode wrote:


What is the best way to structure a library these days?

Currently I've got buttons with a script, and a 'mouseup' handler to 
'insert the script of me into back' in my object library. But I don't 
think that's very modern.


What's the right way to do it? Especially if I want to share it?

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


Re: Translate Code?

2020-12-03 Thread Alex Tweedly via use-livecode

I'll have a try - though it's in R, not Python - and I've never used R -)

constant alpha = 2
constant n = 1000
-- x, y are arrays - initialised to 0 already for LC, so no need for "rep"

repeat with i = 2 to n
  -- runif(1) returns a random between 0 and 1, so do something similar
  put (random(1) / 1) * 2 * pi into theta
  put (random(1) / 1) ^ (-1/alpha) into f
  put x[i-1] + f*cos(theta) into x[i]
  put y[i-1] + f * sin(theta) into y[i]
end repeat

Any mistakes are mine - any correct bits are courtesy of Google -)

-- Alex.

On 03/12/2020 19:48, Roger Guay via use-livecode wrote:

Can someone please translate the code below into LC ? I believe it to be Python?
alpha=2
n=1000
x=rep(0,n)
y=rep(0,n)

for (i in 2:n){
theta=runif(1)*2*pi
f=runif(1)^(-1/alpha)
x[i]=x[i-1]+f*cos(theta)
y[i]=y[i-1]+f*sin(theta)
}

Thanks very much,

Roger
___
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 the DateFormat read only?

2020-11-07 Thread Alex Tweedly via use-livecode
Thank you Matthias. Those detailed instructions will come in handy for 
me - when/if I get that far.


The problem I mentioned a couple of emails ago in this thread was in the 
IDE - haven\t yet got as far as doing it on the server.


I tested out the TimeZone library with a couple of randomly chosen 
timezones - and they all came back incorrect (i.e. unchanged from UTC 
even though the timezones should have been different). I know that if 
you pass in a timezone that is not in the local machine's database, it 
will silently return the UTC value - but that's not the case here.


I've now looked at it more closely - some of these timezones give the 
right answer, some give the wrong answer - though they are all in the 
TimeZones() list.


All on my MacBook Pro, OSX 10.13.6, LC 9.6 ...


   local tTimeZones, tAllTheTimeZones
   put timezones() into tAllTheTimeZones
   put "UTC" & CR after tTimeZones
   put "America/New_York" & CR after tTimeZones
   put "America/Anchorage" & CR after tTimeZones
   put "junktotest" & CR after tTimeZones
   put "US/Central" & CR after tTimeZones
   put "US/Alaska" & CR after tTimeZones

   repeat for each line L in tTimeZones
  if L is among the lines of tAllTheTimeZones then
 put L && FromUniversalTime(the seconds,L)  after msg
  else
 put L && "is not in the database"  after msg
  end if
   end repeat

gives


UTC 1604762435
America/New_York 1604744435
America/Anchorage 1604730035
junktotest is not in the database
US/Central 1604762435
US/Alaska 1604762435

Note the last two (which happened to be the ones I chose in my earlier 
test) wrongly show the UTC time, though they are clearly in the 
TimeZones() list.


Maybe just a bug and I should report it ?

Alex

On 07/11/2020 14:36, matthias rebbe via use-livecode wrote:

Alex,

i've posted already some info about how to use the time zone library in Livecode server 
in my comment to David's post "Aw: Basic question: Time Zone Library".

Here it is again and a little bit more detailed.

1. copy the folder com.livecode.library.timezone from the LC extensions folder 
to your webserver into a folder extensions. The extensions folder can be found 
in the App Bundle on macOS or in the windows program folder
e.g. C:\Program Files (x86)\RunRev\LiveCode Business 9.6.1

2. place your .lc script in the same folder where the extensions folder exists.

3. configure/set the path where the shared library for your server os is 
located (see line 3 in the sample script below)
4. load the extension module.lcm (see line 4 in the sample script below)

The following script uses the time zone library to output the available time 
zones

" in tTZ
put tTZ
?>



-
Matthias Rebbe
Life Is Too Short For Boring Code


Am 07.11.2020 um 13:57 schrieb Alex Tweedly via use-livecode 
:

Thanks Graham. That does indeed work - on your local system.

The issue I am trying to deal with (and maybe it's related to what David is 
doing) is dealing with time zone issues on a LC web server. If you want to 
timestamp when some event happens, you can do that as a UTC timestamp using a 
function like this one of yours; but that leaves you two problems.

  - presenting those timestamps back to the user - which should be in *their* 
local time
  - allowing the user to provide their own timestamp - again should be local 
for them.

Most advice I've found via Google, etc. suggests keeping the timestamps in UTC, 
and asking the user to provide their timezone - usually when they 'register'. 
You can then use PHP (or ...) functions to convert a date/time between UTC and 
their local zone.

You might hope to do that in LC using 'convert .. to internet date' - but that 
doesn't work because that conversion (seems to) assume a local time, and then 
simply fill in the time offset for the local system (i.e. the problem David 
reported).

You should be able to do it using the TimeZone library - but I haven't figured 
out how to to do that, or I'm using it wrong, or something. (I didn't know 
about the Timezone library until David mentioned it yesterday.)

I'm currently using an ugly (though working :-) workaround using e.g.

put "America/New_York" into timeZone

*put*shell("TZ=" & timeZone & " date") into tmp

and working it all out from there (assumes Unix server - don't know if it works 
on others).

Alex.



On 07/11/2020 10:27, Graham Samuel via use-livecode wrote:

I am as confused as anyone else as to what you are trying to do, but just in 
case, this little function seems to work for me to get the ’standard’ UTC date 
format which I have to use in my app to put time stamps into GPX files. It 
apparently produces the correct time zone. Doubtless it could be more elegantly 
coded.

Hope it helps - who knows?

Graham

function fUTCTime
local t1,t2,t3
-- this gets the current 

Re: Is the DateFormat read only?

2020-11-07 Thread Alex Tweedly via use-livecode

Thanks Graham. That does indeed work - on your local system.

The issue I am trying to deal with (and maybe it's related to what David 
is doing) is dealing with time zone issues on a LC web server. If you 
want to timestamp when some event happens, you can do that as a UTC 
timestamp using a function like this one of yours; but that leaves you 
two problems.


 - presenting those timestamps back to the user - which should be in 
*their* local time
 - allowing the user to provide their own timestamp - again should be 
local for them.


Most advice I've found via Google, etc. suggests keeping the timestamps 
in UTC, and asking the user to provide their timezone - usually when 
they 'register'. You can then use PHP (or ...) functions to convert a 
date/time between UTC and their local zone.


You might hope to do that in LC using 'convert .. to internet date' - 
but that doesn't work because that conversion (seems to) assume a local 
time, and then simply fill in the time offset for the local system (i.e. 
the problem David reported).


You should be able to do it using the TimeZone library - but I haven't 
figured out how to to do that, or I'm using it wrong, or something. (I 
didn't know about the Timezone library until David mentioned it yesterday.)


I'm currently using an ugly (though working :-) workaround using e.g.

put "America/New_York" into timeZone

*put*shell("TZ=" & timeZone & " date") into tmp

and working it all out from there (assumes Unix server - don't know if 
it works on others).


Alex.



On 07/11/2020 10:27, Graham Samuel via use-livecode wrote:

I am as confused as anyone else as to what you are trying to do, but just in 
case, this little function seems to work for me to get the ’standard’ UTC date 
format which I have to use in my app to put time stamps into GPX files. It 
apparently produces the correct time zone. Doubtless it could be more elegantly 
coded.

Hope it helps - who knows?

Graham

function fUTCTime
local t1,t2,t3
-- this gets the current time and puts it into UTC format, i.e 
-MM-DDThh:mm:ssTZD
put word 5 to 6 of the internet date into t3 -- we are interested in the 
time and time zone
put the long time into t1
convert t1 to dateItems -- format is ,m,d,h,m,s,day no.
put (item 1 of t1) & "-" & f2digits(item 2 of t1) & "-" & f2digits(item 3 of t1) 
&"T" & word 1 of t3 into t2
put word 2 of t3 into t1 -- the time zone indication
get char 1 of t1 — the code for 0 (zero) is Z, apparently
if it <> "+" and it <> "-“ then
   put "Z" after t2
else
   put t1 after t2
end if
return t2
end fUTCTime

function f2digits theNum
-- add a leading zero. We don't check if there are more than two digits
if number of chars of theNum = 1 then
   return ("0" & theNum)
else
   return theNum
end if
end f2digits



On 7 Nov 2020, at 01:34, Alex Tweedly via use-livecode 
 wrote:

I don't think it "strips" the TZ info - it simply ignores it. I think the key 
phrase is in the dictionary as :


*Note:* The *convert* command assumes all dates / times are in local time 
except for 'the seconds', which is taken to be universal time.


So it assume syou date is in local time (regardless of the +0300), and therefore your 
example returns + for you (I assume you're in the UK, or equivalent,  now). It does 
the same for me, and returns the date with "+".

However, the same code run on my LC server (wherever on-rev is these days), 
changes the +0300 to -0500 - i.e. it's taken as local time where the server is.


I assume you should be able to do something with the TimeZone library - but I'm 
struggling to figure that out.


local tNow
put the seconds into tNow
put FromUniversalTime(tNow,"US/Central") into tt
put tNow && tt
put FromUniversalTime(tNow,"US/Alaska") into tt
put CR & tt after msg

gives me

1604709030 1604709030

1604709030

so I don't have a clue  what it was trying to do !?!

Alex.

On 06/11/2020 21:28, David Bovill via use-livecode wrote:

Why does:

get "Fri, 06 Nov 2020 10:57:37 +0300"
convert it to internet date
put it

— give
"Fri, 06 Nov 2020 10:57:37 +"

Just seems to strip the timezone info?
On 30 Oct 2020, 21:29 +, How to use LiveCode 
, wrote:

ToUniversalTime

___
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

Re: Is the DateFormat read only?

2020-11-06 Thread Alex Tweedly via use-livecode
I don't think it "strips" the TZ info - it simply ignores it. I think 
the key phrase is in the dictionary as :


*Note:* The *convert* command assumes all dates / times are in local 
time except for 'the seconds', which is taken to be universal time.


So it assume syou date is in local time (regardless of the +0300), and 
therefore your example returns + for you (I assume you're in the UK, 
or equivalent,  now). It does the same for me, and returns the date with 
"+".


However, the same code run on my LC server (wherever on-rev is these 
days), changes the +0300 to -0500 - i.e. it's taken as local time where 
the server is.



I assume you should be able to do something with the TimeZone library - 
but I'm struggling to figure that out.



   local tNow
   put the seconds into tNow
   put FromUniversalTime(tNow,"US/Central") into tt
   put tNow && tt
   put FromUniversalTime(tNow,"US/Alaska") into tt
   put CR & tt after msg

gives me

1604709030 1604709030

1604709030

so I don't have a clue  what it was trying to do !?!

Alex.

On 06/11/2020 21:28, David Bovill via use-livecode wrote:

Why does:

get "Fri, 06 Nov 2020 10:57:37 +0300"
convert it to internet date
put it

— give
"Fri, 06 Nov 2020 10:57:37 +"

Just seems to strip the timezone info?
On 30 Oct 2020, 21:29 +, How to use LiveCode 
, wrote:

ToUniversalTime

___
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: Plotting Equations that Bifurcate

2020-11-04 Thread Alex Tweedly via use-livecode

Hi,

gmSetCustomMarker is the first gm Library handler called in the demo app 
- so it sounds like the library isn't being downloaded or set up properly.


I found one combination of browser and laptop here where the 
.livecodescript file is displayed as though it were a text file, rather 
than being downloaded! No idea why !!


So, I've uploaded a ZIP archive. Visit 
https://www.tweedly.org/lcms.lc/GraphMaker again, and use the archive 
link to download the zip fie and decompress it. Then open the demo app 
in the IDE.


In the IDE, you could set a breakpoint in 'openstack' on card 1 of the 
demo app, and verify that the library is being properly found in the 
'start using tt' line, e.g. by checking the stacksinuse just after it.


If the library is properly loaded, then the "can't find handler 
gmSetCustomMarker" problm should disappear.


Cool - I'll go take a look at CoupDeGraph.

I've been wondering how you handle multi-bifurcating functions - but 
that'll be a separate email (after I've looked at CoupDeGraph :-)


Alex.

On 04/11/2020 18:09, Roger Guay via use-livecode wrote:

Hi Alex,

Thanks for your continued interest in my little project. I have succeeded in 
implementing a multiple polygon approach, but it ain’t elegant as they say!

I seem to recall that I learned a lot from your GraphMaker some time ago, but 
as I try to review your latest on your website, I run into repeated errors 
about “can’t find handler gmSetCustomMarker”. I can’t seem to make any headway 
to resolve this. Am I supposed to do something with the “Library”? I could not 
find instructions anywhere.

Meanwhile, I should explain further that I am trying to expand on a stack that 
I built 2 or 3 years ago called CoupDeGraph which you can find in the Example 
Stacks of LiveCode. Put simply, I am currently trying to expand on CoupDeGraph 
to be able to handle double-valued equations.

Again, thanks for your help

Roger


On Nov 3, 2020, at 4:48 PM, Alex Tweedly via use-livecode 
 wrote:

On 31/10/2020 02:28, Roger Guay via use-livecode wrote:


Lots of clever ideas here, Alex, but I think you’re missing the point of what I 
ultimately want to do. I'm building a plotting program for which I want to plot 
any equation including those that have multiple values of y for a given x. An 
equation might branch at any point and might even have multiple branches both 
of which are unknown before plotting.

Of course, there’s always the possibility that I’m not fully comprehending your 
suggestions??? What does NB stand for? Are you suggesting creating a new 
polygon every time a branch is detected? That just might work?!

Hi Roger. You're right - I missed the point; I jumped to the assumption that 
you were asking about a fairly small, specific issue - so leapt too quickly to 
a code sample. But before I address the general question(s), let me get the 
little points out of the way :-)

NB - sorry, kind of common usage in British English. Actually, it's from a Latin phrase - 
"Nota Bene" - meaning "note well". So basically just 'take note of'.

"a new polygon every branch" - yes, perfectly possible. Also possible is what I 
did in the first case of the code sample -  a new 'sequence of points' for each branch, 
and then stitch those together (with blank lines between) into a single polygon; but 
that's, for now, a detail.

The essence of the problem is that your app will (somehow) develop a number of 
'sequences of *data* points' - and then those need to be translated into 
equivalent sets of *display* points (by either a plotting library, or by your 
own code) to allow it to be displayed appropriately.

There are at least two possible plotting libraries that might do what you want 
(or do something close enough that they could be useful). By coincidence, they 
were both discussed at the San Jose LC conference in 2019.If you have access to 
the video / papers from that you might already have some of the info you need; 
I don't know if the conference papers are ever put out for more general usage 
later.

Option A. Monte described a wrapper for the JSPlot library. It's a very 
powerful library capable of many kinds of graphs / plots, and very quick and 
capable. The most obvious downside is that it needs to be used within a browser 
widget - but well worth looking at it if you can.

Option B. I did a library called "GraphMaker" - a pure-Livecode plotting 
library. It is (I think) fairly easy to use - but that may not be the case for someone 
else coming to it new. I know it can handle this case of bifurcating plots (using 
multiple sequences of data points). The conference slides were a decent, if very brief, 
introduction; the lengthier documentation was, maybe, not quite complete. However, it 
does come with a demo app that uses the library to draw a variety of graph types. Main 
advantage is it's pure LC, and hopefully easy to use - both in understanding and in ease 
of integra

Re: Plotting Equations that Bifurcate

2020-11-03 Thread Alex Tweedly via use-livecode

On 31/10/2020 02:28, Roger Guay via use-livecode wrote:


Lots of clever ideas here, Alex, but I think you’re missing the point of what I 
ultimately want to do. I'm building a plotting program for which I want to plot 
any equation including those that have multiple values of y for a given x. An 
equation might branch at any point and might even have multiple branches both 
of which are unknown before plotting.

Of course, there’s always the possibility that I’m not fully comprehending your 
suggestions??? What does NB stand for? Are you suggesting creating a new 
polygon every time a branch is detected? That just might work?!


Hi Roger. You're right - I missed the point; I jumped to the assumption 
that you were asking about a fairly small, specific issue - so leapt too 
quickly to a code sample. But before I address the general question(s), 
let me get the little points out of the way :-)


NB - sorry, kind of common usage in British English. Actually, it's from 
a Latin phrase - "Nota Bene" - meaning "note well". So basically just 
'take note of'.


"a new polygon every branch" - yes, perfectly possible. Also possible is 
what I did in the first case of the code sample -  a new 'sequence of 
points' for each branch, and then stitch those together (with blank 
lines between) into a single polygon; but that's, for now, a detail.


The essence of the problem is that your app will (somehow) develop a 
number of 'sequences of *data* points' - and then those need to be 
translated into equivalent sets of *display* points (by either a 
plotting library, or by your own code) to allow it to be displayed 
appropriately.


There are at least two possible plotting libraries that might do what 
you want (or do something close enough that they could be useful). By 
coincidence, they were both discussed at the San Jose LC conference in 
2019.If you have access to the video / papers from that you might 
already have some of the info you need; I don't know if the conference 
papers are ever put out for more general usage later.


Option A. Monte described a wrapper for the JSPlot library. It's a very 
powerful library capable of many kinds of graphs / plots, and very quick 
and capable. The most obvious downside is that it needs to be used 
within a browser widget - but well worth looking at it if you can.


Option B. I did a library called "GraphMaker" - a pure-Livecode plotting 
library. It is (I think) fairly easy to use - but that may not be the 
case for someone else coming to it new. I know it can handle this case 
of bifurcating plots (using multiple sequences of data points). The 
conference slides were a decent, if very brief, introduction; the 
lengthier documentation was, maybe, not quite complete. However, it does 
come with a demo app that uses the library to draw a variety of graph 
types. Main advantage is it's pure LC, and hopefully easy to use - both 
in understanding and in ease of integration into an app (you just create 
a suitable group to contain the graph, set its rect properly and pass in 
all the point data along with various parameters.  It has nowhere near 
the coverage of different graph types that JSPlot does - it's basically 
line, bar and scatter plots, with primary X-axis, and can have shading, etc.


Option C. Roll your own.

I'd certainly suggest investigating the use of an existing library 
first. There's quite a lot of effort needs to go into determining how to 
scale the data to the space available, how to label the axes, how to add 
tick marks, grid lines and (perhaps) multiple Y-axes. That stuff 
probably accounted for 90% of the effort of creating the library.


If you'd like to try out my library, the latest version can be found at

https://www.tweedly.org/lcms.lc/GraphMaker

(sorry - I haven't formatted it into my usual download structure - so 
this is simply a page that gives links that allow you to download the 2 
files you need and 2 more files you don't need.)


Of course, I'll be happy to help out in any way I can with it.

Alex.

P.S. the demo app includes an example of a 'branching' plot (Graph 3).


___
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: Plotting Equations that Bifurcate

2020-10-30 Thread Alex Tweedly via use-livecode


On 30/10/2020 22:40, Roger Guay via use-livecode wrote:

Let’s try this again after spellchecking:


Yes, yours is a good example of a bifurcated line. But now imagine producing 
this line programmatically with an equation that:

Produces a constant y value of 149 as x progresses from 35 to 235 (no problem)
Then produces 2 different but simultaneous values of y as x progresses from 235 
to 335. This is the problem as you don’t want the end point of the separated 
lines to connect. If you place an empty line in the points after each iteration 
beyond x = 235 then you end up with the bifurcated lines being points rather 
than a solid line.

How do plotting programs handle this situation



Here are two different ways you could do it.

1. simple - assume there would (could) be two Y values for any x, and 
just calculate two series, and combine them for output.


2. harder - for each x value, keep track of the previous y value for 
each series, and if necessary, put in a 'skip' plus new value plus skip ...


NB makes for a more complex polygon; each new x value after bifurcation 
results in 5 lines added to the points.


on mouseup
   local tSeries1, tSeries2, thepoints
   if the shiftkey is down then

  -- the easy way - just allow for the possibility of two series of 
points all along

  repeat with i = 35 to 335
 -- calculate series 1
 if i < 235 then
    put i,249  after tSeries1
 else
    put i, 249+(i-235)  after tSeries1
 end if
 -- calculate series 2
 if i < 235 then
    -- do nothing - it's the same as series 1
 else
    put i, 249+2*(i-235)  after tSeries2
 end if
  end repeat

  put tSeries1  & tSeries2 into thePoints
  set the points of grc "X" to thePoints
  set the foregroundColor of grc "X" to "blue"
   else
  -- the harder way - multiple series ...
  -- does each step for each series ... much more complex polygon, 
but ...

  local t1, t2, tLast1, tLast2
  repeat with i = 35 to 335
 -- calculate values
 if i < 235 then
    put 249 into t1
    put 249 into t2
 else
    put 249+(i-235) into t1
    put 249+2*(i-235) into t2
 end if
 -- put in series 1
 if tLast1 is not empty then
    put i-1, tLast1  & i, t1  after thePoints
 end if
 -- possibly put in series 2
 if tLast1 <> tLast2 OR t1 <> t2 then
    put CR after thePoints -- blank skip over to series 2 value
    put i-1, tLast2  & i, t2  after thePoints
    put CR after thePoints -- blank skip back to series 1
 end if
 put t1 into tLast1
 put t2 into tLast2
  end repeat
  set the points of grc "X" to thePoints
  set the foregroundColor of grc "X" to "red"
   end if

end mouseup


___
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 the DateFormat read only?

2020-10-30 Thread Alex Tweedly via use-livecode
But that will only work for those time zones whose variation from UTC is 
an exact number of hours.


the internet date has 4 digits so that it can handle hour and minute 
variations - you could change


  subtract (char 1 to -3 of last word of the internet date) from item 4 
of tTime


to

  put the last word of the internet time into tmp
  subtract (char 1 to -3 of tmp) from item 4 of tTime
  subtract (char 1 of tmp & char -2 to -1 of tmp) ) from item 5 of tTime

and then you would be handling all cases correctly.

Alex.

On 30/10/2020 20:06, J. Landman Gay via use-livecode wrote:

On 10/29/20 4:33 PM, Graham Samuel via use-livecode wrote:
The only souci with this format is that it gives the month in alpha, 
presumably according to the nationality of the OS. But it’s easy to 
get the numeric month in other ways. Still, it is just a little bit 
fiddly to create a full UTC date of the format:


-MM-DDThh:mm:ssTZD


Here's something I use:

  put the seconds into tTime
  convert tTime to dateitems
  subtract (char 1 to -3 of last word of the internet date) from item 
4 of tTime

  convert tTime to dateitems
  set the numberformat to "00"
  put item 1 of tTime &"-"& (item 2 of tTime)+0 &"-"& (item 3 of 
tTime)+0 & "T" & (item 4 of tTime)+0 &":"& \
    (item 5 of tTime)+0 &":"& (item 6 of tTime)+0 & "Z" into 
tTimestamp




___
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: Plotting Equations that Bifurcate

2020-10-29 Thread Alex Tweedly via use-livecode
remember that a blank line in the 'points' (aka the vertexlist) is not 
drawn - therefore you can put each of the branches as a subset of 
points, with a blank in between


Alex.

e.g. two Y values for each X, in a single graphic ...

repeat with i = 1 to N
    put N,2*n  after t1
    put N,3*n  after t2
end repeat
set the points of grc "L1" to t1  & t2


On 29/10/2020 22:03, Roger Guay via use-livecode wrote:

I am trying to plot an equation that bifurcates by setting the points of a 
polygon as I iterate the equation. But I can’t figure how to handle the 
bifurcation. Any help will be greatly appreciated!

Roger
___
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: Naive XML questions

2020-10-25 Thread Alex Tweedly via use-livecode

On 25/10/2020 18:51, Bernard Devlin via use-livecode wrote:


In his reply to you I think Alex is suggesting you use the handlers that
come with the  Datagrid.  These can convert xml to a LC array.  You might
find it easier just to deal with a familair data structure rather than
learn XML.

I found them here: http://revonline2.runrev.com/stack/571/XMLAndArrays

But the handlers are also to be found inside the datagrid library in the
IDE (I suspect they are more up to date).


Or indeed on Trevor's GitHub page, which is where I could vaguely 
remember having seen them.


But wherever you get them from, they do provide a (fairly 
straightforward) familiar interface of a LC array.


(And give us yet another reason to say "thank you" to Trevor :-)

Alex.



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


Re: Naive XML questions

2020-10-25 Thread Alex Tweedly via use-livecode
I know nothing about it, so I can feel free to answer:-)

Don’t care about the file format- look at the array format, probably in the 
IDE/debugger. That’s probably going to let you see how to address the 
individual nodes.
Alex

Sent from my iPhone

> On 25 Oct 2020, at 17:21, Graham Samuel via use-livecode 
>  wrote:
> 
> I feel stupid, but even with Sarah Reichelt’s help, there are very very 
> simple things I can’t do with the LC XML functions. My current problem is 
> this:
> 
> I have a series of XML files which are in fact .gpx files - a collection of 
> GPS coordinates representing a route on the Earth’s surface. There are 
> thousands of files around which I can use as test data, so I don’t have to 
> roll my own. Taking just one of these examples, I can do the following in LC
> 
> 1. Get the user to find the file and download it
> 
> 2. Check it’s a .gpx file
> 
> 3. Turn it into an LC XML data structure with an integer ID
> 
> 4. Find out how many child nodes there are.
> 
> Then it all goes wrong, because I don’t seem to be able to address the 
> individual nodes. This is obviously needed for further progress, in functions 
> like revXMLFirstChild  and revXMLNodeContents.
> 
> I just don’t know what format to use. Sarah’s tutorial doesn’t help because 
> her data structure is too simplified.
> 
> If you’re still with me, this is what the beginning of a typical file looks 
> like:
> 
>> 
>> http://www.topografix.com/GPX/1/1; creator="Digital Crow" 
>> version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
>> xsi:schemaLocation="http://www.topografix.com/GPX/1/1 
>> http://www.topografix.com/GPX/1/1/gpx.xsd;>
>> 
>> 
>>   
> 
>> 
>> 169.623637 
> 
>> 
>> 169.744722 
> 
>> 
>> 169.744722 
> 
>> 
>> 169.266626 
>> 
> etc - there may sometimes be thousands of these “trkpt” elements.
> 
> So, suppose I want to get the first instance of the “lon” attribute into a 
> local variable. How do I address the first  node etc in order to do it? 
> I have attempted various common-sense methods, but none work.
> 
> This must be child’s play to a lot of people, just not me.
> 
> Hoping for some guidance.
> 
> Graham
> ___
> 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: LiveCode server IDE

2020-10-12 Thread Alex Tweedly via use-livecode

Hi Keith,

My workflow is not much different from Ralph's.

Short answer:

 - edit in IDE, test in IDE

 - upload to server using Coda 2  (which I also use to edit non-lc files).

Long answer:

 - I don't use any of the LCserver specific features -  no entangled 
html, no includes, ... - everything is a regular script-only stack


 - I have a test stack that I use in the IDE which lets me specify 
which page (and parameters, cookies, etc.) I want, generates the web 
page and displays the output in a web browser instance within the 
testing stack.


 - when satisfied, I use Coda 2 to upload the LC files (I never edit 
them in Coda))


 - I edit other files (menu definitions, form definitions, web pages, 
views, etc.)  in Coda2


I use both on-rev and hostM for servers - both have everything already 
installed,  good support, etc.


(tbh, if on-rev hadn't had a bad patch a few years ago with email 
problems, I would probably never have strayed, but it's kind of good to 
know that hostM is there as an alternate source in case I need it :-)


Alex.

On 12/10/2020 15:49, Keith Clarke via use-livecode wrote:


Thanks for the response, Ralph.

I've struggled to retain/regain my old local Sites, web server and LC Server on 
my home Macs. So, I was thinking of embarking down the script-only stacks 
route, using an on-rev LC-Server instance to do any web-services heavy-lifting 
work server-to-server, on behalf of client apps that use either LC desktop or 
simple html forms.

My html & css 'hackery-pokery' has been on Coda2 to date, but its replacement, 
Nova, still lacks any LiveCode autocompletion.

I may need to learn a new text-editing based IDE tool. Thanks for the Atom 
suggestion - I see that there's a LiveCode language pack available that 
includes LC Server, so that may be a better place to play than VS Code, etc.

Thanks & regards,
Keith


On 12 Oct 2020, at 15:01, Ralph DiMola via use-livecode 
 wrote:

Keith,

As a follow up... If you have a web server with LC installed running on your
local machine then just a ctrl S in the LC IDE will let you test your server
script(stack) immediately in the currently open IDE instance.

IDE alternatives to edit LC script only stacks are many. I use the Atom for
LC builder and html(when Dreamweaver is just to much).

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 Keith Clarke via use-livecode
Sent: Monday, October 12, 2020 3:18 AM
To: use-livecode@lists.runrev.com
Cc: Keith Clarke
Subject: LiveCode server IDE

Hi folks,
What is the current state of the art regarding LiveCode server IDE -
searching around, this seems down to personal preference of text editor plus
FTP?

I'm Mac-based and looking to experiment with web services.
Thanks and regards,
Keith


Sent from my iPad
___
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


___
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: ICS Generation

2020-10-01 Thread Alex Tweedly via use-livecode


On 02/10/2020 00:11, Bob Sneidar via use-livecode wrote:

Thanks Alex. I already downloaded the git zip file. I’ll have a look.


Oh yeah, it's on github - I'd forgotten that :-)

But I haven't used it since (I think) LC 5.5 - so if you bump into any 
issues, please drop me anote.


Thanks

Alex.


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


Re: ICS Generation

2020-10-01 Thread Alex Tweedly via use-livecode
I don't know of one - but the minimal version (i.e. all-day events only, 
no repeating events, no multiple timezones) should be really trivial. If 
no-one comes up with something in the next day or two I'll try it as my 
weekend project.


Bob - if you want to interact with calendars, take a look at Bill 
Vlahos's library as Matthias pointed out. If you want to read (i.e. not 
write) ICS files I have a library for doing that - let me know and I'll 
check if it works with recent versions of LC and send it to you.


And if you are even thinking of programming something with times/dates, see

https://www.youtube.com/watch?v=-5wpm-gesOY_channel=Computerphile

Alex.

On 01/10/2020 18:08, Peter Reid via use-livecode wrote:

Has anyone got a calendar library for LiveCode? I'm developing an app, part of 
which exports a handful of events to do with ordering regular medication. I'd 
like to export an ICS format file containing 3 all-day events titled something 
like the following:

1. MEDS RUN-OUT TODAY
2. COLLECT MEDS
3. ORDER NEXT MEDS

What I'm looking for is either a full calendar library that I can use to 
generate such a ICS file, or the minimalist version, ie just enough calendar 
support to generate this minimal ICS file - nothing more complex.

Anyone know of anything suitable?

Thanks

Peter
--
Peter Reid
Loughborough, UK


___
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: Converting from unicode to ASCII

2020-09-24 Thread Alex Tweedly via use-livecode
You could even decide that, rather than strip out non-ascii characters, 
you would convert (reduce?) each one to a canonical equivalent (where 
there is one), and hence instead of


l’Académie française--->  lAcadmiefranaise_1234.livecode

it would become

l’Académie française--->  lAcademiefrancaise_1234.livecode

Marginally more readable, and much more typeable :-)

Alex.



On 24/09/2020 17:26, Dave Cragg via use-livecode wrote:


That's what I was thinking. So the filename for " l’Académie française" might 
becomes something like  lAcadmiefranaise_1234.livecode. Kind of readable, but guaranteed 
unique. (And also allows identifying the database record from the filename if that is 
needed.)

(Apologies if this appears twice.)


I'm pretty sure each record has an ID. This would be for ensuring unique file 
names, right?

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On September 24, 2020 2:00:50 AM Dave Cragg via use-livecode 
 wrote:


Jacqueline,

You said earlier you don't have a field in the database for the file name. But 
does the database table have a unique numerical ID field for each record?  If 
so, could you strip out the non-ASCII characters and then append the numerical 
ID to the file name?


On 23 Sep 2020, at 20:59, J. Landman Gay via use-livecode 
 wrote:

I'm drifting toward the idea of removing non-ascii characters. That might 
satisfy all requirements, at least for now. We don't do Sanskrit or Chinese 
yet. Or alternately I could bite the bullet and convert my build tool to insert 
metadata into the clickable lists. That isn't terribly difficult, I was just 
wondering if there was a different way using what we already have.



___
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


___
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: Persistant Insertion Point

2020-09-11 Thread Alex Tweedly via use-livecode
You can save the insertion point (i.e. the selectedchunk) when you leave 
the second field, and then provide a handler to insert text at that 
saved point; and of course call that handler when needed


e.g.   in your "second field, have


local sChunk
on exitfield
   put the selectedchunk into sChunk
   put schunk  after msg
end exitfield

on closefield
   put the selectedchunk into sChunk
   put schunk  after msg
end closefield

on acceptText pText
   do "put" && pText && "into" && sChunk
   put "accepted" && schunk & Cr after msg
end acceptText

and in the other field have something like


ON selectionchanged
   local tmp
   put "here"  after msg
   put the mousetext into tmp
   dispatch "accepttext" to fld 2 with tmp
   put "disp" && it && the result  after msg
end selectionchanged

Alex.

On 12/09/2020 00:16, Roger Guay via use-livecode wrote:

I have 2 fields, the first from which I take the mouseText, the second  into 
which I place that text. Trouble is, I want the placed text to be at the 
insertion point I had before clicking outside that field.
Can someone suggest a way to preserve the insertion point in a field as one 
clicks into another field?

I appreciate any help
___
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: Looping though a numerically indexed array

2020-09-02 Thread Alex Tweedly via use-livecode
If the array is indexed from 1 with no gaps, you can do

repeat with I = 1 to item 2 of line 1 of the extents of myArray

Alex


> On 2 Sep 2020, at 15:54, David Bovill via use-livecode 
>  wrote:
> 
> I’m pretty sure there must be a way to efficiently loop through numerically 
> indexed arrays
> 
> Repeat for each key and repeat for each element does not seem to sort the 
> keys in numeric order,. Of course I can get the keys and sort them before 
> repeating - but is there a more efficient way?
> ___
> 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: Help me understand infinity

2020-07-29 Thread Alex Tweedly via use-livecode


On 29/07/2020 20:17, Dr. Hawkins wrote:


On Jul 29, 2020, at 12:08 PM, Alex Tweedly via use-livecode 
mailto:use-livecode@lists.runrev.com>> 
wrote:


Any number compared to positive infinity (other than itself) *will* 
be less than it.

Bah,

*ℵ*_2 > floating point infinity (which is *ℵ*_1 )


Maybe in the real universe. Or in the realm of mathematics.

But in the domain of computers &  IEEE, any *number* is smaller than it.

(Since NaN is, well, not a number :-)

Alex.

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


Re: Help me understand infinity

2020-07-29 Thread Alex Tweedly via use-livecode


On 29/07/2020 18:57, Richard Gaskin via use-livecode wrote:

In the v9.6.1RC1 Release Notes there's this:

   Infinity constant
   The constant infinity has been added to the language in this release.
   As a result, theunquoted literal infinity is now reserved. Any
   existing uses of it should be quoted, as otherwiseit will resolve to
   the floating point value representing infinity, rather than the
   string "infinity".

What is the use-case prompting this?


A coupe of choices:

1. Less serious: It's a "bragging rights" thing. Every other (*almost*) 
computer language has a constant representing infinity, and as Livecode 
grows up, it felt it needed one too.


2. More serious: It is a reliable floating point number that can be 
represented in IEEE FP number space - and can therefore be relied on to 
act as you would expect in comparisons. Any number compared to positive 
infinity (other than itself) *will* be less than it.


Alex.


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


Re: Object naming

2020-07-28 Thread Alex Tweedly via use-livecode



On 28/07/2020 08:27, Curry Kenworthy via use-livecode wrote:


Alex:

> Using unambiguous short names prevents behaviour scripts
> that references child controls completely

Sure about that? (Option A)

Yes, I think I am. At least, it prevents using names of the child 
objects in the script. The other solution using cached IDs works in a 
behaviour script. But I still can't see a way to do it using names.


Give me one more clue please; I'd really like to use option A.


> Inside A, there is a rect called "R" and also a group called "B"
> inside B there is a rect called "R"

Or put the "direct" R in a subgroup also. (Option B)
A-B-R vs A-C-R.

No, unfortunately option B doesn't work. Remember that A and B are 
instances of the same group, so when you introduce the extra group level 
in A, you do the same in B; i.e. it's now A-C-R versus A-B-C-R


And again Livecode's "incomplete" name matching will give whichever one 
has a lower layer number.


Verified:
> *put*thelongnameofgrc"R1"ofgrp"A"
... graphic "R1" of group "C" of group "B" of group "A" of card id 1002 
of stack "Untitled 1"


when A-B is lower than A-C (which it has to be to avoid obscuring it).


So I'm going to abandon this idea - I can go back to a different 
solution which allows behaviour scripts, but requires slightly more 
setup. Not quite so easy to use (initially), but probably easier to 
continue to use in the long run.


Many thanks,

Alex.

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


Re: Object naming

2020-07-28 Thread Alex Tweedly via use-livecode
Thanks Martin. That does indeed work (might need tweaking for some more 
complex cases).


However, it goes through all controls on the card - the same effect is 
achieved without the performance risk using the childControlIDs, as in



function idOfChild pLongID, pShortName
  repeat for each line L in the childControlIDs of  pLongID
 if the short name of control ID L = pShortName then return the 
long id of control ID L

  end repeat
end idOfChild

I'm currently using that - but I'm convinced by Richard and Dr Seuss 
that I'm on the wrong path and will try a redesign.


Alex.

On 28/07/2020 04:04, Martin Koob wrote:

Hi Alex

You could use the owner of the control in conjunction with the name of 
the control to distinguish between the two graphic’s named ‘R’.


I did that  for the  simple case in your example  but may not work 
with something more complex.


I created a stack with the same hierarchy of graphics and groups and 
using the following scripts in a button I placed on the card I can 
distinguish between  graphic A - R and B - R.


*
*

*on* mouseup

*ask*“enter owner name/control name/control colour"

*put* it into tResponse

*set*theitemdelimiterto"/"

*put*item1of tResponse into tOwner

*put*item2of tResponse into tControl

*put*item3of tResponse into tControlColour

*put* findTargetControl(tOwner, tControl) into tTargetControl

*set*thebackgroundcolorofcontrol tTargetControl 
of*group*"A"to tControlColour


*end* mouseup


*function* findTargetControl pOwner, pControl

*put*thenumberofcontrolsof*group*"A"into tIndex

*repeat* with tControl = 1to tIndex

*if* theshortnameofcontrol tControl of*group*"A" = pControl *then*

*if* theshortnameoftheownerofcontrol tControl of*group*"A" = pOwner *then*

*exit* *repeat*

*end* *if*

*end* *if*

*end* *repeat*

*return* tControl

*end* findTargetControl


Martin Koob



On Jul 27, 2020, at 8:47 PM, Alex Tweedly via use-livecode 
<mailto:use-livecode@lists.runrev.com>> wrote:



On 27/07/2020 21:26, Curry Kenworthy via use-livecode wrote:


Use unambiguous SHORT names!


Thanks, but ...

Yes, using unambiguous SHORT names solves this naming problem, but 
introduces other problems. In particular, this group script should 
(probably) be a behaviour script, since the group will be 
instantiated multiple times and will in the future need updating for 
enhancements or even (Heaven forfend!) bug fixes.


Using unambiguous short names prevents behaviour scripts that 
references child controls completely, and even if I simply used 
normal scripts which were replicated for each instance, I'd still 
need to go through the script to change all the references to the 
child control names (a pain, and source of possible future errors).


For now, I'm caching the IDs of the direct child controls in 
script-local variables in each instance of the group. If I find a 
name-based way that works reliably and allows behaviour scripts, I'll 
change - but this method works.


I'll have this group ready for release soon (or soon-ish) so y'all'll 
be able to see how it turned out :-)


Thanks again everyone,

Alex.


___
use-livecode mailing list
use-livecode@lists.runrev.com <mailto: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: Object naming

2020-07-28 Thread Alex Tweedly via use-livecode



On 28/07/2020 06:24, Richard Gaskin via use-livecode wrote:

Consider a simplified problem statement:

You have two objects of the same type in a container, and you want to 
tell them apart but had given them the same name.



+100

OK, when I stop laughing, I will admit I am convinced :-)

Alex.


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


Re: Object naming

2020-07-27 Thread Alex Tweedly via use-livecode



On 27/07/2020 21:26, Curry Kenworthy via use-livecode wrote:


Use unambiguous SHORT names!


Thanks, but ...

Yes, using unambiguous SHORT names solves this naming problem, but 
introduces other problems. In particular, this group script should 
(probably) be a behaviour script, since the group will be instantiated 
multiple times and will in the future need updating for enhancements or 
even (Heaven forfend!) bug fixes.


Using unambiguous short names prevents behaviour scripts that references 
child controls completely, and even if I simply used normal scripts 
which were replicated for each instance, I'd still need to go through 
the script to change all the references to the child control names (a 
pain, and source of possible future errors).


For now, I'm caching the IDs of the direct child controls in 
script-local variables in each instance of the group. If I find a 
name-based way that works reliably and allows behaviour scripts, I'll 
change - but this method works.


I'll have this group ready for release soon (or soon-ish) so y'all'll be 
able to see how it turned out :-)


Thanks again everyone,

Alex.


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


Re: Object naming

2020-07-27 Thread Alex Tweedly via use-livecode

On 27/07/2020 16:33, Richard Gaskin via use-livecode wrote:
There are many ways to refer to things.  The simplest is to use 
unambiguous names for things that matter.



Is there an unambiguous name in this case ? And if so, what is it :-) ?

A group "A" contains a rectangle "R", and a (sub)group "B". "B" also 
contains a rectangle "R". (btw - "B" also may contain a subgroup "C", 
and it too will have a rectangle "R", and ).


There is an unambiguous name for the 'most nested' "R", but there 
doesn't seem to be for the other "R"s. I had expected (or perhaps just 
hoped) that using a long name would first try to find an exact match, 
and if that failed it would then find the closest inexact match - but 
that sadly was just a hope.


I could (and probably will) use IDs but that doesn't work for 
duplicating the group - you need to either go in and adjust a script / 
custom property OR have the group's script find the IDs.


Or - am I'm missing something ?

Alex.


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


Re: Object naming

2020-07-27 Thread Alex Tweedly via use-livecode

Thanks Mark and Andre.

Mark's description of the solution is correct - but in my situation it's 
not a solution.


The sub-groups (B in my earlier example) are opaque - they have 
coloured, filled backdrops so that they can capture e.g. mouseMove 
messages, so they need to be opaque. Therefore, I can't simply re-layer 
so that the 'direct' graphics are behind (below) the groups.


The custom properties 'selector' idea is interesting - I'll need to mull 
it over some more.


I'm currently thinking of something like

function idOfChild pLongID, pShortName
  repeat for each line L in the childControlIDs of  pLongID
 if the short name of control ID L = pShortName then return the 
long id of control ID L

  end repeat
end idOfChild

unless someone sees a problem with that. (And of course I'll do that 
once and cache the values for continuing use).


Alex.

On 27/07/2020 15:40, Andre Garzia via use-livecode wrote:


Alex,

I think that Mark solution is the correct one but I couldn't resist telling
you some other idea, one that is only applicable if performance is not a
problem.

You can add custom properties to controls you want to find later and then
look for them by looping everyone in the card. A reusable short function
can be created with whatever letter you want, like "q", and code similar 
totrolIDs of
this:

function q selector, value
   repeat with x = 1 to the number of controls in this card
 if the selector of control x of this card is value then
   return the long id of control x of this card
 end if
   end repeat
end function

And then you can go:

put q("blue-rect", "true") into tLongID

You can even have something like "qq" that returns a list of long ids for
all the controls that match that query. Caching these results is the best
architecture, on preOpenCard you can find all the controls you'll need and
place them in script local arrays, then all the functions that need them
can peek into those arrays.

It is a bit convoluted but allows for some clever programming. Remembering
that "clever" is one of the trickster spirits of the software development
world.

Best
A

On Mon, 27 Jul 2020 at 01:33, Alex Tweedly via use-livecode <
use-livecode@lists.runrev.com> wrote:


I think my head is melting :-)

I have a group called 'A'.

Inside A, there is a rect called "R" and also a group called "B"

inside B there is a rect called "R"

How do I refer unambiguously to the first rectangle (i.e. A - R, not A -
B - R) ?

If I say
 grc "R" of grp "B" of grp A
then I unambiguously get A-B-R; but if I say simply
 grc "R" of grp "A"
then I *also* get A-B-R.

There must be a way to do this (and maybe if it wasn't nearly 2 in the
morning I would be able to figure it out).

Help! Please !

Alex.


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





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


Object naming

2020-07-26 Thread Alex Tweedly via use-livecode

I think my head is melting :-)

I have a group called 'A'.

Inside A, there is a rect called "R" and also a group called "B"

inside B there is a rect called "R"

How do I refer unambiguously to the first rectangle (i.e. A - R, not A - 
B - R) ?


If I say
   grc "R" of grp "B" of grp A
then I unambiguously get A-B-R; but if I say simply
   grc "R" of grp "A"
then I *also* get A-B-R.

There must be a way to do this (and maybe if it wasn't nearly 2 in the 
morning I would be able to figure it out).


Help! Please !

Alex.


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


Re: ANN: FieldGroup - a simple rich text editor field.

2020-07-23 Thread Alex Tweedly via use-livecode


On 23/07/2020 17:20, Richard Gaskin via use-livecode wrote:




https://www.tweedly.org/downloads/FieldGroupsample.livecode


Thanks for posting this, Alex. Super cool.

I didn't find license info in the package - did I miss it?

What license is this distributed under?


Sorry, I should have said.

It is released under the MIT license; I've added the license text to the 
script of the group, and updated the copy on my website (as above) - now 
at version 0.2


While I was doing that :-), I added a new message sent on updates :

  fguser.textchange pFiledID, pStartLine, pEndLine

This happens after the text has changed, but *before* the undo system 
records it. It is therefore possible for the app to make further 
changes, and they will be recorded as part of the singe change operation.


As an example, I've updated the sample app to process

 - #tags  - any word beginning with a "#" is set into 'box' style

 - *bold* (as in Markdown) - text within any paired "*"s is set to bold

(note - it's just an example, I don't do the inverse and add "*"s to any 
bold text ...)


Alex


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


ANN: FieldGroup - a simple rich text editor field.

2020-07-22 Thread Alex Tweedly via use-livecode
I'd like to announce the Beta (i.e. v0.1) release of my simple rich text 
field. Currently it's not on Github or anywhere sensible - it's just on 
my own download site (see URL at end of this email).


I'd be happy if anyone finds it useful, and / or has feedback that might 
make it useful.



FieldGroup - a rich text editor field for Livecode.

Actually, as the old joke goes, it's not really "rich" text, just 
comfortably off. :-)


That is, it supports only some fairly basic features compared to a 
fully-featured rich text editor.


Supported features include :
 - multi-level undo/redo
 - 'undo' can be reset (e.g. after 'save', or 'open')
 - set text style of a chunk by tool button or (sample) menu
 - undo includes text style setting
 - simple (enclosed) tool bars with text or icon buttons - optional of 
course.

 - each kind of button comes in two sizes
 - button tool bars in any one of four placements (top,right,bottom,left)
 - view scaling
 - call-backs to let the app know when undo/redo are available (e.g. to 
adjust menus)

 - no front scripts used.

FieldGroup is a standalone group which can be simply copy/paste'd into 
your own stacks, and provides a (moderately) rich set of text field 
features. You can have as many of these fieldgroups as you want - each 
is entirely self-contained.


Easy to use - handlers/functions are well documented and (I hope) 
straightforward to understand and use. The downloadable stack includes 
the group, ready to be copy/pasted, as part of a simple sample app which 
shows common uses.


The handler definitions are included below - this is also available in 
the sample app. The "fill" button ill give you text to play with, but 
shift-Fill will restore this document.


You can download the sample app - which includes the group you ned to 
copy/paste - from


https://www.tweedly.org/downloads/FieldGroupsample.livecode

This popped out from a simple app I'm writing (actually, just starting 
to write) so I'm sure I will realize I need more features, and they will 
be added. However, I do not intend it to grow to an all-singing, 
all-dancing word processor-like field editor - I have no need for one of 
those. But it might be a staring point for someone else who wants that.


-- Alex.

/Handlers/

In general, these handlers are invoked by 'dispatch'ing the message to 
the group. The sample app shows an example of how to structure the menu 
items (edit and Format menus). It also contains examples of manipulating 
the text (the *Exchange* button), showing different configurations of 
the buttons (the *Snap* button, and capturing the return messages for 
undo/redo being available.


/Handlers/

*/fg.init/* pAConfig

Initialize the field, with an optional set of configuration parameters 
(see fg.configChange for details of these).


/dispatch "fg.init" to grp "fldgrp" with "textbuttonsize=large", 
"svgbutton=large"/


*/fg.configChange/* pAConfig

Configure the settings for buttons usage, placement, size, etc.

This can be either an array, with the key/value pairs, or any number of 
parameters each being in the form “key=value”.


Examples:

/put "top" into tA["textbuttons"]//
put "small" into tA["textbuttonsize"]
dispatch "fg.configChange" to grp "fldgrp" with tA/

or

/dispatch "fg.configChange" to grp "fldgrp" with "textbuttons=top", 
"textbuttonsize=large"/


Parameters that can be set are:
- textbuttons : top | bottom
- svgbuttons : top | bottom | right | left
- textbuttonsize : small | large
- svgbuttonsize : small | large
- resizing : true | false (defaults true - if FALSE then the group will 
not adjust for any resizing)


*/fg.version/*

Returns the version of the fieldgroup.

/dispatch function "fg.version" to grp "fldgrp"//
put "Version" && the result  into msg
/

/
/

*/fg.getText/* pType

Retrieve the contents of the field.

/dispatch function "fg.getText" to grp "fldgrp" with "styledtext"/

pType is one of
- styledtext (the default) : return the complete styledtext /array
- text : plain text of the field/
- htmlText : htmltext of the field
- rtftext : rtfText of the field

*/fg.resetUndoSystem/*

Resets all undo info, for example if the app does a save, and if it 
determins that the user should ne bot able to'undo' beyond that point, 
then it would call this handler.


/dispatch function "fg.version" to grp "fldgrp"//
put the result into URL ("binfile:savedfile.txt")
dispatch "fg.resetUndoSystem" to grp "fldgrp"/

/
/

*/fg.set.initialText/* pText

Set the initial text for the field (i.e. set the text, an reset the undo 
system).


/put URL ("binfile:" & sFilename) into tText//
put arraydecode(tText) into tA
dispatch "fg.set.initialText" to grp "fldgrp" with tA/

pText can be either an array (in which case it is the styledText to be 
set), or string (of simple text).



*fg.replaceChunk* pChunk, pAText

Replaces the specified chunk of the field with the styledText in the 
array pA.


/dispatch "fg.replaceChunk" to grp "fldgrp" with tChunk, tAText/



Re: Livecode Community Site

2020-07-08 Thread Alex Tweedly via use-livecode


On 08/07/2020 06:30, Richard Gaskin via use-livecode wrote:

LC Ltd loves guest content in their blog, 


Really ?  There's been *one* guest blog post in the last 2 years - maybe 
they need to push harder for contributions.


and additions to the Lessons and docs.  The nice thing about making 
contributions with the core project is they keep the 
highest-possible-ranking site looking fresh, while also reducing work 
for the author.


Yep!

So the answer for me is clear - I should write a (potential) blog post 
for the Livecode Blog, and offer ti to Heather. It may not be up to 
their standards - but at least I'll have tried.


OK, off I go to write up my little "Them are beads!" project.

Alex.




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


Re: Livecode Community Site

2020-07-07 Thread Alex Tweedly via use-livecode

On 07/07/2020 18:46, Tom Glod via use-livecode wrote:


Hi Folks,

For years I have owned the domain "lovelivecode.com". At one point I lost
it, but decided to buy it again a few months ago.

...

Recently,I am seeing the glaring need in the community (also touched on by
recent threads):

Yes, I agree (some).

I don't have a ton of time to spend on it, but thanks to modern tools, I
don't need lots of time.


Please give me a quick reply
1. If this interests you.
2. And If you would like to be involved with it


1. Yes, I'm interested.

2. Yes, I'd ike to be involved.

3. BUT I am wary :-)

I fully agree that we are missing some of those things, and that a 
community effort could maybe help fill some of them. But we also already 
suffer from duplication and fragmentation (and too many possible places 
to have to go look).


So I think that unless we are confident that there is enough interest, 
commitment and agreement on goals, we would be better off not even 
starting . Sorry if that sounds negative - but the last thing we need to 
do is to use up the rather scarce resource we have (i.e. our own time) 
on a likely-to-fail effort.


So I'm going to pick over your stated goals, and comment on them. Partly 
think of this as an attempt to avoid "boiling the ocean" - we'd be 
better getting success on 2 or 3 goals than only a little bit of 
progress on 10 of them.



Here are my goals:

For LoveLivecode.com to be a "modern" central hub for:


Not sure what 'modern' is (or whether I like it :-)  And central could 
mean 'one place for everything' which I think is not practical.


The goals, rearranged into a different order to suit me:



LC News
Member Post Feed
Communication between members (forums / PMs)
Here I think we already have adequate choices (and fragmentation). I 
would love to find a way to unify the forums and the use-list - but if 
it was going to be easy, it would have happened by now. And a separate 
(non-LCLtd) solution is just going to be another fragment.

(Up-to-date) Educational resources

Yeah, could be possible.

Code snippets
Sample Files
Yes, definitely. I think there is a particular gap in this area 
(libraries) but I'll keep that for a possible later detailed discussion.

Events / Online & Live
Community Polls (to help livecode inc to understand us better)
Yes - I'm sure there is interest for this, even if we are all not sure 
what we want, we really do want something.

Developer Directory (And maybe project submission for developer bids??)
and Ad space for anyone whose target market is LC Developers.


Yes, why not.

I hope you (we) can get something going, even if I'm not sure yet what I 
most want it to be.


Alex.

P.S. is it "love livecode" or "love. live. code." ?



___
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: [off-topic-ish] do you prefer LC-related content as books or video courses?

2020-07-07 Thread Alex Tweedly via use-livecode

My immediate response is  anything but video !!

I hate video - can't find things, no indexing, can't fast forward 
effectively over the bits I know or more-or-less know, need audio which 
doesn't always fit my surroundings, 


But that doesn't mean video is without its advantages - sometimes it 
gets details across in a way that written methods fail with. Videos 
which are *short*, with really good external index/content description 
might be just the thing.


As for "book" - does that mean paper, ePub, PDF, or something better.  I 
would love to see a stack-based solution that gave quick, searchable, 
hyper-linked access to content that was also accessed in other ways. For 
example, I buy an e-book giving me a PDF plus a stack which allows me 
good access to the content (including updates, errata, new additions).


And I think you should consider a model of initial purchase with (cheap) 
on-going subscription, that would allow you an on-going revenue stream 
to keep the enhanced-book up-to-date and relevant.


And I think you could (depending on your content area) perhaps sell 
content which is sample apps. I would happily pay for a *realistic* iOS 
app - don't much care what it does, so long as it contains current 
techniques for building a real app - including using mobile widgets, 
etc. and comes with a full set of build instructions - i.e. it can't be 
a "Hello World" app, it must have reasonable set of features. Then I 
could take the app, follow the instructions - and hopefully get a 
successful build with fewer headaches. And that would be the ideal case 
for initial purchase + subscription because the instructions would 
evolve over time.


And if wanted to then build my own app, I would most likely do it as an 
offshoot from that working model. (Don't know how you work out licensing 
for that :-)


I suspect you could do similar for Android, a desktop + web combo,  
and find people who would get good value from buying that to give them a 
headstart on their own development. You'd need to find a balance of 
enough content to be a *real* app without soaking up too much 
development time.


Alex.


On 07/07/2020 17:27, Andre Garzia via use-livecode wrote:

Hey Folks,

I have been working on some new LC content to sell. I want to transition my
career into content production and I think there is an unserved demand for
quality content for our beloved language.

I'm just not exactly sure if you prefer to consume content in book format
or video format. My reason to ask is because I love books but apparently
people enjoy video courses more. Some friends of mine report more revenues
from video courses than books, but doing video is harder and takes longer,
so before deciding on what medium to go for I decided to ask you all about
it.

My outline is done and the research into the topics I want to cover is
almost complete. I'll soon reach the point in my production pipeline where
I need to decide which way should the content go. What do you prefer?

Best
Andre



___
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: Message watcher and selectionChanged

2020-07-06 Thread Alex Tweedly via use-livecode



On 06/07/2020 17:19, J. Landman Gay via use-livecode wrote:
There's a button at the lower right of the window that allows you to 
select which messages are suppressed. The default is to suppress 
unused messages but you can change that. IDE messages aren't shown by 
default either and you can add your own if you want.



Thanks Jacqueline.

I tried that button, and it tells me (or seems to tell me) that the only 
'suppressed' message is 'mousemove' (and it doesn't mention 'unused' at 
all - only 'handled' and 'not handled' - and neither of those is 
selected as suppressed). So it's a confusing 'default'.


Now that I know, I will always test with a handler rather than assuming 
the Watcher is telling the truth.


(Hmmm - that last line feels like I'm in an episode of Buffy, or Once 
Upon a Time, or ... :-)


Thanks

Alex.


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


Message watcher and selectionChanged

2020-07-06 Thread Alex Tweedly via use-livecode
I was using the Message Watcher in the IDE to check on which messages 
were sent in different cases, and noticed that:


'selectionChanged' was not being reported when I changed the selection 
or insertion point within a field.


BUT if I add a 'selectionChanged' handler to the field, the handler is 
called, and the Message Watcher THEN does report it.


Does that seem right ?

Should messages only be reported if they are being checked for somewhere ?

-- Alex.

P.S. or if anyone wants to answer the *real* question :
   does anyone have a general purpose 'undo/redo' handler-set for text 
fields that they could share :-) ?



___
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: WebSites made using Livecode.

2020-07-06 Thread Alex Tweedly via use-livecode

Hi Hery,

not sure if you've received any pointers to actual sites yet :-).

Here are a few I've made :

https://kilmelford.com/

most interesting of them - but since all events are cancelled this year, 
it's currently less interesting than other times :-) All made with my 
own CMS for LC; flat file text and text database, so really trivial 
installation, and very little attack surface (no PHP, no SQL)


http://karenliversedge.com/

done with Ralf's revigniter framework.

https://melaniechmielewska.co.uk/

not quite a 'modern' website.  Done with a very simple LC server script 
some years ago. The artist said "I want a retro appearance. I make stone 
sculptures to last 200-2000 years - I don't want a website that changes 
every 2 year". :-)


Alex.

On 06/07/2020 00:53, Rick Harrison via use-livecode wrote:

Hi Hery,

You can set up your Livecode Server to work
with your database directly on the same computer.
You do not need PHP at all for anything.  In fact
if you look at your server log files you will see that
China hacker bots are heavily searching for PHP
and when they can’t find it they even try to install
it so they can continue hacking away.

Livecode Server is fun!

Good luck!

Rick
___
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: Animation Engine: speed tips

2020-07-02 Thread Alex Tweedly via use-livecode


On 01/07/2020 02:52, J. Landman Gay via use-livecode wrote:
Did you use acceleratedRendering? Set it to true and set the layermode 
of each moving object to dynamic. I'd be curious to see if there's a 
difference.



Hadn't  tried those until now. There is a difference - but not the kind 
I'd hoped for :-)


Full script is below with detailed time, but the summary is:
- acceleratedRendering made things much worse (50% to 90% slower)
- dynamic layerMode made things a little bit better (5% to 15%).

If the circle was moving over a plain background, improvement was only 
5%-ish, while if moving over multiple other shapes, it gave a better 
improvement.


Here's the full snippet of the script involved (other cases obvious :-)


  set the acceleratedRendering of this stack to false
   set the layermode of grc "g1" to "static"

   repeat 3 times
  put 100,400 into tmp
  put the millisecs into tim1
  repeat 100 times
 add 1 to item 1 of tmp
 set the loc of grc "g1" to tmp
 wait 0 with messages
  end repeat
  put the acceleratedRendering of this stack && \
    the layermode of grc "g1" \
    && the millisecs-tim1  after gLog
   end repeat
   put CR after gLog


Here are the times for each of the cases, moving 100 times

false static 192
false static 154
false static 155

true static 285
true static 332
true static 249

true dynamic 265
true dynamic 255
true dynamic 309

false dynamic 131
false dynamic 134
false dynamic 149

Alex.


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


Re: Animation Engine: speed tips

2020-06-30 Thread Alex Tweedly via use-livecode

Hi David,

I had a quick look at this (for slightly selfish reasons - I will be 
doing some simple animation soon, so this piqued my interest to look at 
it sooner :-)


[ all comments on performance or timing here are on an aging (2011) 
Macbook Pro, LC 9.6.0 ]


So, there's good news, and there's bad news :-)

1. Bad news.

It is slow (surprisingly, disappointingly slow) to move graphic objects 
in LC. Moving small simple objects (unfilled circle graphics <20 pixels 
across) over an uncomplicated background. Each move takes between 1 and 
2.6 msecs. (Yes, that's for one object !!)


[ Puts on 'grumpy old man' hat = that's about the same time as it took 
on my old Atari ST - 34 years ago!! Where's Moore's Law when I need it 
:-). ]


2. Good news.

Although disappointing performance, it is (probably) good enough for 
your described example. Around 30 simple, small objects moving, 20 fps 
~= 700ms within a second; it should just be doable.


3. Bad News.

You're on the edge !!  The timings above were for moving objects in a 
simple, tight loop. (see sample code below my sig.)  You have a little 
bit of spare CPU left over to handle overhead, object management, new 
co-ord calculation, etc., but not very much.


Animation Engine.

It's a powerful library - has lots of good stuff to do fading, morphing, 
collision detection, input constraint, color changes, animated scrolls 
(bounce, overshoot, ...), and then it has two methods of just *moving* 
LC controls.


The 'classic' version requires the developer to set up a timer/loop 
handler, and use the various aeMovexxx handlers; because of the timer 
handling it's tricky and needs care from the developer.


The other version is only for straight line moves (aeMoveTo); this is 
much simpler to use, can handle multiple shapes moving in synch and does 
it very efficiently. (The older equivalent was aeMoveLinear, which is 
deprecated). If all your moving is (or can be cast into) using this 
version, you might have no problems. Note Malte describes aeMoveTo as 
'frame-perfect' - all the moves done by aeMoveTo happen perfectly 
aligned by the (single) frame timer, so moves can be precisely 
coordindated to start and/or finish at exactly the same time.


If it can't be, then you might think about adding new functionality to 
AE to provide a similar capability , using the same single timer that 
aeMoveTo uses.


My needs are slightly different:-
1. linear and "hop" moves only (*)
2. need to string together multiple moves within a 'frame-perfect' setting

btw - this 'stringing together' is exactly what you would need for 
hand-drawn curve following; you'd form a points-list from the 
hand-drawing, then construct a series of linear moves along each edge.


I decided the easiest way to achieve what I need was a simple 
purpose-specific library, that has just these features. It's simple to 
use, understand and debug - currently < 200 lines, and likely to finish 
up around 250 lines by the time I'm done adding features.


(*) What's a "hop" move?
Think of a child's board game (Ludo, S, ...) When you move a 
piece, you don't (if you're playing with a child) usually just pick it 
up and move it (say) 5 squares, instead you go "...1...2...3...4...5", 
while touching the piece in or near each square in turn. That's a hop 
move (or a series of hop-moves. :-)


Anyway - I have that working now, so with luck I'll get a chance to work 
on it this week and get it tidied up, and release a first version by the 
weekend, so if you (or anyone) is interested they can try it out.


Alex.

Simple benchmark:

I finished up with a pretty trivial example bit of code:


>    put the loc of grc "g1" into tmp
>    repeat 100 times
>   add 1 to item 1 of tmp
>   set the loc of grc "g1" to tmp
>   wait 0 with messages
>    end repeat

Notes:

0. Graphic "g1" is a simple, small circle.

1. if the graphic wanders off screen (out of window) the time taken 
drops to 0.


2. If you remove the "add 1 to item 1 of tmp" (i.e. the graphic remains 
in the same place), then again the time drops to effectively 0.


So with this simple code, I find that (on my aging Macbook Pro), those 
100 moves take between 125 and 275 ms (i.e. just about 1 to 2.5 ms per 
shape to move). And that variation is easily matched against the 
complexity of the surroundings the piece is moving through - if it moves 
over (or under) many other graphic objects, it takes clearly longer.


Good luck.

On 28/06/2020 01:09, David Bovill via use-livecode wrote:


I made a quick test - creating and animating small graphic circles along a complex 
curve with many points. It works fine with one or two animated spheres but I’d 
like to be able to animate >30 and it slows to a crawl after 4 or 5. I tried 
setting the layer mode appropriately for all the objects - but I’m doing this on a 
new MacBook Pro - and it does not make a difference.

Does anyone have an example stack with multiple animated objects that I can 
compare / 

Re: Animation Engine: speed tips

2020-06-29 Thread Alex Tweedly via use-livecode
Thanks Malte. Hope you are enjoying whatever it is you're doing instead 
of writing code :-)


Thanks again for having put AE into the Public Domain.

Alex.

On 29/06/2020 10:15, Malte Pfaff-Brill via use-livecode wrote:

Hey Alex,

Public Domain it is. I’ve set it free couple. of years back, as I am 
essentially no longer writing code. :-) Still following LiveCodes progress with 
interest though.  :-)

Cheers,

Malte
___
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: Animation Engine: speed tips

2020-06-28 Thread Alex Tweedly via use-livecode

Hi there submariner :-),

can you just confirm the licensing of AE ?

The demo code says it is dual Commercial & GLPL3 - but GitHub says it is 
Public Domain.


Can you just say which of those is correct ?

Thanks

Alex.

On 28/06/2020 10:27, Malte Pfaff-Brill via use-livecode wrote:

Hi,

off
it. might be worth digging into AEs source and change the handlers from using 
cProps to local variables.  Also,  there might be unnecessary instances. of 
locking / unlocking screen that. should be refactored in AE.
If anyone is going to take that up I’d be happy iff you shared your patches to 
the community. :-)
on

All the. Best,

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


"Set filename of image" does nothing if the file name has not changed.

2020-06-19 Thread Alex Tweedly via use-livecode

Hi folks,

I'm trying to decide if this is a bug or just an oddity. (or a 
documentation deficiency).


Comments welcome to help me decide what bug report (if any) to file :-)

When I "set the filename of an image" to a file, I expected that the 
image should show the content of the file. And if I then go (outside the 
app) and change the file, that change will *not* be immediately 
reflected - but if I again "set the filename" (to the same value), it 
would then pick up the new, correct image data from the file.


However it doesn't. The 'filename' property has the correct value, but 
the image is not updated.


If I "set the filename to empty", and then "set the filename to (the 
file)" again then the image is updated.


(Kind of hard to describe well - see end of this email for another 
description).


Does that seem right ?  Or like a bug ?

The docs do say


Setting an image's filename property to the name and
location of a file deletes the previous contents of the image.

which to me means this should just work - but I could be persuaded 
otherwise.


Alex.

((Same description in step-by-step 

1. copy bad.gif into this.gif (it's a bad file)

2. click on button - should show the bad image - that is, shows a blank 
image

   i.e.   set the filename of img "img1" to ""

3. copy good.gif to this.gif (it's a good image)

4. click button again (doesn't fix it)
   i.e.   set the filename of img "img1" to ""

5. shift-click button (does fix it)
   i.e.   set the filename of img "img1" to empty; set the filename 
of img "img1" to ""




___
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: New Campaign

2020-06-18 Thread Alex Tweedly via use-livecode



On 18/06/2020 08:48, Heather Laine via use-livecode wrote:

:) what he said.
Thanks Sean - tried that first :-) No (relevant) subscriptions, only two 
old ones (one deactivated, one cancelled !!).

But if you don't see your subscription there, check your email address. You 
could have a second account under a different email... If you need more help, 
please email me in support.


Thanks Heather, I do indeed have a second email registered - but it has 
no subscriptions at all.


So clearly there is something slightly weird specific to me (no 
surprise, I've had many different licenses over the years, depending on 
the special offers at the time :-)


I'll email you via the support list ...

Thanks again,

Alex.




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


Re: New Campaign

2020-06-17 Thread Alex Tweedly via use-livecode

Hi Heather,

I have a question, and I think it might be a common one, so I'll ask 
here on the list rather than individually. Please feel free to reply 
whichever way you think is better :-)


I will definitely buy something (or failing that simply donate) - but I 
wanted to find what would be the best choice for me. I know (or think I 
know) I have an Indy license, and wanted to see when it expires so I can 
decide if I should renew/extend it now - and if not, then I'll find 
another toy to buy.


But I can't find that info on the livecode.com/account page. I can only 
find a licenses for "Livecode commercial" and for "Livecode complete". I 
know that last one expired a long time ago - but can't find any more 
info for the "Livecode Commrcial" one.


Can you tell me where/how to look ? Or if necessary, tell me off-list.

Many thanks,

Alex.


On 17/06/2020 15:30, Heather Laine via use-livecode wrote:

Dear list folks,

I'm drawing your attention to our crowd funding campaign, which we have just 
launched here:

https://livecode.com/covid-19-livecode-impact-fund/ 


This is an important campaign for LiveCode. If you have a moment please do go 
and check it out.

Warmest Regards,

Heather

Heather Laine
Customer Services Manager
LiveCode Ltd
www.livecode.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: Moving object out of a group

2020-06-15 Thread Alex Tweedly via use-livecode
two possible, but not great, answers ... but (something like) this has 
worked for me in the past.


1. - drag/drop the grc rect to the containing group or card (i.e. 
outside the groups it should not be in)


 - drag / drop other groups to before it

2. - select the group it is in

   - "Ungroup"

   - deselect the rect

   - "Group"

Alex.



On 15/06/2020 17:31, Sean Cole (Pi) via use-livecode wrote:

Hi all,

This has been a problem for some time now but it's just got so much more
frustrating for me. I tend to organise my objects into groups as there are
often lots of them and it helps keep them manageable.

However, I have created a rectangle grc I need positioning between two
group layers but I can never seem to get it to between them but only inside
one or the other. It's not easy to describe so I've created a little video
to help demonstrate it. -
https://www.dropbox.com/s/w75fapg0pqcgezg/MoveOutOfGrp.mov?dl=0

Ideally, the grc should end up outside of both groups but between them in
the list. I've tried drag-drop and by changing the layer number but can't
get it to place properly. Is there a way to overcome this?

Thanks

Sean Cole
*Pi Digital *
___
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: Unicode and languages

2020-06-06 Thread Alex Tweedly via use-livecode
If you simply need to protect users in the scenario you describe, then 
you could try a simple heuristic


 - extract the first 100 (200? - 500?) characters (or first 20 words)

 - spell check that

 - if there are more than 10 (20? - 50??) spelling errors then flag it 
as a likely language mismatch.

 - and if not, proceed to do the spellcheck.

Adjust the numbers until it gives protection without too many false 
positives.


Alex.

On 05/06/2020 18:15, Paul Dupuis via use-livecode wrote:
In all the added stuff the LC7 and higher Unicode engine includes, is 
there any way to determine the LANGUAGE of a range of text?


USE-CASE

We have a tool that helps researchers transcribe text from digital 
media. It is used internationally. We have added spell checking using 
lclSpell form Live Code Labs, a LiveCode store add-on.


For lclSpell, we only have Dictionaries for a small set of languages. 
You can build you own Dictionaries for lclSpell, but we'll still only 
have Dictionaries for a small subset of the languages people 
transcribe in. We also have people who do BOTH transcription AND 
translations.


For example, transcribing a Chinese language media recording, typing 
in the Simplified or Traditional Chinese characters AND then translate 
it to English, typing the English translation after the transcription.


With lclSpell (or I suspect ANY LiveCode compatible spell checker) if 
you try to spell check a reasonably large chunk of text that is NOT in 
the same language as your Dictionary, it ties up LiveCode forever, or 
at least such a long time and most people would force-quit. It is 
after all marking every word as misspelled and trying to do whatever 
it does to determine  that.


Now, you can react, that the researcher should just KNOW better than 
to do Spell check a text in a language that is not their loaded 
Dictionary! However, people are people, and will do such things and 
expect software to protect them from their own mistakes. Also, with 
mixed transcription and translation, you do want to spell check the 
English part and skip the Chinese (if you do not have a Chinese 
Dictionary)


So, we're looking for a way to detect the LANGUAGE of a range of text, 
in a LiveCode field, to be able to then determine whether it matches 
the current (or any available) dictionary or not and act accordingly.


There is a "fontLanguage" function in LC, but that seem to predate 
Unicode Everywhere and seem pretty useless now.


For example. in a new stack, with a single scrolling field, we paste 
in a Chinese text and then execute:


put the fontLanguage of (the effective textfont of char 1 to -1 of fld 1)

and get "ansi". Even you you set the range (char 2 to 3) that is 
specifically Chinese (no white space), it still returns "ansi". The 
textFont returns empty and the effective textFont returns "Segue UI"


I don't even know if language exists in the IBM Unicode engine as some 
exportable property a future version of LiveCode could expose.


Any clever ideas or thoughts on this problem are welcome.



___
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: ADA Compliency

2020-05-29 Thread Alex Tweedly via use-livecode

On 29/05/2020 18:09, Curry Kenworthy via use-livecode wrote:



> Have you tried using the mac OS voice commands or controls?

Strike two! 

I think that's a bad call.
Think carefully about the implications of what I said: "I can only say 
a few words without getting out of breath."


You are quoting yourself without adequate context. The fuller version of 
what you said was


yet I've had several periods in life (including right now after COVID 
for many weeks and ongoing) when I can only say a few words without 
getting out of breath. 
That implies you've had several periods when you did *not* suffer badly 
from shortness of breath., and therefore may well have experience with 
voice input. So I think your rather condescending attempted put-down was 
wrong.


Indeed, I could make a similar evaluation of the first part of your 
response; although you described your (mostly) successful use of a 
mouse, you did not mention your experiences with trackball or trackpad. 
The mere fact that you regularly use one method doesn't mean that you 
haven't also used the others, so it seems a worthwhile question to ask 
for your valuable insights into use of those.


And I'll add a third example of usability declining over time (my wife 
has a neurological condition that is probably on the same scale as yours 
- though of course it will be entire different in detailed effects).


Trackpads are very difficult for her to use. It's not just the X,Y issue 
- it's the third dimension of getting enough touch to be noticed, 
without inadvertently being too firm and having that be counted as a 
button press. This is less of a problem on Windows (specifically HP 
laptops) than it is on Macs, but still an issue. A few years ago, HP had 
many laptops with a trackpad *and* two buttons below it (i.e. nearer to 
the user). That was easy to use compared to modern laptops (though of 
course that has to be tempered with the fact that those laptops died 
years ago, so her fine motor capabilities are much poorer now than they 
were when she used those older HPs).


Alex.

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


Re: What have I done now ? (aka CR and LF confusion)

2020-05-28 Thread Alex Tweedly via use-livecode
Thanks Brian, that was a very helpful and clear description. It's 
amazing that I've been an active Runrev/livecode for nearly 20 years and 
not been affected by this until now :-)


Re. a PR to change it, it does seem it will run into concerns about 
backward compatability. Is it likely to succeed to propose a new 
URL-type - maybe "textfile".


Then you could do

  put tData into URL "textfile:tiny.txt"   to get the sane behaviour

but continue to do

  put tData into URL "file:tiny.txt"   to get the existing behaviour

To me, it feels like a better self-documenting case - binfile vs 
textfile, rather than binfile vs file.


Alex.


On 28/05/2020 03:15, Brian Milby via use-livecode wrote:

You need to use binfile on Mac to get sane line endings.  I have a PR to fix, 
but doubt it will get merged.

On Mac/Windows, file will convert line endings to what LC thinks is the native 
one for the OS.  CRLF for Windows and CR for Mac (the real CR, not the one that 
LC uses internally where CR and LF are synonyms for LF).  So on Linux you can 
use either file or binfile, on Windows you need to use file, and on Mac you 
need to use binfile to get the currently expected line endings.

Thanks,
Brian
On May 27, 2020, 9:24 PM -0400, Alex Tweedly via use-livecode 
, wrote:

I don't know if I've done something to my LC prefs, or to my Mac, or to
myself :-)

the following script


on mouseUp
    local t
    put "asd" & CR & "qwe" & CR & "zxc"  into t
    put t into URL ("file:/Users/alextweedly/tiny.txt")
end mouseUp

does create a file - but that file can't be (easily, properly) used by
some other Mac apps, because all the end-of-line characters are 0x0d
(i.e. numtochar(13)). So unix utilities like wc, cat, grep, more, ...
won't deal with it properly - though emacs, Sublime, Coda2, etc. do ok.

If I create the same file in an editor (emacs, Sublime Text, ...) they
all produce e-o-l characters which are 0x0A (i.e. numtochar(10)), and
this works in both editors and utilities mentioned above, as well as LC.

Maybe it's always been like this ??

I don't know - I just noticed because I tried to 'grep' for some
characters in all files within a folder, and didn't find anything
(though I should have done).

SO I can get by - just avoid using any files created within LC with any
other apps - but I'd rather find out if I should be doing something
different, or if I've accidentally changed some setting that causes this.

Thanks for any thoughts,

Alex.


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

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


___
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


What have I done now ? (aka CR and LF confusion)

2020-05-27 Thread Alex Tweedly via use-livecode
I don't know if I've done something to my LC prefs, or to my Mac, or to 
myself :-)


the following script


on mouseUp
   local t
   put "asd" & CR & "qwe" & CR & "zxc"  into t
   put t into URL ("file:/Users/alextweedly/tiny.txt")
end mouseUp
does create a file - but that file can't be (easily, properly) used by 
some other Mac apps, because all the end-of-line characters are 0x0d 
(i.e. numtochar(13)). So unix utilities like wc, cat, grep, more, ... 
won't deal with it properly - though emacs, Sublime, Coda2, etc. do ok.


If I create the same file in an editor (emacs, Sublime Text, ...) they 
all produce e-o-l characters which are 0x0A (i.e. numtochar(10)), and 
this works in both editors and utilities mentioned above, as well as LC.


Maybe it's always been like this ??

I don't know - I just noticed because I tried to 'grep' for some 
characters in all files within a folder, and didn't find anything 
(though I should have done).


SO I can get by - just avoid using any files created within LC with any 
other apps - but I'd rather find out if I should be doing something 
different, or if I've accidentally changed some setting that causes this.


Thanks for any thoughts,

Alex.


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


Re: Map Widget - how does it actually work?

2020-05-25 Thread Alex Tweedly via use-livecode
Well, the big advantage of widgets is that you can look at the source 
code. As it says in the Livecode Lesson ( 
http://lessons.livecode.com/m/4071/l/1005132-how-do-i-modify-a-livecode-widget 
),


What do you do if a LiveCode widget is missing a property or message 
you need?


The source code for all the widgets provided 'out of the box' is 
accessible so you can take those widgets as a base and improve and 
extended them as you need.


Unfortunately, there is a non-obvious meaning to "out of the box" - what 
it means is "source code for all the widgets provided 'out of the box' 
*in the community version* is accessible ..."


So, sadly, you can't just go look at the source code to find out what 
you need.


However, in the dictionary under "Guide" you can find some more info / 
example about the map widget. In particular, it defines the format used 
for  region, coordinates, span and markers - which is probably all that 
you need (I think all the others parameters in the API are booleans).


Disclaimer: I have never used the map widget - everything I say here is 
taken at face value from the doc and the visible files within the widget 
folder of 9.6.0(rc1)


Alex.

On 25/05/2020 21:57, Graham Samuel via use-livecode wrote:

Back to my problems with inadequate documentation on widgets. The Map widget is 
probably very powerful, but the Dictionary entry simple tells you the names of 
the parameters. I can’t work out anything about the format of the data you can 
feed in, or what it looks like when it comes out. There isn’t even enough info 
to start a meaningful experiment, IMHO.

Does anyone know of a source of helpful documentation on this? I am as ever 
interested in the iOS version.

Thanks for any info.

Graham
___
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: on-rev server upgrade-related problems

2020-05-08 Thread Alex Tweedly via use-livecode
While I'm glad the issue has been tracked down, we need to remember that 
what's really happened is that a work-around has been found (due to 
great detective work by Matthias).


The real problem remains, but will, I hope, some day be identified and 
solved.


Problem statement : the upgrade to significantly faster hardware, a 
modern 64-bit OS and LC6.x to 9.x cause a degradation in performance 
sufficient that client apps failed because the server responses were so 
delayed that the clients timed out.


Work-around: increase the timeout values on the clients (and be glad 
that Phil controls bother server and clients, so is able to do this).


Real problem: there are still too many areas in which 9.x performance is 
much worse than 6.x, and it would be good to see more (some) info from 
the mothership on how they plan to tackle these. Phil may be able to 
shed some light on the kind of things being done on his sever app, to 
see if that can identify particular areas that are having this negative 
effect.


Alex.



On 08/05/2020 13:28, matthias rebbe via use-livecode wrote:

Phil,

i´ve answered already to the bug report, but maybe this is also of interest for 
the others.

As i have also accoun ton the same On-Revi  as you and did some test.
I am sure it´s a tsNet timeout problem.

tsNET has several default timeouts. The defaults are 30, 0, 30, 6, 30, 
1000

  The fifth one defines "the time period in seconds that is used to calculate 
whether or not the transfer has fallen below the low speed limit set by 
pLowSpeedLimit."
It can be set either to 0 to disable the time out or to any other value.

In my first test my LC Server script returned just a 5MB file back to the 
client. That worked.

I then added a "wait 45 seconds"  to the script before outputting/returning 5MB 
file to the client. I got exactly the same error message than youor your  clients,

"tsneterr: (28) Operation too slow. Less than 1000 bytes/sec transferred the last 30 
seconds"
This makes sense as because of the "wait 45 seconds" we exceeded the default 
time-out value of 30.


I then added the following line to the client script.

tsNetSetTimeouts 30, 0, 30, 6, 120, 1000
With it i´ve changed the timeout to 120 seconds.

After adding that line, the 5 MB file was received again by the client w/o the 
tsNet error.

So setting the timeout either to a higher value or to 0 in the client script 
should solve it. I am not sure, but i assume setting it to 0 is not recommended.

Hope this helps.

Matthias

-
Matthias Rebbe
Life Is Too Short For Boring Code


Am 07.05.2020 um 20:35 schrieb Phil Davis via use-livecode 
:

Thank you all for so many great questions and responses! I don't have time to 
give a comprehensive response right now but (1) I'll whittle away at it and (2) 
all your comments renew my hope that a solution is out there waiting for me to 
find it.

Quick responses:

- I too would start by going back to LC 6.6.x on the server if I could, but 
apparently the recent server upgrades - new hardware running LC 9.5.1 - are not 
backward compatible. That's what I'm told at least.

- The LC client app is POSTing a request to an LC CGI system on an on-rev server. 
The server system assembles a data packet (normally an encoded array), encrypts 
& encodes it and writes it back to the client. The packet can be any size up to 
maybe a megabyte or two, but that would be pretty big. Normally the packet size is 
no more than a few hundred KB.

Thanks again -
Phil


On 5/7/20 7:29 AM, Ralph DiMola via use-livecode wrote:

Phil,

I had a problem with a GET request with a url encoded url in a parameter
after the upgrade. There are new security rules. I changed it to a POST and
it then worked. I am changing my apps to use a POST. Robin had lifted the
new security rule for me temporarily until all the apps are updated. One
other thing, the new MySQL server is now Maria DB. It is functionally the
same but I noticed if you have a column with no default value but is
required and the field is not in the SQL update then it throws an error.
MySQL did not do this.

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 Phil Davis via use-livecode
Sent: Thursday, May 07, 2020 3:18 AM
To: How to use LiveCode
Cc: Phil Davis
Subject: on-rev server upgrade-related problems

Has anyone had part or all of an on-rev server-based system stop working
since the server upgrades a month or so ago?

My client has an on-rev.com-based training system. Training delivery is via
web browser, and that part continues to work. But there are several desktop
apps that provide training development, management and real-time monitoring.
All of those apps became non-functional as soon as the upgrades were done,
and remain so. I haven't been able to figure out how to restore
functionality.

Robin in on-rev support has been very 

Re: on-rev server upgrade-related problems

2020-05-07 Thread Alex Tweedly via use-livecode

Hi Phil,

I absolutely agree with Matthias - the first thing to try (if you didn't 
already) is a custom-install of the older LC server version that you 
were using pre-upgrade.


However, it would also help to clarify the bug report somewhat. My 
reading of it is (almost) the opposite of Mathias's - i.e. I think 
you're posting a large file to the server.


If so, what happens to the large file - is it simply stored by the LC 
server, or does it need to be processed ?


If that is the case, can you write a tiny .lc server script that just 
receives and stores it ?


Can you add logging statements to the server script to verify if *it* 
sees the post arrive ?


If the tiny script works - could you (as a test and/or a temp 
workaround) store that file on the server (e.g. in /tmp) and return the 
tmp filename, and then have a second request that processes it ?


Alex.


On 07/05/2020 09:34, matthias rebbe via use-livecode wrote:

Phil,

you are not mentioning how you do prepare the data which is posted to the 
server.

Which engine is processing your post? PHP or LC Server?

In your bug report you are writing "to a large file". How big is "large"?

You are posting data to the server to get back the large file, right?

Is the file plain text or binary data?

If you are using LC Server scripts on your server to handle the posts...
Which version of LC Server was installed in your old hosting package?
- If it was a lower version than the currently installed one , then i would do 
a custom install of that LC Server version that was installed on your old 
hosting package and try with that version.
   That could be done in some minutes.

Does the large file already exist  on the  server or is it created on the fly 
when the data is posted to the server?
- If the file already exists on the server i would create a little .php or .lc 
test script which just outputs/returns the file back when executed.
- If the file is created on the fly, then i would first create a large sample 
file on the server and would then try with some test scripts.
This would show if the server has problems with large files in general, but i 
doubt it has.


Is the file returned with http headers or just returned plain without any 
headers?


Matthias


-
Matthias Rebbe
Life Is Too Short For Boring Code


Am 07.05.2020 um 09:17 schrieb Phil Davis via use-livecode 
:

Has anyone had part or all of an on-rev server-based system stop working since 
the server upgrades a month or so ago?

My client has an on-rev.com-based training system. Training delivery is via web 
browser, and that part continues to work. But there are several desktop apps 
that provide training development, management and real-time monitoring. All of 
those apps became non-functional as soon as the upgrades were done, and remain 
so. I haven't been able to figure out how to restore functionality.

Robin in on-rev support has been very helpful, but we still don't have a 
solution. This is the bug report:

   https://quality.livecode.com/show_bug.cgi?id=22704

I wouldn't wish this on anyone, but in a way I'm hoping it isn't just us.

Thanks -
Phil Davis

___
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: Group resizing.

2020-05-04 Thread Alex Tweedly via use-livecode

David,

thank you - that's a kind and generous offer to Zoom / pair on it. 
However, since the immediate problem is solved, I'd rather take a 
raincheck, and keep your offer in my back pocket for some future time I 
have a problem.


Summary of this case - when you do resizing based on groups, you should 
be sure to have the lockLocation of the groups set true.


I had a silly typo
   set the top of something to the bottom of another+10
and I had
   set the top of something to the bottom of another+1000

If lockLocation had been set, that would have been trivially obvious, 
and fixed in 30 seconds. However, it wasn't, so the group grew out of 
scale and obscured  most of the window, including where the problematic 
controls should have been - so I couldn't see they had gone astray..


And by bad luck, when I started adding "put  to msg" statements, I 
happened to span a bit of code that *only* tried to change X 
coordinates, and was actually changing Y coords (because of group 
inclusion). So I spent a long time down a rabbit hole of trying to see 
find which code could be doing that, not realizing this "feature" that 
changing one dimension would expand both dimensions of the group.


Thanks again,

Alex.

P.S. any thoughts on another group Zoom for Livecoders ? Haven't heard 
more from Heather (and they may be busy), so maybe we should try to 
arrange a community get-together ?



On 04/05/2020 10:09, David Bovill via use-livecode wrote:

Trying to understand this thread. I’ve been doing nested group resizing for all 
my work now for several years - it has been difficult often to debug track 
errors because of all the nested messages.

As a result I’ve had to make a bunch of tools to test each nested element 
before they are combined, and also I’ve developed a consistent style of doing 
it - which may mean that I’m not coming across the issue you report.

My suggestion Alex is the only way to explore this is to jump into a Zoom where 
we can share practice and see visually the issue? It would also be more fun at 
this time if lock down?

Feel free to pick a time if that appeals - I got nothing better to do :)

• https://woven.com/c/david62/pairprogramming

On 4 May 2020, 01:38 +0100, scott--- via use-livecode 
, wrote:

Oh good, I was hoping I wasn’t the only one.

—
Scott



On May 3, 2020, at 11:28 AM, Alex Tweedly via use-livecode 
 wrote:


I can now get back to my "10-minute cleanup task" that I started 8 hours ago :-)

Alex.


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

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


___
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: Group resizing.

2020-05-03 Thread Alex Tweedly via use-livecode

No, I don't, and that's probably what I should be doing.

I had not expected that changing the LEFT of a control would change both 
X *and* Y coordinates of the enclosing group - but that is what seems to 
happen; and that at least makes sense - any change to the control causes 
an adjustment to both dimensions of the enclosing group.


The surprise now is that changing the WIDTH of that control (which I do 
in the previous statement), which also could change both left & right X 
coords of the control, didn't also have that effect. Maybe because in 
this case the width setting didn't actually change the values - so it 
optimized out actually setting them, or adjusting to allow for it.


Anyway - thanks Brian, I can now get back to my "10-minute cleanup task" 
that I started 8 hours ago :-)


Alex.

On 03/05/2020 16:38, Brian Milby via use-livecode wrote:

Do you have the group size/position locked (lockLocation property)? If not, 
moving a control could change the rect.

Thanks,
Brian
On May 3, 2020, 10:28 AM -0400, Håkan Liljegren via use-livecode 
, wrote:

You probably need to lock messages in the beginning of your resizeControl. 
Otherwise the group will adapt to your resizing of your controls. I usually 
begin with both lock messages and lock screen, but the last is more for 
optimization.

Håkan
On 3 May 2020, 16:22 +0200, Alex Tweedly via use-livecode 
, wrote:

I realized after the discussion last week about resizing that I was
missing the benefits of "resizeControl" being sent to each group, so I
changed one of my resize handlers to make use of groups (adding a few
groups along the way).

And it all went wrong :-(

Eventually I traced it down to the following ... and don't know if I'm
missing something or if I've bumped into a bug.

The resize handler is


on resizeControl
    set the width of field "list titles" of me to the width of me - 20
    put "B" && the rect of me && the bottom of me  after msg
    set the left of field "list titles" of me to 10
    put "C" && the rect of me && the bottom of me  after msg
    local tR
    put 10, the top of me, the right of me -10, the bottom of me-10 into tR
    set the rect of fld "List" of me to tR
end resizeControl

Note the two "put ... msg" statements. - for no reason I can figure out,
the "bottom of me" changes between these two statements. Here's the
output from the message box:


B 5,32,331,468 468
C 6,32,325,2618 2618
B 5,32,331,471 471
C 5,32,320,2622 2622
B 5,32,331,473 473
C 5,32,320,2626 2626


If I comment out that "set the left of ..." statement, all apparently
works as expected.

Why should setting the 'left' of a control change the bottom of its
enclosing group ?

And why change it to an apparently silly value ?

-- Alex.


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

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

___
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: Group resizing.

2020-05-03 Thread Alex Tweedly via use-livecode
Thanks, but no, I can't do that. lock messages will prevent the 
"resizeControl" being fired for any sub-groups whose co-ordinates get 
changed, so it would prevent proper layout for them. 'lock messages' is 
good if you have all your controls directly re-positioned within your 
resize handler - but disallows hierarchy (which is the feature I'm 
trying to take advantage of here).


lock screen is of course a good optimization - thanks.

Alex.

On 03/05/2020 15:26, ha...@exformedia.se wrote:
You probably need to lock messages in the beginning of your 
resizeControl. Otherwise the group will adapt to your resizing of your 
controls. I usually begin with both lock messages and lock screen, but 
the last is more for optimization.


Håkan
On 3 May 2020, 16:22 +0200, Alex Tweedly via use-livecode 
, wrote:

I realized after the discussion last week about resizing that I was
missing the benefits of "resizeControl" being sent to each group, so I
changed one of my resize handlers to make use of groups (adding a few
groups along the way).

And it all went wrong :-(

Eventually I traced it down to the following ... and don't know if I'm
missing something or if I've bumped into a bug.

The resize handler is


on resizeControl
   set the width of field "list titles" of me to the width of me - 20
   put "B" && the rect of me && the bottom of me  after msg
   set the left of field "list titles" of me to 10
   put "C" && the rect of me && the bottom of me  after msg
   local tR
   put 10, the top of me, the right of me -10, the bottom of me-10 
into tR

   set the rect of fld "List" of me to tR
end resizeControl


Note the two "put ... msg" statements. - for no reason I can figure out,
the "bottom of me" changes between these two statements. Here's the
output from the message box:


B 5,32,331,468 468
C 6,32,325,2618 2618
B 5,32,331,471 471
C 5,32,320,2622 2622
B 5,32,331,473 473
C 5,32,320,2626 2626


If I comment out that "set the left of ..." statement, all apparently
works as expected.

Why should setting the 'left' of a control change the bottom of its
enclosing group ?

And why change it to an apparently silly value ?

-- Alex.


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

http://lists.runrev.com/mailman/listinfo/use-livecode

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


Group resizing.

2020-05-03 Thread Alex Tweedly via use-livecode
I realized after the discussion last week about resizing that I was 
missing the benefits of "resizeControl" being sent to each group, so I 
changed one of my resize handlers to make use of groups (adding a few 
groups along the way).


And it all went wrong :-(

Eventually I traced it down to the following ... and don't know if I'm 
missing something or if I've bumped into a bug.


The resize handler is


on resizeControl
   set the width of field "list titles" of me to the width of me - 20
   put "B" && the rect of me && the bottom of me  after msg
   set the left of field "list titles" of me to 10
   put "C" && the rect of me && the bottom of me  after msg
   local tR
   put 10, the top of me, the right of me -10, the bottom of me-10 into tR
   set the rect of fld "List" of me to tR
end resizeControl


Note the two "put ... msg" statements. - for no reason I can figure out, 
the "bottom of me" changes between these two statements. Here's the 
output from the message box:



B 5,32,331,468 468
C 6,32,325,2618 2618
B 5,32,331,471 471
C 5,32,320,2622 2622
B 5,32,331,473 473
C 5,32,320,2626 2626

If I comment out that "set the left of ..." statement, all apparently 
works as expected.


Why should setting the 'left' of a control change the bottom of its 
enclosing group ?


And why change it to an apparently silly value ?

-- Alex.


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


Re: Best relational database for IOS / Android

2020-04-29 Thread Alex Tweedly via use-livecode
Livecloud is indeed from Canela Software - but there's no obvious link 
from their own website for it.


Go straight to livecloud.io to get the info about it.

It does require Indy or above LC license

Alex.

On 29/04/2020 15:06, Clarence Martin via use-livecode wrote:

You may want to explore LiveCloud. It is a cloud based database by Canela
Software that allows for both cloud and Local- to the device- database.
http://canelasoftware.com/
I am developing and testing for a while.

-Original Message-
From: use-livecode  On Behalf Of Skip
Kimpel via use-livecode
Sent: Wednesday, April 29, 2020 6:54 AM
To: How to use LiveCode 
Cc: Skip Kimpel 
Subject: Best relational database for IOS / Android

Good morning,

In your opinion, what is the best relational database to use for an IOS /
Android application?

Being a PC guy and always living in the Microsoft world, I always default to
SQL, however, with my latest discoveries of the complexities involved and
lack of support in LC I don't think that would be the best move at this
point.

Suggestions?

SKIP
___
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: Mobile screen sizes - another naive question

2020-04-28 Thread Alex Tweedly via use-livecode

Richard,

it wasn't that you over-wrote it - the problem was I over-thought it.

My excuse is that I have been thinking quite a bit this last week about 
whether there was a (simple enough) approach to layout that would allow 
"rows & columns" semi-flow layout to be nearly automatic, and be 
possible to provide a UI that would make it practical (and quick) to 
provide extra guidance to such a system.


You message just happened to fit into that thought exercise - causing me 
to over-complicate things.


So my apologies. I think what you wrote was perfectly clear, it just 
didn't happen to be the same as I was working on :-)


Alex.

On 28/04/2020 16:22, Richard Gaskin via use-livecode wrote:

Very good thoughts there, Alex.

The assumptions you list would be important to keep in mind if one 
were aiming to generalize basic layout handling, with libraries that 
have nicely-designed APIs, or even further with virtual props that 
would lend themselves well to reducing things further to simple 
point-and-click authoring.


But in this exercise I'm making no assumptions at all; I'm just 
looking at the UI and writing purpose-built code to make it do what I 
want.


And with only a dozen lines, why not?

There's good value in generalizing app development.  Data binding is 
ripe with unexplored opportunities, as are field entry validation, 
window management, menu management, exception handling and reporting, 
socket comms, and many other things we write.


Sometimes we make tools or libraries to reduce the scripting we would 
use to deliver those.


Sometimes we generalize far enough to reduce it further to assigning 
the desired behavior with property settings which would then lend 
themselves to a point-and-click development workflow.


But often we just write a few lines of script to do what we want to do 
for the case at hand and be done with it.


The draft Lesson I posted serves only as a reminder that placing 
objects where we want them isn't all that deep, and if we use groups 
well we can reduce that scripting even farther.


That this wasn't clear in the writing suggests the draft is possibly 
too long.  "Set the loc of  to " doesn't really require a 
whole page.


Different apps require different code. Layout is the least of it. 
LiveCode is a scripting language.  We script.


And when we look at the apps we use from others, regardless what tool 
they're written in, we see those authors do the same thing: they look 
at their layout, consider what they want to communicate to the user, 
and put things where they want them to support that.


What I had tried to convey was that putting things where you want them 
is neither mysterious nor difficult in a nice language like LC.  
Clearly I overwrote.




___
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: Another widget grumble

2020-04-28 Thread Alex Tweedly via use-livecode


On 28/04/2020 13:38, Brian Milby via use-livecode wrote:

For any that are part of the main product, a PR to add that feature would not 
be very difficult.  If I get some time I will take a look.  I do agree that a 
distinct label would be a good idea for native control widgets.


How do you tell whether a widget is "part of the main product" ?

Or, conversely, how do you find out what other source it came from ?

I don't see anything in the dictionary about owner/source of the widgets.

Alex.


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


Re: Mobile screen sizes - another naive question

2020-04-27 Thread Alex Tweedly via use-livecode



On 27/04/2020 21:29, Richard Gaskin via use-livecode wrote:


I've been itching to write a tutorial on using specific object 
placement ("Responsive Design", as the kids call it) to compliment the 
Lesson we've had for years on the other mobile layout option, 
FullScreenMode.


I had a few minutes over the weekend, and a discussion with a new 
developer prompted me to craft a simple example of how groups can be 
used to handle common design patterns with little code.


This may be fleshed out more fully in the future, but for now at least 
it's more than the zero tutorials we've had on it thus far:


https://forums.livecode.com/viewtopic.php?f=53=33989=15#p190927

Interesting, and as you say, a good start can be made easily. But it has 
many built-in assumption that may come back to bite you 


on resizeControl -- Allow the user to enjoy whichever orientation -- 
they prefer with responsive design: -- put item 1 of the loc of me 
into tMidX put item 2 of the loc of me into tMidY -- if the width of 
this cd < the height of this cd then -- Portrait: set the loc of grp 
"UserInfo" to \ tMidX, tMidY - (the formattedHeight of grp "UserInfo" 
div 2) set the loc of grp "MembershipInfo" to \ tMidX, tMidY + (the 
formattedHeight of grp "MembershipInfo" div 2) else -- Landscape: set 
the loc of grp "UserInfo" to \ tMidX - (the formattedWidth of grp 
"UserInfo" div 2), tMidY set the loc of grp "MembershipInfo" to \ 
tMidX + (the formattedWidth of grp "MembershipInfo" div 2), tMidY end 
if -- end resizeControl
In Portrait mode, this assumes that the two groups are the same height 
(or nearly so). If they're not, one or other of them will finish up 
bumping against the top (or bottom) of the card.


Similarly, in Landscape, it assumes they are same-ish width, otherwise 
one of them will stick out the side.
*AND* it assumes they are the same height, otherwise the tops will be 
mis-aligned and potentially ugly.

( you could add lines like
put the min(top of grp "MembershipInfo", the top of grp "Userinfo") into 
temp if temp < the top of me + 10 then put the top of me + 10 into temp 
set the top of grp "MembershipInfo" to temp set the top of grp 
"UserInfo" to temp


to the end of the Landscape case).

And there are other assumptions

1. the fields are sized suitable to fit in the width of the narrowest 
device. If a narrow device is small enough, maybe the labels should 
slide around to above its field, rather than be beside it.


2. assumes that you don't want to widen the fields on not-very-narrow 
devices - whether stretching the fields, or increasing spacing between them.


3. In landscape, there may well not be enough width to allow the two 
groups side-by-side (say, on a phone), and you would really prefer to 
have the stacked vertically, even though in Landscape.


4. (perhaps the hardest) if you have text areas (i.e. multi-line 
fields), how do you decide whether to expand vertically depending on the 
height of the card, versus simply allowing vertical scroll bars within 
the field.



In summary - I absolutely agree that LC has everything needed to provide 
responsive layouts, and that with even a modicum of effort (which might 
seem tedious the first few times :-), it can produce layouts which are 
MUCH more responsive than a typical web page/app. But there is a danger 
of thinking it is too easy, and producing semi-responsive designs which 
are not quite good enough.


Things that would help:

1. either a widget or a compound-control for labelled field which wold 
allow the encapsulation for the sizing options for label+field; and 
would allow for labelling above or beside the field depending on 
context, space available and kind of field.


And there are others -library functions or behaviours that will help 
with the common cases - more thought on that tomorrow.


Alex.

.


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


Re: Three very simple questions

2020-04-26 Thread Alex Tweedly via use-livecode


On 26/04/2020 13:28, Klaus major-k via use-livecode wrote:


I was thinking for example of an array of constants (really strings) which 
could be written into my script. Again, if that’s possible I don’t know how. It 
seems odd to have to do something like convert lists of constants into array 
form only when the program is running.
Monsieur?
Well, when else would you like to do it in LC, when it is not running? :-D
I'm sure I did nto really understand what you mean.


I think Graham was hoping for more powerful 'constant' statement.

I know I'd like to be able to say things like

constant kA["help"][1] = "This is the help string"

or

constant N = 1
constant kA["help"][N] = "some string"
constant kA["help"][N+1] = "next string"

or indeed my old favourite

constant kManyLinesOfText = """
here's a version of the constant string
which spans multiple lines"""

Alex.




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


Re: Three very simple questions

2020-04-26 Thread Alex Tweedly via use-livecode
Sorry for sending 3 replies - but I don't know when I will run out of 
time, and wanted to get some sent before the oven demands attention :-)


On 26/04/2020 13:11, Graham Samuel via use-livecode wrote:

3. I can’t work out if you can construct an array using the IDE, i.e. prior to 
actually executing the code. I was thinking for example of an array of 
constants (really strings) which could be written into my script. Again, if 
that’s possible I don’t know how. It seems odd to have to do something like 
convert lists of constants into array form only when the program is running. 
Somehow I don’t think this is possible in LC, but I’m not sure.


No easy way to do it as constants. It is odd, but easiest is to just do 
it in an "opencard" or openstack handler, with a global array.


on opencard
  put "This is the help introduction" into gStrings["help"][1]
  put "(C) 2020 Graham Samuel" into gStrings["help"[2]
  ...
end opencard


Or, you can use Custom Properties (or Property Arrays) - but I don't 
remember how; it's just easier to do it as an array.


Or you can hold it in an external text file (e.g. Tab Separated file) so 
it is easier to edit with your favourite text editor, or import from 
spreadsheet, or ...). If you do that, I'd recommend reading it into a 
(global?) array, and providing a "write back to file" function so you 
can easily update it while in the IDE, and save those changes.


Alex.


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


Re: Three very simple questions

2020-04-26 Thread Alex Tweedly via use-livecode


On 26/04/2020 13:11, Graham Samuel via use-livecode wrote:

1. In the IDE, the ‘Align Selected Controls’ menu item doesn’t allow all 
possible combinations of alignment, particularly aligning horizontal and 
vertical centres; nor does it allow alignments in relation to the stack 
dimensions. I think this functionality used to exist, but maybe (very likely!) 
my memory is faulty. If these functions are available somewhere in the IDE, I 
don’t see where.


Select multiple objects.

Then from the menu    Object / Object Inspector

then the rightmost tab in the property inspector should be the align 
icon (like a left-aligned text symbol). Select that, and you will see 
all the options such as  center-aligned, etc.


I don't think they are available from the menu, but I didn't even 
realize any alignment could be done there.


Alex.



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


Re: Three very simple questions

2020-04-26 Thread Alex Tweedly via use-livecode


On 26/04/2020 13:11, Graham Samuel via use-livecode wrote:

2. I’ve not had to use LC arrays much, at least not ones containing my own 
data. The description of arrays is somewhat scattered throughout the lessons 
and the Guide, and I failed to find a thorough treatment of the whole idea of 
arrays in LC, which I find quite slippery. I am looking to use a two- or 
three-dimensional array, where you can script something like

  put myArray[2,7] into…, or
  get myArray[x,y,z]

I still don’t know if this is possible. I kind of think it is, but I can’t 
grasp how to do it.


Forget comma-separated indices - use multi-level arrays.

put myArray[2][7] into ...

get myArray[x][y][z]

and then it "all just works as you expect" :-)

Alex


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


Re: Even Distribution

2020-04-17 Thread Alex Tweedly via use-livecode

Or to do the full distribution ...

put Njobs div Ndrivers into tMin
put NJobs mod Ndrivers into tExtras

repeat with i = 1 to NDrivers
   if i <= tExtras then
  allocate tMin+1
  else
 allocate tMin
  end if
end repeat

However, say your drivers are sorted alphabetically, then before long 
Andy will realise that he is being allocated more jobs that Zebedee. You 
could (sometimes) reverse the order of drivers - but then Mary loses out 
on jobs compared to both Andy and Zebedee. Or you could randomize the 
order of the drivers - but maybe they're also pre-sorted by location.


Instead, you want to even out the spread of extras across the drivers - 
so you need something like


repeat with i = 1 to Ndrivers
   if tExtras > (Ndrivers-i)/2 then
  allocate tMin+1
  subtract 1 from tExtras
  else
 allocate tMin
  end if
end repeat

(which still has a slight bias towards giving jobs to Zebedee - but it's 
so slight it will take probably take him years to notice :-)


Alex.

On 17/04/2020 05:28, Jerry Jensen via use-livecode wrote:

  Hi Skip,
Forgive me if this is not the answer you seek, or an oversimplification, but 
there is an easy way to find if the jobs can be exactly evenly distributed, 
with nothing left over:
if (tjobs mod tdrivers) = 0 then // it is evenly distrutable.
.Jerry


On Apr 16, 2020, at 7:41 PM, Skip Kimpel via use-livecode 
 wrote:

I have working on creating a loop that would divide the number of jobs by
the number of users and then checking to see to see if it is evenly
divisible but that is kind of where I am stuck.  Everything I have tried
thus far has proven to be unsuccessful.


___
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: Getting started with geographical coordinates

2020-04-07 Thread Alex Tweedly via use-livecode
Thanks. Can’t think of a better place to be locked in!
I’m sure Google thinks of what3words as a competitor, but also I suspect w3w 
keeps their mapping very close to their chest as a proprietary asset.

Alex .


Sent from my iPad

> On 7 Apr 2020, at 16:58, Ben Rubinstein via use-livecode 
>  wrote:
> 
> What a beautiful view you have! Interesting that Google Maps doesn't accept 
> what3words yet - possibly viewed as a competitor.
> 
>> On 04/04/2020 01:49, Alex Tweedly via use-livecode wrote:
>> And I'm at plump.magpie.tightest (sorry, no calculated height available, not 
>> even in annoying feet - but I'd guess somewhere around 2 or 3 metres).
>> Alex.
>>> On 03/04/2020 23:07, Graham Samuel via use-livecode wrote:
>>> A long way from me at 43°16′43″N 2°09′36″E 
>>> <https://tools.wmflabs.org/geohack/geohack.php?pagename=Raissac-sur-Lampy=43.2786_N_2.16_E_type:city(456)_region:FR-OCC>
>>>  - and much higher (I’m about 130m). Sorry not to be quite so accurate!
>>> 
>>> Thanks
>>> 
>>> Graham
>>>> On 3 Apr 2020, at 22:28, Devin Asay via use-livecode 
>>>>  wrote:
>>>> 
>>>> Graham,
>>>> 
>>>> You get back lat and long in degrees and fractions of degrees, as a 
>>>> decimal numeral. For instance, I get latitude: 40.248676 and longitude: 
>>>> -111.651062, and for good measure altitude in meters at 1398.380493. Wow, 
>>>> now you all know exactly where I am!
>>>> 
>>>> Devin
>>>> 
>>>> 
>>>> 
>>>>> On Apr 3, 2020, at 1:49 PM, Graham Samuel via use-livecode 
>>>>>  wrote:
>>>>> 
>>>>> This is cheeky but I can’t run up my mobile simulation today - can 
>>>>> someone tell me the format of the geographical coordinates produced by 
>>>>> mobileSensorReading et al. I mean, is say latitude just one integer 
>>>>> showing seconds, or is it deg, min, sec - and are fractional seconds 
>>>>> returned (so, floating point)? I shall find out for myself eventually but 
>>>>> it would help a little to know now. AFAIKS there’s nothing in the LC 
>>>>> documentation about it.
>>>>> 
>>>>> Graham
> 
> ___
> 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: Maximum field height?

2020-04-06 Thread Alex Tweedly via use-livecode

Hi Jacque,

Scott made many of the same good points as you did - so I won't 
replicate my replies here.


On 06/04/2020 05:20, J. Landman Gay via use-livecode wrote:
On April 5, 2020 8:39:15 PM Alex Tweedly via use-livecode 
 wrote:



1. xTalk features just don't work, or work totally inadequately (e.g.
scrolling fields).


Somewhat true. LC made a start by adding widgets you can drop onto the 
stack to create native mobile buttons and fields, but I'd like to see 
regular LC controls magically change to native mobile controls much as 
the Mac, Windows, and (sort of) Linux appearances do. That would make 
a world of difference.

Yes !!


But there are features on mobile that don't exist on desktop. LC has 
provided for things like Android toasts and iOS popups. These things 
are one reason the language can't be entirely universal; mobile 
requires a different feature set. But it would be great if a scrolling 
field would just be a scrolling field everywhere. On the other hand, 
mobile lets you scroll all sorts of things (images, carousels, etc.) 
so we'd still need our mobile scroller anyway.
Same response to that as I have to mobilePick, mobilePickDate, etc. Why 
shouldn't they exist on desktop - if they're useful features for a good 
UI, why would LC not want to add them for desktop.



I agree it could be easier, but it isn't impossible. But parity 
wherever possible would be my first choice in what I'd like to see 
improved.




2. Failure in cross-platform equivalence.


If you mean mobile equivalence, Android is catching up quickly, in 
part because of the FM initiative. I appreciate that. iOS is pretty 
well covered for the most part. Some folks mentioned the issue of 
branching for different mobile platforms but that doesn't bother me 
much. We have to do that sometimes for the three desktop platforms 
already. The features that both iOS and Android do have in common use 
the same code and syntax.


I mean that, but for all platforms. If there is a common piece of UI 
functionality (e.g. pick a date) then abstract that out to a library 
function (in the box - not one we each create separately and slightly 
differently), and have it use the appropriate platform method. And if 
that means we finally get a pickDate widget on desktop then I'd say 
"about time" (and ask for a pickTime function as well :-)






The other two are, I suspect, not truly solvable.

3. It's not "Live"Code. Developing for Mobile gets you back into the
horrible edit - compile (i.e. build a standalone) - test cycle.


Yeah, this is a pain. I'm not sure there's any way around it but the 
addition of remote debugging has made it far easier. For a long time I 
felt like I was back in 1998 where I had to sprinkle "answer" dialogs 
all over the place just to know what my variable values were. There 
are some tricks though that help. I created a generic launcher app 
that loads my working stack so there's no actual compile required. I 
can't do this for complex apps, but I can do it for testing pieces and 
bits that will eventually go into the main app later. For simpler 
apps, the entire stack can be tested pretty easily this way.


Great. Now why didn't LC create a Launcher app like that so that 
everyone (esp new users) can use it,  one that runs in a standard way so 
we can easily communicate about it - and is documented.


4. You still need to deal with the ugly issues of the SDKs and the
app-store  requirements.


For me this is the hardest part, way worse than developing the app 
itself. It's also why I'd much rather deal with Android than Apple. 
Google is pretty easy to deal with. Apple is a constantly moving 
target with a rollercoaster of requirements, not to mention the 
profiles and certificates and what seems to me to be an unnecessarily 
complex review process.


Yes, but even getting the Android SDK seems to be (still) troublesome. I 
know it took me (literally) days way back when - it does seem to be 
better documented now, but apparently not quite straightforward.





However, if you are just developing for yourself or a few other 
people, you don't have to mess with either app store. Android apps can 
be freely distributed to anyone by any method and you don't even need 
a Google account. iOS apps can be distributed to a few people as 
"testers" without going through their byzantine submission process, 
though you do still need to mess with their account, certificates and 
profiles.


I'm thankful that the LC team keeps up with Apple's constantly 
changing requirements. Apple doesn't seem to value their developers much.




So, for me personally, even if LC Ltd. could fix (1) and (2), I would
still not even bother trying to build a mobile app; it's just not worth
the hassle or the learning curve.


It isn't such a steep learning curve as you'd think. One test app will 
probably get you going. If I were starting over, I'd start with 
Android because it's so much more f

Re: Mobile Wondering

2020-04-06 Thread Alex Tweedly via use-livecode


On 06/04/2020 03:55, scott--- via use-livecode wrote:

1. xTalk features just don't work, or work totally inadequately (e.g. scrolling 
fields).

I feel this is overly harsh. Livecode fields (and the creation of native UIText 
fields) do work on mobile. I think the issue is that the use of some objects 
(like fields) on mobile is not as drag ’n' drop simple as it is on desktop. No 
argument there.


Yes, it was harsh - but sometimes a little bit of hyperbole helps, if 
only the mood of the speaker :-)


And, thinking about your and Jacque's responses, maybe my experience is 
a bit out of date; I should try again.


But, afaik, it's not just scrolling fields; aren't there also issues 
with keyboard input requiring you to scroll / move the field to remain 
visible, or

  And the fact that mobile-specific commands each need to be wrapped inside an 
environment-check to keep from throwing an error in the IDE.


Yes, that's the kind of thing I meant in my item (2) "equivalence".

Many of the mobileXXX function have no desktop equivalent - but could 
still be better named, and provide some empty response to ease 
development on the desktop.


But others are actually useful features - and I see no reason why LC 
shouldn't implement those as widgets for desktop (where feasible). Why 
not have a mobilePick that works on desktop ?  Or "pickDate", or 
"pickContact" ? Or mobileCompose???mail ?


That way we'd be maintaining "platform equivalence" - and maybe even 
giving desktop developers features that make LC an even better choice.





3. It's not "Live"Code. Developing for Mobile gets you back into the horrible 
edit - compile (i.e. build a standalone) - test cycle.

I agree that there is much more of this needed for mobile since the IDE doesn’t 
allow us to build directly on mobile (I’m not sure that is a bad thing.) I have 
found simulators to be a good intermediary but it absolutely does require this 
frequent build cycle for some aspects of development.
I found simulators completely useless. Though that may be because it was 
a few years ago. And even then, you have the clumsiness of wiating for a 
build/download/test cycle.

4. You still need to deal with the ugly issues of the SDKs and the app-store  
requirements.

I suspect that jumping the security hoops like certificates and store portals are a 
big reasons why even if "everyone can code” not everyone can see their mobile 
creation made available to others. Learning how to navigate these added security 
restrictions is time consuming and confusing (at least to me). Several people like 
Trevore DeVore and Matthias Rebbe have been helping ease these complications for 
desktop. I’m not sure what the answer is for mobile, though.


I should have made those two separate points.

4A. SDKs and the build environment. Just horrible; when I tried this a few years ago (for Android) it took me 
days of frustration and guesswork to get a working SDK, and get it connected to LC, and to try to get a 
simulator to work properly. Including choosing (I think it "device type") from a long drop-down 
list of devices I didn't own. I picked at random - and was told either that it was "unavailable" or 
"will be slow - suggest you try a different device". Well - they were right about that - the 
simulator was S...L...O...W.
I never did get round to trying for IOS, because everyone said how much harder 
it was than Android :-)

4B. App store issues. Never got that far - though it sounds like it's pretty 
annoying.
Build for a few people (and sidestep the store) - seems to be possible, but not 
clear how easy it is.

Thanks for the reply - it has stiffened my resolve to have another go !!

-- Alex.


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


Re: Maximum field height?

2020-04-05 Thread Alex Tweedly via use-livecode

As I see it, there are 4 broad areas of problem for LC on mobile OSes.

The first two have been well described earlier in the thread and should 
just be fixed.


1. xTalk features just don't work, or work totally inadequately (e.g. 
scrolling fields).


2. Failure in cross-platform equivalence.

The other two are, I suspect, not truly solvable.

3. It's not "Live"Code. Developing for Mobile gets you back into the 
horrible edit - compile (i.e. build a standalone) - test cycle.


4. You still need to deal with the ugly issues of the SDKs and the 
app-store  requirements.


So, for me personally, even if LC Ltd. could fix (1) and (2), I would 
still not even bother trying to build a mobile app; it's just not worth 
the hassle or the learning curve.


OK - that's an easy decision for me - I don't do this for a living, I do 
it for fun. And right now Mobile development is no fun.


The downside is, I've all but run out of reasons to develop in LC. I 
used to write little (but useful) apps/games/utilities for myself, or my 
family, or sometimes for friends. I don't think my wife's laptop has 
been switched on this year - she uses her tablet and/or phone almost 
exclusively. And others in the family are much the same.


So I think the right solution is for LC Ltd is to add *another* target 
platform - PWAs. (This has the advantage that it also tackles the 
inadequacy of the HTML platform).


LC Ltd should just pick a set of PWA components (I don't know which - 
maybe Angular, Polymer, etc. I *really* don't know which - but just pick 
one for me !!). Then they should identify a *subset* of LC script/UI 
features that can be readily mapped to JS and a LC/JS library, and 
implement that.


Given the ability to re-load JS it should be feasible to be (fairly) 
"Live"Code, without a full stand-alone build step.  It should produce 
fast-loading, small "apps" that would allow many fairly straightforward 
apps to be developed easily - bringing Mobile development back into the 
realm where new / naive users (that includes me) can readily develop 
apps and run them on the devices we all use these days.


And I'd get to stick to LC :-)

Alex.

On 05/04/2020 21:53, Curry Kenworthy via use-livecode wrote:


Agreed!!! I had grown weary of endless arguments previously pushing 
back against most LC critiques while the wagons were circled, so very 
glad to see this frankly discussed now.


"Live" Code. Meaning: WYSIWYG between dev and runtime, no 
edit-compile-run cycle, much more efficient. Remember the marketing? 
For us the Users, it wasn't just marketing. It was real, and it was 
the reason and the empowerment. We lived it and used it. Still do on 
desktop.


But LC has never been "Live" Code on mobile platforms. A big fail. Not 
just the UI, but also the mobileBlahBlah keywords that must be placed 
in if/then branches to avoid runtime errors on desktop whereas they 
should have been designed pan-platform. When these first appeared I 
was hoping they were temporary. Instead they've grown and multiplied, 
setting an arguably bad trend for the future.


That was a huge design flaw or design mistake/bad decision for a 
product called "Live" Code. LC Ltd needs to understand and embrace 
some key characteristics of its own product. It's not just marketing, 
and it's not a HyperCard "Boomer" fad that will (or should) die out 
demographically with younger coders. It's valid, there's a reason, and 
it's so important.


How's that for a "second"? :)

Best wishes,

Curry Kenworthy

Custom Software Development
"Better Methods, Better Results"
LiveCode Training and Consulting
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: Getting started with geographical coordinates

2020-04-03 Thread Alex Tweedly via use-livecode
And I'm at plump.magpie.tightest (sorry, no calculated height available, 
not even in annoying feet - but I'd guess somewhere around 2 or 3 metres).


Alex.

On 03/04/2020 23:07, Graham Samuel via use-livecode wrote:

A long way from me at 43°16′43″N 2°09′36″E 

 - and much higher (I’m about 130m). Sorry not to be quite so accurate!

Thanks

Graham

On 3 Apr 2020, at 22:28, Devin Asay via use-livecode 
 wrote:

Graham,

You get back lat and long in degrees and fractions of degrees, as a decimal 
numeral. For instance, I get latitude: 40.248676 and longitude: -111.651062, 
and for good measure altitude in meters at 1398.380493. Wow, now you all know 
exactly where I am!

Devin




On Apr 3, 2020, at 1:49 PM, Graham Samuel via use-livecode 
 wrote:

This is cheeky but I can’t run up my mobile simulation today - can someone tell 
me the format of the geographical coordinates produced by mobileSensorReading 
et al. I mean, is say latitude just one integer showing seconds, or is it deg, 
min, sec - and are fractional seconds returned (so, floating point)? I shall 
find out for myself eventually but it would help a little to know now. AFAIKS 
there’s nothing in the LC documentation about it.

Graham

___
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

Devin Asay
Director
Office of Digital Humanities
Brigham Young University

___
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: DataGrid question...

2020-03-30 Thread Alex Tweedly via use-livecode

Yeah,  mtfDataItemClicked calls gatherItemClickedInfo to get the info :-)


On 30/03/2020 21:07, Jerry Jensen via use-livecode wrote:

In modTableField there’s a function for that:
mtfDataItemClicked pColumnClicked, pLineClicked, pItemContent, pGroupName


On Mar 30, 2020, at 3:49 AM, Alex Tweedly via use-livecode 
 wrote:

I don't know of a simple way to do it.

However, Bernd's modTableField does do it, and it uses regular fields, and it's 
open source - so I took a very quick look there.

It's not simple :-)

But there's a function 'gatherItemClickedInfo' that (with some modifications) 
might be the foundation of a general handler for you.

___
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: DataGrid question...

2020-03-30 Thread Alex Tweedly via use-livecode

I don't know of a simple way to do it.

However, Bernd's modTableField does do it, and it uses regular fields, 
and it's open source - so I took a very quick look there.


It's not simple :-)

But there's a function 'gatherItemClickedInfo' that (with some 
modifications) might be the foundation of a general handler for you.


Alex.


On 30/03/2020 10:08, Pi Digital via use-livecode wrote:

Hmm, but if you look back to Curry’s last post he claims regarding table 
fields, not data grids :


Working out which cell has been clicked: Sorry, that's not accurate either. 
Yes, we do have that! Also for a long time.

Curry is a very reliable and valued source of LC knowledge. So, have we all 
missed a clever and simple, non convoluted method of telling which cell in a 
scrollable, non editable table field has been clicked? Even if that cell is 
empty. Something as simple as:

put the dgIndex of the target into theIndexThatWasClickedOn
?

Sean Cole
Pi



On 30 Mar 2020, at 07:32, J. Landman Gay via use-livecode 
 wrote:

I can't write a test handler right now, but I'm thinking you might be able do 
something like this:

repeat for each item i in the tabstops of the field:
  if the clickH > i and less than item i+1,
  that's your column

The clickline gives you the row.


On 3/29/20 11:04 PM, Terry Judd via use-livecode wrote:
This is rough but sort of works...
on selectionChanged
set the itemDel to tab
put word 2 of the selectedLine into tRow
put word 2 of the selectedChunk into nChar
put length(line 1 to tRow-1 of me) into tStart
put char tStart+2 to nChar of me into tText
put the number of items in tText into tCol
put tRow&
end selectionChanged


--
Jacqueline Landman Gay |

___
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: Its very quiet

2020-03-27 Thread Alex Tweedly via use-livecode

Yeah- but we can't count higher than 2 ! :-)

On 27/03/2020 15:17, Bob Sneidar via use-livecode wrote:

That’s odd. Here in ‘Merica we only have to stay 6 feet away.

Bob S



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


Re: Its very quiet

2020-03-27 Thread Alex Tweedly via use-livecode

It's social distancing.

I have to stay 2 metres away from the message - and I can't reach the 
keyboard.


Alex.

On 27/03/2020 15:08, Heather Laine via use-livecode wrote:

We are all still here, right? Our list hasn't fallen over again...

If you get this, no need to reply ;) Only let me know if you don't.

Cheers

Heather

Heather Laine
Customer Services Manager
LiveCode Ltd
www.livecode.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: Any electronic document formats offering interactivity?

2020-03-18 Thread Alex Tweedly via use-livecode

Hi David,

as Richard says, there are many unknowns, or unstated constraints, etc. 
- so anyone who would try to give a detailed answer without more details 
is either:


 - brave

 - foolhardy  or

 - just foolish.


So here I go  you choose which of the above adjectives fits :-)

Possibly a suitable format is  HTML.

Not just any old html, but a carefully selected subset / context.

Deliver a single, self-contained file of html. CSS and a small amount of 
JS all inline within the file.


Put in enough JS library/framework  (i.e. probably lift a minimal subset 
of Bootstrap or similar) to provide any kinds of interactivity you need 
such as clever tooltips, etc.), and build a LC tool to create the 
elements you want to place.


-- Alex.

P.S. If you need images then this "single page" idea breaks - you might 
need to make images be "in the cloud" and require Internet connectivity.



On 18/03/2020 18:00, David V Glasgow via use-livecode wrote:

Hi folks,

I would like to be able to generate a document from LC consisting of a single 
page (effectively a copy of a card) which can offer some basic interactivity.

I would be pretty happy if users can create a document that would display 
‘tooltip-like’ explanatory notes if summary fields are clicked.

I couldn’t make any sense of the interactivity offered by PDF.  I did a bit 
better with ePub, but the emphasis seems to be on links, animation and video 
etc, which is far more than I want.

Any advice or suggestions?


Best Wishes,
David Glasgow
Consultant Forensic & Clinical Psychologist

   

   
  
___
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: encrypting script-only stacks

2020-02-17 Thread Alex Tweedly via use-livecode

H - you're doing that on 'standalonesaved'.

Isn't that too late ?  Shouldn't it be on 'savingstandalone' ?

(I've not made a standalone on years, far less ever used either of those 
handlers, but based on their names, that seems like a possible idea :-)


Alex.

On 17/02/2020 22:57, Kaveh Bazargan via use-livecode wrote:


Hi Jacqueline

I tried but could not make it work. I have posted a minimal stack on the
forum in case you get time to comment.

https://forums.livecode.com/viewtopic.php?f=9=33678=188122#p188122

Thanks. I have learnt a lot already!

Kaveh





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



--
Kaveh Bazargan PhD
Director
River Valley Technologies  • Twitter
 • LinkedIn






___
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: Synchronisation of sound and vision

2020-02-12 Thread Alex Tweedly via use-livecode
It shouldn't be that much work (!? he said, in the comfort of knowing he 
won't be doing it :-), at least for lines. Individual words could be too 
hard.


Write a little app, so you can listen to the recording and click a 
button at the start (or end?) of each line, and just keep track of the 
times vs lines that way. Add in the ability to take up from an existing 
position, and with a little bit of manual editing you should be nearly 
there.


Of course, if you (or your helpers) are making the recordings, then you 
can capture the button clicks at the same time as the recording is being 
made.


Alex.

On 12/02/2020 12:28, Graham Samuel via use-livecode wrote:

Thanks, that’s a start - I will look at the dictionary. I suppose the callbacks 
rely on one analysing how long each line/word takes the performer to say. It’s 
a lot of work, but there’s no way around it since potentially every line takes 
a different length of time to recite. If it’s too much work, I guess I can just 
display the whole text and have one callback at the end of each recording. 
Maybe that is really the practical solution for a large body of work (say all 
the Shakespeare sonnets, for example).

Anyway thanks for the hint.

Graham


On 12 Feb 2020, at 12:16, Tore Nilsen via use-livecode 
 wrote:

You will have to use the callbacks property of the player to do what you want 
to do. The callbacks list would be your cues. From the dictionary:

The callbacks of a player <> is a list of callbacks, one per line. Each callback 
consists of an interval number, a comma, and a message <> name.


Regards
Tore Nilsen



12. feb. 2020 kl. 11:25 skrev Graham Samuel via use-livecode 
:

Folks, forgive my ignorance, but it’s a long time since I considered the 
following and wondered what pitfalls there are.

I have in mind a project where a recording of someone reading a poetry text 
(“old fashioned” poetry in metrical lines) needs to be synchronised to the 
display text itself on the screen, ideally so that a cursor or highlight would 
move from word to word with the speaker, although that would almost certainly 
involve too much work for the developer (me), or at least highlight lines as 
they are being spoken. I see that one would inevitably have to add cues to the 
spoken text file to fire off the highlighting, which is indeed an unavoidable 
amount of work, but can it be done at all in LC? For example, what form would 
the cues take?

TIA

Graham
___


___
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


OT: Completely OT: Reading list recommendations.

2020-02-06 Thread Alex Tweedly via use-livecode
So, I'm going on a train journey tomorrow and the next day. Three or 
four hours each day, scenery I've seen a million times already 


Hoping for suggestions to keep me reading while on the way.

Requirements.

1. MUST be on kindle (or iBooks or similar).

2. Hopefully I'll find 3 books

 - a techie one

 - a non-techie non-fiction one

 - fiction - preferably fairly light, easy reading (as a break from the 
others above).


I know you guys can give me better recommendations than Amazon can -)

Many thanks,

Alex.


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


Re: OMG text processing performance 6.7 - 9.5

2020-02-04 Thread Alex Tweedly via use-livecode


On 04/02/2020 22:12, Richard Gaskin via use-livecode wrote:


The code I was using was similar to Alex' itemDel solution, but 
playing with all three together shows itemDel only slightly faster 
than delete, and both much faster than traversing in-place with "start 
at".


You know I'm always happy to take credit for someone else's work :-)   - 
but I should say that the "parse0" (aka "itemDel") function was 
Hermann's, not mine.


Alex.


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


Re: directory tree -> array

2020-02-04 Thread Alex Tweedly via use-livecode

On 04/02/2020 17:20, Bob Sneidar via use-livecode wrote:


Good points. I'll make some changes and resubmit. It never dawned on me that 
someone would intentionally send an empty path, but it *might* happen 
accidentally. Also, a path like /Users/BobSneidar being repeated would be very 
edge case, and as an IT guy I would probably take the computer away from any 
user that managed to make that happen, but it *could* happen and it's always a 
good idea to guard against such things.


Absolutely :-)

There should be a "basic competency test" - if you pass, you get to have 
a computer; if not, you're limited to an iPad :-)


Although "/Users/BobSneidar" is an extremely unlikely case, maybe "/tmp" 
or "/Users" are example where there is a greater danger the string 
occurring within the sub-folder names.


If you're going to resubmit to the Master Library, then I have one more 
suggestion (though I realize that it may be ruled out for backwards 
compatibility). Your function is called 'directorylisting', but it 
actually returns a list of files; maybe it could have its name changed 
to 'filelisting', and a 'directorylisting' function added ?


-- Alex.

P.S. Here's my version, called folderListing.

NB

1. it is non-recursive - in general iteration is faster than recursion.

2. like Ben's recursive version, it allows for easy suppression of 
"dot-folders", but I made that a parameter of the function


3. it puts newly found directories at the start of the list, rather than 
the end, so that it will get exactly the same result (i.e. in the same 
order) as the straightforward recursive method (i.e. depth-first). Just 
adding them at the end would have been marginally more efficient, and 
noticeably simpler in code - but it's a price worth paying for 
equivalency testing.



function folderListing pFolder, pIgnoreDotFolders
   local tFolders, tAllFolders
   local tOriginalFolder
   if pIgnoreDotFolders is empty then -- ignore them by default (Unix 
convention)

  put TRUE into pIgnoreDotFolders
   end if

   put the defaultfolder into tOriginalFolder

   local tAbsFolder, tFoldersLeft, tSub, tFoldersHere
   set the defaultfolder to pFolder
   put the defaultfolder into tAbsFolder   -- changes relative into 
absolute


   put CR into tFoldersLeft
   repeat until tFoldersLeft is empty
  put line 1 of tFoldersLeft into tSub
  set the defaultFolder to (tAbsFolder & tSub)
  if the result is not empty then
 -- skip or report as needed
 next repeat
  end if
  put (tAbsFolder & tSub)   after tAllFolders
  try
 put folders() into tFolders
  end try
  delete line 1 of tFolders   -- delete ".."
  if pIgnoreDotFolders then
 filter tFolders without ".*"
  end if
  if tFolders is empty then
 delete line 1 of tFoldersLeft
  else
 put empty into tFoldersHere
 repeat for each line L in tFolders
    put tSub & "/" & L & CR after tFoldersHere
 end repeat
 put char 1 to -2 of tFoldersHere into line 1 of tFoldersLeft
  end if
   end repeat
   set the defaultfolder to tOriginalFolder
   return tAllFolders
end folderListing




___
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: directory tree -> array

2020-02-04 Thread Alex Tweedly via use-livecode

Hi Bob.

I have a couple of other suggestions (driven by my paranoia :-)

1. There is a problem with passing empty for 'whatfolder'

Currently, if you pass in an empty folder, it  returns very misleading 
results - the files in the current directory when the function is 
called, plus the folders at the top level, with their files and subfolders.


Depending on how you want to interpret that case, you could EITHER

a. add a line something like

if whatFolder is empty then put "." into whatFolder

to the start of 'directorylisting'

OR

b. change

set the directory to whatfolder

TO

set the directory to (whatfolder&"/")

before getting the files listing.


2. in directoryListingToArray

  replace tRoot with empty in tPath

Hmmm - that's not safe - the string tRoot *could* occur multiple times 
within the filename.


Since all lines should (must) begin with tRoot, you could simply delete 
the first N characters of each line.


Alex.

On 03/02/2020 17:19, Bob Sneidar via use-livecode wrote:

I already wrote some functions to do this but sent them to Richard in a demo 
stack. Here is the code based on directoryListing, which I believe is in the 
MasterLibrary. I made a minor adjustment to it if I recall. DirectoryListing 
was returning duplicate paths for each unique folder for some reason. I 
modified it to only return one unique path for a given folder.

Setting the arrayData of a tree widget to the returned value of 
directoryListingToArray() function will yield the results you want.

function directoryListing whatFolder, c
/*
Example:
put 1 into cNum
if target = empty then
   answer folder "Pick a folder you want to walk:"
   put it into whatFolder
   set cursor to watch
   put directoryListing(whatFolder,cNum) into target
   exit to top
end if
if the controlKey is down and the optionKey is down then
   put empty into target
   exit to top
end if
if the controlKey is down and the commandKey is down then
   put word 2 of the clickline into tLine
   put line tLine of target into tLaunch
   launch document tLaunch
   exit to top
end if
if the controlKey is down then
   put word 2 of the clickline into tLine
   put line tLine of target into whatFolder
   set itemDel to "/"
   delete last item of whatFolder
   set cursor to watch
   put directoryListing(whatFolder,cNum) into target
   exit to top
end if
if the optionKey is down then
   set itemDel to "/"
   sort lines of target descending by last item of each
   exit to top
end if
if the commandKey is down then
   set itemDel to "/"
   sort lines of target ascending by last item of each
   exit to top
end if
put word 2 of the clickline into tLine
put line tLine of target into whatFolder
set cursor to watch
put directoryListing(whatFolder,cNum) into target
global firstPass
if firstPass is empty then
   put whatFolder & cr into R
   put false into firstPass
end if
*/

set the directory to whatFolder

if c = 0 or the result is not empty then
   -- delete variable firstPass
   return R
end if

put the files into tFileList

sort tFileList
replace cr with cr & whatFolder & "/" in tFileList
put whatFolder & "/" & tFileList & cr after R
put line 2 to -1 of the folders into tDirList
sort tDirList
repeat for each line L in tDirList
   put directoryListing((whatFolder & "/" & L),(c-1)) after R
end repeat

-- delete variable firstPass

return R
end directoryListing

function directoryListingToArray pDirectoryList
put line 1 of pDirectoryList into tRoot
delete line 1 of pDirectoryList
set the itemDelimiter to "/"
put empty into aArrayData [tRoot]

repeat for each line tPath in pDirectoryList

   replace tRoot with empty in tPath
   put "["  & quote before tPath
   put quote & "]" after tPath
   replace "/" with quote & "]" & space & "[" & quote in tPath
   put "[" & quote & tRoot & quote & "] " before tPath
   put "put empty into aArrayData " & tPath into tCommand
   do tCommand
end repeat

return aArrayData

end directoryListingToArray

Bob S



On Feb 1, 2020, at 13:16 , Dick Kriesel via use-livecode 
 wrote:



On Jan 22, 2020, at 10:17 AM, Richard Gaskin via use-livecode 
 wrote:

I stumbled across a code challenge for y'all, one that seems seductively simple 
but I don't think it is:

What is the simplest way to build an array that reflects the files and folders 
within a given folder?

There's a discussion about this here:

https://forums.livecode.com/viewtopic.php?f=7=33565


On Jan 22, 2020, at 10:26 AM, Richard Gaskin via use-livecode 
 wrote:
We have many handlers that deliver directory trees as lists, but arrays are a different 
beast.  Because the depth is both unknowable and varied, I can't think of a way to do 
this without 

Re: directory tree -> array

2020-02-04 Thread Alex Tweedly via use-livecode

Hey Bob,

there's a problem in directoryListingToArray in some cases.

Wen I run it on my home directory, I get an error message

   ...: execution error at line 119 (repeat: error in statement), char 1

The 'repeat' error is misleading - that's just the line following the 
'do tCommand'.


It's caused because I have a file (I think created by Dropbox - but I'm 
not sure) which contains a control character (specifically, 
numtochar(13)) in its name. (it urlencodes to .../Dropbox/Icon%0D)


When this gets to your "do" command, it causes Livecode to stop with an 
error report, because the embedded "CR" gets the parser confused.


You can 'fix' it by adding

   replace numtochar(13) with "%0D" in tPath

at the appropriate place - but it's not clear if that's just storing up 
problems for the future.


(Just another reason to avoid 'do', and go with Ben's recursive solution 
straight into an array rather than getting a list and converting it. But 
if you do have a reason to convert a list, then you could come up with a 
way to do that without 'do' using a similar method to Ben's)


Alex.


On 03/02/2020 17:19, Bob Sneidar via use-livecode wrote:

I already wrote some functions to do this but sent them to Richard in a demo 
stack. Here is the code based on directoryListing, which I believe is in the 
MasterLibrary. I made a minor adjustment to it if I recall. DirectoryListing 
was returning duplicate paths for each unique folder for some reason. I 
modified it to only return one unique path for a given folder.

Setting the arrayData of a tree widget to the returned value of 
directoryListingToArray() function will yield the results you want.
...
function directoryListingToArray pDirectoryList
put line 1 of pDirectoryList into tRoot
delete line 1 of pDirectoryList
set the itemDelimiter to "/"
put empty into aArrayData [tRoot]

repeat for each line tPath in pDirectoryList

   replace tRoot with empty in tPath
   put "["  & quote before tPath
   put quote & "]" after tPath
   replace "/" with quote & "]" & space & "[" & quote in tPath
   put "[" & quote & tRoot & quote & "] " before tPath
   put "put empty into aArrayData " & tPath into tCommand
   do tCommand
end repeat

return aArrayData

end directoryListingToArray

Bob S



On Feb 1, 2020, at 13:16 , Dick Kriesel via use-livecode 
 wrote:



On Jan 22, 2020, at 10:17 AM, Richard Gaskin via use-livecode 
 wrote:

I stumbled across a code challenge for y'all, one that seems seductively simple 
but I don't think it is:

What is the simplest way to build an array that reflects the files and folders 
within a given folder?

There's a discussion about this here:

https://forums.livecode.com/viewtopic.php?f=7=33565


On Jan 22, 2020, at 10:26 AM, Richard Gaskin via use-livecode 
 wrote:
We have many handlers that deliver directory trees as lists, but arrays are a different 
beast.  Because the depth is both unknowable and varied, I can't think of a way to do 
this without resorting to "do".



Since that thread vanished last week, and hasn’t returned, I'm offering help 
here instead.

The list of full paths contains enough information to build an array 
representation of the directory tree.


/**

Summary: Given a list of full paths, and given the partial path they share, 
build an array representing the directory structure

pPaths: a return-delimited list of full paths

pPath: the path that was used to generate the list of full paths

Returns (array): A array with a branch node for each folder and a leaf node for 
each file

Description: Eliminate pPath from every line of pPaths. Then insert each line 
into an array.

email subject "directory tree -> array"

forum topic "f=7=33565"

*/


function arrayFromPaths pPaths, pPath -- a list of full paths, and the path 
that was used to generate the list

local tPaths, tFile, tArray

set the itemDelimiter to "/"


put char 2 to -1 of replaceText( cr & pPaths, cr & pPath & slash, cr ) into 
tPaths -- eliminate pPath from every full path

repeat for each line tPath in tPaths -- insert each file name into the array

put the last item of tPath into tFile

delete the last item of tPath

if tPath is empty then -- the file is in folder pPath

put "true" into tArray[ tFile ]

else -- the file is in a folder in folder pPath

split tPath by slash

put "true" into tArray[ tPath ][ tFile ]

end if

end repeat


return tArray

end arrayFromPaths


on mouseUp

local tPaths = "a/b/c,a/b/d/e,a/b/d/f" -- folder a/b contains file c and folder 
d, which contains files e and f

local tPath = "a/b" -- the shared partial path

replace comma with cr in tPaths


get arrayFromPaths( tPaths, tPath )


breakpoint

end mouseUp




If the topic reappears soon, I’ll repost there because reading code is easier 
there.

By, the way, thanks to RG for the bug report on my earlier posting in the 
now-vanished thread.

— Dick



___
use-livecode 

Re: LC Server survey

2020-01-23 Thread Alex Tweedly via use-livecode

OK, now I fell really dumb :-)

How do I cast a vote ?  I'm not generally a forum user (don't have time 
or patience for that appalling UIX), so maybe I'm just missing the 
background info on how to cast votes in surveys.


I wondered if I was supposed to simply post a reply, and then someone 
would add that in to the totals - but you have 84 responses, and only 59 
pots - so that doesn't seem right.


Anyway - I'm a

 - C2  - I run it on multiples shared servers

and a

 - AB (intend to run it on dedicated server, but not done so yet :-)

Alex.

On 22/01/2020 01:35, Richard Gaskin via use-livecode wrote:
I've been running a survey of LC Server use in the forums for some 
time now:


https://forums.livecode.com/viewtopic.php?f=15=26772

If you haven't cast your vote it would be helpful if you could take a 
moment to do so.


I've been thinking of making some tools for LC Server deployment and 
monitoring, but with just 76 total participants in that poll it's 
difficult to discern just how useful such things would be.


Thanks in advance for helping to broaden all of our understanding of 
how LC Server is used.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.com http://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: Use-livecode author names

2020-01-14 Thread Alex Tweedly via use-livecode
I'm slightly unsure of those numbers. My email outbox has over 1000 
messages to the list - and although a few of them were rejected :-), I 
would have thought I should still appear in that 'frequent-sender' list 
(even if I did split my posts between a couple of authornames).


Alex.

On 14/01/2020 11:17, hh via use-livecode wrote:

See the "statistics" here:
http://forums.livecode.com/viewtopic.php?p=186723#p186723

___
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


Scripting puzzle / challenge.

2020-01-12 Thread Alex Tweedly via use-livecode

It's been a while since we had a puzzle challenge on here 

I came across this article

https://medium.com/free-code-camp/bet-you-cant-solve-this-google-interview-question-4a6e5a4dc8ee

and it seemed to me like an interesting puzzle. The article is 
interesting, but (IMHO) pretty flawed; don't be put off by how complex 
he makes it seem :-).


Problem is simple:

given a rectangular grid of squares, each square has a color and the 
task is to find the largest contiguous block of any single colour.


We'll keep the problem size moderate - up to 100x100 squares in the 
grid, up to 8 colours. Any 2 squares are adjacent only if they share an 
edge - i.e. corner touches don't count.


The input format is a file : each line is a row of the grid, each 
character is a square within that row, and the value of the char 
represents the colour of that square. (or simply generate the data 
internally in the same format).


So an example would be

rbbrbbrb
rggr
rggr
rggr
rggr
rggr
rbbrbbrb

which has a block of 18 'g' squares, so the result would be something like

2,2 3,2 4,2 5,2 6,2 7,2 2,3 7,3 2,4 7,4 2,5 7,5 2,6 3,6 4,6 5,6 7,6

I'll post my solution in a day or two - but if you are impatient you can 
download from


https://www.tweedly.org/downloads/color_solver.livecodescript
    - text file, script for the solution function only (< 100 lines)

https://www.tweedly.org/downloads/ColoutCounter.livecode 


    - stack file, including display of the results, etc.

and some sample data at /color_1.txt   .../color_2.txt and 
.../color_3.txt


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


Re: Standalones and the defaultFolder

2019-12-14 Thread Alex Tweedly via use-livecode



On Dec 13, 2019, at 3:21 PM, Bob Sneidar via use-livecode 
 wrote:

Thanks for the confirmation Tom. I did see two places in my code that I have to 
set the default folder, so I just reset it when I am done. Same thing, getting 
list of files. There may have been some discussion in the past about a files 
command where the path could be passed, but that's not close to any priority.


Hi Bob. Since 8.1 the files command allows the directory to be provided, 
e.g.


   put files("..") into temp

   put files("/user/alex", "detailed") into temp

etc. Also works for  folders()

Alex.


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


Re: Groups in the message path: Trapping Mouseup

2019-12-09 Thread Alex Tweedly via use-livecode

On 12/9/19 6:30 AM, Sannyasin Brahmanathaswami via use-livecode wrote:

In this use case,

- the button "starWidget"  is a "standalone" button on an independent 
layer on the card  and not a part of any group
-- @Jacque... the groups that are trapping the mouseup I are 
background groups using on various card.
  Mark Weider says "A background group will definitely get the 
message before the stack

script does. Also any script being used as a behavior."

BR: is this "really" expected behavior? gosh, I hope not! 
"Encapsulation"would mean


BR - are you maybe reading more into it than Mark meant.

I think the correct (and nit-picky) statement is ...

Mark Weider says "A background group will definitely get the message 
before the stack
script does. Also any script being used as a behavior **for the 
background group**."


Hope I'm not misconstruing it, and that's not making everything more 
confusing ...


Alex.

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


Re: Commands on server and lack of examples

2019-11-19 Thread Alex Tweedly via use-livecode

On 19/11/2019 18:19, Richard Gaskin via use-livecode wrote:



I may be able to help with the workaround, writing a script to set 
that up.  But I'm finding that there are so many different shared 
hosting configs, each with their own precious special needs, that 
making a single installation script for all of them is non-trivial.



Call me a cynic :-) - but I'm an optimistic cynic 

I know *absolutely* nothing about the workaround or what's involved - 
but it's easy to believe there are a myriad of special config needs. 
However, I'm a cynic so I'll admit that I don't care about all the many 
hundreds or thousands of them - I only care about two; the two ISPs I 
use for my own sites.


That's not *simply* selfishness, because I believe there are perhaps 
only a handful of ISPs who provide a high percentage of the Livecode 
(shared) servers found in the real world, and I'm optimistic to think 
that solving this problem for those cases would be enough to make a 
difference, and specifically would help anyone coming to LC server as a 
new user.


Google tells me (in a 30 second search, limited to the first two pages) 
that only on-rev (aka Livecode hosting) and HostM specifically advertise 
themselves for Livecode servers. Maybe those two would be a good start ?


(and by coincidence are the two I care about :-) :-)

Alex.



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


Re: Learning from scratch - any recommendations? [with OT additions]

2019-11-03 Thread Alex Tweedly via use-livecode


On 03/11/2019 22:04, Richmond via use-livecode wrote:
I'm not sure if in some countries kids learn languages more easily 
than in others.


But, I do think:

1. In English-speaking countries there is an unconscious feeling that 
learning a foreign language is not 100%

serious as "all the world learns English."


No, it's surely simpler than that.

For an English speaker, a rational analysis shows that the Return on 
Investment for learning *any* other language is much lower than the RoI 
for anyone else thinking of learning English.


Learning another language is (for most of us) difficult - it takes a lot 
of time, energy and effort; so it's a legitimate question whether or not 
it is worth that investment ?


Although Mandarin and Hindi are spoken by more people than English, the 
great majority of those people are  very unlikely to be encountered by 
any English speaker.


Spanish has some claim - but outside of South America its numbers are 
much smaller - and the percentage of those outside South America who 
don't also speak English is (I suspect - can't find reliable numbers to 
back it up) probably low.


There are many good reasons to learn another language, ranging from the 
well-proven neurological benefits of multiple languages to the simple 
common courtesy of doing so - but in straightforward "increase in 
ability to communicate" I'm unconvinced that an English speaker gains 
enough to justify the effort.


Better to put the time / money into supporting EFL / ESL for others :-)

Alex, only partially tongue in cheek.

P.S. hmmm  does that argument also apply to 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: Possible solution to determine if default network has changed (MacOS only for now)

2019-10-22 Thread Alex Tweedly via use-livecode

Beware CARP !!   (or, very similarly, HSRP or VRRP).

In essence, there are a number of routers, which share a single MAC 
address - and it is passed between them (so there is always one active 
router and only it responds to the shared MAC address). Meanwhile they 
each use their own MAC address to run their routing protocols, and the HSRP.


Gives fast, easy and transparent fail-over (but with some pitfalls), so 
AFAIK not very widely used.


Alex.

P.S.  within Cisco, the engineering name for this was CRAP - but 
pressure form the marketing guys changed it, initally to CARP, and then 
to HSRP before it was released.


On 22/10/2019 19:05, Bob Sneidar via use-livecode wrote:


Hi all.

MacOS only for now.

I think I put together a way to tell if the default network has changed since 
the last time an internet connection took place. It's no good of course, just 
getting the IP address, as given an identical subnet, you have a 1 in 254 
change of getting the same IP address on a different network. We want to be 
absolutely certain.

Similarly, the gateway, subnet mask and DNS might also be identical. Finally, 
the only adapter we care about is the one that is being used as the default 
route to the internet or local resources. (there may be more than one active 
adapter, as in the Ethernet and Wireless adapters).

The trick is to get the MAC address of the router, then store it and compare it 
each time you attempt to communicate. Here's what I came up with. Feel free to 
chide me if I am overthinking this:

on mouseUp
put "route get default" into tShellCommand
put shell(tShellCommand) into tDefaultAdapter
put lineOffset("Interface: ", tDefaultAdapter) into tInterfaceLine

if tInterfaceLine = 0 then

   answer info "No default interface found!" as sheet
   exit mouseUp
end if

put word 2 of line tInterfaceLine of tDefaultAdapter into tDefaultInterface

put "ipconfig getpacket " & tDefaultInterface into tShellCommand
put shell(tShellCommand) into tInterfaceDetail
put lineOffset("router (ip_mult): ", tInterfaceDetail) into tRouterLine
put word 3 of line tRouterLine of tInterfaceDetail into tRouterAddress
put char 2 to -2 of tRouterAddress into tRouterAddress
put tRouterAddress
put "arp " & tRouterAddress into tShellCommand
put shell(tShellCommand) into tArpReply
put word 4 of tArpReply into tDefaultMACAddress
end mouseUp

Bob S


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


___
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: Where do we want LiveCode to go? (was "Re: Where LiveCode is Now")

2019-10-04 Thread Alex Tweedly via use-livecode

Thank you Richard for diverting us onto a more productive direction.

This won't be my only reply to this thread. This is mostly a discussion 
of  "what do I want", rather than "what can we do".


On 04/10/2019 18:47, Richard Gaskin via use-livecode wrote:

"Where would we like LiveCode to be?"

Usually we think of a spectrum  "good, better, best ...", or perhaps 
"easy, easier, easiest".


But in this context, the spectrum is backwards. We already have (IMO)

LC is *the easiest* environment/language to develop cross-platform 
apps for all major platforms

but I think we need to aim MUCH higher; I want to see

LC is *an easy* environment/language to develop cross-platform apps 
for all major platforms



That's right - it's already "easiest", but it's not "easy".

Currently you can't write even very simple apps using the 'built-in', 
cross-platform features and get something acceptable for the mobile 
platforms. You need to use some combination of "mobileXXX' and  
"iosXXX'" or "androidXXX" functions to get something that is even 
remotely acceptable as a 'finished' app.


We even have an entire (ok, short :-) lesson on how to create a 
scrolling text field !!


In this lesson we will see how to set up a native mobile scroller to 
allow you to scroll the contents of a field.
IMHO, LC's built-in scrolling text field should do this (or whatever 
variation of this is needed) so that any scrolling text field will work, 
and look, and behave, as a user of each major platform would expect.


And if that is not possible, then we should have instead some new 
control, say "portable field" which abstracts out as much functionality 
as we can achieve cross-all-platform into easy-to-use controls. (And can 
probably use some clever backwards-compatability trick to allow easy 
porting of existing apps).


It's not just fields - for example "mobilePickDate" should *not* exist - 
there should just be a "pickDate" handler that works on all platforms; 
there should be a "textInput" handler that does 'the best it can' to 
provide appropriate functionality on *all* platforms - even if that 
means there are limitations in some implementations. Et cetera.



Of course, we also have to look at the problems of build / deployment on 
iOS and Android. There's lots of info about PWAs (Progressive Web Apps) 
- so much of it covered in so much hype and marketing, that as a casual 
reader I can't figure out exactly what to believe :-)  And my interest 
in spending time digging into it is limited by the fact that if it 
doesn't involve using Livecode then I'm almost certainly not interested :-)


But if even 25% of the hype is true, then it *should* be possible to 
produce such a web app with/from Livecode; all we need is offline 
operation/database or storage, pre-downloaded/installed executables, 
etc.  Even if this (again) required that we forego some of the existing 
controls (e.g. removing the current field, in favour of a portable 
field'), it should be possible to get a large subset of functionality on 
a way that can be deployed to all platforms.



OK, enough for tonight; more semi-rants tomorrow, and hopefully some 
actual useful suggestions by Monday :-) :-)


Alex.



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


  1   2   3   4   >