Re: Filter with wildcards

2023-11-02 Thread David Glasgow via use-livecode



> On 1 Nov 2023, at 11:24 pm, Neville Smythe  
> wrote:
> 
> But I suspect you should allow for the required strings to be followed by 
> punctuation or be at the end of the line, things which are hard to do with a 
> simple LC wildcard search, at least in a single filter. 


When I originally went down the wildcard route, I wrote some gentle text 
preprocessing (using replace) to make sure words are always bounded by a space, 
including before punctuation and at an eol.

I also need users to see the reason  the message appears in the results (i.e 
the matched filter) so  they are listed under a heading consisting of the 
search term.  Not sure what users would make of regex!

Thanks again,

Cheers

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


Re: Filter with wildcards

2023-11-01 Thread David Glasgow via use-livecode
Thanks all for the suggestions, folks.

I expected someone to mention regex (shudder).  I have many searches in a loop 
and most are simple strings, so excepting regex filters would be a bit of a 
pain (unless of course I could specify regex but this would not choke if the 
search was simple string containing no regular expressions)

Because I am lazy, and a simple soul, I will probably just  split the task into 
two filter commands - which will deliver exactly what I want at only a minimal 
time and thought overhead.

Cheers

David G

> On 30 Oct 2023, at 7:29 pm, Mark Waddingham via use-livecode 
>  wrote:
> 
> The filter command has had a ‘with[out] regex’ form for a long time - so I’d 
> use a regex instead :)
> 
> (I’m pretty sure [ ] is a set of characters to match, rather than a list of 
> sub strings, in wildcard expressions)
> 
> Warmest Regards,
> 
> Mark.
> 
> Sent from my iPhone
> 
>> On 30 Oct 2023, at 17:19, David Glasgow via use-livecode 
>>  wrote:
>> 
>> Hi folks,
>> 
>> I am doing the above and struggling with an oddity that I can’t find 
>> guidance on on Livecode or wider wildcard stuff
>> 
>> A simple example is I am searching text messages for 'with you' or 'with u’
>> 
>> so I use the wildcard form
>> 
>> *with [you,u]*
>> 
>> That finds all examples of both just fine.  However, it also finds ‘with 
>> unlimited cheese’ and 'with us’, ‘with yours’ etc.  so I want a space after 
>> both u
>> 
>> When I put two spaces inside the square brackets after each string, the 
>> search still works but spaces seem to be ignored (so still finds the above 
>> resamples I don’t want).
>> 
>> If I put a single space after the brackets the first bracketed string is 
>> ignored and the filter only finds “with u “
>> 
>> Hope someone can help me stop pulling my baffled face
>> 
>> Cheers
>> 
>> David Glasgow
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


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


Filter with wildcards

2023-10-30 Thread David Glasgow via use-livecode
Hi folks,

I am doing the above and struggling with an oddity that I can’t find guidance 
on on Livecode or wider wildcard stuff

A simple example is I am searching text messages for 'with you' or 'with u’

so I use the wildcard form

*with [you,u]*

That finds all examples of both just fine.  However, it also finds ‘with 
unlimited cheese’ and 'with us’, ‘with yours’ etc.  so I want a space after 
both u

When I put two spaces inside the square brackets after each string, the search 
still works but spaces seem to be ignored (so still finds the above resamples I 
don’t want).

If I put a single space after the brackets the first bracketed string is 
ignored and the filter only finds “with u “

Hope someone can help me stop pulling my baffled face

Cheers

David Glasgow


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


Re: Creating 'read only' text files

2023-05-02 Thread David Glasgow via use-livecode
Perfect.  Thanks, Paul.

> On 30 Apr 2023, at 1:43 pm, Paul Dupuis via use-livecode 
>  wrote:
> 
> I don't know of a Livecode syntax per se to do this (i.e some syntax like: 
> set the permissions of file tFile to read-only)
> 
> You can do this in Livecode using the shell() function (see the dictionary) 
> to issue applicable mac or win command lines. For eample a Google search 
> shows the command line to change a file's permissions on Windows is:
> 
> attrib +r file.txt
> 
> so you could code something like (not tested):
> 
> switch platform()
>   case "Win32"
> set the hideConsoleWindows to true -- prevents windows console window 
> from appears when the shell command executes
>put "attrib +r " & quote & tFile & quote into tCommand -- were tFile is 
> the file (path and name with native \ delimiters) you want to make read-only
>put shell(tCommand) into tResult
>break
>   case "MacOS"
> -- use chmod 744 apple.txt for you to have full access and everyone else 
> read-only OR
> -- use chmod 444 apple.txt for everyone, you included, to be read-only
>put "chmod 444 " & quote & tFile & quote into tCommand -- were tFile is 
> the file (path and name) you want to make read-only
>put shell(tCommand) into tResult
>break
> end switch
> 
> This code may need some tweaking but I think this is the general approach to 
> do what you want.
> 
> On 4/30/2023 7:35 AM, David V Glasgow via use-livecode wrote:
>> Hi folks,
>> 
>> Really simple question that I can’t see having been asked before, so here 
>> goes…
>> 
>> I have a stack that outputs small text files.  Each includes a hash value 
>> referencing part of itself that can be checked subsequently, so any change 
>> to the text can be flagged.
>> 
>> Is there a way I can easily create read-only files (Mac & Win) to discourage 
>> accidental user changes?  No need for encryption or hiding information 
>> anywhere, I just want to deter casual oopsies.
>> 
>> Thanks in anticipation...
>> 
>> Best Wishes,
>> 
>> David Glasgow
>> Honorary Professor, Nottingham Trent University
>> Sexual Offences, Crime and Misconduct Research Unit
>> Consultant Forensic & Clinical Psychologist
>> Carlton Glasgow Partnership
>> Director, Child & Family Training, York
>> 
>> 
>> LinkedIn > >
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com 
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode 
>> 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com 
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode 
> 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sort list alphabetically- ignoring first character if it is a space

2023-02-22 Thread David Glasgow via use-livecode
Of course!!!  And indeed a bonus that we can keep happy our AI overlords-to-be.

> On 20 Feb 2023, at 10:11 pm, Mark Wieder via use-livecode 
>  wrote:
> 
> On 2/20/23 13:29, Niggemann, Bernd via use-livecode wrote:
> 
> ...or to make ChatGPT happy:
> 
> sort tData ascending by word 1 to -1 of each # ignoring spaces
> 
> 
> 
> -- 
> Mark Wieder
> ahsoftw...@gmail.com
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


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


scripted Show tooltip not a thing?

2022-01-11 Thread David Glasgow via use-livecode
Hi folks

I have an app in which tooltips are generally off.  I also have a button menu 
which allows the selection of equality/inequelity.  Users are non technical, 
and on selection (i.e. not the usual hover) I wanted to pop up a brief tooltip 
describing the selected item in ordinary language (irrespective of whether 
tooltips are globally on or off):

on menuPick pChosenItem
   set the label of me to pChosenitem
   switch
  case pChosenItem = "="
 set the tooltip of me to "Equals"
 break
  case pChosenItem = "≤"
 set the tooltip of me to  “Is at least"
 break
  case pChosenItem = "≅"
 set the tooltip of me to “Is approximately"
 break
   end switch
   set the tooltipdelay to 500
   show the tooltip of me
   set the tooltip delay to 0
end menuPick

It seems  show the tooltip of me isn’t a thing.  I appreciate that I could show 
and hide an ordinary field, but I wondered if I have overlooked a suitable 
message and/or syntax that will enable what I want. 


Best Wishes,

David Glasgow
Honorary Professor, Nottingham Trent University (SOCAMRU)
Consultant Forensic & Clinical Psychologist
Carlton Glasgow Partnership
Director, Child & Family Training, York

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


screen resolution and stack height

2021-12-01 Thread David Glasgow via use-livecode
Hi folks,

I have been developing a desktop stack at 1024×760 for a while.  Vertical space 
is becoming increasingly cramped, and I need a bit more.  I reckon 40 pixels 
would do it.

Obviously that would break the 4:3 ratio.  So am I better reconfiguring for a 
completely different screen ratio (if so, which), or just setting the stack 
height to what I need?  I remember 1280×800 was common for quite a while, but 
is it still?  

I Googled about a bit, but the interweb was full of contradictory advice.  
(Imagine that!)


Best Wishes,

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


On the subject of things with the same short name... ('identical' groups which behave differently)

2021-10-08 Thread David Glasgow via use-livecode
Being essentially a lazy and a sloppy programmer, I made a group which 
contained a script that caused the group to do what I wanted.  Then I copied it 
again and again, and grouped the resultant groups.   Rather than adapting the 
script to be located on the card I just left several identical scripts in 
groups which have the same short name.  I told you.  Lazy.  However, all groups 
worked absolutely fine.

I then decided to add a visual effect to the final unlock screen in each 
instance.  I tried a couple of groups to see how it would look, and I found 
that it worked perfectly on one group, but not a second, identical(?)  group. 

The script is...
+++

on mouseup

lock screen for visual effect in rect (the rect of the long name of me)

**depending on target object which was clicked, change appearance of group 
here**

unlock screen with visual wipe right slow

end mouseup

+++

There are no other locks or unlocks.

The weird thing is that the script runs without error in both cases.  The final 
appearance of the group in both cases is exactly what I would expect.  However, 
the visual effect manifests itself in one instance, but not the other.  I was 
bit hesitant about 'the rect of the long name of me’, but as I keep saying, it 
seems to works perfectly in one case.

Que pasa?

(  Mac 10.13.6 and LC 9.6, if that makes a difference.)

Best Wishes,

David Glasgow
Consultant Forensic & Clinical Psychologist
Carlton Glasgow Partnership
Director, Child & Family Training, York
Honorary Professor, Nottingham Trent University (SOCAMRU)


___
use-livecode mailing list
use-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-05 Thread David Glasgow via use-livecode
Maybe 'strain' could be a culinary synonym?
;-)

Best wishes 

David Glasgow

Sent from my  iPad via iBrain & iFingers

LinkedIn

> On 5 Aug 2018, at 16:36, J. Landman Gay via use-livecode 
>  wrote:
> 
> This is getting pretty contorted and is becoming less like natural language. 
> For what it's worth, I have never been confused by the current use of filter. 
> I think of it as pouring soup through a wire strainer. Filtering "with" keeps 
> the solids. Filtering "without" dumps them and keeps the liquid.
> 
> Maybe I cook too much. In any case, the solids (what remains after filtering) 
> are the things you're either keeping or discarding.
> --
> Jacqueline Landman Gay | jac...@hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>> On August 5, 2018 9:38:45 AM Brian Milby via use-livecode 
>>  wrote:
>> 
>> Probably better:
>> 
>> 
>> filter [{lines | items | keys | elements} of] filterSource {keeping | 
>> discarding | with | without | [not] matching} {[{wildcard | regex} pattern] 
>> filterPattern | where filterExpression} [into targetContainer]
>> 
>> 
>> So Monte’s example would be:
>> filter keys of tFoo keeping where tFoo[each] is not tBar[each]
>> (And to get Richard’s result you would need to follow this by an intersect 
>> each way. The filter would replace the repeat loop in Mark’s solution)
>> 
>> 
>> Even though “with where” would be syntactically correct, the preferred usage 
>> would be “keeping where”.
>> 
>> Thanks,
>> Brian
>>> On Aug 5, 2018, 7:32 AM -0500, Mark Waddingham via use-livecode 
>>> , wrote:
>>> On 2018-08-05 07:31, Monte Goulding via use-livecode wrote:
>>> > Given I have been wanting to do ^ for a couple of years I decided to
>>> > just go ahead and do it… might be a while before we have time to
>>> > bikeshed the syntax though.
>>> >
>>> > https://github.com/livecode/livecode/pull/6626
>>> > 
>>> >
>>> > Examples:
>>> > local tFoo,tBar
>>> > put "foo" into tFoo[1]
>>> > put "bar" into tFoo[2]
>>> > put "baz" into tBar[1]
>>> > put "bar" into tBar[2]
>>> > filter keys of tFoo with expression tFoo[each] is tBar[each]
>>> > — tFoo now has one key 2 which is `bar`
>>> >
>>> > put “yes,foo” & return & “no,bar” into tFoo
>>> > filter lines of tFoo with expression item 1 of each is “yes”
>>> >
>>> > We could feasibly not use `with|without` for this forcing the
>>> > expression to return true to filter. If we went that way then perhaps
>>> > `where` would be nicest?
>>> >
>>> > filter lines of tFoo where item 1 of each is “yes”
>>> 
>>> Geez @Monte - you do like creating work for me don't you! ;)
>>> 
>>> In terms of syntax - definitely not 'with expression' - that's ghastly.
>>> It is a 'where' clause - in the same vein as SQL and other query
>>> languages - so no bike-shedding required there (also, pleasingly, all
>>> other 'filter' types become sugar for a where clause using operators
>>> which the language does not have yet - but obviously we have the code
>>> for...).
>>> 
>>> If we are going to bike-shed over syntax - can we do so over the use of
>>> 'filter' itself. I don't know why but I have a complete mental block
>>> about it - regardless of how many times I use it or read it - I always
>>> have to 'double-think' to work out what form to use - is that just me?
>>> 
>>> filter  of X with Y
>>> filter  of X without Y
>>> 
>>> I couldn't tell you just by looking *what* they actually do. I'm not
>>> sure why but I think the verb is actually wrong - in all cases you have
>>> a set of things and you are either keeping an element, or removing an
>>> element... So I wonder if:
>>> 
>>> keep  of X where Y
>>> discard  of X where Y
>>> 
>>> (I'm not particularly attached to keep/discard - but it does need to be
>>> a pair of 'true' antonyms which don't intersect with any other 'core'
>>> pairs of such things we have).
>>> 
>>> Might be more appropriate?
>>> 
>>> Of course, maybe it is just 'with' / 'without' are inappropriate, and
>>> 'where' might actually help me retrain my mind to see with/without as
>>> the sugar they truly are.
>>> 
>>> Anyway, thought it worth throwing out there to see what people think?
>>> 
>>> Warmest Regards,
>>> 
>>> Mark.
>>> 
>>> --
>>> Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
>>> LiveCode: Everyone can create apps
>>> 
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> 
> 
> ___
> use-livecode mailing list
> 

Re: URGENT: MergGoogle no longer works on iOS: CLIENTS VERY UNHAPPY

2018-05-04 Thread David Glasgow via use-livecode
It was a single problem, but the poor fellow was in hock up to the ears and out 
of time. 

If there is anything positive here it is the response of the community. No 
lectures on what he should have done different, just genuine concern and an 
astonishingly quick fix. 

Best wishes 

David Glasgow

Sent from my  iPad via iBrain & iFingers

LinkedIn

> On 4 May 2018, at 11:07, Lagi Pittas via use-livecode 
>  wrote:
> 
> I still think for a  client to pull away like that with  a single problem
> that was not insurmountable
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


"Aphasia" (was Re: use-livecode Digest, Vol 171, Issue 44)

2017-12-28 Thread David Glasgow via use-livecode
Unfortunately, it is all rather more complicated than either Richmond or Peter 
suggest. There are many more contributing areas than Brocas, and what Peter 
describes doesn't appear to be aphasia at all, but rather a pathology of 
semantics or word finding. 

It's not possible to be more specific without more information, and my advice 
would be to speak with a neuropsychologist before coding. You could spend a lot 
of time comparing wavs and coming up with a solution to the wrong problem. 

Best wishes 

David Glasgow
Sent from my iBrain via iFingers & iPad


LinkedIn

> On 28 Dec 2017, at 08:26, Richmond Mathewson via use-livecode 
>  wrote:
> 
> If we start to unpack your post we can come to a slightly simpler conclusion 
> than what you set out as your goal initially.
> 
> 1. Is your main idea to have a program where the device can "do the talking" 
> for the patient?
> 
> 2. As the "owner" of a 94 year old Mother-in-law who suffers from some sort 
> of selective dementia I realise that
> pointing out to her that her hallucinations are hallucinations (rather than 
> reality) is both an uphill struggle
> and causes her a lot of distress: oddly enough she's far happier inside the 
> comfort zone of her hallucinations.
> 
> If "Granny" suffers from Aphasia she has permanent damage in the Broca's Area 
> of her brain, normally due to
> a stroke: this cannot be sorted out, unfortunately.
> 
> She could, also, suffer from a type of dementia that has similar symptoms to 
> aphasia.
> 
> Doesn't really matter which; the end result is just as bad and bl**dy awful 
> for all concerned.
> 
> If you are going for #1 then there is absolutely no need for any 
> speech-recognition stuff or comparison
> between recorded sounds and those on the device.
> 
> Richmond.
> 
>> On 28/12/17 2:26 am, Peter Reid via use-livecode wrote:
>> Hi Marc, Paul, Phil, Rick and Richmond
>> 
>> Thanks for your various thoughts.
>> 
>> To put a bit more flesh on this, here's what I'm developing and why...
>> 
>> In the first instance I'm doing this development for a friend who's 
>> grandmother suffers from aphasia (saying completely the wrong word).  The 
>> idea is that her family can put together sets of words where each word is 
>> spoken by the app whilst displaying a relevant picture and optionally a 
>> short video clip illustrating the correct mouth shape when saying the word.  
>> The app displays the word in a very large font with a picture, then the app 
>> says the word (with the option to see a mouth shape video clip).  The user 
>> responds by trying to say the same word and (the thing I can't do yet!) the 
>> app gives the user a percentage score that represents how closely the user 
>> matched the sample word. If the user's score is above a variable threshold, 
>> the user sees a smiley face, otherwise a sad face!
>> 
>> I tried contacting Mark Smith as suggested by Paul but his email address 
>> m...@maseurope.net no longer works.
>> 
>> So far I have everything working apart from the comparison of 2 WAV files, 
>> in particular the following is working:
>> 
>> - the app checks for the presence of a micro SD card as the source of a 
>> collection of word packs
>> - a word pack consists of a collection of words in sound (WAV) and picture 
>> (JPG) form, optionally with supporting video clips (MP4)
>> - the app lets the user select a word pack at start up and loads the pack 
>> into RW file space
>> - the user taps a large arrow icon to go forwards/backwards through the 
>> chosen list of words
>> - for each word, the word is displayed in a large font at the top of the 
>> landscape screen, with its associated picture occupying the lower half of 
>> the screen
>> - as the word is displayed, it is spoken
>> - the user can tap a microphone icon and record their attempt at the word
>> - currently I simulate the comparison of the 2 WAV files
>> - the app gives a percentage score and displays a smiley or sad face 
>> accordingly
>> 
>> To be honest, my main aim is to help a friend.  At this stage I'm not 
>> looking beyond this, so licensing, etc. is not on the horizon at the moment.
>> 
>> Thanks again
>> 
>> Peter
>> --
>> Peter Reid
>> Loughborough, UK
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences: