Re: Reliable Custom Window Dragging in LC7?

2015-08-08 Thread Mike Bonner
Ah, I see what you mean.  If I stumble onto something that works reliably
i'll post, but its not likely.

On Sun, Aug 9, 2015 at 12:45 AM, Scott Rossi  wrote:

> Yes, dragging can work by itself.
>
> But create a new untitled stack in the IDE.  Click between between the new
> stack and the windowShaped stack and drag them around.  Over here, when
> clicking on the windowShaped stack after the standard stack, there is a
> delay while the window becomes active, and then dragging is thrown way
> off, depending on how fast you drag.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
>
> On 8/8/15, 11:24 PM, "Mike Bonner"  wrote:
>
> >Just tried it here, this old script seems to work fine for me 7.0.6..
> >
> >
> http://lessons.runrev.com/m/4071/l/6867-how-to-make-a-stack-with-a-window-
> >shape
> ><-- source
> >
> >Sorry if you've already tried this method.
> >
> >*local* sgDragging, sgLeftOffset, sgTopOffset
> >
> >*on* mouseDown
> >*put* item 1 of the mouseLoc into sgLeftOffset
> >*put* item 2 of the mouseLoc into sgTopOffset
> >*put* true into sgDragging
> >*end* mouseDown
> >
> >*on* mouseMove
> >*lock* screen
> >*if* sgDragging is true *then*
> >*set* the left of this stack to item 1 of globalloc(the mouseLoc)
> >-
> >sgLeftOffset
> >
> >*set* the top of this stack to item 2 of globalloc(the mouseLoc) -
> >sgTopOffset
> >*end* *if*
> >*unlock* screen
> >*end* mouseMove
> >
> >*on* mouseRelease
> >*put* false into sgDragging
> >*end* mouseRelease
> >
> >*on* mouseUp
> >*put* false into sgDragging
> >*end* mouseUp
> >
> >On Sat, Aug 8, 2015 at 10:56 PM, Scott Rossi 
> >wrote:
> >
> >> Hi All:
> >>
> >> Is anyone still making custom-shaped stacks out there that use scripts
> >>to
> >> manage window dragging?
> >>
> >> I've noticed for some time now that custom window drag routines which
> >>used
> >> to work in all past versions of LiveCode now seem to be ineffective in
> >> LC7.  For example, if you have a couple of stacks with custom
> >>windowShapes
> >> and click/drag to reposition them, it takes LiveCode several cycles to
> >> make the window active and catch up with the cursor position.  And when
> >> the stack finally starts moving, it's position is way off from where the
> >> click first occurred on the stack.
> >>
> >> To work around this problem, I figured out a new dragging routine that
> >> seems to work pretty reliably, but it relies on some tactics that have
> >> been discouraged in the past, such tracking the screenMouseLoc and
> >>polling
> >> the mouse state.  Here's the script I'm using (applied using a
> >>behavior):
> >>
> >> local mLoc
> >>
> >> before mouseDown
> >>trackDrag
> >> end mouseDown
> >>
> >> command trackDrag
> >>repeat while the mouse is "down"
> >>   put the screenMouseLoc into SML
> >>   set topLeft of this stack to item 1 of SML - item 1 of mLoc,\
> >>   item 2 of SML - item 2 of mLoc
> >>end repeat
> >> end trackDrag
> >>
> >> before mouseMove X,Y
> >>put X,Y into mLoc
> >>pass mouseMove
> >> end mouseMove
> >>
> >>
> >>
> >> I know there aren't a ton of people building stacks with custom
> >> windowShapes and appearances out there.  And while the above has been
> >> working for me for a while now, I'm still curious if anyone else has run
> >> into this and come up with an alternate solution.
> >>
> >>
> >> Thanks & Regards,
> >>
> >> Scott Rossi
> >> Creative Director
> >> Tactile Media, UX/UI Design
> >>
> >>
> >>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >___
> >use-livecode mailing list
> >use-livecode@lists.runrev.com
> >Please visit this url to subscribe, unsubscribe and manage your
> >subscription preferences:
> >http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Reliable Custom Window Dragging in LC7?

2015-08-08 Thread Scott Rossi
Yes, dragging can work by itself.

But create a new untitled stack in the IDE.  Click between between the new
stack and the windowShaped stack and drag them around.  Over here, when
clicking on the windowShaped stack after the standard stack, there is a
delay while the window becomes active, and then dragging is thrown way
off, depending on how fast you drag.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 8/8/15, 11:24 PM, "Mike Bonner"  wrote:

>Just tried it here, this old script seems to work fine for me 7.0.6..
>
>http://lessons.runrev.com/m/4071/l/6867-how-to-make-a-stack-with-a-window-
>shape
><-- source
>
>Sorry if you've already tried this method.
>
>*local* sgDragging, sgLeftOffset, sgTopOffset
>
>*on* mouseDown
>*put* item 1 of the mouseLoc into sgLeftOffset
>*put* item 2 of the mouseLoc into sgTopOffset
>*put* true into sgDragging
>*end* mouseDown
>
>*on* mouseMove
>*lock* screen
>*if* sgDragging is true *then*
>*set* the left of this stack to item 1 of globalloc(the mouseLoc)
>-
>sgLeftOffset
>
>*set* the top of this stack to item 2 of globalloc(the mouseLoc) -
>sgTopOffset
>*end* *if*
>*unlock* screen
>*end* mouseMove
>
>*on* mouseRelease
>*put* false into sgDragging
>*end* mouseRelease
>
>*on* mouseUp
>*put* false into sgDragging
>*end* mouseUp
>
>On Sat, Aug 8, 2015 at 10:56 PM, Scott Rossi 
>wrote:
>
>> Hi All:
>>
>> Is anyone still making custom-shaped stacks out there that use scripts
>>to
>> manage window dragging?
>>
>> I've noticed for some time now that custom window drag routines which
>>used
>> to work in all past versions of LiveCode now seem to be ineffective in
>> LC7.  For example, if you have a couple of stacks with custom
>>windowShapes
>> and click/drag to reposition them, it takes LiveCode several cycles to
>> make the window active and catch up with the cursor position.  And when
>> the stack finally starts moving, it's position is way off from where the
>> click first occurred on the stack.
>>
>> To work around this problem, I figured out a new dragging routine that
>> seems to work pretty reliably, but it relies on some tactics that have
>> been discouraged in the past, such tracking the screenMouseLoc and
>>polling
>> the mouse state.  Here's the script I'm using (applied using a
>>behavior):
>>
>> local mLoc
>>
>> before mouseDown
>>trackDrag
>> end mouseDown
>>
>> command trackDrag
>>repeat while the mouse is "down"
>>   put the screenMouseLoc into SML
>>   set topLeft of this stack to item 1 of SML - item 1 of mLoc,\
>>   item 2 of SML - item 2 of mLoc
>>end repeat
>> end trackDrag
>>
>> before mouseMove X,Y
>>put X,Y into mLoc
>>pass mouseMove
>> end mouseMove
>>
>>
>>
>> I know there aren't a ton of people building stacks with custom
>> windowShapes and appearances out there.  And while the above has been
>> working for me for a while now, I'm still curious if anyone else has run
>> into this and come up with an alternate solution.
>>
>>
>> Thanks & Regards,
>>
>> Scott Rossi
>> Creative Director
>> Tactile Media, UX/UI Design
>>
>>
>>
>> ___
>> use-livecode mailing list
>> use-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: Extracting a reference to a stack

2015-08-08 Thread Mike Bonner
Ok. Better way.  Use a virtual getprop in a library stack

getprop owningstack
   return (the name of this stack)
end owningstack

Then if you have the long id of an object you can do this..
get the owningstack of myLongId
and "it" will contain the stackname.  (should also work inserted into
front, right?)

On Sat, Aug 8, 2015 at 11:47 PM, Mike Bonner  wrote:

> This may not do things in the required way, but..  If you have a library
> stack with a function or command that just grabs the name of "this stack"
> then you can dispatch or send the request to the object and POOF it'll tell
> you what stack its on, no parsing necessary.
>
> Just tried it here, and it works fine.
>
> On Sat, Aug 8, 2015 at 7:03 PM, Richard Gaskin  > wrote:
>
>> David Bovill wrote:
>>
>> > Yes - you're right. The long name is the only case and like you I
>> > only use long ids in the use cases I have. Except when I store
>> > references when I use the ruggedID handler of the IDE - that should
>> > be a native reference I think?
>>
>> It would be nice to have an engine version of revRuggedID, or for that
>> function definition to just be moved from revbackscriptlibrary to
>> revcommonlibrary, since the latter is copied into every standalone so
>> everyone would have it everywhere.
>>
>> In fact, since both of those libraries are now text-only stacks, anyone
>> sufficiently motivated could make the move and submit a pull request in
>> github.
>>
>>
>> --
>>  Richard Gaskin
>>  Fourth World Systems
>>  Software Design and Development for the Desktop, Mobile, and the Web
>>  
>>  ambassa...@fourthworld.comhttp://www.FourthWorld.com
>>
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Reliable Custom Window Dragging in LC7?

2015-08-08 Thread Mike Bonner
Just tried it here, this old script seems to work fine for me 7.0.6..

http://lessons.runrev.com/m/4071/l/6867-how-to-make-a-stack-with-a-window-shape
<-- source

Sorry if you've already tried this method.

*local* sgDragging, sgLeftOffset, sgTopOffset

*on* mouseDown
*put* item 1 of the mouseLoc into sgLeftOffset
*put* item 2 of the mouseLoc into sgTopOffset
*put* true into sgDragging
*end* mouseDown

*on* mouseMove
*lock* screen
*if* sgDragging is true *then*
*set* the left of this stack to item 1 of globalloc(the mouseLoc) -
sgLeftOffset

*set* the top of this stack to item 2 of globalloc(the mouseLoc) -
sgTopOffset
*end* *if*
*unlock* screen
*end* mouseMove

*on* mouseRelease
*put* false into sgDragging
*end* mouseRelease

*on* mouseUp
*put* false into sgDragging
*end* mouseUp

On Sat, Aug 8, 2015 at 10:56 PM, Scott Rossi  wrote:

> Hi All:
>
> Is anyone still making custom-shaped stacks out there that use scripts to
> manage window dragging?
>
> I've noticed for some time now that custom window drag routines which used
> to work in all past versions of LiveCode now seem to be ineffective in
> LC7.  For example, if you have a couple of stacks with custom windowShapes
> and click/drag to reposition them, it takes LiveCode several cycles to
> make the window active and catch up with the cursor position.  And when
> the stack finally starts moving, it's position is way off from where the
> click first occurred on the stack.
>
> To work around this problem, I figured out a new dragging routine that
> seems to work pretty reliably, but it relies on some tactics that have
> been discouraged in the past, such tracking the screenMouseLoc and polling
> the mouse state.  Here's the script I'm using (applied using a behavior):
>
> local mLoc
>
> before mouseDown
>trackDrag
> end mouseDown
>
> command trackDrag
>repeat while the mouse is "down"
>   put the screenMouseLoc into SML
>   set topLeft of this stack to item 1 of SML - item 1 of mLoc,\
>   item 2 of SML - item 2 of mLoc
>end repeat
> end trackDrag
>
> before mouseMove X,Y
>put X,Y into mLoc
>pass mouseMove
> end mouseMove
>
>
>
> I know there aren't a ton of people building stacks with custom
> windowShapes and appearances out there.  And while the above has been
> working for me for a while now, I'm still curious if anyone else has run
> into this and come up with an alternate solution.
>
>
> Thanks & Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
> ___
> use-livecode mailing list
> use-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: Extracting a reference to a stack

2015-08-08 Thread Mike Bonner
This may not do things in the required way, but..  If you have a library
stack with a function or command that just grabs the name of "this stack"
then you can dispatch or send the request to the object and POOF it'll tell
you what stack its on, no parsing necessary.

Just tried it here, and it works fine.

On Sat, Aug 8, 2015 at 7:03 PM, Richard Gaskin 
wrote:

> David Bovill wrote:
>
> > Yes - you're right. The long name is the only case and like you I
> > only use long ids in the use cases I have. Except when I store
> > references when I use the ruggedID handler of the IDE - that should
> > be a native reference I think?
>
> It would be nice to have an engine version of revRuggedID, or for that
> function definition to just be moved from revbackscriptlibrary to
> revcommonlibrary, since the latter is copied into every standalone so
> everyone would have it everywhere.
>
> In fact, since both of those libraries are now text-only stacks, anyone
> sufficiently motivated could make the move and submit a pull request in
> github.
>
>
> --
>  Richard Gaskin
>  Fourth World Systems
>  Software Design and Development for the Desktop, Mobile, and the Web
>  
>  ambassa...@fourthworld.comhttp://www.FourthWorld.com
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Reliable Custom Window Dragging in LC7?

2015-08-08 Thread Scott Rossi
Hi All:

Is anyone still making custom-shaped stacks out there that use scripts to
manage window dragging?

I've noticed for some time now that custom window drag routines which used
to work in all past versions of LiveCode now seem to be ineffective in
LC7.  For example, if you have a couple of stacks with custom windowShapes
and click/drag to reposition them, it takes LiveCode several cycles to
make the window active and catch up with the cursor position.  And when
the stack finally starts moving, it's position is way off from where the
click first occurred on the stack.

To work around this problem, I figured out a new dragging routine that
seems to work pretty reliably, but it relies on some tactics that have
been discouraged in the past, such tracking the screenMouseLoc and polling
the mouse state.  Here's the script I'm using (applied using a behavior):

local mLoc

before mouseDown
   trackDrag
end mouseDown

command trackDrag
   repeat while the mouse is "down"
  put the screenMouseLoc into SML
  set topLeft of this stack to item 1 of SML - item 1 of mLoc,\
  item 2 of SML - item 2 of mLoc
   end repeat
end trackDrag

before mouseMove X,Y
   put X,Y into mLoc
   pass mouseMove
end mouseMove



I know there aren't a ton of people building stacks with custom
windowShapes and appearances out there.  And while the above has been
working for me for a while now, I'm still curious if anyone else has run
into this and come up with an alternate solution.


Thanks & Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design



___
use-livecode mailing list
use-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: Emulate thumb drag on desktop

2015-08-08 Thread dunbarx
Hi.


Are you asking if there is a way to make the scroll of a field track the 
mouseLoc? If so, then you are right to use the "mouseMove" message, and scale 
the y-value of its included parameter to the vScroll of the field.


Or am I missing it?


Craig Newman



-Original Message-
From: Brahmanathaswami 
To: How to use LiveCode 
Sent: Sat, Aug 8, 2015 7:04 pm
Subject: Emulate thumb drag on desktop


To scroll a field on mobile I'm going to try this:

on createQuoteScroller
  
local tScrollerRect,tContentRect,sScrollerID
if environment() is not
"mobile" then exit createQuoteScroller
mobileControlCreate "scroller",
"quoteScroller"
put the result into sScrollerID
put the rect of fld
"quote" into tScrollerRect
put the topleft of fld "scrollMe" & "," & the
right of fld 
"scrollme"&","&( the top of fld "scrollme" + the formattedHeight
of fld 
"scrollme") into tContentRect
mobileControlSet "quoteScroller",
"rect", tScrollerRect
mobileControlSet "quoteScroller", "contentRect",
tContentRect
mobileControlSet "quoteScroller", "visible", true
   
mobileControlSet "quoteScroller", "scrollingEnabled", true
mobileControlSet
"quoteScroller", "vIndicator", true
mobileControlSet "quoteScroller",
"vscroll", 0
end createQuoteScroller

on scrollerDidScroll hOffset, vOffset

// When the user scrolls move the displayed content
set the vScroll of fld
"quote" to vOffset
end scrollerDidScroll

but how do we emulate this with the
mouse?

on mouseMove

end mouseMove

would seem to be our best tool

but
how to translate the mouseloc into vScroll of the field?

on mouseMove
   
put the mouseloc
end mouseMove

have to sleep on that one... but perhaps
someone else already build
this...

BR

___
use-livecode
mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Peter M. Brigham
On Aug 8, 2015, at 5:44 PM, Richmond wrote:

> executing at 12:43:43 AM
> TypeFunction: error in function handler
> ObjectBrigham
> Lineput wordOffsets("were", pText, true) into offList
> HintwordOffsets

Probably you didn't include the wordOffsets() handler from my post earlier 
today. Try it again with the utility functions available. See the post I sent 5 
minutes ago.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Peter M. Brigham
On Aug 8, 2015, at 6:41 PM, Richard Gaskin wrote:

> Richmond wrote:
> 
>> function findWere pText
>>   -- returns a comma-delim list of all the line offsets matching "were *ed"
>>   --or "were" && .
>>   put fld "WERBS" into pretList
>>   put wordOffsets("were", pText, true) into offList
> 
> Unless the build you're using a custom build, wouldn't that be "wordOffset" 
> (singular)?

I included the utility functions wordOffsets() and offsets() in one of my 
previous posts. I probably should have repeated them. I use them a lot -- there 
are many contexts in which they are useful.

function wordOffsets str, pContainer, matchWhole
   -- returns a comma-delimited list of all the wordOffsets of str in pContainer
   -- if matchWhole = true then only whole words are located
   --else will find word matches everywhere str is part of a word in 
pContainer
   --note that in LC words will include adjacent puncutation,
   --   so using matchWhole = true may exclude too many "words"
   -- duplicates are stripped out
   --eg wordOffsets("co","the common coconut") = 2,3   not   2,3,3
   -- note: to get the last wordOffset of a string in a container (often useful)
   --use "item -1 of wordOffsets(...)"
   -- by Peter M. Brigham, pmb...@gmail.com — freeware
   -- requires offsets()
   
   if matchWhole = empty then put false into matchWhole
   put offsets(str,pContainer) into offList
   if offList = 0 then return 0
   repeat for each item i in offList
  put the number of words of (char 1 to i of pContainer) into wdNbr
  if matchWhole then
 if word wdNbr of pContainer <> str then next repeat
  end if
  put 1 into A[wdNbr]
  -- using an array avoids duplicates
   end repeat
   put the keys of A into wordList
   sort lines of wordList ascending numeric
   replace cr with comma in wordList
   return wordList
end wordOffsets

function offsets str, pContainer
   -- returns a comma-delimited list of all the offsets of str in pContainer
   -- returns 0 if not found
   -- note: offsets("xx","xx") returns "1,3,5" not "1,2,3,4,5"
   -- ie, overlapping offsets are not counted
   -- note: to get the last occurrence of a string in a container (often useful)
   -- use "item -1 of offsets(...)"
   -- by Peter M. Brigham, pmb...@gmail.com — freeware
   
   if str is not in pContainer then return 0
   put 0 into startPoint
   repeat
  put offset(str,pContainer,startPoint) into thisOffset
  if thisOffset = 0 then exit repeat
  add thisOffset to startPoint
  put startPoint & comma after offsetList
  add length(str)-1 to startPoint
   end repeat
   return item 1 to -1 of offsetList -- delete trailing comma
end offsets

> Also, if you're using v7 you might consider "trueWordOffset", which accounts 
> for quote characters and omits punctuation that characterize the historic 
> definition of "word" in xTalks.
> 
> The Unicode libraries in v7 make many natural-language parsing tasks much 
> simpler - there's even a new "sentence" chunk type.

Yes, with newer versions the engine now does stuff that required scripted 
functions in earlier LC versions. I'm still not using later versions because my 
work stacks don't run in them properly, so I have all these utility functions 
in my library.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig



___
use-livecode mailing list
use-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: Visual Effects on Mobile

2015-08-08 Thread Scott Rossi
I believe curl and flip are the only visual effects that are exclusive to
mobile (iOS only?), while the others should work.  I know for a fact that
push and wipe work fine, as I use these in mobile stacks, combined with
limiting transitions to defined rects:

  lock screen for visual effect in rect (rect of grc 1)

It would be easy enough for you to create a basic test stack and run it in
the simulator or on a device.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 8/8/15, 7:14 PM, "Brahmanathaswami"  wrote:

>The only visual effect I really think works in most scenarios is
>dissolve  at least for my use case... having things flip, or move wipe
>down etc... all very distracting.
>
>but the Dictionary indicates that only scroll and reveal work on iOS and
>Android.
>
>But I have seen apps in iOS that have many other transitions.  And
>Android also has a robust transition API
>
>https://developer.android.com/reference/android/transition/TransitionValue
>s.html
>
>Are scroll and reveal *really* the only two available to us via Livecode?
>
>BR
>
>___
>use-livecode mailing list
>use-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: Local Path for Mobile

2015-08-08 Thread Brahmanathaswami

Can you share that function?

i could guess what it is... but why re-invent the wheel?




Ralph DiMola wrote:

I have a function "TheEngineFolder" that returns the engine folder on mobile 
and the location of the included assets when in the IDE. This allows testing using the 
same code.



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


Visual Effects on Mobile

2015-08-08 Thread Brahmanathaswami
The only visual effect I really think works in most scenarios is 
dissolve  at least for my use case... having things flip, or move wipe 
down etc... all very distracting.


but the Dictionary indicates that only scroll and reveal work on iOS and 
Android.


But I have seen apps in iOS that have many other transitions.  And 
Android also has a robust transition API


https://developer.android.com/reference/android/transition/TransitionValues.html

Are scroll and reveal *really* the only two available to us via Livecode?

BR

___
use-livecode mailing list
use-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: Extracting a reference to a stack

2015-08-08 Thread Richard Gaskin

David Bovill wrote:

> Yes - you're right. The long name is the only case and like you I
> only use long ids in the use cases I have. Except when I store
> references when I use the ruggedID handler of the IDE - that should
> be a native reference I think?

It would be nice to have an engine version of revRuggedID, or for that 
function definition to just be moved from revbackscriptlibrary to 
revcommonlibrary, since the latter is copied into every standalone so 
everyone would have it everywhere.


In fact, since both of those libraries are now text-only stacks, anyone 
sufficiently motivated could make the move and submit a pull request in 
github.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

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


Re: Extracting a reference to a stack

2015-08-08 Thread David Bovill
Yes - you're right. The long name is the only case and like you I only use
long ids in the use cases I have. Except when I store references when I use
the ruggedID handler of the IDE - that should be a native reference I think?

On Sunday, August 9, 2015, Richard Gaskin 
wrote:

> David Bovill wrote:
>
> > Richard Gaskin wrote:
> > >> function ObjectStack pObj
> > >>return char (offset(" of stack ", pObj)+4) to -1 of pObj
> > >> end ObjectStack
> >
> > The test case would be "this is a stack of rubish" as a substack -
> > that would break your code?
>
> It would have to be "this is a of stack of rubbish" - but even then it
> wouldn't break since the long ID of the object would be:
>
>   button id 1003 of card id 1002 of stack "this is of stack of rubbish"
>   of stack "/Users/t/Desktop/stack.livecode"
>
> ...in which the first occurrence of " of stack " is the one we want.
>
> We could break it by changing the use case: instead of requiring long IDs
> (I rarely anything else) we might pass in a long name, in which a button
> might have a name that includes " of stack ".
>
> But as soon as we allow other forms of object references to be passed in
> we're probably going to want to convert those to long IDs anyway.  And
> since we can't guarantee the object reference is valid we'd probably need
> to add a try structure there as well:
>
> function ObjectStack pObj
>try
>  put the long id of pObj into pObj
>catch tErr
>  throw "Error in call to ObjectStack: invalid object reference"
>end try
>return char (offset(" of stack ", pObj)+4) to -1 of pObj
> end ObjectStack
>
> Any other edge cases that should be accounted for?
>
> --
>  Richard Gaskin
>  Fourth World Systems
>  Software Design and Development for the Desktop, Mobile, and the Web
>  
>  ambassa...@fourthworld.comhttp://www.FourthWorld.com
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Extracting a reference to a stack

2015-08-08 Thread Richard Gaskin

David Bovill wrote:

> Richard Gaskin wrote:
> >> function ObjectStack pObj
> >>return char (offset(" of stack ", pObj)+4) to -1 of pObj
> >> end ObjectStack
>
> The test case would be "this is a stack of rubish" as a substack -
> that would break your code?

It would have to be "this is a of stack of rubbish" - but even then it 
wouldn't break since the long ID of the object would be:


  button id 1003 of card id 1002 of stack "this is of stack of rubbish"
  of stack "/Users/t/Desktop/stack.livecode"

...in which the first occurrence of " of stack " is the one we want.

We could break it by changing the use case: instead of requiring long 
IDs (I rarely anything else) we might pass in a long name, in which a 
button might have a name that includes " of stack ".


But as soon as we allow other forms of object references to be passed in 
we're probably going to want to convert those to long IDs anyway.  And 
since we can't guarantee the object reference is valid we'd probably 
need to add a try structure there as well:


function ObjectStack pObj
   try
 put the long id of pObj into pObj
   catch tErr
 throw "Error in call to ObjectStack: invalid object reference"
   end try
   return char (offset(" of stack ", pObj)+4) to -1 of pObj
end ObjectStack

Any other edge cases that should be accounted for?

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

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


Making a browser smaller

2015-08-08 Thread David Bovill
I've a web site that I want to make smaller in Livecode. In Chrome or
Firefox I can shrink the browser view using Zoom In / Zoom Out. In Livecode
we have "revBrowserMakeTextSmaller" - but this only shrinks the text.

Any CSS or other tricks to zoom / shrink an entire web site? I guess not -
just hoping :)
___
use-livecode mailing list
use-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: Extracting a reference to a stack

2015-08-08 Thread David Bovill
The test case would be "this is a stack of rubish" as a substack - that
would break your code?

On 9 August 2015 at 00:59, Richard Gaskin 
wrote:

> Thierry Douez wrote:
>
> >> Yep - and being a lazy person this is how I get the stack reference:
> >>
> >> function ObjectStack pObj
> >>return char (offset(" of stack ", pObj)+4) to -1 of pObj
> >> end ObjectStack
> >
> > Not always beneficial to be lazy :)
> >
> > I tried your code with the long ID I gave previously
> > without success.
>
> Which one?
>
> I found this one in a message from you earlier today:
>--button id 1003 of card id 1002 of stack "stack 2"
>--of stack "/Users/t/Desktop/stack.livecode"
> 
>
> When I pass that to the function shown above I get:
>
>   stack "stack 2" of stack "/Users/t/Desktop/stack.livecode"
>
> What did you get?
>
> Or was there another object long ID in this thread I'd missed?
>
> --
>  Richard Gaskin
>  Fourth World Systems
>  Software Design and Development for the Desktop, Mobile, and the Web
>  
>  ambassa...@fourthworld.comhttp://www.FourthWorld.com
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Extracting a reference to a stack

2015-08-08 Thread Richard Gaskin

Thierry Douez wrote:

>> Yep - and being a lazy person this is how I get the stack reference:
>>
>> function ObjectStack pObj
>>return char (offset(" of stack ", pObj)+4) to -1 of pObj
>> end ObjectStack
>
> Not always beneficial to be lazy :)
>
> I tried your code with the long ID I gave previously
> without success.

Which one?

I found this one in a message from you earlier today:
   --button id 1003 of card id 1002 of stack "stack 2"
   --of stack "/Users/t/Desktop/stack.livecode"


When I pass that to the function shown above I get:

  stack "stack 2" of stack "/Users/t/Desktop/stack.livecode"

What did you get?

Or was there another object long ID in this thread I'd missed?

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

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


Re: Extracting a reference to a stack

2015-08-08 Thread J. Landman Gay

On 8/8/2015 6:20 PM, David Bovill wrote:

the new offset feature (which I think is the
feature I remember).


The offset feature hasn't changed, but you may be thinking of the 
itemDelimiter, which in LC 7 can be more than one character.


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

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


Re: Jane Austen's peculiarity

2015-08-08 Thread Alex Tweedly
I think I'd agree that a conditional clause should be equired (could it 
be any of 'if', 'unless', 'whether', ...)?


Otherwise, you'd be finding false positives like:

I gave two shillings to my brother and last night they _were returned_ 
to me.


-- Alex.

On 08/08/2015 20:56, Paul Looney wrote:

Richmond,

The key here is the “if” - which creates a conditional clause - which requires the 
past plural of the verb (in this case “were”). This is similar to the “wenn" 
clause in German (Deutsch) and the “ut” clause in Latin.
If I were able, I’d thank you in person for mentioning this.

Paul Looney


On Aug 8, 2015, at 9:42 AM, Richmond  wrote:

Jane Austen [amongst others] uses an interesting type of grammatical 
construction of this sort:

After breakfast, the girls walked to Meryton to inquire if Mr. Wickham
_were returned_, and to lament over his absence from the Netherfield ball.

Pride and Prejudice.

I would like to analyse a million word corpus that I have been granted access 
to for this type of construction.

However, I don't want to find examples of only 'were returned', but all 
examples of

were + infinitive / preterite / past participle

and, presumably for that I shall have to use wildcards . . .

OR ???

Richmond.
___
use-livecode mailing list
use-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: [OT-ish] naming a MeetUp group

2015-08-08 Thread Colin Holgate
I progressed with the Meetup page. I settled on:

NYC High Level App Development Tools Meetup

that covers desktop and mobile. I didn’t go for rapid development because apps 
take a long time to develop, even if the coding part is made easier. It’s 
generally not rapid.

I can’t see how to edit my description, and now that I see the mock up page, 
the description doesn’t all fit. Here’s what I wrote:

"Objective-C and Java are scary! Even Swift needs a deep understanding of how 
Xcode works. But, life doesn't have to be like that. There are several 
authoring tools that can develop apps using graphics to achieve a lot of the 
needs, and more understandable programming languages to do the coding. If you 
ever go to Meetups because you have an idea for an app, but you find yourself 
being completely confused by the technicalities of the presentation, you should 
come to this Meetup instead!”

The “n” of ‘presentation’ is where it gets cut off.

The costs are $10 if you expect 50 members and four organizers, or $15 for 
unlimited. Clearly unlimited is the better deal, if you’re an optimist.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: [OT-ish] naming a MeetUp group

2015-08-08 Thread Richard Gaskin

Colin Holgate wrote:
> Can you say something about the costs of running a Meetup group?

It's not cheap but affordable, and worth every penny.   Meetup.com has 
become the go-to place folks use the most when looking for events like 
yours.


In our Linux group we took up a collection among members and got enough 
in one meeting to cover the costs for two years.



> The point is to give the non-coders some hope.

You may enjoy this:

Steve Blank: Why Founders Should Learn How To Code
Coding, he says, is the backbone of any mobile startup


LiveCode is the perfect answer for everything that article describes, 
allowing people with domain expertise to put that knowledge into action.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

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


Re: Extracting a reference to a stack

2015-08-08 Thread Thierry Douez
> Yep - and being a lazy person this is how I get the stack reference:
>
> function ObjectStack pObj
>return char (offset(" of stack ", pObj)+4) to -1 of pObj
> end ObjectStack
>

Not always beneficial to be lazy :)

I tried your code with the long ID I gave previously
without success.

Regards,

Thierry



Thierry Douez - http://sunny-tdz.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: Extracting a reference to a stack

2015-08-08 Thread David Bovill
Wow - lot's of cool examples. Richards is one of the shortest - but breaks
theoretically if a stack is named weirdly. Thierry gets the nerdy award,
and mark for digging up the new offset feature (which I think is the
feature I remember).

By the way one of the most puzzling aspects of software conventions is to
publish your documentation as pdf's - presumably so you can print the
things. Can we not have the Livecode release notes published as searchable
HTML - or has someone rescued this valuable archive from this historical
lunacy already? As in do I really have to manually read through all these
pdf's to find this feature documented, or perhaps import them to Evernote,
or

Back to the mission of perfecting the stack_Object of a control - I seem to
remember it had something to do with tokens or a newer equivalent -
combining that with Marks remembrance we have:

   put the long name of control "this is a stack of rubbish" into
> someControl
>set the wholematches to true
>put word (wordOffset ("stack", someControl)) to -1 of someControl
>

the new feature is tokenoffset - but it does not seem to work. wordofffset
will do the job as it ignores anything that is quoted (this surprised me).


On 8 August 2015 at 23:51, Richard Gaskin 
wrote:

> dunbarx wrote:
>
> Wait just a doggone minute. The long id of a control contains the stack
>> reference.
>>
>
> Yep - and being a lazy person this is how I get the stack reference:
>
> function ObjectStack pObj
>return char (offset(" of stack ", pObj)+4) to -1 of pObj
> end ObjectStack
>
> --
>  Richard Gaskin
>  Fourth World Systems
>  Software Design and Development for the Desktop, Mobile, and the Web
>  
>  ambassa...@fourthworld.comhttp://www.FourthWorld.com
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Emulate thumb drag on desktop

2015-08-08 Thread Mike Bonner
To do it with this method, the traversal of the field needs to be off.
(though this can probably be worked around)

Put this script into the field.

local sMouseLoc
on mouseDown
   put the mouseloc into sMouseLoc
   setScroll
end mouseDown

on setScroll
   if the mouse is down then
  lock screen
  if item 1 of sMouseLoc > item 1 of the mouseloc then
 set the hscroll of me to the hscroll of me - (item 1 of the
mouseloc - item 1 of sMouseLoc)
  else
 set the hscroll of me to the hscroll of me + (item 1 of sMouseLoc
- item 1 of the mouseloc)

  end if

  if item 2 of sMouseLoc > item 2 of the mouseloc then
 set the vscroll of me to the vscroll of me - (item 2 of the
mouseloc - item 2 of sMouseLoc)
  else
 set the vscroll of me to the vscroll of me + (item 2 of sMouseLoc
- item 2 of the mouseloc)

  end if
  put the mouseloc into sMouseLoc
  send setScroll to me in 50 millisec
  unlock screen
   else
  put empty into sMouseLoc
   end if
end setScroll




On Sat, Aug 8, 2015 at 5:04 PM, Brahmanathaswami  wrote:

> To scroll a field on mobile I'm going to try this:
>
> on createQuoteScroller
>local tScrollerRect,tContentRect,sScrollerID
>if environment() is not "mobile" then exit createQuoteScroller
>mobileControlCreate "scroller", "quoteScroller"
>put the result into sScrollerID
>put the rect of fld "quote" into tScrollerRect
>put the topleft of fld "scrollMe" & "," & the right of fld
> "scrollme"&","&( the top of fld "scrollme" + the formattedHeight of fld
> "scrollme") into tContentRect
>mobileControlSet "quoteScroller", "rect", tScrollerRect
>mobileControlSet "quoteScroller", "contentRect", tContentRect
>mobileControlSet "quoteScroller", "visible", true
>mobileControlSet "quoteScroller", "scrollingEnabled", true
>mobileControlSet "quoteScroller", "vIndicator", true
>mobileControlSet "quoteScroller", "vscroll", 0
> end createQuoteScroller
>
> on scrollerDidScroll hOffset, vOffset
>// When the user scrolls move the displayed content
>set the vScroll of fld "quote" to vOffset
> end scrollerDidScroll
>
> but how do we emulate this with the mouse?
>
> on mouseMove
>
> end mouseMove
>
> would seem to be our best tool
>
> but how to translate the mouseloc into vScroll of the field?
>
> on mouseMove
>put the mouseloc
> end mouseMove
>
> have to sleep on that one... but perhaps someone else already build this...
>
> BR
>
> ___
> use-livecode mailing list
> use-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: Local Path for Mobile

2015-08-08 Thread Ralph DiMola
The specialFolderPath() has many more options. I later versions (post 5.5?)
there are 2 short cuts also. These folders are common for both mobile
platforms. IOS has a few more.

specialFolderPath("engine") = the engine folder.
specialFolderPath("documents") = the documents folder.
specialFolderPath("cache") = No equivalent.
specialFolderPath("resources") = No equivalent.



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

-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
Of Colin Holgate
Sent: Saturday, August 08, 2015 6:29 PM
To: How to use LiveCode
Subject: Re: Local Path for Mobile

The function Ralph alludes to is specialFolderPath(). 

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


Emulate thumb drag on desktop

2015-08-08 Thread Brahmanathaswami

To scroll a field on mobile I'm going to try this:

on createQuoteScroller
   local tScrollerRect,tContentRect,sScrollerID
   if environment() is not "mobile" then exit createQuoteScroller
   mobileControlCreate "scroller", "quoteScroller"
   put the result into sScrollerID
   put the rect of fld "quote" into tScrollerRect
   put the topleft of fld "scrollMe" & "," & the right of fld 
"scrollme"&","&( the top of fld "scrollme" + the formattedHeight of fld 
"scrollme") into tContentRect

   mobileControlSet "quoteScroller", "rect", tScrollerRect
   mobileControlSet "quoteScroller", "contentRect", tContentRect
   mobileControlSet "quoteScroller", "visible", true
   mobileControlSet "quoteScroller", "scrollingEnabled", true
   mobileControlSet "quoteScroller", "vIndicator", true
   mobileControlSet "quoteScroller", "vscroll", 0
end createQuoteScroller

on scrollerDidScroll hOffset, vOffset
   // When the user scrolls move the displayed content
   set the vScroll of fld "quote" to vOffset
end scrollerDidScroll

but how do we emulate this with the mouse?

on mouseMove

end mouseMove

would seem to be our best tool

but how to translate the mouseloc into vScroll of the field?

on mouseMove
   put the mouseloc
end mouseMove

have to sleep on that one... but perhaps someone else already build this...

BR

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


Re: [OT-ish] naming a MeetUp group

2015-08-08 Thread Colin Holgate
Thanks for the “Swift” reply!

Can you say something about the costs of running a Meetup group?

I do think the presentations would range from Swift, Javascript, and 
TypeScript, at the low end, and not a line of code typed all night 
presentations at the high end. The target audience would be both coders who are 
looking for work, and non-coders who get confused at the many coding Meetups. 
The point is to give the non-coders some hope.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: [OT-ish] naming a MeetUp group

2015-08-08 Thread Richard Gaskin

Colin Holgate wrote:
> I attend a programming user group that has gotten more and more quiet
> over the years. Sometimes nobody shows up! We’ve been wondering
> whether to change it to be a Meetup group instead

Yes and double yes!  Once our local Linux group opened a Meetup page 
attendance has steadily grown and the whole planning process is much easier.


I'll be putting one together for our SoCal LiveCode group soon.

Meetup nailed that task beautifully.


> My thought is to make the topic be broader than it is now, and
> different to other MeetUps that already exist. There are lots of
> programming and app development meetings, but they all tend to get
> a  bit low level and geeky. Perhaps there would be interest in
> talking about higher level tools such as LiveCode?
>
> In naming a group they encourage you to say where it is, and that
> it’s a Meetup. Best I can come up with so far is:
>
> "NYC High Level Software Development Tools Meetup”
>
> Bit wordy, but how else do you describe LiveCode and other tools that
> are a long way from Java and Objective-C?
>
> I might make it be:
>
> "NYC High Level Mobile Development Tools Meetup”
>
> even if we might cover desktop and browser applications, just because
> “mobile” is more popular right now.
>
> Any suggestions about the name would be great, thanks.

Have you considered something that includes "Rapid App Development" 
rather than "High Level"?


I find that the distinction between high- and low-level languages is 
most readily appreciated by users of low-level languages.  Maybe "Rapid 
Development" may provide the focus you're looking for, and also give you 
some wiggle room if you wind up having a presentation about 
middle-of-the-road languages like Swift now and then.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

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

[OT-ish] naming a MeetUp group

2015-08-08 Thread Colin Holgate
I attend a programming user group that has gotten more and more quiet over the 
years. Sometimes nobody shows up! We’ve been wondering whether to change it to 
be a Meetup group instead, which has the advantages of knowing how many people 
will come, and some have a pre-pay $5 system, so if nobody shows up, at least 
the group covered the costs of the meeting.

My thought is to make the topic be broader than it is now, and different to 
other MeetUps that already exist. There are lots of programming and app 
development meetings, but they all tend to get a bit low level and geeky. 
Perhaps there would be interest in talking about higher level tools such as 
LiveCode?

In naming a group they encourage you to say where it is, and that it’s a 
Meetup. Best I can come up with so far is:

"NYC High Level Software Development Tools Meetup”

Bit wordy, but how else do you describe LiveCode and other tools that are a 
long way from Java and Objective-C?

I might make it be:

"NYC High Level Mobile Development Tools Meetup”

even if we might cover desktop and browser applications, just because “mobile” 
is more popular right now.

Any suggestions about the name would be great, thanks.



___
use-livecode mailing list
use-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: Extracting a reference to a stack

2015-08-08 Thread Richard Gaskin

dunbarx wrote:


Wait just a doggone minute. The long id of a control contains the stack 
reference.


Yep - and being a lazy person this is how I get the stack reference:

function ObjectStack pObj
   return char (offset(" of stack ", pObj)+4) to -1 of pObj
end ObjectStack

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

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


Re: Jane Austen's peculiarity

2015-08-08 Thread Richard Gaskin

Richmond wrote:


function findWere pText
   -- returns a comma-delim list of all the line offsets matching "were *ed"
   --or "were" && .
   put fld "WERBS" into pretList
   put wordOffsets("were", pText, true) into offList


Unless the build you're using a custom build, wouldn't that be 
"wordOffset" (singular)?


Also, if you're using v7 you might consider "trueWordOffset", which 
accounts for quote characters and omits punctuation that characterize 
the historic definition of "word" in xTalks.


The Unicode libraries in v7 make many natural-language parsing tasks 
much simpler - there's even a new "sentence" chunk type.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

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


Re: Local Path for Mobile

2015-08-08 Thread Colin Holgate
The function Ralph alludes to is specialFolderPath(). 

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


LiveCode-bijeenkomst September 2015 / LiveCode Meeting September 2015

2015-08-08 Thread Mark Schonewille
*** LiveCode-bijeenkomst September 2015 ***

(see below for English version)

Het is alweer bijna een jaar geleden, dat we elkaar hebben ontmoet. Het wordt 
dus de hoogste tijd, dat we elkaar weer eens treffen. Ik heb daarom het plan 
opgevat na de vakantie weer eens een LiveCode-bijeenkomst te organiseren.

Om de interesse te pijlen, wil ik je vragen het volgende vragenformulier in te 
vullen:

https://nl.surveymonkey.com/s/8BZTJGJ

Het formulier heeft 10 vragen en duurt slechts enkele minuten.

De vragen over Arduino hebben te maken met het feit dat we nu twee of drie 
mensen hebben die iets met Arduino doen. Wellicht is het interessant om niet 
alleen een demo te bekijken maar ook zelf aan de slag te gaan in aan 
Arduino-workshop. Ik wil graag eens kijken of dat mogelijk is.

Ik zal over ongeveer twee weken nog eens vragen welke dag jou het beste 
uitkomt. Op basis daarvan kiezen we een definitieve datum for the bijeenkomst.


*** LiveCode Meeting September 2015 ***


Our last meeting is almost a year ago. It is time to meet again! I am currently 
planning to have another LiveCode meeting after summer holidays.

To get an indication of how many people may beinterested in a meeting, I'd like 
to ask you to fill out the following form:

https://nl.surveymonkey.com/s/8BZTJGJ

The form has 10 questions and takes no more than a few minutes.

The questions about Arduino are related to the fact that we have two people 
dealing with Arduino now. It may be interesting to not only watch a demo but 
actively participate in an Arduino workshop. I would like to know the potential 
to organise this.

In about two weeks, I will ask you again which day suits you best. We will use 
that info to choose the definite date for the meeting.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour 
spaces. http://www.color-converter.com

We have time for new software development projects. Contact me for a quote.







___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Richmond

Oddly enough this does NOT seem to be a problem with my counters.

If I reorder my verbList the stack still only finds text bits with 'found'.

Retyping the list (rather than importing it from RTF) the first 
occurrence of the first verb in the list results.


There seems to be a problem with the way LibreOffice encodes RTF, and 
then another problem inwith my script.


However if one imports a text file and says: set the text of fld "TEKST" 
to  URL ("file:" & it)


nothing works at all when an analysis is attempted.

Richmond.



___
use-livecode mailing list
use-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: Local Path for Mobile

2015-08-08 Thread Ralph DiMola
File in the stack are in "the engine folder" and it's sub folders. This is read 
only.

You can store files in "the documents folder".

Check the docs for other folder options. 

I have a function "TheEngineFolder" that returns the engine folder on mobile 
and the location of the included assets when in the IDE. This allows testing 
using the same code. 




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



 Original message From: Brahmanathaswami 
 Date:08/08/2015  18:04  (GMT-05:00) 
To: How to use LiveCode  
Subject: Local Path for Mobile 
Complete mobile newbie here... will be coming with my begging bowl out  
a lot in the days to come.


Is this good for mobile also?

function localPath
put the effective filename of this stack into tPath
set the itemdel to "/"
delete item -1 of tPath
put "/" after tPath
return tPath
end localPath

where we need to reference images, icons, text files and other data..

we can fetch things  with

set the defaultfolder to (localPath() &"img/icons")
put the files


BR

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

Local Path for Mobile

2015-08-08 Thread Brahmanathaswami
Complete mobile newbie here... will be coming with my begging bowl out  
a lot in the days to come.



Is this good for mobile also?

function localPath
   put the effective filename of this stack into tPath
   set the itemdel to "/"
   delete item -1 of tPath
   put "/" after tPath
   return tPath
end localPath

where we need to reference images, icons, text files and other data..

we can fetch things  with

set the defaultfolder to (localPath() &"img/icons")
put the files


BR

___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Richmond

on mouseUp
   put fld "TEKST" into TEKST
   put fld "WERBS" into WERBS
  put findWere(TEKST) into linesList
  repeat for each item i in linesList
put line i of TEKST & cr after relevantLines
  end repeat
  put char 1 to -2 of relevantLines into fld "COOKED"
end mouseUp

function findWere pText
  -- returns a comma-delim list of all the line offsets matching "were *ed"
  --or "were" && .
  put fld "WERBS" into pretList
  put wordOffsets("were", pText, true) into offList
  repeat for each item w in offList
 put word w+1 of pText into testWord
 if testWord ends with "ed" or testWord is among the words of 
pretList then
put (the number of lines of word 1 to w of pText) & comma after 
outList

 end if
  end repeat
  return char 1 to -2 of outList
  end findWere


 executing at 12:43:43 AM
TypeFunction: error in function handler
ObjectBrigham
Lineput wordOffsets("were", pText, true) into offList
HintwordOffsets

Something either I don't understand (obviously your 'Logic' and my 
'Logic' are not sitting well together).


Richmond.

___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Richmond

On 09/08/15 00:26, Peter M. Brigham wrote:

On Aug 8, 2015, at 4:51 PM, Richmond wrote:


On 08/08/15 23:33, Peter M. Brigham wrote:



Missing an "of" in the two lines above:
put line textLine *of* $TEKST into line cookedLine of fld "COOKED" etc
Don't know if that's the problem.




Your script logic seems unnecessarily complex. Since it looks as if only the 
last occurrence is ending up in the output field, instead of using a counter to 
keep track of the next line in the field, you could just
put cr & line textLine of $TEKST after fld "COOKED"
But once again, loading a line into a field repeatedly will be much slower than 
putting it into a variable in the repeat loop and then  putting the variable 
into the field just once when the repeat is done. Getting or putting something 
from or into a field is much slower than doing the same in a variable, so just 
do it once.

Also, I can see no reason to be loading your data into system variables, which is what 
"$WERBS" etc is defining. The only reason to put something into a variable beginning with 
"$" is if you want some other system process besides LC to be able to access the data.

-- Peter



Well, as per your suggestion I did this:

on mouseUp
   put 1 into textLine
   put fld "WERBS" into WERBS
   put fld "TEKST" into TEKST
   repeat until line textLine of TEKST contains "finalSolution666"
  put textLine into fld "KOUNT"
  put 1 into verbLine
  repeat until line verbLine of WERBS is empty
 put line textLine of TEKST into fld "LYNE"
 put line verbLine of WERBS into WERB
 put "were" && WERB into FRAZE
 put FRAZE into fld "FRAZE"
 if line textLine of TEKST contains FRAZE then
if fld "COOKED" is empty then
   put line textLine of TEKST after fld "COOKED"
-- this is here so that line 1 of fld "COOKED" does not end up 
empty
   else
  put cr & line textLine of TEKST after fld "COOKED"
  end if
 end if
 add 1 to verbLine
  end repeat
  add 1 to textLine
   end repeat
end mouseUp

but still get only the last value.

Well, your logic still makes my head hurt, too many counters.


My logic is based on the belief that one has to keep count of the lines 
in the Ur-text, the verb list, and the output field.


It is also derived from a program I wrote to make concordances in PASCAL 
in 1985.


The idea of using a carriage-return is very useful (haven't actually 
thought about those since my BA, as typed all my work on an Olivetti

portable which my Mum was given by her Mum and Dad for her 21st birthday).


  Here's what I'd do, using a variant of my original function since it appears 
that you want to list the lines the relevant phrases occur in, not just the 
isolated phrases.


Isolated phrases are not much use for subsequent analysis; i.e. to see 
which collocations they occur in, context, and so on.




function findWere pText
   -- returns a comma-delim list of all the line offsets matching "were *ed"
   --or "were" && .
   put fld "WERBS" into pretList
   put wordOffsets("were", pText, true) into offList
   repeat for each item w in offList
  put word w+1 of pText into testWord
  if testWord ends with "ed" or testWord is among the words of pretList then
 put (the number of lines of word 1 to w of pText) & comma after outList
  end if
   end repeat
   return char 1 to -2 of outList
end if

then:

on mouseup
   put fld "TEKXT" into tText
   put findWere(tText) into linesList
   repeat for each item i in linesList
 put line i of tText & cr after relevantLines
   end repeat
   put char 1 to -2 of relevantLines into fld "COOKED"
end mouseup

Untested, but you get the idea.


I do.

Thanks.

I shall put your code in another button and see what happens.



-- Peter




Richmond.

___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Peter M. Brigham
On Aug 8, 2015, at 4:51 PM, Richmond wrote:

> On 08/08/15 23:33, Peter M. Brigham wrote:
> 
> 
>> Missing an "of" in the two lines above:
>>put line textLine *of* $TEKST into line cookedLine of fld "COOKED" etc
>> Don't know if that's the problem.
> 
> 
> 
>> Your script logic seems unnecessarily complex. Since it looks as if only the 
>> last occurrence is ending up in the output field, instead of using a counter 
>> to keep track of the next line in the field, you could just
>>put cr & line textLine of $TEKST after fld "COOKED"
>> But once again, loading a line into a field repeatedly will be much slower 
>> than putting it into a variable in the repeat loop and then  putting the 
>> variable into the field just once when the repeat is done. Getting or 
>> putting something from or into a field is much slower than doing the same in 
>> a variable, so just do it once.
>> 
>> Also, I can see no reason to be loading your data into system variables, 
>> which is what "$WERBS" etc is defining. The only reason to put something 
>> into a variable beginning with "$" is if you want some other system process 
>> besides LC to be able to access the data.
>> 
>> -- Peter
>> 
>> 
> 
> Well, as per your suggestion I did this:
> 
> on mouseUp
>   put 1 into textLine
>   put fld "WERBS" into WERBS
>   put fld "TEKST" into TEKST
>   repeat until line textLine of TEKST contains "finalSolution666"
>  put textLine into fld "KOUNT"
>  put 1 into verbLine
>  repeat until line verbLine of WERBS is empty
> put line textLine of TEKST into fld "LYNE"
> put line verbLine of WERBS into WERB
> put "were" && WERB into FRAZE
> put FRAZE into fld "FRAZE"
> if line textLine of TEKST contains FRAZE then
>if fld "COOKED" is empty then
>   put line textLine of TEKST after fld "COOKED"
>-- this is here so that line 1 of fld "COOKED" does not end up 
> empty
>   else
>  put cr & line textLine of TEKST after fld "COOKED"
>  end if
> end if
> add 1 to verbLine
>  end repeat
>  add 1 to textLine
>   end repeat
> end mouseUp
> 
> but still get only the last value.

Well, your logic still makes my head hurt, too many counters. Here's what I'd 
do, using a variant of my original function since it appears that you want to 
list the lines the relevant phrases occur in, not just the isolated phrases.

function findWere pText
  -- returns a comma-delim list of all the line offsets matching "were *ed"
  --or "were" && .
  put fld "WERBS" into pretList
  put wordOffsets("were", pText, true) into offList
  repeat for each item w in offList
 put word w+1 of pText into testWord
 if testWord ends with "ed" or testWord is among the words of pretList then
put (the number of lines of word 1 to w of pText) & comma after outList
 end if
  end repeat
  return char 1 to -2 of outList
end if

then:

on mouseup
  put fld "TEKXT" into tText
  put findWere(tText) into linesList
  repeat for each item i in linesList
put line i of tText & cr after relevantLines
  end repeat
  put char 1 to -2 of relevantLines into fld "COOKED"
end mouseup

Untested, but you get the idea.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-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: English usage [OT] (used to be "Re: Jane Austen's peculiarity")

2015-08-08 Thread Richmond

On 08/08/15 23:59, Peter M. Brigham wrote:

On Aug 8, 2015, at 4:44 PM, Richmond wrote:


On 08/08/15 23:23, Paul Looney wrote:

In your last example:

"Mr. Rushworth _was returned_”

“was returned” (singular, past tense, passive)

I'm not sure if that is a passive, or an older form of the past perfect (= had 
returned) ???

I believe that with verbs relating to motion and location, the old past tense was not "has returned" but "is returned." 
"He has come home" is modern English, it used to be "He is come home." The old usage survives in modern French: 
"Il est venu," rather than "Il a venu." I agree that it's not passive, just an old auxiliary verb.

-- Peter




That is extremely useful: I shall pass that onto my wife (she's the 
Linguist-qua-Linguist: I just have an MA from SIUC in the subject - a 
dabbler),

as she will be very pleased with that.

Thank you.

Richmond.

___
use-livecode mailing list
use-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: English usage [OT] (used to be "Re: Jane Austen's peculiarity")

2015-08-08 Thread Peter M. Brigham
On Aug 8, 2015, at 4:44 PM, Richmond wrote:

> On 08/08/15 23:23, Paul Looney wrote:
>> In your last example:
>> 
>> "Mr. Rushworth _was returned_”
>> 
>> “was returned” (singular, past tense, passive)
> 
> I'm not sure if that is a passive, or an older form of the past perfect (= 
> had returned) ???

I believe that with verbs relating to motion and location, the old past tense 
was not "has returned" but "is returned." "He has come home" is modern English, 
it used to be "He is come home." The old usage survives in modern French: "Il 
est venu," rather than "Il a venu." I agree that it's not passive, just an old 
auxiliary verb.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Richmond

On 08/08/15 23:33, Peter M. Brigham wrote:



Missing an "of" in the two lines above:
put line textLine *of* $TEKST into line cookedLine of fld "COOKED" etc
Don't know if that's the problem.





Your script logic seems unnecessarily complex. Since it looks as if only the 
last occurrence is ending up in the output field, instead of using a counter to 
keep track of the next line in the field, you could just
put cr & line textLine of $TEKST after fld "COOKED"
But once again, loading a line into a field repeatedly will be much slower than 
putting it into a variable in the repeat loop and then  putting the variable 
into the field just once when the repeat is done. Getting or putting something 
from or into a field is much slower than doing the same in a variable, so just 
do it once.

Also, I can see no reason to be loading your data into system variables, which is what 
"$WERBS" etc is defining. The only reason to put something into a variable beginning with 
"$" is if you want some other system process besides LC to be able to access the data.

-- Peter




Well, as per your suggestion I did this:

on mouseUp
   put 1 into textLine
   put fld "WERBS" into WERBS
   put fld "TEKST" into TEKST
   repeat until line textLine of TEKST contains "finalSolution666"
  put textLine into fld "KOUNT"
  put 1 into verbLine
  repeat until line verbLine of WERBS is empty
 put line textLine of TEKST into fld "LYNE"
 put line verbLine of WERBS into WERB
 put "were" && WERB into FRAZE
 put FRAZE into fld "FRAZE"
 if line textLine of TEKST contains FRAZE then
if fld "COOKED" is empty then
   put line textLine of TEKST after fld "COOKED"
-- this is here so that line 1 of fld "COOKED" does not 
end up empty

   else
  put cr & line textLine of TEKST after fld "COOKED"
  end if
 end if
 add 1 to verbLine
  end repeat
  add 1 to textLine
   end repeat
end mouseUp

but still get only the last value.

Richmond.

___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Richmond

On 08/08/15 23:23, Paul Looney wrote:

In your last example:

"Mr. Rushworth _was returned_”

“was returned” (singular, past tense, passive)


I'm not sure if that is a passive, or an older form of the past perfect 
(= had returned) ???

is correct (although a simple “returned” would have been more powerful). There 
is no conditional, no “if”; as in your first example:

"to inquire if Mr. Wickham_were returned_,"

Haven’t had this much fun with the language in a long time…



On Aug 8, 2015, at 1:07 PM, Richmond  wrote:

On 08/08/15 22:56, Paul Looney wrote:

Richmond,

The key here is the “if” - which creates a conditional clause - which requires the 
past plural of the verb (in this case “were”). This is similar to the “wenn" 
clause in German (Deutsch) and the “ut” clause in Latin.
If I were able, I’d thank you in person for mentioning this.

Paul Looney

I'm not sure anent that:

"He had been visiting a friend in the neighbouring county, and that
friend having recently had his grounds laid out by an improver, Mr.
Rushworth _was returned_ with his head full of the subject, and very eager
to be improving his own place in the same way; and though not saying
much to the purpose, could talk of nothing else."

Jane Austen, "Mansfield Park"

Richmond.

On Aug 8, 2015, at 9:42 AM, Richmond  wrote:

Jane Austen [amongst others] uses an interesting type of grammatical 
construction of this sort:

After breakfast, the girls walked to Meryton to inquire if Mr. Wickham
_were returned_, and to lament over his absence from the Netherfield ball.

Pride and Prejudice.

I would like to analyse a million word corpus that I have been granted access 
to for this type of construction.

However, I don't want to find examples of only 'were returned', but all 
examples of

were + infinitive / preterite / past participle

and, presumably for that I shall have to use wildcards . . .

OR ???

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

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


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


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



___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Richmond

On 08/08/15 23:33, Peter M. Brigham wrote:

On Aug 8, 2015, at 3:41 PM, Richmond wrote:


I seem to be going wrong:

I have a fld "WERBS" containing:

found
returned
become

and my test to be analysed in a fld "TEKST":

My Dad ate cheese.
My Mum and Dad were returned home when it 
began to rain.
He had a house in Spain.
They were become hairdressers.
They were found.
finalSolution666

But this:

on mouseUp
   put 1 into textLine
   put fld "WERBS" into $WERBS
   put fld "TEKST" into $TEKST
   put 1 into cookedLine
   repeat until line textLine of $TEKST contains "finalSolution666"
  put 1 into verbLine
  repeat until line verbLine of $WERBS is empty
 put line verbLine of $WERBS into WERB
 put "were" && WERB into FRAZE
 if line textLine $TEKST contains FRAZE then
put line textLine $TEKST into line cookedLine of fld "COOKED"

Missing an "of" in the two lines above:
put line textLine *of* $TEKST into line cookedLine of fld "COOKED" etc
Don't know if that's the problem.


add 1 to cookedLine
 end if
 add 1 to verbLine
  end repeat
  add 1 to textLine
   end repeat
end mouseUp

put only "They were found" in line 1 of fld "COOKED"

Your script logic seems unnecessarily complex. Since it looks as if only the 
last occurrence is ending up in the output field, instead of using a counter to 
keep track of the next line in the field, you could just
put cr & line textLine of $TEKST after fld "COOKED"
But once again, loading a line into a field repeatedly will be much slower than 
putting it into a variable in the repeat loop and then  putting the variable 
into the field just once when the repeat is done. Getting or putting something 
from or into a field is much slower than doing the same in a variable, so just 
do it once.

Also, I can see no reason to be loading your data into system variables, which is what 
"$WERBS" etc is defining. The only reason to put something into a variable beginning with 
"$" is if you want some other system process besides LC to be able to access the data.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig



Um . . . "$" is a mistake brought on by a dream I had about FORTRAN last 
night: in FORTRAN IV '$" was used for string variables.


Senior moment!

Richmond.

___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Peter M. Brigham
On Aug 8, 2015, at 3:41 PM, Richmond wrote:

> I seem to be going wrong:
> 
> I have a fld "WERBS" containing:
> 
> found
> returned
> become
> 
> and my test to be analysed in a fld "TEKST":
> 
> My Dad ate cheese.
> My Mum and Dad were returned home when it 
> began to rain.
> He had a house in Spain.
> They were become hairdressers.
> They were found.
> finalSolution666
> 
> But this:
> 
> on mouseUp
>   put 1 into textLine
>   put fld "WERBS" into $WERBS
>   put fld "TEKST" into $TEKST
>   put 1 into cookedLine
>   repeat until line textLine of $TEKST contains "finalSolution666"
>  put 1 into verbLine
>  repeat until line verbLine of $WERBS is empty
> put line verbLine of $WERBS into WERB
> put "were" && WERB into FRAZE
> if line textLine $TEKST contains FRAZE then
>put line textLine $TEKST into line cookedLine of fld "COOKED"

Missing an "of" in the two lines above:
   put line textLine *of* $TEKST into line cookedLine of fld "COOKED" etc
Don't know if that's the problem.

>add 1 to cookedLine
> end if
> add 1 to verbLine
>  end repeat
>  add 1 to textLine
>   end repeat
> end mouseUp
> 
> put only "They were found" in line 1 of fld "COOKED"

Your script logic seems unnecessarily complex. Since it looks as if only the 
last occurrence is ending up in the output field, instead of using a counter to 
keep track of the next line in the field, you could just
   put cr & line textLine of $TEKST after fld "COOKED"
But once again, loading a line into a field repeatedly will be much slower than 
putting it into a variable in the repeat loop and then  putting the variable 
into the field just once when the repeat is done. Getting or putting something 
from or into a field is much slower than doing the same in a variable, so just 
do it once.

Also, I can see no reason to be loading your data into system variables, which 
is what "$WERBS" etc is defining. The only reason to put something into a 
variable beginning with "$" is if you want some other system process besides LC 
to be able to access the data.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Paul Looney
In your last example:

"Mr. Rushworth _was returned_”

“was returned” (singular, past tense, passive) is correct (although a simple 
“returned” would have been more powerful). There is no conditional, no “if”; as 
in your first example:

"to inquire if Mr. Wickham_were returned_,"

Haven’t had this much fun with the language in a long time…


> On Aug 8, 2015, at 1:07 PM, Richmond  wrote:
> 
> On 08/08/15 22:56, Paul Looney wrote:
>> Richmond,
>> 
>> The key here is the “if” - which creates a conditional clause - which 
>> requires the past plural of the verb (in this case “were”). This is similar 
>> to the “wenn" clause in German (Deutsch) and the “ut” clause in Latin.
>> If I were able, I’d thank you in person for mentioning this.
>> 
>> Paul Looney
> 
> I'm not sure anent that:
> 
> "He had been visiting a friend in the neighbouring county, and that
> friend having recently had his grounds laid out by an improver, Mr.
> Rushworth _was returned_ with his head full of the subject, and very eager
> to be improving his own place in the same way; and though not saying
> much to the purpose, could talk of nothing else."
> 
> Jane Austen, "Mansfield Park"
> 
> Richmond.
>> 
>>> On Aug 8, 2015, at 9:42 AM, Richmond  wrote:
>>> 
>>> Jane Austen [amongst others] uses an interesting type of grammatical 
>>> construction of this sort:
>>> 
>>> After breakfast, the girls walked to Meryton to inquire if Mr. Wickham
>>> _were returned_, and to lament over his absence from the Netherfield ball.
>>> 
>>> Pride and Prejudice.
>>> 
>>> I would like to analyse a million word corpus that I have been granted 
>>> access to for this type of construction.
>>> 
>>> However, I don't want to find examples of only 'were returned', but all 
>>> examples of
>>> 
>>> were + infinitive / preterite / past participle
>>> 
>>> and, presumably for that I shall have to use wildcards . . .
>>> 
>>> OR ???
>>> 
>>> Richmond.
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com 
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode 
>> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com 
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode 
> 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Jane Austen's peculiarity

2015-08-08 Thread Richmond

On 08/08/15 22:56, Paul Looney wrote:

Richmond,

The key here is the “if” - which creates a conditional clause - which requires the 
past plural of the verb (in this case “were”). This is similar to the “wenn" 
clause in German (Deutsch) and the “ut” clause in Latin.
If I were able, I’d thank you in person for mentioning this.

Paul Looney


I'm not sure anent that:

"He had been visiting a friend in the neighbouring county, and that
friend having recently had his grounds laid out by an improver, Mr.
Rushworth _was returned_ with his head full of the subject, and very eager
to be improving his own place in the same way; and though not saying
much to the purpose, could talk of nothing else."

Jane Austen, "Mansfield Park"

Richmond.



On Aug 8, 2015, at 9:42 AM, Richmond  wrote:

Jane Austen [amongst others] uses an interesting type of grammatical 
construction of this sort:

After breakfast, the girls walked to Meryton to inquire if Mr. Wickham
_were returned_, and to lament over his absence from the Netherfield ball.

Pride and Prejudice.

I would like to analyse a million word corpus that I have been granted access 
to for this type of construction.

However, I don't want to find examples of only 'were returned', but all 
examples of

were + infinitive / preterite / past participle

and, presumably for that I shall have to use wildcards . . .

OR ???

Richmond.
___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Paul Looney
Richmond,

The key here is the “if” - which creates a conditional clause - which requires 
the past plural of the verb (in this case “were”). This is similar to the 
“wenn" clause in German (Deutsch) and the “ut” clause in Latin.
If I were able, I’d thank you in person for mentioning this.

Paul Looney

> On Aug 8, 2015, at 9:42 AM, Richmond  wrote:
> 
> Jane Austen [amongst others] uses an interesting type of grammatical 
> construction of this sort:
> 
> After breakfast, the girls walked to Meryton to inquire if Mr. Wickham
> _were returned_, and to lament over his absence from the Netherfield ball.
> 
> Pride and Prejudice.
> 
> I would like to analyse a million word corpus that I have been granted access 
> to for this type of construction.
> 
> However, I don't want to find examples of only 'were returned', but all 
> examples of
> 
> were + infinitive / preterite / past participle
> 
> and, presumably for that I shall have to use wildcards . . .
> 
> OR ???
> 
> Richmond.
> ___
> use-livecode mailing list
> use-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: Jane Austen's peculiarity

2015-08-08 Thread Richmond

I seem to be going wrong:

I have a fld "WERBS" containing:

found
returned
become

and my test to be analysed in a fld "TEKST":

My Dad ate cheese.
My Mum and Dad were returned home when it 
began to rain.

He had a house in Spain.
They were become hairdressers.
They were found.
finalSolution666

But this:

on mouseUp
   put 1 into textLine
   put fld "WERBS" into $WERBS
   put fld "TEKST" into $TEKST
   put 1 into cookedLine
   repeat until line textLine of $TEKST contains "finalSolution666"
  put 1 into verbLine
  repeat until line verbLine of $WERBS is empty
 put line verbLine of $WERBS into WERB
 put "were" && WERB into FRAZE
 if line textLine $TEKST contains FRAZE then
put line textLine $TEKST into line cookedLine of fld "COOKED"
add 1 to cookedLine
 end if
 add 1 to verbLine
  end repeat
  add 1 to textLine
   end repeat
end mouseUp

put only "They were found" in line 1 of fld "COOKED"

something wrong with my counters 

Richmond.


___
use-livecode mailing list
use-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: Jane Austen's peculiarity

2015-08-08 Thread Richmond

On 08/08/15 21:18, Peter M. Brigham wrote:

On Aug 8, 2015, at 1:56 PM, Richmond wrote:


On 08/08/15 20:48, Peter M. Brigham wrote:

On Aug 8, 2015, at 12:42 PM, Richmond wrote:


Jane Austen [amongst others] uses an interesting type of grammatical 
construction of this sort:

After breakfast, the girls walked to Meryton to inquire if Mr. Wickham
_were returned_, and to lament over his absence from the Netherfield ball.

Pride and Prejudice.

I would like to analyse a million word corpus that I have been granted access 
to for this type of construction.

However, I don't want to find examples of only 'were returned', but all 
examples of

were + infinitive / preterite / past participle

and, presumably for that I shall have to use wildcards . . .

OR ???

I'll leave it to those who speak Regex to suggest a wildcard solution. Here's another one 
(not tested) that will catch past participles ending in "ed".

Looks good; however, I am really looking for ALL preterites; such as 'become', 
so your 'ed' trap won't catch that.

I am wondering about using a listField of all the preterites that I am looking 
for.

if you do that then just make the repeat loop as follows:
repeat for each item w in offList
   put word w+1 of pText into testWord
   if testWord ends with "ed" then put w & comma after outList
   else if testWord is among the words of fld "preteritesList"
   then put w & comma after outList
end repeat

This will be faster if you put the preteritesList field into a variable before 
the repeat loop, since it's significantly faster for the engine to access the 
contents of a variable compared with the contents of a field.


Thanks for that one I've just made a fool of myself using a listField of 
the verb forms and the "thing" is glacially slow.


As soon as the stack has run its course I will implement your suggestion.

Richmond.



-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig



Not sure how this will scale with large texts:

function findWere pText
-- returns a comma-delim list of all the word offsets matching "were *ed"
put wordOffsets("were", pText, true) into offList
repeat for each item w in offList
   put word w+1 of pText into testWord
   if testWord ends with "ed" then put w & comma after outList
end repeat
return item 1 to -1 of outList
end if

function wordOffsets str, pContainer, matchWhole
-- returns a comma-delimited list of all the wordOffsets of str in 
pContainer
-- if matchWhole = true then only whole words are located
--else will find word matches everywhere str is part of a word in 
pContainer
--note that in LC words will include adjacent puncutation,
--   so using matchWhole = true may exclude too many "words"
-- duplicates are stripped out
--eg wordOffsets("co","the common coconut") = 2,3   not   2,3,3
-- note: to get the last wordOffset of a string in a container (often 
useful)
--use "item -1 of wordOffsets(...)"
-- by Peter M. Brigham, pmb...@gmail.com — freeware
-- requires offsets()
  
if matchWhole = empty then put false into matchWhole

put offsets(str,pContainer) into offList
if offList = 0 then return 0
repeat for each item i in offList
   put the number of words of (char 1 to i of pContainer) into wdNbr
   if matchWhole then
  if word wdNbr of pContainer <> str then next repeat
   end if
   put 1 into A[wdNbr]
   -- using an array avoids duplicates
end repeat
put the keys of A into wordList
sort lines of wordList ascending numeric
replace cr with comma in wordList
return wordList
end wordOffsets

function offsets str, pContainer
-- returns a comma-delimited list of all the offsets of str in pContainer
-- returns 0 if not found
-- note: offsets("xx","xx") returns "1,3,5" not "1,2,3,4,5"
-- ie, overlapping offsets are not counted
-- note: to get the last occurrence of a string in a container (often 
useful)
-- use "item -1 of offsets(...)"
-- by Peter M. Brigham, pmb...@gmail.com — freeware
 
if str is not in pContainer then return 0

put 0 into startPoint
repeat
   put offset(str,pContainer,startPoint) into thisOffset
   if thisOffset = 0 then exit repeat
   add thisOffset to startPoint
   put startPoint & comma after offsetList
   add length(str)-1 to startPoint
end repeat
return item 1 to -1 of offsetList -- delete trailing comma
end offsets

P.S. I love Jane Austen. One of my favorite books of all time is "Pride and 
Prejudice." It's so beautifully constructed.


Glad to hear that another programmer doesn't spend all their time in front of a 
computer screen!


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

Re: Odd behavior in Win8-I'm stuck fixing it, Help??

2015-08-08 Thread Paul Hibbert
Hi Bill,

Sorry for the delay replying, I’ve been away from home for a few days.

I don’t think line 6 will give the result you are looking for, I would change 
it to:

> 6. export snapshot from Group "snapshotGrp" with metadata theMetadataArray to 
> image mySnapShot

i.e. Remove the “from rect” part of the command. Using "from rect” still relies 
on the computer hardware to produce the snapshot, where as “from object” allows 
LC to render the snapshot with whatever parameters you supply.

I’ve saved a test stack to dropbox, hopefully this will demonstrate the 
differences a little better:

https://www.dropbox.com/s/xkx2fk4a2mel6l3/Export%20High%20Res%20Image.livecode?dl=0

I hope this helps resolve the problem.

Regards,

Paul


> On Aug 6, 2015, at 11:00, William Prothero  wrote:
> 
> Paul: One more thing. My test uses a variable “theMetadataArray”, which is 
> not set, so is blank. The manual states:
> metadata - The metadata is an array of metadata. Currently the only key 
> supported is "density" with a value in pixels per inch (ppi).   
> 
> So, I wonder if, to get the benefit, I have to set pixels per inch somehow, 
> in theMetadataArray.
> Best,
> Bill
> 
>> On Aug 6, 2015, at 10:57 AM, William Prothero  
>> wrote:
>> 
>> Paul:
>> FYI, I set up a test stack to figure out how to use the “from object” method 
>> of getting a snapshot image. Here’s the steps I followed:
>> 
>> 1. put all images that are to be captured in a group.
>> 2. set the group rect to the desired snapshot rect
>> 3. Lock the group rect
>> 4. Set the group to "scaling"
>> 5. In the script: set the snapRect to the rect of the group
>> 6. export snapshot from rect snapRect of Group "snapshotGrp" with metadata 
>> theMetadataArray to image mySnapShot
>> 7. set the rect of img mySnapShot to snapRect
>> 8. set the visible if img mySnapShot to TRUE
>> 
>> Perhaps this will help others. I have no idea if this would solve the 
>> problem an occasional student has, but the method works fine in Macintosh OS 
>> 10.10.4 and livecode 7.0.6
>> 
>> What I have is a very large map image in the group. The map is magnified, 
>> scrolled, etc. When some kinds of data are plotted, graphic and field object 
>> are placed in the correct locations over the map. Then the snapshot is taken 
>> and the graphic objects (except for the map) are deleted. For large symbol 
>> datasets, like earthquakes, I draw the symbols directly into the snapshot 
>> graphic. That way the image data is much smaller than if I tried to draw 
>> into the large map, and also, the large map doesn’t need to be refreshed 
>> when data are erased from view.
>> 
>> Thanks again for the hints.
>> Best,
>> Bill
>> 
>>> On Aug 3, 2015, at 7:42 PM, Paul Hibbert  wrote:
>>> 
>>> Bill,
>>> 
>>> I’ve done a few tests and it appears to me that "from rect” still relies on 
>>> the screen output from the computer, whereas “from object” allows LC to 
>>> render an image of an object independent of the screen hardware.
>>> 
>>> Try this:
>>> 
>>> Move your stack so the map image is half off the screen, then make the 
>>> snapshot, the image doesn’t render completely, this suggests to me that the 
>>> app is accessing a screen representation of the image rather than using 
>>> LC’s internal rendering, so 'I think' changing the snap routine to make a 
>>> snap from say a group of the map and it’s associated data may cure the 
>>> problem.
>>> 
>>> eg. export snapshot from group “mapAndData” to image “mapSnap” — then try 
>>> the test above again.
>>> 
>>> Paul
>>> 
>>> 
 On Aug 3, 2015, at 16:22, William Prothero  wrote:
 
 Paul:
 Thanks for the hint. I do use the newer “from” syntax.
 export snapshot from rect  snapRect to image "mapSnap"
 
 Thanks,
 Bill
 
> On Jul 31, 2015, at 3:35 PM, Paul Hibbert  wrote:
> 
> Bill,
> 
> I’ve just read the following explanation from RG relating to another 
> snapshot problem and wondered if it also relates to your student’s 
> problems…
> 
>> 
>> The "from" option renders the object into a new buffer set up just for 
>> the snapshot, while the older "of" syntax grabs the object's rect from 
>> the composite screen buffer.
>> 
>> LiveCode renders only the content region of a window but the window 
>> itself is rendered by the OS, so it has no choice but to obtain that 
>> image from the screen buffer.
>> 
>> -- 
>> Richard Gaskin
>> Fourth World Systems
>> Software Design and Development for the Desktop, Mobile, and the Web
>> 
>> ambassa...@fourthworld.comhttp://www.FourthWorld.com
> 
> When I first read your post I wondered if the problem could be due to low 
> grade or incompatible video cards in the affected machines, if that’s the 
> case then the above explanation would make sense, to me at least.
> 
> So, the question i

Re: Extracting a reference to a stack

2015-08-08 Thread Thierry Douez
Here is a regex solution.

and as a bonus, in 3 variants:

on mouseUp
   --button id 1003 of card id 1002 of stack "stack 2"
   --of stack "/Users/t/Desktop/stack.livecode"

   put fld "L1" into aLongID

   put theStackOwner( aLongID) into field "L2"

   put theMainStackOwner( aLongID) into field "L3"

   put stackOwners( aLongID) into R

   if R is empty then put "not found" into fld "L4"
   else put item 1 of R &" --- "& item 2 of R into field "L4"
end mouseUp



function theStackOwner pLongID
   if matchText(pLongID, "of stack \x22(.*?)\x22", _1) then return _1
   return "not found"
end theStackOwner

function theMainStackOwner pLongID
   if matchText(pLongID, "of stack \x22([^\x22]*)\x22$", _1) then return _1
   return "not found"
end theMainStackOwner

function stackOwners pLongID
   local REX
   put "(?: of stack \x22([^\x22]*?)\x22)? of stack
\x22([^\x22]*)\x22$" into REX
   if matchText(pLongID, REX, _1, _2) then return _1 &comma& _2
   return empty
end stackOwners

Did a quick test, so it works here,
plus I put the word "stack" in the stack names for a more severe test.

As I hate to write "& quote &" in my code,
\x22 is the ASCII value for the quote char.

Not tested on LC 7 yet.

Regards,

Thierry





Thierry Douez - http://sunny-tdz.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: Jane Austen's peculiarity

2015-08-08 Thread Peter M. Brigham
On Aug 8, 2015, at 1:56 PM, Richmond wrote:

> On 08/08/15 20:48, Peter M. Brigham wrote:
>> On Aug 8, 2015, at 12:42 PM, Richmond wrote:
>> 
>>> Jane Austen [amongst others] uses an interesting type of grammatical 
>>> construction of this sort:
>>> 
>>> After breakfast, the girls walked to Meryton to inquire if Mr. Wickham
>>> _were returned_, and to lament over his absence from the Netherfield ball.
>>> 
>>> Pride and Prejudice.
>>> 
>>> I would like to analyse a million word corpus that I have been granted 
>>> access to for this type of construction.
>>> 
>>> However, I don't want to find examples of only 'were returned', but all 
>>> examples of
>>> 
>>> were + infinitive / preterite / past participle
>>> 
>>> and, presumably for that I shall have to use wildcards . . .
>>> 
>>> OR ???
>> I'll leave it to those who speak Regex to suggest a wildcard solution. 
>> Here's another one (not tested) that will catch past participles ending in 
>> "ed".
> 
> Looks good; however, I am really looking for ALL preterites; such as 
> 'become', so your 'ed' trap won't catch that.
> 
> I am wondering about using a listField of all the preterites that I am 
> looking for.

if you do that then just make the repeat loop as follows:
   repeat for each item w in offList
  put word w+1 of pText into testWord
  if testWord ends with "ed" then put w & comma after outList
  else if testWord is among the words of fld "preteritesList"
  then put w & comma after outList
   end repeat

This will be faster if you put the preteritesList field into a variable before 
the repeat loop, since it's significantly faster for the engine to access the 
contents of a variable compared with the contents of a field.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


>> Not sure how this will scale with large texts:
>> 
>> function findWere pText
>>-- returns a comma-delim list of all the word offsets matching "were *ed"
>>put wordOffsets("were", pText, true) into offList
>>repeat for each item w in offList
>>   put word w+1 of pText into testWord
>>   if testWord ends with "ed" then put w & comma after outList
>>end repeat
>>return item 1 to -1 of outList
>> end if
>> 
>> function wordOffsets str, pContainer, matchWhole
>>-- returns a comma-delimited list of all the wordOffsets of str in 
>> pContainer
>>-- if matchWhole = true then only whole words are located
>>--else will find word matches everywhere str is part of a word in 
>> pContainer
>>--note that in LC words will include adjacent puncutation,
>>--   so using matchWhole = true may exclude too many "words"
>>-- duplicates are stripped out
>>--eg wordOffsets("co","the common coconut") = 2,3   not   2,3,3
>>-- note: to get the last wordOffset of a string in a container (often 
>> useful)
>>--use "item -1 of wordOffsets(...)"
>>-- by Peter M. Brigham, pmb...@gmail.com — freeware
>>-- requires offsets()
>>  
>>if matchWhole = empty then put false into matchWhole
>>put offsets(str,pContainer) into offList
>>if offList = 0 then return 0
>>repeat for each item i in offList
>>   put the number of words of (char 1 to i of pContainer) into wdNbr
>>   if matchWhole then
>>  if word wdNbr of pContainer <> str then next repeat
>>   end if
>>   put 1 into A[wdNbr]
>>   -- using an array avoids duplicates
>>end repeat
>>put the keys of A into wordList
>>sort lines of wordList ascending numeric
>>replace cr with comma in wordList
>>return wordList
>> end wordOffsets
>> 
>> function offsets str, pContainer
>>-- returns a comma-delimited list of all the offsets of str in pContainer
>>-- returns 0 if not found
>>-- note: offsets("xx","xx") returns "1,3,5" not "1,2,3,4,5"
>>-- ie, overlapping offsets are not counted
>>-- note: to get the last occurrence of a string in a container (often 
>> useful)
>>-- use "item -1 of offsets(...)"
>>-- by Peter M. Brigham, pmb...@gmail.com — freeware
>> 
>>if str is not in pContainer then return 0
>>put 0 into startPoint
>>repeat
>>   put offset(str,pContainer,startPoint) into thisOffset
>>   if thisOffset = 0 then exit repeat
>>   add thisOffset to startPoint
>>   put startPoint & comma after offsetList
>>   add length(str)-1 to startPoint
>>end repeat
>>return item 1 to -1 of offsetList -- delete trailing comma
>> end offsets
>> 
>> P.S. I love Jane Austen. One of my favorite books of all time is "Pride and 
>> Prejudice." It's so beautifully constructed.
> 
> 
> Glad to hear that another programmer doesn't spend all their time in front of 
> a computer screen!


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

Re: Jane Austen's peculiarity

2015-08-08 Thread Richmond

On 08/08/15 20:48, Peter M. Brigham wrote:

On Aug 8, 2015, at 12:42 PM, Richmond wrote:


Jane Austen [amongst others] uses an interesting type of grammatical 
construction of this sort:

After breakfast, the girls walked to Meryton to inquire if Mr. Wickham
_were returned_, and to lament over his absence from the Netherfield ball.

Pride and Prejudice.

I would like to analyse a million word corpus that I have been granted access 
to for this type of construction.

However, I don't want to find examples of only 'were returned', but all 
examples of

were + infinitive / preterite / past participle

and, presumably for that I shall have to use wildcards . . .

OR ???

I'll leave it to those who speak Regex to suggest a wildcard solution. Here's another one 
(not tested) that will catch past participles ending in "ed".


Looks good; however, I am really looking for ALL preterites; such as 
'become', so your 'ed' trap won't catch that.


I am wondering about using a listField of all the preterites that I am 
looking for.



Not sure how this will scale with large texts:

function findWere pText
-- returns a comma-delim list of all the word offsets matching "were *ed"
put wordOffsets("were", pText, true) into offList
repeat for each item w in offList
   put word w+1 of pText into testWord
   if testWord ends with "ed" then put w & comma after outList
end repeat
return item 1 to -1 of outList
end if

function wordOffsets str, pContainer, matchWhole
-- returns a comma-delimited list of all the wordOffsets of str in 
pContainer
-- if matchWhole = true then only whole words are located
--else will find word matches everywhere str is part of a word in 
pContainer
--note that in LC words will include adjacent puncutation,
--   so using matchWhole = true may exclude too many "words"
-- duplicates are stripped out
--eg wordOffsets("co","the common coconut") = 2,3   not   2,3,3
-- note: to get the last wordOffset of a string in a container (often 
useful)
--use "item -1 of wordOffsets(...)"
-- by Peter M. Brigham, pmb...@gmail.com — freeware
-- requires offsets()

if matchWhole = empty then put false into matchWhole

put offsets(str,pContainer) into offList
if offList = 0 then return 0
repeat for each item i in offList
   put the number of words of (char 1 to i of pContainer) into wdNbr
   if matchWhole then
  if word wdNbr of pContainer <> str then next repeat
   end if
   put 1 into A[wdNbr]
   -- using an array avoids duplicates
end repeat
put the keys of A into wordList
sort lines of wordList ascending numeric
replace cr with comma in wordList
return wordList
end wordOffsets

function offsets str, pContainer
-- returns a comma-delimited list of all the offsets of str in pContainer
-- returns 0 if not found
-- note: offsets("xx","xx") returns "1,3,5" not "1,2,3,4,5"
-- ie, overlapping offsets are not counted
-- note: to get the last occurrence of a string in a container (often 
useful)
-- use "item -1 of offsets(...)"
-- by Peter M. Brigham, pmb...@gmail.com — freeware

if str is not in pContainer then return 0

put 0 into startPoint
repeat
   put offset(str,pContainer,startPoint) into thisOffset
   if thisOffset = 0 then exit repeat
   add thisOffset to startPoint
   put startPoint & comma after offsetList
   add length(str)-1 to startPoint
end repeat
return item 1 to -1 of offsetList -- delete trailing comma
end offsets

P.S. I love Jane Austen. One of my favorite books of all time is "Pride and 
Prejudice." It's so beautifully constructed.



Glad to hear that another programmer doesn't spend all their time in 
front of a computer screen!




-- Peter




Richmond.

___
use-livecode mailing list
use-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: Extracting a reference to a stack

2015-08-08 Thread Peter M. Brigham
On Aug 8, 2015, at 1:45 PM, Peter Haworth wrote:

> I do it like this
> 
> function stackOfObject pobject
> 
> local tObject
> 
> put pobject into tObject
> repeat
>   if word 1 of tObject is "stack" then
>  return tObject
> end if

I assume you meant to include a line "delete word 1 of tObject" at the end of 
the repeat loop.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-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: Extracting a reference to a stack

2015-08-08 Thread Peter Haworth
Whoops, hit send too soon, should be:

function stackOfObject pobject

   repeat
  if word 1 of pobject is "stack" then
 return pobject
 else
  put the long owner of pobject into pobject
   end repeat

end stackOfObject

On Sat, Aug 8, 2015 at 10:45 AM Peter Haworth  wrote:

> I do it like this
>
> function stackOfObject pobject
>
> local tObject
>
> put pobject into tObject
> repeat
>if word 1 of tObject is "stack" then
>   return tObject
> end if
>
> On Sat, Aug 8, 2015 at 10:31 AM Peter M. Brigham  wrote:
>
>> OK, Here's a revision:
>>
>> function ownerStack pObjLongID
>>-- returns the name of the stack immediately containing pObjLongID
>>-- by Peter M. Brigham, pmb...@gmail.com — freeware
>>-- tags: control
>>-- requires getprop robustName
>>
>>replace " of " with cr in pObjLongID
>>put lineoffset(cr & "stack ",cr & pObjLongID) into stLine
>>put line stLine to -1 of pObjLongID into stName
>>replace cr with " of " in stName
>>return stName
>> end ownerStack
>>
>> -- Peter
>>
>> Peter M. Brigham
>> pmb...@gmail.com
>> http://home.comcast.net/~pmbrig
>>
>>
>> On Aug 8, 2015, at 10:45 AM, David Bovill wrote:
>>
>> > There was a recent feature added to the language that would help -
>> maybe it
>> > was something to do with the owner
>> >
>> > I have a similarly convoluted function and getprop - one of the issues
>> is
>> > that if you want the long name of the stack the control is part of -
>> this
>> > could be a mainstack or a substack - so to get "the stack on which the
>> > control is placed" has always been a bit of a pain...
>> >
>> > On 8 August 2015 at 15:16, Peter M. Brigham  wrote:
>> >
>> >> Here's a quick solution:
>> >>
>> >> function ownerStack pObjLongID
>> >>   replace " of " with numtochar(8) in pObjLongID
>> >>   set the itemdel to numtochar(8)
>> >>   return item -1 of pObjLongID
>> >> end ownerStack
>> >>
>> >> A more general solution is what I use in my library. The getItem()
>> >> function is so useful that I use it *everywhere*.
>> >>
>> >> function ownerStack pObjLongID
>> >>   -- returns the name of the stack containing pObjLongID
>> >>   -- by Peter M. Brigham, pmb...@gmail.com — freeware
>> >>   -- requires getItem(), getDelimiters()
>> >>
>> >>   put getItem(pObjLongID,-1," of ") into tStack
>> >>   put the name of tStack into stackName
>> >>   return stackName
>> >> end ownerStack
>> >>
>> >> function getItem pContainer, pIndex, pDelim
>> >>   -- returns item # pIndex of pContainer, given itemdelimiter = pDelim
>> >>   -- could just "get item pIndex of pContainer" in the calling handler
>> but
>> >>   --then have to set and restore the itemDelimiter, so this is less
>> >> hassle
>> >>   -- for instance, the following returns the filename from the
>> filepath:
>> >>   --put getItem(tPath,-1,"/") into tFileName
>> >>   -- defaults to pDelim = tab
>> >>   -- allows pIndex to be a range, eg "3-5"
>> >>   --in that case enclose the range in quotes
>> >>   -- also allows pDelim to be a string of characters
>> >>   --so you could do this:
>> >>   --   getItem("a//b//c//d//e//f",4,"//") -> d
>> >>   --or:
>> >>   --   getItem("a or b or c or d or e or f","3-5"," or ") -> c or d
>> >> or e
>> >>   --which expands the possibilities for use enormously
>> >>   -- by Peter M. Brigham, pmb...@gmail.com — freeware
>> >>   -- requires getDelimiters()
>> >>
>> >>   -- first, if pDelim is a string then get a delimiter that is not
>> found
>> >>   --in pContainer and use it in place of pDelim
>> >>   if pDelim = empty then put tab into pDelim
>> >>   if len(pDelim) > 1 then
>> >>  put getDelimiters(pContainer) into tempDel
>> >>  if tempDel begins with "Error" then
>> >> return "Error in getDelimiters()"
>> >>  end if
>> >>  replace pDelim with tempDel in pContainer
>> >>   else
>> >>  put pDelim into tempDel
>> >>   end if
>> >>
>> >>   -- now parse pIndex to take care of ranges and negative values
>> >>   --and get the item(s) requested
>> >>   put offset("-",pIndex) into dashPos
>> >>   set the itemdelimiter to tempDel
>> >>   if dashPos > 1 then
>> >>  -- don't catch if pIndex is something like -1, -2, etc
>> >>  put char 1 to dashPos-1 of pIndex into tStart
>> >>  put char dashPos+1 to -1 of pIndex into tEnd
>> >>  put item tStart to tEnd of pContainer into theItem
>> >>  replace tempDel with pDelim in theItem
>> >>   else
>> >>  put item pIndex of pContainer into theItem
>> >>   end if
>> >>   return theItem
>> >> end getItem
>> >>
>> >> function getDelimiters pText, nbr
>> >>   -- returns a cr-delimited list of  characters
>> >>   --not found in the variable pText
>> >>   -- use for delimiters for, eg, parsing text files, manipulating
>> arrays,
>> >> etc.
>> >>   -- usage: put getDelimiters(pText,2) into tDelims
>> >>   --if tDelims begins with "Error" then exit to top -- or
>> whatever
>> >>   --put line 1 of t

Re: Jane Austen's peculiarity

2015-08-08 Thread Peter M. Brigham
On Aug 8, 2015, at 12:42 PM, Richmond wrote:

> Jane Austen [amongst others] uses an interesting type of grammatical 
> construction of this sort:
> 
> After breakfast, the girls walked to Meryton to inquire if Mr. Wickham
> _were returned_, and to lament over his absence from the Netherfield ball.
> 
> Pride and Prejudice.
> 
> I would like to analyse a million word corpus that I have been granted access 
> to for this type of construction.
> 
> However, I don't want to find examples of only 'were returned', but all 
> examples of
> 
> were + infinitive / preterite / past participle
> 
> and, presumably for that I shall have to use wildcards . . .
> 
> OR ???

I'll leave it to those who speak Regex to suggest a wildcard solution. Here's 
another one (not tested) that will catch past participles ending in "ed". Not 
sure how this will scale with large texts:

function findWere pText
   -- returns a comma-delim list of all the word offsets matching "were *ed"
   put wordOffsets("were", pText, true) into offList
   repeat for each item w in offList
  put word w+1 of pText into testWord
  if testWord ends with "ed" then put w & comma after outList
   end repeat
   return item 1 to -1 of outList
end if

function wordOffsets str, pContainer, matchWhole
   -- returns a comma-delimited list of all the wordOffsets of str in pContainer
   -- if matchWhole = true then only whole words are located
   --else will find word matches everywhere str is part of a word in 
pContainer
   --note that in LC words will include adjacent puncutation,
   --   so using matchWhole = true may exclude too many "words"
   -- duplicates are stripped out
   --eg wordOffsets("co","the common coconut") = 2,3   not   2,3,3
   -- note: to get the last wordOffset of a string in a container (often useful)
   --use "item -1 of wordOffsets(...)"
   -- by Peter M. Brigham, pmb...@gmail.com — freeware
   -- requires offsets()
   
   if matchWhole = empty then put false into matchWhole
   put offsets(str,pContainer) into offList
   if offList = 0 then return 0
   repeat for each item i in offList
  put the number of words of (char 1 to i of pContainer) into wdNbr
  if matchWhole then
 if word wdNbr of pContainer <> str then next repeat
  end if
  put 1 into A[wdNbr]
  -- using an array avoids duplicates
   end repeat
   put the keys of A into wordList
   sort lines of wordList ascending numeric
   replace cr with comma in wordList
   return wordList
end wordOffsets

function offsets str, pContainer
   -- returns a comma-delimited list of all the offsets of str in pContainer
   -- returns 0 if not found
   -- note: offsets("xx","xx") returns "1,3,5" not "1,2,3,4,5"
   -- ie, overlapping offsets are not counted
   -- note: to get the last occurrence of a string in a container (often useful)
   -- use "item -1 of offsets(...)"
   -- by Peter M. Brigham, pmb...@gmail.com — freeware
   
   if str is not in pContainer then return 0
   put 0 into startPoint
   repeat
  put offset(str,pContainer,startPoint) into thisOffset
  if thisOffset = 0 then exit repeat
  add thisOffset to startPoint
  put startPoint & comma after offsetList
  add length(str)-1 to startPoint
   end repeat
   return item 1 to -1 of offsetList -- delete trailing comma
end offsets

P.S. I love Jane Austen. One of my favorite books of all time is "Pride and 
Prejudice." It's so beautifully constructed.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-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: Extracting a reference to a stack

2015-08-08 Thread Peter Haworth
I do it like this

function stackOfObject pobject

local tObject

put pobject into tObject
repeat
   if word 1 of tObject is "stack" then
  return tObject
end if

On Sat, Aug 8, 2015 at 10:31 AM Peter M. Brigham  wrote:

> OK, Here's a revision:
>
> function ownerStack pObjLongID
>-- returns the name of the stack immediately containing pObjLongID
>-- by Peter M. Brigham, pmb...@gmail.com — freeware
>-- tags: control
>-- requires getprop robustName
>
>replace " of " with cr in pObjLongID
>put lineoffset(cr & "stack ",cr & pObjLongID) into stLine
>put line stLine to -1 of pObjLongID into stName
>replace cr with " of " in stName
>return stName
> end ownerStack
>
> -- Peter
>
> Peter M. Brigham
> pmb...@gmail.com
> http://home.comcast.net/~pmbrig
>
>
> On Aug 8, 2015, at 10:45 AM, David Bovill wrote:
>
> > There was a recent feature added to the language that would help - maybe
> it
> > was something to do with the owner
> >
> > I have a similarly convoluted function and getprop - one of the issues is
> > that if you want the long name of the stack the control is part of - this
> > could be a mainstack or a substack - so to get "the stack on which the
> > control is placed" has always been a bit of a pain...
> >
> > On 8 August 2015 at 15:16, Peter M. Brigham  wrote:
> >
> >> Here's a quick solution:
> >>
> >> function ownerStack pObjLongID
> >>   replace " of " with numtochar(8) in pObjLongID
> >>   set the itemdel to numtochar(8)
> >>   return item -1 of pObjLongID
> >> end ownerStack
> >>
> >> A more general solution is what I use in my library. The getItem()
> >> function is so useful that I use it *everywhere*.
> >>
> >> function ownerStack pObjLongID
> >>   -- returns the name of the stack containing pObjLongID
> >>   -- by Peter M. Brigham, pmb...@gmail.com — freeware
> >>   -- requires getItem(), getDelimiters()
> >>
> >>   put getItem(pObjLongID,-1," of ") into tStack
> >>   put the name of tStack into stackName
> >>   return stackName
> >> end ownerStack
> >>
> >> function getItem pContainer, pIndex, pDelim
> >>   -- returns item # pIndex of pContainer, given itemdelimiter = pDelim
> >>   -- could just "get item pIndex of pContainer" in the calling handler
> but
> >>   --then have to set and restore the itemDelimiter, so this is less
> >> hassle
> >>   -- for instance, the following returns the filename from the filepath:
> >>   --put getItem(tPath,-1,"/") into tFileName
> >>   -- defaults to pDelim = tab
> >>   -- allows pIndex to be a range, eg "3-5"
> >>   --in that case enclose the range in quotes
> >>   -- also allows pDelim to be a string of characters
> >>   --so you could do this:
> >>   --   getItem("a//b//c//d//e//f",4,"//") -> d
> >>   --or:
> >>   --   getItem("a or b or c or d or e or f","3-5"," or ") -> c or d
> >> or e
> >>   --which expands the possibilities for use enormously
> >>   -- by Peter M. Brigham, pmb...@gmail.com — freeware
> >>   -- requires getDelimiters()
> >>
> >>   -- first, if pDelim is a string then get a delimiter that is not found
> >>   --in pContainer and use it in place of pDelim
> >>   if pDelim = empty then put tab into pDelim
> >>   if len(pDelim) > 1 then
> >>  put getDelimiters(pContainer) into tempDel
> >>  if tempDel begins with "Error" then
> >> return "Error in getDelimiters()"
> >>  end if
> >>  replace pDelim with tempDel in pContainer
> >>   else
> >>  put pDelim into tempDel
> >>   end if
> >>
> >>   -- now parse pIndex to take care of ranges and negative values
> >>   --and get the item(s) requested
> >>   put offset("-",pIndex) into dashPos
> >>   set the itemdelimiter to tempDel
> >>   if dashPos > 1 then
> >>  -- don't catch if pIndex is something like -1, -2, etc
> >>  put char 1 to dashPos-1 of pIndex into tStart
> >>  put char dashPos+1 to -1 of pIndex into tEnd
> >>  put item tStart to tEnd of pContainer into theItem
> >>  replace tempDel with pDelim in theItem
> >>   else
> >>  put item pIndex of pContainer into theItem
> >>   end if
> >>   return theItem
> >> end getItem
> >>
> >> function getDelimiters pText, nbr
> >>   -- returns a cr-delimited list of  characters
> >>   --not found in the variable pText
> >>   -- use for delimiters for, eg, parsing text files, manipulating
> arrays,
> >> etc.
> >>   -- usage: put getDelimiters(pText,2) into tDelims
> >>   --if tDelims begins with "Error" then exit to top -- or
> whatever
> >>   --put line 1 of tDelims into lineDivider
> >>   --put line 2 of tDelims into itemDivider
> >>   -- etc.
> >>   -- by Peter M. Brigham, pmb...@gmail.com — freeware
> >>
> >>   if pText = empty then return "Error: no text specified."
> >>   if nbr = empty then put 1 into nbr -- default 1 delimiter
> >>   put "2,3,4,5,6,7,8,16,17,18,19,20,21,22,23,24,25,26" into baseList
> >>   -- low ASCII values, excluding CR, LF, tab, etc.
> >>   put the nu

Re: Extracting a reference to a stack

2015-08-08 Thread Peter M. Brigham
OK, Here's a revision:

function ownerStack pObjLongID
   -- returns the name of the stack immediately containing pObjLongID
   -- by Peter M. Brigham, pmb...@gmail.com — freeware
   -- tags: control
   -- requires getprop robustName
   
   replace " of " with cr in pObjLongID
   put lineoffset(cr & "stack ",cr & pObjLongID) into stLine
   put line stLine to -1 of pObjLongID into stName
   replace cr with " of " in stName
   return stName
end ownerStack

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


On Aug 8, 2015, at 10:45 AM, David Bovill wrote:

> There was a recent feature added to the language that would help - maybe it
> was something to do with the owner
> 
> I have a similarly convoluted function and getprop - one of the issues is
> that if you want the long name of the stack the control is part of - this
> could be a mainstack or a substack - so to get "the stack on which the
> control is placed" has always been a bit of a pain...
> 
> On 8 August 2015 at 15:16, Peter M. Brigham  wrote:
> 
>> Here's a quick solution:
>> 
>> function ownerStack pObjLongID
>>   replace " of " with numtochar(8) in pObjLongID
>>   set the itemdel to numtochar(8)
>>   return item -1 of pObjLongID
>> end ownerStack
>> 
>> A more general solution is what I use in my library. The getItem()
>> function is so useful that I use it *everywhere*.
>> 
>> function ownerStack pObjLongID
>>   -- returns the name of the stack containing pObjLongID
>>   -- by Peter M. Brigham, pmb...@gmail.com — freeware
>>   -- requires getItem(), getDelimiters()
>> 
>>   put getItem(pObjLongID,-1," of ") into tStack
>>   put the name of tStack into stackName
>>   return stackName
>> end ownerStack
>> 
>> function getItem pContainer, pIndex, pDelim
>>   -- returns item # pIndex of pContainer, given itemdelimiter = pDelim
>>   -- could just "get item pIndex of pContainer" in the calling handler but
>>   --then have to set and restore the itemDelimiter, so this is less
>> hassle
>>   -- for instance, the following returns the filename from the filepath:
>>   --put getItem(tPath,-1,"/") into tFileName
>>   -- defaults to pDelim = tab
>>   -- allows pIndex to be a range, eg "3-5"
>>   --in that case enclose the range in quotes
>>   -- also allows pDelim to be a string of characters
>>   --so you could do this:
>>   --   getItem("a//b//c//d//e//f",4,"//") -> d
>>   --or:
>>   --   getItem("a or b or c or d or e or f","3-5"," or ") -> c or d
>> or e
>>   --which expands the possibilities for use enormously
>>   -- by Peter M. Brigham, pmb...@gmail.com — freeware
>>   -- requires getDelimiters()
>> 
>>   -- first, if pDelim is a string then get a delimiter that is not found
>>   --in pContainer and use it in place of pDelim
>>   if pDelim = empty then put tab into pDelim
>>   if len(pDelim) > 1 then
>>  put getDelimiters(pContainer) into tempDel
>>  if tempDel begins with "Error" then
>> return "Error in getDelimiters()"
>>  end if
>>  replace pDelim with tempDel in pContainer
>>   else
>>  put pDelim into tempDel
>>   end if
>> 
>>   -- now parse pIndex to take care of ranges and negative values
>>   --and get the item(s) requested
>>   put offset("-",pIndex) into dashPos
>>   set the itemdelimiter to tempDel
>>   if dashPos > 1 then
>>  -- don't catch if pIndex is something like -1, -2, etc
>>  put char 1 to dashPos-1 of pIndex into tStart
>>  put char dashPos+1 to -1 of pIndex into tEnd
>>  put item tStart to tEnd of pContainer into theItem
>>  replace tempDel with pDelim in theItem
>>   else
>>  put item pIndex of pContainer into theItem
>>   end if
>>   return theItem
>> end getItem
>> 
>> function getDelimiters pText, nbr
>>   -- returns a cr-delimited list of  characters
>>   --not found in the variable pText
>>   -- use for delimiters for, eg, parsing text files, manipulating arrays,
>> etc.
>>   -- usage: put getDelimiters(pText,2) into tDelims
>>   --if tDelims begins with "Error" then exit to top -- or whatever
>>   --put line 1 of tDelims into lineDivider
>>   --put line 2 of tDelims into itemDivider
>>   -- etc.
>>   -- by Peter M. Brigham, pmb...@gmail.com — freeware
>> 
>>   if pText = empty then return "Error: no text specified."
>>   if nbr = empty then put 1 into nbr -- default 1 delimiter
>>   put "2,3,4,5,6,7,8,16,17,18,19,20,21,22,23,24,25,26" into baseList
>>   -- low ASCII values, excluding CR, LF, tab, etc.
>>   put the number of items of baseList into maxNbr
>>   if nbr > maxNbr then return "Error: max" && maxNbr && "delimiters."
>>   repeat with tCount = 1 to nbr
>>  put true into failed
>>  repeat with i = 1 to the number of items of baseList
>> put item i of baseList into testNbr
>> put numtochar(testNbr) into testChar
>> if testChar is not in pText then
>>-- found one, store and get next delim
>>put false i

Re: Extracting a reference to a stack

2015-08-08 Thread Mark Wieder

On 08/08/2015 07:45 AM, David Bovill wrote:

There was a recent feature added to the language that would help - maybe it
was something to do with the owner


I LC7 you can now set whole words as delimiters.
So (off the top of my head)

set the itemDelimiter to "stack"
get item -1 of the long id of control 

But note that this will return the mainstack.
If substacks enter into the picture it gets more complicated.

get item 1 of the long id of control 

might do the job.

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


Jane Austen's peculiarity

2015-08-08 Thread Richmond
Jane Austen [amongst others] uses an interesting type of grammatical 
construction of this sort:


After breakfast, the girls walked to Meryton to inquire if Mr. Wickham
_were returned_, and to lament over his absence from the Netherfield ball.

Pride and Prejudice.

I would like to analyse a million word corpus that I have been granted 
access to for this type of construction.


However, I don't want to find examples of only 'were returned', but all 
examples of


were + infinitive / preterite / past participle

and, presumably for that I shall have to use wildcards . . .

OR ???

Richmond.
___
use-livecode mailing list
use-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: Extracting a reference to a stack

2015-08-08 Thread David Bovill
There was a recent feature added to the language that would help - maybe it
was something to do with the owner

I have a similarly convoluted function and getprop - one of the issues is
that if you want the long name of the stack the control is part of - this
could be a mainstack or a substack - so to get "the stack on which the
control is placed" has always been a bit of a pain...

On 8 August 2015 at 15:16, Peter M. Brigham  wrote:

> Here's a quick solution:
>
> function ownerStack pObjLongID
>replace " of " with numtochar(8) in pObjLongID
>set the itemdel to numtochar(8)
>return item -1 of pObjLongID
> end ownerStack
>
> A more general solution is what I use in my library. The getItem()
> function is so useful that I use it *everywhere*.
>
> function ownerStack pObjLongID
>-- returns the name of the stack containing pObjLongID
>-- by Peter M. Brigham, pmb...@gmail.com — freeware
>-- requires getItem(), getDelimiters()
>
>put getItem(pObjLongID,-1," of ") into tStack
>put the name of tStack into stackName
>return stackName
> end ownerStack
>
> function getItem pContainer, pIndex, pDelim
>-- returns item # pIndex of pContainer, given itemdelimiter = pDelim
>-- could just "get item pIndex of pContainer" in the calling handler but
>--then have to set and restore the itemDelimiter, so this is less
> hassle
>-- for instance, the following returns the filename from the filepath:
>--put getItem(tPath,-1,"/") into tFileName
>-- defaults to pDelim = tab
>-- allows pIndex to be a range, eg "3-5"
>--in that case enclose the range in quotes
>-- also allows pDelim to be a string of characters
>--so you could do this:
>--   getItem("a//b//c//d//e//f",4,"//") -> d
>--or:
>--   getItem("a or b or c or d or e or f","3-5"," or ") -> c or d
> or e
>--which expands the possibilities for use enormously
>-- by Peter M. Brigham, pmb...@gmail.com — freeware
>-- requires getDelimiters()
>
>-- first, if pDelim is a string then get a delimiter that is not found
>--in pContainer and use it in place of pDelim
>if pDelim = empty then put tab into pDelim
>if len(pDelim) > 1 then
>   put getDelimiters(pContainer) into tempDel
>   if tempDel begins with "Error" then
>  return "Error in getDelimiters()"
>   end if
>   replace pDelim with tempDel in pContainer
>else
>   put pDelim into tempDel
>end if
>
>-- now parse pIndex to take care of ranges and negative values
>--and get the item(s) requested
>put offset("-",pIndex) into dashPos
>set the itemdelimiter to tempDel
>if dashPos > 1 then
>   -- don't catch if pIndex is something like -1, -2, etc
>   put char 1 to dashPos-1 of pIndex into tStart
>   put char dashPos+1 to -1 of pIndex into tEnd
>   put item tStart to tEnd of pContainer into theItem
>   replace tempDel with pDelim in theItem
>else
>   put item pIndex of pContainer into theItem
>end if
>return theItem
> end getItem
>
> function getDelimiters pText, nbr
>-- returns a cr-delimited list of  characters
>--not found in the variable pText
>-- use for delimiters for, eg, parsing text files, manipulating arrays,
> etc.
>-- usage: put getDelimiters(pText,2) into tDelims
>--if tDelims begins with "Error" then exit to top -- or whatever
>--put line 1 of tDelims into lineDivider
>--put line 2 of tDelims into itemDivider
>-- etc.
>-- by Peter M. Brigham, pmb...@gmail.com — freeware
>
>if pText = empty then return "Error: no text specified."
>if nbr = empty then put 1 into nbr -- default 1 delimiter
>put "2,3,4,5,6,7,8,16,17,18,19,20,21,22,23,24,25,26" into baseList
>-- low ASCII values, excluding CR, LF, tab, etc.
>put the number of items of baseList into maxNbr
>if nbr > maxNbr then return "Error: max" && maxNbr && "delimiters."
>repeat with tCount = 1 to nbr
>   put true into failed
>   repeat with i = 1 to the number of items of baseList
>  put item i of baseList into testNbr
>  put numtochar(testNbr) into testChar
>  if testChar is not in pText then
> -- found one, store and get next delim
> put false into failed
> put testChar into line tCount of delimList
> exit repeat
>  end if
>   end repeat
>   if failed then
>  if tCount = 0 then
> return "Error: cannot get any delimiters."
>  else if tCount = 1 then
> return "Error: can only get one delimiter."
>  else
> return "Error: can only get" && tCount && "delimiters."
>  end if
>   end if
>   delete item i of baseList
>end repeat
>return delimList
> end getDelimiters
>
>
> On Aug 8, 2015, at 8:23 AM, David Bovill wrote:
>
> > Given the long id of a control - 

Re: Extracting a reference to a stack

2015-08-08 Thread Peter M. Brigham
Here's a quick solution:

function ownerStack pObjLongID
   replace " of " with numtochar(8) in pObjLongID
   set the itemdel to numtochar(8)
   return item -1 of pObjLongID
end ownerStack

A more general solution is what I use in my library. The getItem() function is 
so useful that I use it *everywhere*.

function ownerStack pObjLongID
   -- returns the name of the stack containing pObjLongID
   -- by Peter M. Brigham, pmb...@gmail.com — freeware
   -- requires getItem(), getDelimiters()
   
   put getItem(pObjLongID,-1," of ") into tStack
   put the name of tStack into stackName
   return stackName
end ownerStack

function getItem pContainer, pIndex, pDelim
   -- returns item # pIndex of pContainer, given itemdelimiter = pDelim
   -- could just "get item pIndex of pContainer" in the calling handler but
   --then have to set and restore the itemDelimiter, so this is less hassle
   -- for instance, the following returns the filename from the filepath:
   --put getItem(tPath,-1,"/") into tFileName
   -- defaults to pDelim = tab
   -- allows pIndex to be a range, eg "3-5"
   --in that case enclose the range in quotes
   -- also allows pDelim to be a string of characters
   --so you could do this:
   --   getItem("a//b//c//d//e//f",4,"//") -> d
   --or:
   --   getItem("a or b or c or d or e or f","3-5"," or ") -> c or d or e
   --which expands the possibilities for use enormously
   -- by Peter M. Brigham, pmb...@gmail.com — freeware
   -- requires getDelimiters()
   
   -- first, if pDelim is a string then get a delimiter that is not found
   --in pContainer and use it in place of pDelim
   if pDelim = empty then put tab into pDelim
   if len(pDelim) > 1 then
  put getDelimiters(pContainer) into tempDel
  if tempDel begins with "Error" then
 return "Error in getDelimiters()"
  end if
  replace pDelim with tempDel in pContainer
   else
  put pDelim into tempDel
   end if

   -- now parse pIndex to take care of ranges and negative values
   --and get the item(s) requested
   put offset("-",pIndex) into dashPos
   set the itemdelimiter to tempDel
   if dashPos > 1 then
  -- don't catch if pIndex is something like -1, -2, etc
  put char 1 to dashPos-1 of pIndex into tStart
  put char dashPos+1 to -1 of pIndex into tEnd
  put item tStart to tEnd of pContainer into theItem
  replace tempDel with pDelim in theItem
   else
  put item pIndex of pContainer into theItem
   end if
   return theItem
end getItem

function getDelimiters pText, nbr
   -- returns a cr-delimited list of  characters
   --not found in the variable pText
   -- use for delimiters for, eg, parsing text files, manipulating arrays, etc.
   -- usage: put getDelimiters(pText,2) into tDelims
   --if tDelims begins with "Error" then exit to top -- or whatever
   --put line 1 of tDelims into lineDivider
   --put line 2 of tDelims into itemDivider
   -- etc.
   -- by Peter M. Brigham, pmb...@gmail.com — freeware
   
   if pText = empty then return "Error: no text specified."
   if nbr = empty then put 1 into nbr -- default 1 delimiter
   put "2,3,4,5,6,7,8,16,17,18,19,20,21,22,23,24,25,26" into baseList
   -- low ASCII values, excluding CR, LF, tab, etc.
   put the number of items of baseList into maxNbr
   if nbr > maxNbr then return "Error: max" && maxNbr && "delimiters."
   repeat with tCount = 1 to nbr
  put true into failed
  repeat with i = 1 to the number of items of baseList
 put item i of baseList into testNbr
 put numtochar(testNbr) into testChar
 if testChar is not in pText then
-- found one, store and get next delim
put false into failed
put testChar into line tCount of delimList
exit repeat
 end if
  end repeat
  if failed then
 if tCount = 0 then
return "Error: cannot get any delimiters."
 else if tCount = 1 then
return "Error: can only get one delimiter."
 else
return "Error: can only get" && tCount && "delimiters."
 end if
  end if
  delete item i of baseList
   end repeat
   return delimList
end getDelimiters


On Aug 8, 2015, at 8:23 AM, David Bovill wrote:

> Given the long id of a control - how do I extract the reference to the
> stack ti belongs to? I have a function that i have used since the dawn of
> time for this - but I recall seeing a new chunk / target / reference
> feature of Livecode in the last year that makes this easier. Did I imagine
> it?
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url 

Re: Write variable to a file on a server?

2015-08-08 Thread Tim Selander

Hi Mike,

Worked great!! Thank you very much. Exactly what I'm trying to do.

Tim


On 15/08/08 22:05, Mike Bonner wrote:

You need to set up a script to catch the data, and you need to send the
data using a key=data type format.

So for example if you're sending a book chapter to your server, and the
text of the chapter is in variable tChapter

post ("chapter1=" & urlencode(tChapter)) to URL "
http://myUrl.com/myscript.lc";
put it -- will put whatever is returned into the msg box


For the script itself, since we know the key name..



Obviously this is a very simple example that wouldn't be very useful, but
hopefully it will give you the idea.

The chapter1.txt file will be created right next to your script (since i
didn't tell it elsewhere) so to look at the file you would go to
http://myUrl.com/chapter1.txt

On Sat, Aug 8, 2015 at 5:39 AM, Tim Selander  wrote:


Hi,

Messing with a LC script in a web page, writing a variable to a text file
on my on-rev server account.

The dictionary says the postmyData toURL"
http://www.example.net/indications.cgi"; should work, but it doesn't. I
get an 404 error.

I am trying to save a variable's text contents by using
post myData to URL "http://www.mydomain.info/data.txt";

Can anyone tell me the proper way?

Thanks,

Tim Selander
Tokyo, Japan
___
use-livecode mailing list
use-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: Extracting a reference to a stack

2015-08-08 Thread dunbarx
Wait just a doggone minute. The long id of a control contains the stack 
reference.


Craig



-Original Message-
From: David Bovill 
To: How to use LiveCode 
Sent: Sat, Aug 8, 2015 8:24 am
Subject: Extracting a reference to a stack


Given the long id of a control - how do I extract the reference to the
stack ti
belongs to? I have a function that i have used since the dawn of
time for this
- but I recall seeing a new chunk / target / reference
feature of Livecode in
the last year that makes this easier. Did I
imagine
it?
___
use-livecode
mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe,
unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

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


Re: Extracting a reference to a stack

2015-08-08 Thread dunbarx
Interesting. I wonder if there is a property that gives this directly.


But I suppose you can always find the owner of the control, and if that is a 
group (or a series of groups, continue until you find an owner with the word 
"stack" in it.


Craig Newman



-Original Message-
From: David Bovill 
To: How to use LiveCode 
Sent: Sat, Aug 8, 2015 8:24 am
Subject: Extracting a reference to a stack


Given the long id of a control - how do I extract the reference to the
stack ti
belongs to? I have a function that i have used since the dawn of
time for this
- but I recall seeing a new chunk / target / reference
feature of Livecode in
the last year that makes this easier. Did I
imagine
it?
___
use-livecode
mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe,
unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

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


Re: Write variable to a file on a server?

2015-08-08 Thread Mike Bonner
You need to set up a script to catch the data, and you need to send the
data using a key=data type format.

So for example if you're sending a book chapter to your server, and the
text of the chapter is in variable tChapter

post ("chapter1=" & urlencode(tChapter)) to URL "
http://myUrl.com/myscript.lc";
put it -- will put whatever is returned into the msg box


For the script itself, since we know the key name..



Obviously this is a very simple example that wouldn't be very useful, but
hopefully it will give you the idea.

The chapter1.txt file will be created right next to your script (since i
didn't tell it elsewhere) so to look at the file you would go to
http://myUrl.com/chapter1.txt

On Sat, Aug 8, 2015 at 5:39 AM, Tim Selander  wrote:

> Hi,
>
> Messing with a LC script in a web page, writing a variable to a text file
> on my on-rev server account.
>
> The dictionary says the postmyData toURL"
> http://www.example.net/indications.cgi"; should work, but it doesn't. I
> get an 404 error.
>
> I am trying to save a variable's text contents by using
> post myData to URL "http://www.mydomain.info/data.txt";
>
> Can anyone tell me the proper way?
>
> Thanks,
>
> Tim Selander
> Tokyo, Japan
> ___
> use-livecode mailing list
> use-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


Extracting a reference to a stack

2015-08-08 Thread David Bovill
Given the long id of a control - how do I extract the reference to the
stack ti belongs to? I have a function that i have used since the dawn of
time for this - but I recall seeing a new chunk / target / reference
feature of Livecode in the last year that makes this easier. Did I imagine
it?
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Write variable to a file on a server?

2015-08-08 Thread Tim Selander

Hi,

Messing with a LC script in a web page, writing a variable to a text 
file on my on-rev server account.


The dictionary says the postmyData 
toURL"http://www.example.net/indications.cgi"; should work, but it 
doesn't. I get an 404 error.


I am trying to save a variable's text contents by using
post myData to URL "http://www.mydomain.info/data.txt";

Can anyone tell me the proper way?

Thanks,

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


Digging around

2015-08-08 Thread Richmond
Recently my younger son liberated my "Revolution 1.1.1" User Guide from 
the attic of our house in Scotland when he was up there.


I would be extremely grateful if anyone could point me to a digital 
version of that.


Richmond.

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