Re: Standardize Font Appearance

2022-09-13 Thread Quentin Long via use-livecode
sez Richard Gaskin:
> So help me understand: what are you working on where a user expects > 
> fine-grained font rendering consistency on multiple OSes? What do these > 
> apps do?> > Do your users switch OSes during a session, or work on Windows by 
> day > and Mac at night?  How many also use Linux in that multi-OS workflow?
For me, it was mostly a matter of two questions.
First: Wouldn't it be nice *if* we could somehow do stuff with fonts and just 
have them *be* identical cross-platform? My answer: Yes, that *is* technically 
possible—
Second: Exactly how big of a hassle *would* it be to Just Have Fonts Identical 
Cross-Platform? My answer: —but good god, it's *so* much of a fucking PITA that 
I can't imagine why anyone would *bother*.
I'm rather an odd duck, in that I don't write code for a living; I don't even 
have any financial interests which are dependent on my being able to whip up 
code on schedule/deadline. So I suspect I may have summat more freedom to fart 
around and experiment than do the *real* code jockeys hereabouts. As well, the 
only user *I* have to worry about is *me*, which renders lots of issues, er, 
*non*-issues, as far as I'm concerned.


"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"Read the webcomic 
at [ http://www.atarmslength.net ]!If you like "At Arm's Length", support it at 
[ http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Cross-platform font handling, and why you don't want to do it

2022-09-05 Thread Quentin Long via use-livecode
Cross-platform font compatibility is a hellacious rat's nest of mismatches. It 
may or may not be worse than handling time (Daylight Savings Time? leap years? 
leap *seconds*? etc, ad nauseum), but it's plenty bad enough on its own merits, 
or lack thereof.
* You can't be 100% confident that your user will have the same font(s) you do 
installed on their system.
* If your user has a font *of the same name* as your font installed on their 
system, you can't be 100% confident that *their* font came from the same font 
foundry as *your* font. Yes, font names are legally protected, but... 
Helvetica, anyone?
* If your user has a font *of the same name* as your font installed on their 
system, you can't be 100% confident that it's the *same* font you have. Again: 
Font names are legally protected. But what if you have version 15.0 of 
RandomFontFoundry's WhateverFont on your system, but your user only has version 
1.0 of RandomFontFoundry's WhateverFont? Who *knows* what tweaks 
RandomFontFoundry may have made to WhateverFont in between those two version 
numbers?
* Can you be 100% confident that version 15.0 of RandomFontFoundry's 
WhateverFont *for Mac* is going to render *exactly the same* as version 15.0 of 
RandomFontFoundry's WhateverFont *for Windows* or *for Linux*? No. You cannot. 
Different type rendering engines on different OSes *ensure* that rendering 
compatibility will be problematic at best.
* Assuming your user has exactly the same version of exactly the same font on 
exactly the same OS you do, you can't be 100% confident that your user has 
installed the font metrics data (kerning, sidebearings, etc)—which means you 
have no idea if the damn thing will look the same on your user's system as on 
your system.
If you want to *ensure* that some piece of text looks *exactly the same* 
cross-platform, the only way to get there is to format the text the way you 
want it on one platform, take a screenshot, and use that graphic. But even 
then, can you be 100% confident that your user *hasn't* tweaked some setting on 
their system which messes with graphics..?

The "take a screenshot" solution is not well-suited for any use-case involving 
text which varies from time to time, and largely impractical for any use-case 
involving text which is input by the user. In principle, it should be possible 
to create a library of glyph-images of all glyphs in a font, and import those 
glyph-images as necessary—no, mass quantities of "set the imageSource of char X 
to $GlyphImage" commands ain't gonna fly, cuz letterspacing will look 
crappy—but that "solution" is tantamount to building your own, redundant, set 
of text-handling routines. Yuck!
If "take a screenshot" doesn't work for you, I suspect the next-best route to 
achieving Absolute Cross-Platform Font Fidelity may be this:
 1) Open up your font in your font-editing utility of choice (Fontographer, 
Glyphs, FontLab, whatever)
2) Export your font N times, once for each of the *other* OSes you need font 
compatibility with—WhateverFontMac, WhateverFontWindows, WhateverFontLinux, etc
3) Open up your stack within each of the OSes you're working with, always using 
the appropriate OS-specific version of your font, and see how different your 
stack looks on the other OSes
4) Tweak the font metrics on the other-OS versions of your font until your 
stack looks the same on all OSes
5) When it's time to distribute your stack, be sure to bundle *all* the 
hand-tuned OS-versions of your font with your stack
This procedure is, of course, a royal pain in the arse. Hellacious rat's nest 
of mismatches, yada yada yada. But regardless of how painful it is? If you need 
absolute visual fidelity cross-platform, *and* total flexibility in the 
*content* of text, this procedure may be your least-bad option.
As a perhaps-preferable option:
1) Open up your stack on each of the OSes you're striving for font 
compatibility on
2) Tweak the appearance-relevant text properties (textFont, textHeight, 
textShift, etc) on each OS until you get an acceptable approximation of 
identical appearance
3) Make note of the values of all these text properties for each OS
4) Assuming you have however-many fonts specified by fontName, be sure you 
bundle all those fonts with your stack when you distribute it
5) Include in your stack's preOpenStack handler a switch which includes "case = 
WhateverOS" for each OS you want font compatibility for
6) Within each OS's "case", set all the appearance-relevant text properties for 
that OS
This procedure is not going to achieve anywhere near the degree of 
cross-platform font fidelity as the "roll your own" solution above. On the plus 
side, it's *significantly* less nitpicky/picayune/painful. You puts in your 
money, and you takes your chances...

"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length" Read the 
webcomic at [ http://www.atarmslength.net ]! If you like "At Arm's Length", 
support it at [ http://www.patreon.com/DarkwingDude ]. 

Funky dice (was Re: Generating Random numbers to conform a distribution)

2022-06-08 Thread Quentin Long via use-livecode
From: Richard Gaskin 
> When I was making a game for a friend last summer I fell in love with 
> the Royal Game of Ur (RGoU)…> The dice used in RGoU are binary in range, 
>tetrahedra with the faces 
> blank and two of the four points painted.
> …> If you ever need to plot dice probabilities, this tool handles nearly 
> any number of any type of dice you can think of (except Ur dice, it 
> turns out, but oh well):
>> https://anydice.com/

Ur dice are functionally synonymous with coin-flips—basically, D2s with 
nonstandard markings. Rather than a 2-sided die marked "1" and "2", an Ur die 
is effectively a 2-sided die marked "0" and "1". So if you want to implement Ur 
dice in LiveCode, you have a couple of options:
any char of "01"
(the random of 2) - 1
Or, if you want to play with Ur dice in anydice.com:
output 1d2 - 1output 4d2 - 4
There are various nonstandard uses of dice in the roleplaying game hobby.
Example: The FATE rolegame uses six-sided dice, but they aren't marked with the 
first six integers. Instead, two faces are marked with minus signs; two faces 
are blank; and the final two faces, with plus signs. When you roll FATE dice, 
any die that comes up with a minus sign is counted as negative one, any die 
that came up blank is counted as zero; and any die that came up with a plus 
sign is counted as positive one. The standard FATE die-roll uses four FATE 
dice, hence has a range of -4 (if all four dice came up minus) to +4 (if all 
four dice came up plus). To implement FATE dice in LiveCode, this will do the 
trick:
(the random of 3) - 2
Or the anydice.com equivalent:
output 1d3 - 2output 4d3 - 8
Example: The Shadowrun rolegame (basically a mashup between cyberpunk and high 
fantasy) uses normal six-sided dice, but rather than adding up all the dice, 
you instead count the quantity of dice which came up either 5 or 6. That is, 
you have a 1/3 chance of getting a 1, and a 2/3 chance of getting 0. To 
implement Shadowrun dice in LiveCode, the following one-liner will do:
any char of "001"
I *think* anydice.com *ought to* be able to handle Shadowrun dice, but at 
present, I don't know what sort of syntax is required to make that happen.

"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length" Read the 
webcomic at [ http://www.atarmslength.net ]! If you like "At Arm's Length", 
support it at [ http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Speed up a slow loop

2022-03-08 Thread Quentin Long via use-livecode
It occurs to me that any word which is valid in Boggle must consist of an 
uninterrupted run of letters which are *right next to each other* on the board. 
Hence, any digraph which *doesn't* consist of a pair of neighboring letters, 
*cannot* occur in any valid word.
Since the "filter out all words with LettersNotOnTheBoard" idea worked, it may 
be that an analogous "filter out" operation can speed things up more. When 
setting up a new board...
-- Construct a list of all 576 ( = 26x26 ) digraphs—"aa,ab,ac, … zx,zy,zz". Or, 
more likely, construct that list ahead of time, and store the list in a stack 
property.-- Remove all digraphs which contain at least one letter that's not on 
the board.-- Make a list of all pairs of neighboring letters on the board. 
Since you don't know which direction an arbitrary digraph is running in, you'll 
want to include ZA as well as AZ.-- Remove all the digraphs present on the 
board from the ListOfAllDigraphs.-- Replace all the "," in the 
ListOfAllDigraphs with "|". (i.e., replace commas with pipes)
-- Put "[" & ListOfAllAbsentDigraphs & "]" into RegexPattern.-- Filter WordList 
without RegexPattern.-- ???-- Profit.
Hmmm... since this starts out with a complete list of all 576 digraphs, there's 
no need to do a separate regex filter on individual letters; filtering out the 
full list of unused digraphs should encompass filtering out unused letters. 
Hence, just one regex filter should do the job. I think.
On a 4x4 Boggle board, there are 72 neighboring pairs, hence a maximum of 144 
valid digraphs; on a 5x5 board, there are 110 neighing pairs, hence a max of 
220 digraphs. Hopefully, this won't add too much overhead to board setup.

"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length" Read the 
webcomic at [ http://www.atarmslength.net ]! If you like "At Arm's Length", 
support it at [ http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Speed up a slow loop

2022-03-08 Thread Quentin Long via use-livecode
sez Alex Tweedly:> The caveat - a user guess which isn't in the word list found 
by the > boardwalk can be either "not a word" or "a word, but not present on 
the 
> board", and you don't know which.
Does it *matter* whether a genuine word isn't on the board? If the board has no 
"L" in it, any word with an "L" won't be on the board, right?

"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length" Read the 
webcomic at [ http://www.atarmslength.net ]! If you like "At Arm's Length", 
support it at [ http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-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 Digest, Vol 222, Issue 8

2022-03-07 Thread Quentin Long via use-livecode
sez j. landman gay:
> Interesting idea. There are 25 letters on each board, some are always 
> repeats. I think I'd need 
> a good regex so I wouldn't have to run the filter command multiple times. 
> How's your regex?

I see you've already implemented something, but just for grins, here's my 
thought re: the One True Regex for this situation:
AbsentChars is the name of a variable which contains all the letters that 
*aren't* on the board. My first attempt at the regex is…
filter lines of WordList without "*[AbsentChars]*"
However, that will remove all words that contain at least one letter in the 
specific character string "absentchars", which is not what I want. So, bring 
out the "do" keyword…
do ("filter lines of WordList without" && quote & "*" & AbsentChars & "*" & 
quote)

"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length" Read the 
webcomic at [ http://www.atarmslength.net ]! If you like "At Arm's Length", 
support it at [ http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Speed up a slow loop

2022-03-05 Thread Quentin Long via use-livecode

So… a Boggle game. Hm. Seems to me that anything you can do to reduce the 
number of words you need consider at any given time would be a win. Maybe not a 
*big* win, but still a win. So perhaps give this idea a shot:

When you create a new board:

-- Make a list of all the letters which *are not* on the board


-- Filter out any word that contains at least one letter on the "not on this 
board" list

-- Use the thus-reduced wordlist for all purposes as long as the board doesn't 
change

This would add a bit of overhead to the process of setting up a new board, but 
if it results in time savings during play, the extra overhead might be 
worthwhile anyway.



"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length" Read the 
webcomic at [ http://www.atarmslength.net ]! If you like "At Arm's Length", 
support it at [ http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


re: Sorting cards

2021-12-30 Thread Quentin Long via use-livecode
sez J. Landman Gay:> I am converting an old stack to LC and it needs to sort 
cards by one of two fields. LC does 
> stable sorts, so if I sort by field 1 it works, and then if I sort later by 
>field 2 it retains 
> the original sort and does a sub-sort. I don't want that. What's the best way 
>to ignore the 
> previous sort order?

Hmmm… how about this?
1. Give each card a custom property, call it "SortValue" or some such.2. 
*Before* the first sort: Go thru each card and set the SortValue of each card 
to an integer, incrementing the number by 1 with each new card.3. *After* the 
first sort: Do a new sort, by the SortValue of each card. This should get the 
former order of the cards back.
If you do this, you can obviously re-assign the card-values of SortValue at any 
time, hence you can restore any arbitrary card-order you want with a fresh 
"sort by SortValue of each card".

"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length" Read the 
webcomic at [ http://www.atarmslength.net ]! If you like "At Arm's Length", 
support it at [ http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


For the record…

2021-10-28 Thread Quentin Long via use-livecode
In case anybody actually was curious to know how to type an infinity symbol: On 
a Mac, the keystroke is option-5.
Also on the Mac, there's a cute thingie called "Keyboard Viewer" which does 
what it says on the label. KV displays your entire keyboard, *and* it shows you 
the complete set of characters you can get when you hold down the option key, 
as well as shift-option. It also nicely accommodate the "dead keys" which let 
you type characters with accent marks.
If you've set your machine up to display the "keyboard" dealie in the menubar, 
you can access KV from there. If you haven't done that, you can do it by 
bringing up System Preferences > Keyboard, and clicking on "show keyboard and 
emoji viewers in menu bar"… well, that's how it is in MacOS 10.13.6; I make no 
guarantees re: how Apple may have rearranged things in other OS versions.
And if you neither have the "keyboard" dealie in your menubar, nor *want* to 
have that, bring up SysPref > Keyboard and click on the "Input sources" tab. 
This option isn't *quite* as nice as the genuine KV—it doesn't really handle 
"dead keys"—but it can serve. Again, caveat re: Apple mucking with OS versions, 
yada yada yada.


"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length" Read the 
webcomic at [ http://www.atarmslength.net ]! If you like "At Arm's Length", 
support it at [ http://www.patreon.com/DarkwingDude ]. 
___
use-livecode mailing list
use-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: Changing text properties in a field via the IDE

2020-05-19 Thread Quentin Long via use-livecode
Just saw an improvement in my code that *should* make it happy to work with 
Unicode characters…

local OkayChars = ""
function CleanASCII3 DerText  if OkayChars = "" then -- construct OkayChars 
string as needed    repeat with K1 = 32 to 126      put numToChar (K1) after 
OkayChars    end repeat  end if
  put "" into DerRezult  repeat for each char CC in DerText    if CC is in 
OkayChars then put CC after DerRezult  end repeat  return DerRezultend 
CleanASCII3
Again, this code has not been tested, so use with caution.
___
use-livecode mailing list
use-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: Changing text properties in a field via the IDE

2020-05-19 Thread Quentin Long via use-livecode
While Bob Sneidar's function should do the job of scrubbing weird characters 
from text, am unsure why he felt the need to construct that massive pCustomList 
variable. Seems to me that it would be simpler, and perhaps quicker, to do this 
instead:
function cleanASCII2 DerASCII  put "" into DerRezult
  repeat for each char CC in DerASCII    put charToNum (CC) into Fred    if 
Fred > 31 and Fred < 127 then put CC after DerRezult -- the full range of ASCII 
values for printable characters  end repeat  return DerRezultend cleanASCII2
The above code is not tested in any way. It's clearly not to be trusted with 
Unicode text, so which might be why Sheidar felt the need to go thru a somewhat 
more complicated procedure…
___
use-livecode mailing list
use-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 is a real?

2020-04-25 Thread Quentin Long via use-livecode

sez Bob Sneidar :>Apparently nothing is a real. 
Neither is anything strictly a real. 
 [singing] "Let me take you down, 'coz I'm going to Strawberry Fields…"
___
use-livecode mailing list
use-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: Building a Board Game

2020-04-10 Thread Quentin Long via use-livecode
On 7.04.20 22:24, Roger Guay via use-livecode wrote:
> Hi all,
>
> I know there must be a simple way to do this but it is escaping me at the 
> moment. How can I move an object (grab me on mouseDown) and have it snap to a 
> grid (square on a board game) on mouseUp?
There are any number of ways to do this thing. Try giving this script to the 
object you want to move:
local DisX, DisYlocal GridSize = 20-- if grid uses different sizes for X and Y, 
make GridSizeX and GridSizeYlocal OriginGridX = 10local OriginGridY = 10
on mouseDown  send "TrackDaMouse" to meend mouseDown
on TrackDaMouse  put the mouseLoc into Fred  put GridSize * ((item 1 of Fred - 
OriginGridX) div GridSize) + OriginGridX into DisX  put GridSize * ((item 2 of 
Fred - OriginGridY) div GridSize) + OriginGridY into DisY  set the loc of me to 
Fred  if the mouse is down then    send "TrackDaMouse" to me in 20 msec  else   
 move me to (DisX, DisY) in .5 seconds  end ifend TrackDaMouse
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Possible new dev hardware?

2020-04-01 Thread Quentin Long via use-livecode
Atari is apparently producing a gizmo they call the "Atari VCS", which they're 
positioning primarily as a video game console. However! According to an email I 
just got from them, this beast has what they're calling "Atari sandbox mode 
(install any OS)", and they claim "If you want to develop just for fun or for 
other platforms, use Sandbox Mode to install any development environment you 
want." The relevance to LiveCode is left as an exercise for the reader.
The URL to the propaganda website:

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


Re: Guessing the encoding of a test file...

2020-03-21 Thread Quentin Long via use-livecode
I strongly suspect that the desired goal, to have a nice, robust algorithm 
which automagically identifies the encoding of *ABSOLUTELY ANY* text document 
with zero need for human involvement, simply isn't possible. Because text 
encoding is intrinsically arbitrary—see also: the many variations on extended 
(8-bit) ASCII, the various mutually-incompatible versions of EBCDIC, etc ad 
nauseam.
Seems to me, therefore, that in the general case, human involvement is an 
*unavoidable necessity* in determining which encoding an arbitrary text 
document uses. So the goal of any encoding-ID algorithm should *not* be the 
impossible task of determining that encoding *without* human involvement. 
Rather, the goal should be to *minimize* that human involvement, make that 
human involvement as *simple and painless* as practically feasible. So, here 
goes with some semi-random rambling…  Pretty sure the best, most nearly 
bulletproof way to ID a document's text-encoding involves applying that 
encoding to the bits of the document, and showing the resulting 
character-sequence to a human. If there's more than one possibility for the 
document's encoding, apply all of the possible encodings, and show a human all 
of the resulting character-sequences. I'm thinking that a good way to do this 
might be to put up N different text fields in a window, with all of the text 
fields controlled by one scrollbar, and the human clicks on all of the fields 
whose content looks good to them. Or maybe the human clicks on all the fields 
whose output looks *bad* to them? Whichever way works; as long as there *is* 
some human judgement in there somewhere.
Can we assume that once a particular document's text-encoding has been 
identified, that *all* documents which came from the same source as that 
document use that particular encoding? If so, that might simplify the 
continuing workflow; tell the software "This document came from Source X", and 
the software then uses whichever text-encoding it associates with that source. 
Even if there's more than one such text-encoding in play, that's at least 
easier to work with than having to sort thru an arbitrarily large number of 
text-encodings.
Is it possible to tell the software "hey, no character in $ThisSetOfChars will 
ever appear in this document"? If so, the software should be able to rule out 
any encoding which ends up putting one of the Forbidden Chars into the decoded 
character-sequence.

Given human error, it may be that the human's input ends up ruling out *any 
possible* text-encoding. Prolly a good idea to use something akin to fuzzy 
logic rather than strict Boolean operations.

___
use-livecode mailing list
use-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: Identifying Un-used functions and commands

2019-11-28 Thread Quentin Long via use-livecode
> Date: Tue, 12 Nov 2019 12:12:47 -0500
> From: Stephen MacLean 
> To: How to use LiveCode 
> Subject: Identifying Un-used functions and commands
> Message-ID: 
> Content-Type: text/plain; charset=utf-8
> 
> Hi All,
> 
> I?m wondering if anyone has a way or code to identify any un-used functions 
>and commands in a set of stacks?

Finding explicit function/command calls seems like it should be a fairly 
straightforward task. However, the "do" keyword can also be a source of 
function/command calls, which complicates matters a wee bit. You'll also need 
to evaluate all the non-cleartext components that can go into "do" statements—
do (VariableName)
do (the WhateverProp of ThisObject)
do (line 4 of fld "ThisField")
—etc etc etc.
___
use-livecode mailing list
use-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: math on widths doesn't add up (Sean Cole (Pi))

2019-07-10 Thread Quentin Long via use-livecode
sez Sean Cole (Pi):>I've just been teaching my youngest about the 4th - nth 
dimensions. Time is
>not the 4th but the 1st temporal dimension. If the 3 spatial dimensions are
>Length, height and width then the 4th is depth, ie, going inwards and
>outwards as the easiest way to picture it (but not truly representative).
>That being the case, how would you describe the 5th spacial dimension.
>That'll twist your noggin if it's not something you've thought of before :)
One fictional contemplation of the 4th and 5th 
dimensions:https://johnesimpson.com/pdf/Ifth_of_oofth-waltertevis.pdf
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


After the conference

2019-05-17 Thread Quentin Long via use-livecode
Quentin Long here. As luck would have it, I'm going to be singing in a concert 
on the Friday after the LiveCode Conference. I have no idea how many LCC 
attendees will still be in the Bay Area on Friday, but for the benefit of those 
who are:
The program: Ein deutsches Requiem, by Brahms
The time: 8 PM on Friday, 24 MayThe ticket price: FreeThe location: Stanford 
Memorial Church, in the campus of Stanford UniversityThe googlemap: 
https://goo.gl/maps/hpmagnkmUVfcEgTX6
___
use-livecode mailing list
use-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: Seeking philosophical guidance on library interface design

2019-04-25 Thread Quentin Long via use-livecode
Hmmm… Seems like this library is intended for a summat limited subset of 
graph-styles. There are pie charts, radar charts, etc ad nauseum, and it's not 
clear to me how this library caan cope with any of those "non-standard" types 
of graph. As well, it's unclear to me how this library will deal with funky 
axis-styles (logarithmic?).

Am *not* suggesting that the library must, or even should, be able to handle 
*every* graph-style that might conceivably be thrown at it—that way lies 
madness. Just thinking that it might be good to include, in the documentation, 
a prominent, clear statement of What This Library Can And Cannot Do, to manage 
user expectations.


"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"


Read the webcomic at [ http://www.atarmslength.net ]!


If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: Musings on Architect, MVC, Nested Behaviors

2018-12-28 Thread Quentin Long via use-livecode
> From: Richard Gaskin 
>> J. Landman Gay wrote:
>>
>> On December 27, 2018 2:36:16 PM Richard Gaskin via use-livecode
>>  wrote:
>>>
>>> Sounds like one more reason to allow stack properties as YAML
>>> frontmatter in the file. Ever since I suggested that a couple
>>> years back, the range of valuable use-cases keeps growing.
>>
>> I wouldn't mind if you poked them again about it.
>
> At your prompting I started to open an enhancement request for this, but
> not long into it I hit on why they probably haven't done this yet:
>
> By what means would be indicate which properties we want saved there and
> which ones we don't care about?

To a first approximation, I'd say that any property which has been changed from 
the engine's built-in default value should be saved. One would expect that the 
engine's defaults can be easily accessed for such a purpose?


"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
Read the webcomic at [ http://www.atarmslength.net ]!
If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-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: Searching for a word when it's more than one word

2018-09-02 Thread Quentin Long via use-livecode
Have pondered the question, and come up with some code which may or may not 
solve the problem at hand, but which may at least prove helpful in looking for 
a real solution:

==

Assumption: You’ve got a text document (not HTML, not RTF, just plain TXT) 
which contains, among other things, however-many place names.
Assumption: You have a return-list of place names, which may or may not be 
single words
Assumption: The text document is in the variable SourceDoc
Assumption: The list of place names is in the variable NamesList

Assumption: You want a document which contains a complete census of exactly 
which of the place-names in NamesList occur in SourceDoc
Assumption: For each place-name which does occur within SourceDoc, you want a 
list of which word-numbers each such occurrance begins at

put “” into PlaceNamesCensus
repeat for each line DisName in NamesList
  put the number of words in DisName into DisNameWords
  put 0 into SearchOffset
  put “” into FoundLocs
  repeat
    put offset (DisName, SourceDoc, SearchOffset) into DisLoc
    if DisLoc = 0 then
  -- there is no character string which matches the place name in question
  end repeat
    else
  —- there is a character string which matches the place name in question
  —- is it the actual placename, and not finding “chester” in “colchester”?
  put the number of words in (char 1 to DisLoc of SourceDoc) into StartWord
  if DisName = (word StartWord to (StartWord + DisNameWords - 1) of 
SourceDoc) then
    -- it’s a match, yay!
    put StartWord into item (1 + the number of items in FoundLocs) of 
FoundLocs
  end if
  add DisLoc to SearchOffset
    end if   
  end repeat
  if FoundLocs <> “” then
    —- nope, DisName wasn’t in SourceDoc
    put “[nil]” into DeseLocs
  else
    —- yay! DisName *was* in SourceDoc! at least once!
    put FoundLocs into DeseLocs
  end if
  put DisName & comma & DeseLocs into line (1 + the number of lines in 
PlaceNamesCensus) of PlaceNamesCensus
end repeat

==

Known issue: The above code does not pretend to locate possessive instances of 
place names (i.e., California's, the United Kingdom's, etc). Am thinking that 
pre-processing of SourceDoc will be helpful-to-necessary. This pre-processing 
may need to accommodate more issues than just possessives.
 

"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
Read the webcomic at [ http://www.atarmslength.net ]!
If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-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: valueDiff for arrays

2018-08-07 Thread Quentin Long via use-livecode
Suggestion for the language-token for this function: "transplant".

transplant [qualification] from [SourceArray] to [TargetArray]

[qualification] is a pattern/expression which describes exactly which bits you 
want to move from SourceArray to TargetArray.

If TargetArray doesn't exist, it should be created to hold the stuff from 
SourceArray.

It occurs to me that "transplant" might also be useful as a string-manipulation 
function:

transplant [ChunkType]s where [qualification] from [SourceContainer] to 
[TargetContainer]

Am thinking that the default behavior should be to have the transplanted bits 
be added to the *end* of TargetContainer. Again, if TargetContainer doesn't 
exist, it should be created. It might be useful to be able to specify exactly 
where the transplanted bits get inserted, so maybe:

transplant [ChunkType]s where [qualification] from [SourceContainer] to 
[Location] of [TargetContainer]

"Location" could be "start", or "end", at minimum, or possibly an expression 
that evaluates to a location within TargetContainer.

Am unsure how much of a hassle it would be to implement this, so I shall leave 
it in the capable hands of Mr. Waddingham & Co.



"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
Read the webcomic at [ http://www.atarmslength.net ]!
If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

About the 2019 LiveCode Conference

2018-05-18 Thread Quentin Long via use-livecode
Have just started a googlemap with markers for various points of interest in 
the general vicinity of the Conference. Right now it's just a bunch of 
restaurants, some of which also serve alcohol. Will add more markers as time 
permits.

https://drive.google.com/open?id=10NeWvnKoVmOnoXFP_68Jzjuvr-s3QE_T=sharing

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].
  


___
use-livecode mailing list
use-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: A modest proposal for a new property

2017-09-29 Thread Quentin Long via use-livecode
sez hh :
> > > JLG wrote:
> > > The original issue that influenced this one was how to provide a
> > > larger hit zone on an SVG widget.
> > > How would this property work for that?
> 
> > Quentin L. wrote:
> > I?m thinking that a single line of code would suffice:
> >
> > set the clickableRegion of widget ?Fred? to ListOfPoints
> >
> > As i?ve noted previously, the engine *already* handles clickable
> > regions for *every* control ... 
> 
> No. Sadly (or luckily, depending on one's point of view) a widget is
> not an ordinary control. This has to be implemented in the widget.
Hold it. I don't--can't--believe that the engine *does not* take care of 
deciding when a given mouse-click does or doesn't land on a widget. Unless 
you're saying that the mouse-click might trigger *either* the widget itself, 
*or* the widget's script, depending on exactly what location the mouse-click is 
at?

> To see this write one that handles only the mouse events, not to
> speak of a clickable region.
> Even this is hard to control: who gets first which mouseEvent, the
> widget's script or the widget.
I don't see what difference it makes whether a mouse-click causes mouse events 
to be sent to the *widget proper*, or, instead, to the *widget's script*. 
Either way, *something* has to determine whether the dingus is triggered by a 
mouse-click at an arbitrary screen location, right? And if it's not the engine 
which does that… what *is* doing that?

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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 Digest, Vol 168, Issue 50

2017-09-27 Thread Quentin Long via use-livecode
sez “J. Landman Gay" :
> The original issue that influenced this one was how to provide a larger hit 
> zone on an SVG widget. How would this property work for that?
I’m thinking that a single line of code would suffice:

set the clickableRegion of widget “Fred” to ListOfPoints

As i’ve noted previously, the engine *already* handles clickable regions for 
*every* control, and my proposal ‘merely’ (he says, optimistically…) opens up 
the engine’s mechanisms to the extent of granting developers the opportunity to 
override the engine’s default “define the clickable region” behavior. If a dev 
is happy with the default clickable regions provided by the engine, that dev 
can just ignore the clickableRegion property and everything should work the 
same as it always did… but if a dev *isn’t* happy with the default clickable 
regions provided by the engine, *then* that dev can mess around with the 
clickableRegion property.



   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: A modest proposal for a new property

2017-09-27 Thread Quentin Long via use-livecode
sez  hh :
To: use-livecode@lists.runrev.com
> How would you determine that a clickLoc is within such a
> "region" or not?
> (Say, for simplicity, the region is inside the control's
> rectangle)
Given that the engine *already does* have *some* sort of mechanism for 
determining which control gets triggered by a click at an arbitrary location, 
I'm pretty sure that this is a solved problem on some level. As matters stand, 
the clickable region for a control is entirely determined by the engine; my 
proposal makes that clickable region a thing which developers can adjust.

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

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

A modest proposal for a new property

2017-09-26 Thread Quentin Long via use-livecode
In the past few List digests, there's been some discussion of practical issues 
regarding when a click does or doesn't count as clicking *on* a particular 
item. So, here's a proposed addition to LiveCode…

=

Name: clickableRegion

Recognized abbreviation: clickReg

"clickableRegion" is a proposed property of anything in a stack that might a 
user might reasonably be expected to click on—controls, that is. We're talking 
buttons, fields, graphics, images, yada yada yada.

The clickableRegion of a control is a return-delimited list of points that 
define a region of the screen. Since clickableRegion is a property of a 
control, the engine's internal representation of these points should probably 
use the location of the control as the origin (the 0,0 point) for the 
clickableRegion's points.

Any click whose clickLoc is within the area defined by a control's 
clickableRegion, will be treated by the engine as if it were a click on that 
control.

The default value of a control's clickableRegion should be determined by that 
control's visible-on-screen pixels—for fields, this should be the field's 
rectangle; for graphics, this should be the points of the graphic; and so on 
and so forth.

The clickableRegion property should be both get-able and set-able. If you clear 
the clickableRegion (such as by setting it to ""), it should revert back to its 
default value.

Since clickableRegion can be set to arbitrary values, it may well happen that 2 
or more controls have overlapping clickableRegions. This may not be a problem 
if the engine can simply make use of whatever magic it does when it handles 
clickLocs which fall within the rects of 2+ overlapping buttons. If the 
engine's existing 'click-disambiguation' machinery does not suffice to 
determine which control an ambiguous click is meant for, go with the control 
that has the highest-value layer property.

=

Thoughts/comments/complaints?


   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: Points of Graphic Oval

2017-07-31 Thread Quentin Long via use-livecode
The obvious method for generating the points of an oval—use a loop that 
generates sin(x) & cos(x) coördinate-pairs—has already been mentioned. What's 
*not* so obvious, is that the points generated by that method are not evenly 
spaced! Not unless you're working with a perfect circle, anyway. For non-circle 
ovals, the distance between any two consecutive points will rise with the 
distance between those points and the origin. So if you're using those points 
in a "move [whatever] to the points of"-type command, the thing you're moving 
will not move at a constant speed… well, not unless your 'oval' is a circle, in 
which case the distance to the origin will be constant, hence the resulting 
speed of motion will also be constant.

The closer your 'oval' is to a perfect circle, the less obvious the deviations 
from constant speed will be, of course. You'll have to decide for yourself 
whether those deviations are of great-enough magnitude to be worth worrying 
about.

If deviations from constant speed *are* worth worrying about? Depending on what 
you're actually doing, you may actually want to have the oval-path-constrained 
motion vary in speed, and the particular mode of variance you end up with may 
be exactly the mode of variance you get from using the obvious method. But in 
any other case, you may want to look into a different method for generating the 
set of oval-points you use.

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: "clipsToRect" property

2017-06-14 Thread Quentin Long via use-livecode
My 2 cents' worth: Rather than "clipsToRect", call the property "visibleRect". 
Because that's what it is—it's the rectangular area of the screen, within which 
the specified portion of the group is visible.

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: breakpoint on parameter

2017-05-24 Thread Quentin Long via use-livecode
sez "J. Landman Gay" :
| On 5/23/17 10:36 AM, Matt Maier via use-livecode wrote:
| > I want to find out which parts of my code are making changes to a control's
| > parameter. Specifically, I've got an arrow that I want to be black, and it
| > is black when it's created, but then it turns gray. I can't find the script
| > that's turning it gray.
| > 
| > I don't know where to put a breakpoint in the script.
| > 
| > Can I put a breakpoint on that control's color parameter, so execution
| > stops whenever something modifies it and goes to the script that's doing
| > the modification?
| 
| You can't break for a parameter per se, only at a specified line of 
| script. …
I just had an idea that might be helpful for Matt Maier…

If I'm reading the LC Dictionary aright, the property "executionContexts" 
should be very useful for nailing down which handler did what at whatever time; 
you just need to look at the executionContexts at just the right moment. So, 
use a "send [whatever] in [time]" loop, like so:

on ColorCheck
  if (the color of the specific control) = "gray" then
answer the executionContexts
  end if
  if the optionKey is up then send "ColorCheck" to me in 50 milliseconds
end ColorCheck

Ordinarily, "send [whatever] in [time]" loops are frowned upon because they 
burn cycles gratuitously, thus slowing down the stack's operations. But in this 
case, slowing down the stack's operations should be acceptable, as it gives you 
a better chance of catching the offending command (i.e., the one that's doing 
the color-change) in the act.

Troubleshooting: If what's really happening is an change in the control's blend 
property, that could make the control *appear* to change color while said color 
is actually the same, in which case the "answer the executionContexts" line 
would never execute. If this happens, check for a change in the control's blend 
property, not a change in the control's color property.
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: looking for a smart approach to "sort" an array

2017-05-06 Thread Quentin Long via use-livecode
sez "Tiemo Hollmann TB" :
To: "LiveCode User Liste senden" 
> I have a list field of words and a correspondent array with the words of the
> field as the keys plus some data per key. I can store the array in a file,
> read it later from file and rebuild the list of words from the keys of the
> array. Up to now, I had this list of words alphabetically sorted. So it was
> easy, when reloading the array to sort the list always alphabetically to
> refresh the visible list in the field.
> 
> The user can also create a custom sequence of the words in the field by drag
> and drop the lines in individual order. Now I am looking for a smart
> approach to keep the same sort order in the correspondent array. I need the
> custom sort order of the words in case I reload the array later from file to
> get the same sequence of words as the user has sorted them, after extracting
> the words from the array. The key of the array has to keep the words from
> the list for accessing the data in the array.
> 
> As far as I see it, I have to add an additional item to the array data,
> storing the sort sequence of the keys, while the user creates his custom
> sequence of the words in the list field and keeping this number always
> synchronous to the line number of the fields list. So I could use this "sort
> sequence number" from the array to rebuild the same sort of the words when
> extracting the words from the array.
> 
> Would this be the best approach to keep the sort sequence of the words
> stored with the array, or do you see an easier more straight forward
> approach to keep the array "synchronous sorted" which I don't see right now?
Use the alphabetically-sorted word-list as the keys of an array.

-- MySortedList is a return-delimited list, one word per line, sorted 
alphabetically
-- UserSortedWordList is the return-delimited list of words sorted into the 
user's preferred order
put "" into WordArray
repeat for each line LL in MySortedList
  put lineOffset (LL,UserSortedWordList) into WordArray[LL]
next repeat

I'm not entirely sure that lineOffset (or even wordOffset) are the right thing 
to do here; there's every danger of encountering a Scunthorpe problem, such as 
if "pen" and "open" are both words in the list, or "squire" and "ire", etc etc. 
Hmm… maybe go with comma-delimited lists, and something along the lines of "put 
wordOffset (comma & LL & comma, comma & UserSortedWordList & comma) into 
WordArray[LL]" ?

If this is what Mike Bonner had in mind, chalk it up to my inability to 
comprehend what he wrote.
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

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

An anomaly in the "read from file" command?

2017-04-26 Thread Quentin Long via use-livecode
First off, thanks to Alan Stenhouse for zeroing in on my filter-related 
mistake. Any number fo people *could* have done so, but it was Alan who 
actually did the deed. So, yay Alan!

Second: I discovered something odd as a result of another mistake I made. My 
mistake:

ask file "What do you want to read?"
put it into DisFile
read from file DisFile until EOF
put it into fld "This Field"

What went into field "This Field" was the contents of the *variable* DisFile, 
*not* the contents of the *file* whose name is stored in the variable DisFile. 
This is because of how the pseudo-variable "it" behaves, i suspect.

My mistake was that I didn't *open* file DisFile before reading it, of course. 
And once I did open the file, the reading went on normally, and the contents of 
the field did indeed end up in the field "This Field". So, bad on me for not 
opening the file first, good on me for recognizing & fixing that lapse without 
external assistance. But I do have a question:

Why didn't I get an error message when I tried to read from a file that hadn't 
been opened yet? Shouldn't LiveCode have gotten fussy about that? 

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

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

Weirdness with filter (maybe?)

2017-04-20 Thread Quentin Long via use-livecode
I have a return-delimited list. Each line of this list consists of [some text] 
& tab & [other text]. I want to see all the lines of the list for which [some 
text] contains Character String X. This is obviously a job for the filter 
command, right? So I try this:

filter lines of MyList with ("*" & CharStringX & "*" & tab)

The result I'm expecting is, a list which contains every line of MyList in 
which the [some text] bit contains CharStringX.

The result I get is, a "list" which contains zero lines.

Have tried various alternate forms of the line, including…

filter lines of MyList with ("*" & CharStringX & "*" & numToChar (9))
filter lines of MyList with wildcard pattern ("*" & CharStringX & "*" & tab)
filter lines of MyList matching wildcard pattern ("*" & CharStringX & "*" & tab)

…all of which yield the same results as the original line.

Would appreciate a sanity check: Am I missing some necessary part of the filter 
syntax? Does the filter command even know what to do with the constant "tab"? 
How *does* one filter for a pattern that includes a tab?

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

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

Re: WEIRD: code changes the code instead of a field

2017-03-21 Thread Quentin Long via use-livecode
Message: 13
Date: Tue, 21 Mar 2017 14:58:02 +
sez Bob Sneidar 
> > On Mar 21, 2017, at 04:11 , Klaus major-k via use-livecode 
> >  wrote:
> > 
> > "numtochar" and "chartonum" have been deprecated since version 7.x of 
> > Liveocde!
> > So please try again with "NumtoNativeChar" and maybe also LC 9 dp6. :-)
> say WHUUUT? By deprecated, do you mean not part of the scripting language 
> anymore?? I thought we didn't do that. 
"Deprecated" doesn't mean "eradicated". "Deprecated" means "could you please 
not use this any more? there's better options available now, honest there are!"
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: Messages sent while mouse is down?

2017-03-11 Thread Quentin Long via use-livecode
sez Tim Selander :
> I miss the Zynga "Pathwords" game on Facebook, so for my own 
> amusement I'm trying to recreate it in Livecode.
> 
> For those who don't know the game, it had a solid screenful of 
> Scrabble-like lettered tiles. Click and drag the mouse through 
> adjacent letters to make words.
> 
> Without clicking, simply moving the mouse through the tiles 
> (fields) triggers mouseenter, mouseleave, etc. which makes it 
> easy to pick up the letters.
> 
> But when the mouse is down, it seems mouseloc() is the only thing 
> I can get. Using a variable what has all the field rectangles, I 
> can use the mouseloc() to ultimately identify the field under the 
> pointer, but it's too slow...
> 
> Does a moving mouse with the button down trigger any other 
> messages besides mouseloc()?
I see that Mike Bonner has already provided a solution which seems to do what 
you want. But just in case there are other people out there who might need a 
different solution, here's my stab at it…

If you have a "screenful of Scrabble-like lettered tiles", these "tiles" are 
presumably arranged in a rectangular grid, with neatly aligned rows and 
columns. If this is the case, the locations of the row-tiles are going to be 
separated by X number of pixels, such that row-tile 1 has X-coördinate A; 
row-tile 2 has X-coördinate (A + X); row-tile 3 has X-coordinate (A + 2*X); and 
so on.

Column-tiles will work similarly. Their locations will be separated by Y number 
of pixels, such that column-tile 1 has Y coördinate B; column-tile 2 has Y 
coördinate (B + Y); column-tile 3 has Y coördinate (B + 2*Y); and so on.

If the grid's horizontal spacing is identical to its vertical spacing, the 
separation-values X and Y will be the same, of course. Given the fact that 
pixels are not *necessarily* square, it would be imprudent to *assume* that the 
grid's horizontal and vertical separation-values are identical, and I will not 
make that assumption here.

So.

My solution to Tim Selander's problem completely ignores most of the 
mouse[whatever] messages, depending strictly on mouseLoc. Like so:

local dX = 25 -- if the horizontal-spacing value is not 25, put the real value 
here
local dY = 25 -- again, replace 25 with the real value as needed
local TimeSlice = 50 -- how often, in milliseconds, the code checks the 
mouseLoc. adjust as needed for response time
local GridLocPulse

global GridCell = "1,1"

on GridLoc
  if (GridLocPulse) then send GridLoc to me in TimeSlice milliseconds
  put the mouseLoc into ThisLoc
  put (1 + (item 1 of ThisLoc div dX)) into item 1 of GridCell -- may need 
tweaking to account for edge effects
  put (1 + (item 2 of ThisLoc div dY)) into item 2 of GridCell -- ditto
end GridLoc

on GridLocOn
  put true into GridLocPulse
  GridLoc
end GridLocOn

on GridLocOff
  put false into GridLocPulse
end GridLocOff

The above code can go into the script of the card where the tile-grid lives.

Once every (TimeSlice) milliseconds, this code looks at the mouseLoc and 
converts the mouse coördinates into grid coördinates, which are stored in the 
global variable GridCell. GridCell being a global, its contents should be 
accessible to any handler in any script which includes the line "global 
GridCell".

It's probably a good idea to *not* have the GridLoc handler burning 
clock-cycles *all the time*. Thus, the local variable GridLocPulse, and the 
subsidiary handlers GridLocOn and GridLocOff. GridLocOn activates the GridLoc 
handler, and GridLocOff turns GridLoc off.

Hope this helps…

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: Dragging widgets

2017-02-28 Thread Quentin Long via use-livecode
> > On Feb 28, 2017, at 07:14 , Sannyasin Brahmanathaswami via use-livecode 
> >  wrote:
> > an image is an image is an image, whether it is png, bitmap, jpg or svg, 
> > the fact that is is a "widget" is secondary to the use case.
> 
> sez Bob Sneidar :
> au contraire. Not all images are the same. Support for each kind of image has 
> to be implemented. If the industry developed a new kind of image, LC would be 
> faced with incorporating that format. 

It's true that *under the hood*, LC must handle each distinct 'flavor' of image 
differently. But why should *the user* be concerned about whether a given image 
is vector or raster or RLE or what?

Consider: Numbers can be signed, unsigned, integer, or real, and the engine's 
internal workings must handle each of those 'flavors' of number differently. 
But in spite of those internal differences, *the expression "VarX + VarY" 
ALWAYS just works, REGARDLESS of which flavors of number VarX and VarY happen 
to be*.

As far as *the user* is concerned, a number is a number is a number, and it 
*doesn't matter* whether a number happens to be real or integer or what. Why 
can't an image be an image be an image, *regardless* of whether an image 
happens to be JPG or bitmap or what?

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: Yertle the Turtle

2017-01-31 Thread Quentin Long via use-livecode
Suggestion for RM to try: Don't fuss about non-integer points—do all the 
necessary calculations "under the hood", and just let point-coördinates be 
assigned the resulting non-integer numbers as needed. With any luck, LC will 
make this "just work" on your screen.

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: Not Corruption

2017-01-05 Thread Quentin Long via use-livecode
sez J. Landman Gay:
> On 1/4/17 4:05 PM, Bob Sneidar wrote:
> > I feel so stupid. But I must confess I screwed up.
> You did the right thing posting here. I have a client who runs into 
> problems all the time, so we schedule a Skype session where I can see 
> what's going wrong. Invariably, as soon as she tells me about the issue 
> and I'm watching her screen, she immediately figures out the reason 
> without my help. All I have to do is be there.
https://en.wikipedia.org/wiki/Rubber_duck_debugging
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: EBCDIC to ASCII (Richard Gaskin)

2016-12-29 Thread Quentin Long
sez Richard Gaskin :
> Anyone here have a function to translate the old EBCDIC encoding format 
> to anything more modern format like ASCII or UTF-8?
Doubtful. If ESR is right about its "at least six mutually incompatible 
versions... and the absence of several ASCII punctuation characters... (exactly 
which characters are absent varies according to which version of EBCDIC you're 
looking at)", you'd pretty much *have to* roll your own conversion function. 
The "six mutually incompatible versions" thing strikes me as the most 
problematic, but since the forum member who's asking for this seems to be 
working with files from a single source, maybe it's safe to assume that all the 
relevant files use the same version of EBCDIC?

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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 Digest, Vol 159, Issue 30

2016-12-24 Thread Quentin Long
sez hh:
> What you say is logically totally wrong.
Really. Did you read the sample code dunbarx posted? And if you read it, did 
you understand it? Please, inform me which rawKeyDown events a "do rawKeyDown" 
handler *will not* trap. As well, do clue me in to which rawKeyDown events will 
slip thru a "on rawKeyDown" handle which *does not* have a "pass rawKeyDown" 
statement in it.

> "DoScrollUpStuff" may of course easily be written such that Craig's
> script does the same as your script.
Of course. But it *wasn't explicitly written out*. And I was responding to *the 
sample code that was actually written*, as opposed to… say… making unsupported 
assumptions about *other* code that *could* have been written. Personally, I 
find that dealing with the code that's *actually there* tends to yield better 
results than dealing with code that I only *wish* was there. Your mileage may 
vary.

Is the problem that I didn't comprehend dunbarx's sample code… or is the 
problem that *you* hallucinated a statement or three which were not actually 
present in said sample code? Yes, "hallucinated" is not a particularly 
congenial word in this context, but it's no more offensive than your "logically 
totally wrong" phrase. As the saying goes, "you don't start none, there won't 
be none."

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: Detect scroll activity (when LC is not frontmost)

2016-12-23 Thread Quentin Long
sez dunbarx:
> The "rawkeyDown" message may be trapped as follows:
> 
> on rawkeydown tkey
>if  tkey = 65308 then doScrollDownStuff
>else doScrollUpStuff 
> end rawkeydown
Hold it. That code, as written, will trap *A*L*L* rawKeyDown events, and 
silently kill everything that's *not* a scrollwheel-down event. Which, in turn, 
means that text input is toast, among other probably-unwanted side-effects. Try 
something like this instead:

on rawKeyDown DerKey
  switch DerKey
case 65308
  DoScrollDownStuff
  break
case 65309
  DoScrollUpStuff
  break
default
 pass rawKeyDown
  end switch
end rawKeyDown

Note that with the switch structure I've used here, there are a number of 
perhaps-useful tricks you can pull… but said tricks are strictly outside the 
scope of the original "how do I detect scrollwheel activity?" problem, so I 
will leave said tricks as exercises for the reader.
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

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

Re: Problem with "delete button"

2016-12-19 Thread Quentin Long
sez pink :
> I'm developing a turned based game, on each turn, new buttons get added to
> the board, and it some buttons will get removed. There in lies the problem,
> Livecode keeps crashing when I hit the "delete button xxx" command.
>
> So, the only work around I've come up with is to make the buttons invisible,
> however this means as the game goes on that there are going to be hundreds
> of invisible buttons cluttering the board.
Assuming that button-deletion continues to be a problem, one possible 
workaround would be to figure out the maximum number of buttons that can ever 
be on the board at any one time; give the game-board that many buttons to start 
with; and re-assign button-characteristics (visibility, icons, position, etc) 
"on the fly" as needed.

If you need to deal with specific characteristics of a button on the board, you 
may want to use indirection. I of course don't know any of the details of your 
game, but let's consider the case of a game that involves a 10-by-10 grid, with 
buttons appearing and disappearing on the grid-positions during the course of 
the game. You could have a global variable whose name is "Grid-1-1", and every 
time you move a button into the 1,1 space on the grid, put the name of that 
button into the Grid-1-1 variable. If/when you need to fuss with specific 
properties of the button at (grid-space 1,1), you should be able to do things 
like this:

set the [name of property] of button Grid-1-1 to [value]
put the [name of property] of button Grid-1-1 into [name of variable]

Since the string "Grid-1-1" is a variable, and the value of that variable is 
the name of a button, LiveCode should interpret "button Grid-1-1" as a 
reference to the button whose name is stored in the variable "Grid-1-1". You'll 
want to be careful about quote-marks in your code, of course. A variable name 
in quote-marks will be interpreted as a literal string, which is not what you 
want.

Hope this helps…
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: roundUp function?

2016-11-24 Thread Quentin Long
sez Roger Eller :
> We have round, which will either round up or down depending on the decimal
> value being > or < .5, but what if I want ANY decimal value, even .01 to
> round UP to the next whole number?
The best solution is the Ceiling function. Since that's not an option for the 
version of LiveCode you're working with, you gotta roll your own.

The proposed "return int (DerNumber +.5)" solution won't do, because any number 
whose decimal part is *less than* .5 will round down to the integer part. 
Instead, what you want is something like this:

if DerNumber = int (DerNumber) then -- DerNumber doesn't *have* a decimal part
  return DerNumber
else -- DerNumber *does* have a decimal part, hence rounds up
  return int (DerNumber) + 1
end if

That works fine for positive numbers and zero. Negative numbers, not so much. 
So, a tweak to handle negative numbers:

if DerNumber = int (DerNumber) then -- DerNumber doesn't *have* a decimal part
  return DerNumber
else -- DerNumber *does* have a decimal part, hence rounds up
  return int (DerNumber) + (DerNumber / abs (DerNumber))
end if

The expression "DerNumber / abs (DerNumber)" yields a value of +1 when 
DerNumber is a positive number, and -1 when DerNumber is negative. Alas, it 
runs into problems when DerNumber is zero. So, tweaking again:

function CeilingOf DerNumber
  if DerNumber = 0 then
return 0
  else
if DerNumber = int (DerNumber) then -- DerNumber doesn't *have* a decimal 
part
  return DerNumber
else -- DerNumber *does* have a decimal part, hence rounds up
  return 1 + int (DerNumber)
end if
  end if
end CeilingOf

Please don't feed a non-number to this function. It won't like that.
 
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: put one array after another

2016-08-11 Thread Quentin Long

sez Matt Maier :
> Is there a command to merge two array variables into one?
> 
> Example:
> 
> tFirstArray[tom] = mot
> tFirstArray[jane] = enaj
> 
> tSecondArray[bill] = llib
> tSecondArray[name] = eman
> 
> put tSecondArray after tFirstArray
> 
> tFirstArray[tom] = mot
> tFirstArray[jane] = enaj
> tFirstArray[bill] = llib
> tFirstArray[name] = eman

I don't know if there's a command that will do the job. However, there's a 
construction I use when I merge two list variables into one:

put ItemList2 into item (1 + the number of items in ItemList1) of ItemList1

That construction may seem a little weird, but it does the job. So *if* the 
same sort of logic applies to arrays, something like this might do the job:

function ConcatArray Array1, Array2
  -- if this was a real function, it would confirm that Array1 and Array2 are 
both, you know, *arrays*
  put the number of lines in the keys of Array1 into A1
  put the keys of Array2 into key (A1 + 1) of Array1
  return Array1
end ConcatArray

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

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

Re: Problem with custom functions

2016-07-01 Thread Quentin Long
Follow-up on my recent "WTF!?" message. With the same hardware and OS as in my 
first message, but running LiveCode Community Edition 7.0.0 build 10018 rather 
than the 8.0.0 version, custom functions work with no anomalous behavior I can 
discern.

Should I file a bug report?

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

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

Problem with custom functions

2016-07-01 Thread Quentin Long
I'm not sure if I've exposed a horrible bug, or I've managed to completely 
forget something utterly bleeding obvious, or what. But whatever the deal is, I 
am having inordinate difficulty trying to use custom functions.

Recipe for the problem:

0--Open LiveCode (Community Edition 8.0.0, build 13018) on a MacBook Pro 
(13-inch, mid-2012) running OS X 10.11.5, with a 500 GB hard drive (300 GB free 
space) and 16GB of RAM

1--Create a new stack

2--Put this into the script of the new stack:

function CubeIt DerNum
   return (DerNum ^ 3)
end CubeIt

3--Type "put CubeIt (3)" into the message box

Expected result: "27" should show up in the message box.
Actual result: Nothing shows up in the message box.

4--Type "put CubeIt 3" into the message box
Result:
"Script compile error:
"Error description: Handler: bad command"

What the heck is going on here?
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: "Error description: set: license limit exceeded"

2016-06-15 Thread Quentin Long
"Deprecated" doesn't mean "absent". "Deprecated" means something more like "we 
haven't *got rid of* X because a lot of our installed base depends on X, but we 
*really* don't want to see anybody using X for *new* projects."
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: strange experience in Windows standalone with windowshape

2016-06-15 Thread Quentin Long
sez Dar Scott:
> Be careful! There are some things you can do with 'do'
>  but can't send with 'send'. Also, as I recall, not all you
>  can 'call' can lend itself to 'send'. I've seen things that
>  'do' did but sent d'n't. Also, a sending pending is not
>  the same as a do doing since a pending sending is
>  not done as is a done 'do'. So, unless I need pending,
>  I do do instead of sending a send. 
But wait! Is the potion with the pellet in the vessel with the pestle, or in 
the flagon with the dragon? And is it the chalice with the palace that has the 
brew which is true?

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: Need Help With String Pattern Matching

2016-06-14 Thread Quentin Long
sez Gregory Lypny:
> Thank you for the tips on string pattern matching. I?m
> used to Mathematica?s string pattern syntax, which is
> probably built on regex, but I can see the similarities in
> your nice examples, particularly the using of
> alternatives [Joe|Anges]. While Mathematica?s string
> functions are insanely extensive and their implementation
> far more powerful that those in LiveCode, they can
> become arbitrarily slow if used repeatedly in loops, and
> unfortunately, my procedure requires repeating the
> functions over tens of thousands of files. That is why I
> want to build an alternative procedure in LiveCode.
Hold it. You're saying you don't want to use regex in *LiveCode* because a 
more-complex feature is too slow in *Mathematica*? I'm not sure how to connect 
those dots, myself. Why not give regex in LiveCode a shot anyway?
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

___
use-livecode mailing list
use-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: Need Help With String Pattern Matching

2016-06-12 Thread Quentin Long
Message: 14
Date: Sat, 11 Jun 2016 15:48:00 -0400
From: Gregory Lypny 
To: LiveCode Discussion List 
Subject: Need Help With String Pattern Matching
Message-ID: <19a0e5fc-e4ce-42e8-9dd1-1b4d9040b...@videotron.ca>
Content-Type: text/plain; charset=utf-8

Hello everyone,

> I used to do some basic text analysis of files where the lines containing 
> strings of interest were consistent and therefore easy to spot. I am now 
> working on files where the chunk of text that contains the data I want is 
> more ambiguous.…

>The chunk starts with the word *owner* or the phrase *beneficial owner*.
>
>The chunk ends with *all directors* or *less than one percent*.
>
>The chunk contains all of the following:
>- At least four or five big numbers, e.g., 234,879
>- At least two percentages, e.g., 3.4%, or percentage signs
MatchChunk uses regular expressions ("regex" for short). I don't claim to be a 
master of regex, but hopefully the following will be of some help to you.

First off, "owner" or "beneficial owner". That would be like so:

[owner|beneficial owner]

Since that's the start of the chunks you're interested in, you'll put that at 
the beginning of your regex filter. Next is "all directors" or "less than one 
percent". That's going to be similar:

[all directors|less than one percent]

And *that* bit goes at the *end* of your regex filter. In between the start-bit 
and the end-bit, you have "four or five big numbers", and "percentages" or 
"percentage signs". "Big number" isn't really a well-defined concept, but 
here's one way to go for "big numbers": 

[0-9][0-9],[0-9][0-9][0-9]

In regex, that bit will match any string that consists of *at least* two 
digits, a comma, and three more digits. It'll match XX,XXX (where "X" is any 
digit at all); it'll match XXX,XXX (because if you can match *two* digits in a 
row, you can certainly match *three* digits in a row); it'll match XX, (if 
you can match 3 in a row, you can match 4 in a row); and so on. Note that this 
bit *will not* match X—that's a string of five digits in a row *without* 
any commas. As for percentages, this will work for matching a percent sign:

&

And this will work for matching a single digit followed by a percent sign:

[0-9]%

I'm going to assume that you don't know exactly where the "big number"s or 
"percentage"s will be within the chunks you're interested in, or how many 
characters will occur in between the bits of interest. If you want your regex 
filter to ignore what occurs between the bits of interest, this will do the 
trick:

.*

The period will match any character (except a newline character), and the 
asterisk is regex for "at least 0 of that thing just previous". So if you want 
to match Big Number followed by Percentage, this should do the trick:

[0-9][0-9],[0-9][0-9][0-9].*[0-9]%

If you at least know what order your Big Numbers and Percentages going to be 
found in, you can build a regex filter for that sequence by fitting the bits 
together like Lego bricks, with the period-asterisk "spacer" in between the 
important bits.
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

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

Cubist's first bug report

2016-06-05 Thread Quentin Long
Code which exhibits the bug:

on mouseUp
   put "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" into Fred
   repeat 100 times
  add 1 to any item of Fred
  put Fred into line (1 + the number of lines in fld "testbed") of fld 
"testbed"
   end repeat
   put sum (Fred) into line (1 + the number of lines in fld "testbed") of fld 
"testbed"
end mouseUp

This handler *should* end up generating a 16-item string of integers which sum 
to exactly 100. What it *actually does* end up generating, is a 16-item string 
of integers whose sum may or may not fall somewhere within the range 80-120. 
Not sure what the hell is going on here, but I am not at all happy about it. 
Perhaps other people might like to try this code on their systems, and see if 
it works as intended for them?

http://quality.livecode.com/show_bug.cgi?id=17795

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

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

First experience with LC 8.0's Interactive Welcome

2016-05-06 Thread Quentin Long
Downloaded the stable 8.0 release, opened it up. What the heck, figured I'd try 
to work thru the Interactive Welcome. Noted some aspects of the IW that might 
be problematic for LC newbies. Since the IW is presumably supposed to be LC 
putting its best foot forward, and even minor issues could discourage a novice 
from exploring the wonders of LC, I'll list some issues I encountered, in the 
order encountered…

==

First issue: "Set the 'Background Fill' color of the stack to white"
Problem, from a newbie's PoV: Wait a second. That Inspector-thingie looked 
different for a fraction of a second before it settled down to that tower of 
"fill"s and "color"s. LiveCode does that sort of thing automatically?

Possible fix: Add a little something to the 'narration box'. You've told the 
user about the icons along the top edge of the Inspector window, and what those 
icons are for; the 'little something' called for here is in the neighborhood of 
"Right now, we're going to show you the 'Colors' category of settings." In 
other words, an explicit acknowledgement that LC is going to futz with the 
Inspector, so don't panic.

--

Problem, from a newbie's PoV: Okay, *how* do I set the BF color to white? The 
blue box is pointing right at "Background Fill" in the window that popped up 
when I clicked on the "Inspector" icon, which is good, cuz there's a *lot* of 
other "fill"s and "color"s to confuse the issue. So, okay, "Background Fill", 
but I don't see anything that looks like "click *here* to set a color". There's 
a white box with a red slashmark in it, but a red slashmark means "don't do 
this", so I guess I don't want to click that box. There's also a grey-outlined 
box whose interior is filled with the same color as the background of the 
Inspector window; greyed-out means "not available", right? So… I'm stuck.

Fortunately, I (Cubist) an *not* an LC newbie. I have a fair amount of previous 
experience with MetaCard, Revolution, and LiveCode. So *I* knew to click on 
that red-slashed box in order to set the Background Fill color. Am unsure 
whether someone who genuinely is new to LC would think to do that.

Possible fix: Steal the 'red oval' from Apple Guide. Put said oval around the 
box you're supposed to click on… and maybe said oval should fade in and out, 
'pulsing' to (1) draw attention to itself and (2) provide some indication that 
it's *not* actually a standard part of the LC interface.

==

Second issue: "Set the 'Text Size' of the stack to 18…"
Problem, from a newbie's point of view: Hold it, where did *that* come from? 
Does LiveCode automatically force you to set text size immediately after you 
set background color? I'm not sure I want to deal with LC if *it*'s gonna 
decide for *itself* what settings I'm going to tweak.

Possible fix: Add a new 'narration box', immediately after the user succeeds in 
setting the background color to 'white'. This new narration box should say 
something like, "You've just set the stack's background color to white. Cool! 
For your next trick, you're going to tweak the size of the text that appears in 
this stack."
Next narration box: "Click on the Inspector icon again, to bring the Inspector 
back."
When the Inspector is on the screen, red-oval the Text icon, and a fresh 
narration box: "Click on the Text icon to show you LC's text-formatting 
options."
When the Inspector is displaying its Text options, red-oval the TextSize input 
box, and show the existing "Set the 'Text Size'…" character string in a fresh 
narration box.
   
==

Third issue: The stack turned green when I dragged that 
title-bar/widget/whatzit onto the stack.
Problem, from a newbie's point of view: Wait, what's up with *that*? *I* didn't 
tell it to change any colors of anything! Is this something LC does just 
because, or is it a bug, or what?

Possible fix: Maybe the narration box which directs the user to drag the widget 
onto the stack should include a note about "Oh, and the stack will turn green 
for a little bit when you drag the widget onto it. LC does this because [insert 
reason here]."

==

Fourth issue: "Set the 'Title of the header bar widget to 'BMI Calculator', and 
press ."
Problem, from a newbie's point of view: Will a newbie realize that you're 
asking them to press the return key, and not asking them to *type* 
left-angle-bracket, "r", "e", "t", "u", "r", "n", right=angle-bracket?

Possible fix: Change it to "press the return key"or "type the return key".

--

Problem, from a newbie's point of view: Okay, I typed "BMI Calculator" in that 
text box. I hit the return key… and the "BMI Calculator" string suddenly 
scrolled up to *almost* completely outside its text box. That's kind of ugly 
and awkward.

I (Cubist) know that what's going on here is that the textbox in question 
accepts multi-line input. I am not at all sure that it *should* accept 
multi-line input, because, well, that textbox is supposed to be for letting the 

Re: OT: Who can convert 3.5" diskettes with Hypercard stacks for me?

2016-04-26 Thread Quentin Long
sez Tiemo Hollmann TB:
> I have some 3.5" diskettes from my Mac from the beginning 90th with some
> HyperCard stacks which I just regained again.
> 
> The HyperCard stacks are not vital for me, but if possible I would like to
> see them again (converted to LC), just as a memory.
> 
> Is there anybody, who still has a Mac with diskette drive, who could copy
> the content for me? Best somebody in Europe for easier shipping?
  Sending the actual floppy disks thru (international?) mail may not be 
necessary. If Google Shopping can be trusted, floppy disk drives are 
*currently* available for under USD $20; depending on how many floppies you're 
talking about, and what the actual cost will be in your country (which appears 
to be Germany, judging by the ".de" in your email address), it might be a good 
idea for you to acquire one of those drives for this purpose. 

> And is there a recipie, if and how I can convert HC stacks to LC format? I
> think I have read from time to time that it should be possible.
   Converting HC stacks to LiveCode format is trivial; just open them up in 
LiveCode. If you're very lucky, all of the HC code in your stacks will just run 
under LC, so nothing more will need to be done. If you're not very lucky, the 
HC code will have some easily-solved problems that prevent it from just running 
properly under LiveCode. And if you're very *un*lucky, the HC code will have 
*so* many problems that it might be better to just re-write all the code in LC 
and be done with it.

As it happens, Jacqueline Gay has a webpage on "Converting a HyperCard Stack to 
LiveCode":

http://www.hyperactivesw.com/mctutorial/rrtutorialtoc.html

Hopefully the information Gay assembled will be helpful to you.


"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"

Read the webcomic at [ http://www.atarmslength.net ]!

If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].

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

Possible help for extra-time-consuming operations?

2016-04-15 Thread Quentin Long
Have pondered the issue of ensuring that the OS does *not* label a 
seemingly-'frozen' LC app as unresponsive. The following code (which I haven't 
actually tried in LC, shame on me) might be helpful. Some notes after the code…



local KeepMeAlive = false
local NumSecs = 4

on LifeLine DerStatus

case DerStatus = "on"
put true into KeepMeAlive
TickleMe
break

case DerStatus = "off"
put false into KeepMeAlive
break

default
exit to top
end case

end LifeLine

on TickleMe
if KeepMeAlive = true then send "TickleMe" to me in NumSecs seconds
end TickleMe



How to use this code: Put the code into your stack script, or a backscript, or 
wherever, as you deem appropriate. When a handler has a time-consuming chunk of 
code in it, do the following:

LifeLine ("on")

-- Time-consuming
-- chunk
-- of
-- code

LifeLine ("off")

I used the case structure to provide for any future use-case in which you want 
more options than just "keep this thing alive" or not. NumSecs is a local 
variable so that it can be easily adjusted in case this code is run under an OS 
that thinks, say, 2 seconds is a long-enough period to justify treating an app 
as unresponsive.



It occurs to me that if you're looking for specific strings in a Very Large 
File, and you're reading the VLF in N-character-long chunks, you want to be 
careful that you don't overlook instances of a sought-for string which have a 
between-chunks boundary within them.

Say you're reading 1000-character chunks, and your sought-for StringX *starts* 
at char 999 within the VLF. In this case, only character 1 of StringX will be 
found within the first chunk; only characters 2 thru -1 of StringX will be 
found within chunk 2. If you *just* look *within* each chunk as you read it, 
you won't find the instance of StringX which started at character 999.



"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
Read the webcomic at [ http://www.atarmslength.net ]!
If you like "At Arm's Length", support it at [ 
http://www.patreon.com/DarkwingDude ].
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode