Re: Getting the weekday name

2010-11-13 Thread Dick Kriesel
On 11/13/10 1:44 PM, "Peter Haworth"  wrote:

> I'm using the datetimetoJulian function in Sarah's great datetime
> stack as part of a way to get the alpha weekday name.  The words in
> Sarah's stack say that it's possible to get the day number of the week
> by taking the remainder of dividing the Julian days by 7 but when I do
> that, I consistently get a day number that is 2 less than it should be
> - that's assuming of course that day 1 would be Sunday.
> 
> I can always just add 2 to the day number but wondering if anyone
> knows why this would happen?
> 
> Pete Haworth
> 

Hi, Pete.  Might your task be easier using "dateItems" as this example does?

function dayOfWeek tDate
   convert tDate to dateItems
   return item last item of tDate of \
  "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"
end dayOfWeek

-- Dick


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


Re: sorting html text with arrays

2010-10-05 Thread Dick Kriesel
Hi, Mark.  What are the rules for handling words that appear with more than
one style?

-- Dick 


On 10/5/10 11:40 AM, "Mark Swindell"  wrote:

> I'm using the following script to create a glossary/word list of all words
> appearing in a songbook I'm making in Apple's Pages word processor (over 2,000
> unique words).   (Thanks to Phil Davis for his help with arrays.)
> 
> What I am wondering is if the formatted text can be retained in a case like
> this, and how.  My attempts so far have failed, as the htmlText tags are
> included in the sort... not what I want.)  I'd like to be able to paste in
> from the word processor and do the sort while maintaining formatting (bold,
> font, font size), and then be able to take that result and copy and paste it
> back into the word processor.
> 
> Am I asking too much?
> 
> Thanks
> Mark
> 
> on mouseUp
>repeat for each word tWord in tStripEm
> add 1 to aWordCounts[tWord]
>end repeat
>put the keys of aWordCounts into tList
>sort lines of tList
>put tList into field "sorted3"
> end mouseUp___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


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


Re: Multi-dimensional arrays, tutorial?

2010-08-10 Thread Dick Kriesel
On Aug 10, 2010, at 12:53 AM, FlexibleLearning wrote:
 
> Can someone point me to an explanation or tutorial on using
> multi-dimensional arrays, and specifically persistence between
> sessions?

Hi, Hugh.  If you'd like to see a script locals persistence toolkit, I'd be
glad to share the code.  The library loads and stores script locals, as
you've seen in other replies, but goes further by enabling operations on
multiple arrays in a single invocation, and by enabling operations on arrays
within arrays.

The primary handler in the library starts with this:

command scriptLocals_op pOperation, pVariableNames, pKey, pRevObject
   /*
   pOperation is among the items of
"register,load,store,empty,unregister,remove"
   pVariableNames can be a list delimited by cr, comma, or space.
   pVariableNames is optional; without it, the command operates on all
script locals identified in previous executions of the command.
   pKey can be a string that is a top-level subscript of the array.
   pKey can be a sequentially-keyed array that determines a compound
subscript of the array.
   pKey is optional; without it, the command operates on whole arrays rather
than on elements of arrays.
   pRevObject can identify any Rev object.
   pRevObject is optional; without it, the Rev object is the one whose
script invokes the command.

   The command performs the operation in the context of the Rev object on
the Rev object's own script locals.
   */
 
Please let me know if you have questions or if you'd like to see the
library.

-- Dick


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


Re: OT: Interactive reverse graph plot

2010-07-28 Thread Dick Kriesel



On 7/28/10 11:42 AM, "Alex Adams"  wrote:

> Sorry to sound obtuse, but I have been looking for what seems like it should
> be a simple tool or a program that contains the features to:
> 
> Draw a graph line manually and have it generate/change the corresponding
> plot point data.  Does that make since?  I¹m creating some growth
> projections in a proforma and I know what the curve looks like that I want,
> but generating the data to create the curve is very time consuming.  I want
> to be able to make adjustments by dragging points directly on the graph and
> have the supporting point data updated.
> 
> I¹m not asking for suggestions on how to make such a tool.  I want to find a
> tool that does this today so that I can work through these spreadsheets more
> naturally.
> 
> Any suggestions?


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


Re: Intelligent sorting: NEW WINNER Dick Kriesel

2010-07-08 Thread Dick Kriesel
Thanks, Hugh.  In case anyone wants to see the sample data, here it is:

a 10 a 10 a 10
a 10 a 10 a 9
a 10 a 10 a
a 10 a 9 a
a 10 a 10
a 10 a 9
a 10 a
a 9 a
a 10
a 9
a
10
9
a10a10a10
a10a10a9
a10a10a
a10a9a
a10a10
a10a9
a10a
a9a
a10
a9

And here it is after sorting:

9
10
a
a9
a9a
a10
a10a
a10a9
a10a9a
a10a10
a10a10a
a10a10a9
a10a10a10
a 9
a 9 a
a 10
a 10 a
a 10 a 9
a 10 a 9 a
a 10 a 10
a 10 a 10 a
a 10 a 10 a 9
a 10 a 10 a 10

Incidentally, the "sortMe" function Hugh posted is not part of the solution;
it's just a demonstration of one way to use the solution.

-- Dick


On 7/8/10 1:45 PM, "FlexibleLearning"  wrote:

> This solution from Dick Kriesel is more accurate than any other solution so
> far (to an unliminted depth for all practical purposes) and its speed is
> comparable with the best to date. Yes it is long, but the demands for an
> accurate intelligent sort require some heavy duty parsing. Breaking each
> lines into sub-components is indeed the way to go, optimised by 'for each'.
> The solution is clearly annotated and sorting by the parallel array keys of
> each line is, in my view, a stroke of genius. The only, and quite
> understandable, limitation that I can determine is special-formatted
> sub-components such as dateTime, but within the parameters of the sample
> data expectations it excels. Well done, Dick.
> 
> Save this somewhere like the Scripter's Scrapbook for when you need it. As
> always, watch out for line-wraps...
> 
> function sortMe tData
>   sort_a1a tData
>   return tData
> end sortMe
> 
> command sort_a1a @tData, tSortDelimiter, tOrigin -- note: sort tData
> respecting chunks of digits
>   --| By Dick Kriesel [dick.krie...@mail.com]
>   local tCharPrev, tDigits, tNonDigits, tSortKey, tSortKeys
>   if tSortDelimiter is empty then
> put numToChar(8) into tSortDelimiter
>   end if
>   if tOrigin is empty then
> put 100 into tOrigin
> -- note: tOrigin = 100 enables alphabetic sorting for positive
> integers up to 9,999,999
> -- note: the caller can enable sorting larger numbers, or can reduce the
> number of characters that will be sorted
>   end if
> 
>   /*
>   Step through tData, separating chunks of digits from chunks of other
> characters.
>   For each character that's an integer, append it to a variable that holds
> only digits.
>   For each character that's not an integer, append it to a variable that
> holds no digits.
>   When a character is an integer, but the previous character wasn't, append
> the string of
>   non-digits to the line's sort key.
>   When a character is not an integer, but the previous character was, add
> the origin to the
>   string of digits and append the sum to the line's sort key.
>   */
> 
>   repeat for each line tLine in tData
> put empty into tCharPrev
> put empty into tDigits -- note: tDigits tracks the most recent digits
> put empty into tNonDigits -- note: tNonDigits tracks the most recent
> characters other than digits
> put empty into tSortKey
> 
> repeat for each char tChar in tLine
>   if tChar is an integer then
> if tCharPrev is an integer then
>   put tChar after tDigits
> else
>   put tChar into tDigits
>   if tNonDigits is not empty then
> put tNonDigits & tSortDelimiter after tSortKey
> put empty into tNonDigits
>   end if
> end if
>   else
> if tCharPrev is an integer then
>   put tChar into tNonDigits
>   put tOrigin + tDigits & tSortDelimiter after tSortKey
>   put empty into tDigits
> else
>   put tChar after tNonDigits
> end if
>   end if
>   put tChar into tCharPrev
> end repeat
> 
> if tDigits is not empty then
>   put tOrigin + tDigits after tSortKey
> else if tNonDigits is not empty then
>   put tNonDigits after tSortKey
> end if
> put tSortKey into tSortKeys[tLine]
>   end repeat
> 
>   sort tData by tSortKeys[each]
> end sort_a1a
> 
> 
> 
> Hugh Senior
> FLCo
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


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


Re: Intelligent sorting: A bit of a poser NEW WINNER

2010-07-02 Thread Dick Kriesel
Hi, Hugh, et al.

The test data seems incomplete in that it includes some letters that follow
digits, but doesn't include any example that tests sorting those letters.
For example, since the test data includes "a 1a" then it ought to include
something like "a 1b" to test the sorting thoroughly.

If you do insert "a 1b" into the test data before "a 1a" then you'll see the
currently fastest implementation leaves the "a 1b" before the "a 1a."  Is
that OK with you?

What sample data demonstrates the inaccuracy you mentioned? Would you make
your 10,000-entry list available?  I've drafted yet a new implementation for
you, but I'd like to debug it with your data before posting it to the list.

-- Dick


On 7/2/10 12:42 PM, "FlexibleLearning"  wrote:

> Hi Mike, and welcome to the party!
> 
> Your solution is pretty darn good. Fast, too, with 53 m/s avg benchtime (100
> iterations of a 10,000 random list) so by far the quickest (closest is 74
> m/s by Mike Bonner). It successfully sorts the sample data suplied, a feat
> achieved only by Craig.
> 
> On the highly random benchtest data it is also fairly accurate, but not
> 100%. But then again, no-one has achieved that yet, possibly because the
> degree of randomness was not specified.
> 
> On the basis of the posted 'challenge', Mike... Looks like you are the new
> winner!
> 
> Well done that man.
> 
> /H
> 
> 
> From: Michael Kann 
> 
> Hugh, thanks for providing a fun and educational challenge -- and organizing
> the results. I woke up with an idea. Can you time my late entry?
> Thanks.
> 
> Mike
> 
> -
> -- I think the script is pretty
> -- self-explanatory
> -
> 
> 
> on mouseUp
> put fld 1 into v -- original data
> set the itemDel to "*"
> 
> repeat with k = 0 to 9
>   replace k with "*"&k in v
> end repeat
> 
> repeat for each line k in v
>   replace "*" with "" in item 2 to -1 of k
>   put k & cr after h
> end repeat
> delete last char of h
> 
> sort h numeric by item 2 of each
> sort h by item 1 of each
> replace "*" with "" in h
> 
> put h into fld 2 -- output
> end mouseUp
> 
> -
> 
> --- On Fri, 7/2/10, FlexibleLearning  wrote:
> 
>> From: FlexibleLearning 
>> Subject: Re: Intelligent sorting: A bit of a poser RESULTS CORRECTION
>> To: use-revolution@lists.runrev.com
>> Date: Friday, July 2, 2010, 1:19 AM
>> I made an inexcusable error when
>> applying the solutions in the benchtests.
>> When adjusting Mike's solution to handle commas in the list
>> I omitted to
>> adjust the itemDel. The corrected solution is below.
>> 
>> As a result, Mike's solution is not only very fast, but
>> also sub-sorts the
>> alpha component and handles mixed suffix components (which
>> is very cool).
>> However, as pointed out, it cannot handle alpha-only list
>> items. Dave's
>> solution can handle lists with or without numbers, but the
>> sort order is
>> inexact.
>> 
>> Using the insights of both solutions, I have based a
>> composite solution on
>> Mike's routine adjusted with the flexibility Dave's
>> routine. It has Mike's
>> speed and ability to sort mixed suffixes, but includes
>> Dave's ability to
>> sort mixed alpha-only and alphanumeric lists. I think this
>> provides the best
>> of everything for a generic library function...
>> 
>> function sortMe5 pList
>>   --| Hugh Senior 
>>   --| Based on a solution by Mike Bonner 
>>   set the itemDel to numtochar(8)
>>   repeat for each line theLine in pList
>> if
>> matchchunk(theLine,"([a-zA-Z\s]\d)",theChar,theEnd) then
>>   put numtochar(8) after char theChar of
>> theLine
>> else put numtochar(8) after theLine
>> put theLine & CR after tTemp
>>   end repeat
>>   delete last char of tTemp
>>   sort lines of tTemp numeric by item 2 of each
>>   sort lines of tTemp by item 1 of each
>>   replace numtochar(8) with "" in tTemp
>>   return tTemp
>> end sortMe5
>> 
>> a 1
>> b20
>> a 20
>> a 2
>> b10
>> a 3
>> b3
>> a 1a
>> b2
>> a 10
>> b1a
>> d
>> c
>> b
>> a
>> 
>> gives...
>> 
>> a
>> a 1
>> a 1a
>> a 2
>> a 3
>> a 10
>> a 20
>> b
>> b1a
>> b2
>> b3
>> b10
>> b20
>> c
>> d
>> 
>> Prior Work...
>> 
>> function sortMe1 pVar
>>   --| Mike Bonner 
>>   set the itemDel to numtochar(8)
>>   repeat for each line theLIne in PVar
>> get matchchunk(theLine,"([a-zA-Z\s]\d)" ,
>> theChar,theEnd )
>> put numtochar(8) after char theChar of
>> theLine
>> put theLine & return after tTemp
>>   end repeat
>>   delete the last char of tTemp
>>   sort lines of tTemp ascending numeric by item 2 of
>> each
>>   sort lines of tTemp ascending by item 1 of each
>>   replace numtochar(8) with empty in tTemp
>>   return tTemp
>> end sortMe1
>> 
>> function sortMe2 tData
>>   --| Dave Cragg 
>>   set the itemDel to numtochar(8)
>>   put "(^.*?)([0-9]*$)" into tRE
>>   put "" into tData2
>>   repeat for each line tLine in tData
>> get matchText(tLine, tRE, tS, tNum)
>> put tS & numtochar(8) & tNum & cr
>> af

Re: Simple Arrays

2010-01-11 Thread Dick Kriesel
On 1/10/10 1:25 PM, "Phil Davis"  wrote:

> The things some people do for fun...  ;-)

... can make others want to get in on the fun, like by fixing something that
ain't broke.  Here's an elaboration on your idea that handles your sample
data more than twice as fast, primarily by avoiding the "do" for typical
cases.

Thanks for the cue, Phil.

-- Dick




function table_split tTable,pLineDel,pItemDel
   filter tTable without empty
   set the lineDelimiter to coalesce(pLineDel,cr)
   set the itemDelimiter to coalesce(pItemDel,tab)
   switch number of items in line 1 of tTable - 1 -- number of dimensions
  case 1
 repeat for each line tLine in tTable
put item 2 of tLine into tArray[item 1 of tLine]
 end repeat
 break
  case 2
 repeat for each line tLine in tTable
put item 3 of tLine into tArray[item 1 of tLine][item 2 of
tLine]
 end repeat
 break  
  case 3
 repeat for each line tLine in tTable
put item 4 of tLine into tArray[item 1 of tLine][item 2 of
tLine][item 3 of tLine]
 end repeat
 break  
  default  
 repeat for each line tLine in tTable
do "put last item of tLine into tArray[" & replaceText(item 1 to
-2 of tLine,the itemDelimiter,"][") & "]"
 end repeat
   end switch
   return tArray 
end table_split

function coalesce -- return the first non-empty parameter
   repeat with i = 1 to the paramCount
  if param(i) is not empty then
 return param(i)
  end if   
   end repeat
end coalesce




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


Re: Scaling Groups?

2009-12-10 Thread Dick Kriesel
Thanks, Scott.  Since you still have almost ninety percent of the time left,
what do you think of scaling the content of fields using tPercent? That
could be good when the text is too small for the old reading glasses.

-- Dick


On 12/10/09 9:00 PM, "Scott Rossi"  wrote:

> Thanks to all who replied about my scaling groups question.
> As it turns out, I was able to come up with a solution in about a tenth of
> the time
> I thought it would take (and I was dreading it).
> 
> The biggest issue for me is Rev¹s reliance on integers for object
> positioning --
> this is a serious limitation when it comes to scaling because object
> dimensions can get heavily distorted when the objects are repeatedly scaled.
> I needed a way to keep object dimensions from getting too messed up if the
> user wants
> to size a group up and down repeatedly.  The only way I know how to do this
> is to store the original dimensions and refer to those whenever an object is
> scaled.
> The following code does this, called from a scrollbar whose start/end values
> are 50 and 200 (equates to 50% and 200%).  Objects are initialized with
> their
> ³starting² specs, and since those specs are always used in the code, scaling
> is as
> distortion-free as possible:
> 
> on scrollbarDrag pValue
>scaleGroup long id of grp ³my great group²,pValue
> end scrollbarDrag
> 
> on scaleGroup pGroup,pValue
>initObjSpecs pGroup
>put pValue/100 into tPercent
>put loc of pGroup into masterLoc
>lock screen
>set width of pGroup to the uDefaultWidth of pGroup * tPercent
>set height of pGroup to the uDefaultHeight of pGroup * tPercent
>set loc of pGroup to masterLoc
>repeat with N = 1 to number of controls of pGroup
>   put long id of control N of pGroup into tObj
>   set width of tObj to (item 1 of the uOrigDimensions of tObj *
> tPercent)
>   set height of tObj to (item 2 of the uOrigDimensions of tObj *
> tPercent)
>   put item 1 of masterLoc - (item 1 of the uOrigOffset of tObj *
> tPercent) into X
>   put item 2 of masterLoc - (item 2 of the uOrigOffset of tObj *
> tPercent) into Y
>   set loc of tObj to X,Y
>end repeat
>set loc of pGroup to masterLoc
>unlock screen
> end scaleGroup
> 
> on initObjSpecs pGroup
>put loc of pGroup into masterLoc
>if the uDefaultWidth of pGroup = "" then set the uDefaultWidth of pGroup
> to width of pGroup
>if the uDefaultHeight of pGroup = "" then set the uDefaultHeight of
> pGroup to height of pGroup
>put the number of controls of pGroup into objCount
>repeat with N = 1 to objCount
>   put long id of control N of pGroup into tObj
>   if the uOrigOffset of tObj <> "" and the uOrigDimensions of tObj <> ""
> then next repeat
>   put loc of tObj into objLoc
>   set the uOrigOffset of tObj to item 1 of masterLoc - item 1 of
> objLoc,item 2 of masterLoc - item 2 of objLoc
>   set the uOrigDimensions of tObj to width of tObj,height of tObj
>end repeat
> end initObjSpecs
> 
> 
> Maybe other folks will find this useful.
> 
> Regards,
> 
> Scott Rossi
> Creative Director
> Tactile Media, Multimedia & Design
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


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


Re: [OT] Re: [ANN] tRev's new 'decoder' now showing...video is up!

2009-08-26 Thread Dick Kriesel
Thanks, Jerry, and you're welcome.

The behavior of your breakpoint is so different from Rev's that I can
imagine wanting to use both.  So I'd prefer you to distinguish the two:
breakpoint and, say, tRev_checkpoint.  uRIP resolves the name space thing.

tRev, instead of inserting the string "breakpoint," could insert a
one-liner:

if "tRev" is among the lines of the stacksInUse then tRev_checkpoint

or, less obtrusively,

try; tRev_checkpoint; end try

Would that work for you?

-- Dick


On 8/25/09 4:55 PM, "Jerry Daniels"  wrote:

> Hey, Dick! Good to hear from you.
> 
> I would need to deal with the whole name space thing...if some other
> program used checkpoint, etc.
> 
> Using "breakpoint" has two sizeable advantages over alternatives (now
> that I'm really considering your suggestion):
> 
> 1. I don't have to worry about another program using it.
> 
> 2. It has a use when tRev is not in use. E.g., when you give someone
> else your code and they don't have tRev (because of a religious
> injunction or something).
> 
> Great idea, though. I'll play around with it some. Thanks.
> 
> Best,
> 
> Jerry Daniels
> Watch tRev - The Movie
> http://reveditor.com/trev-the-movie
> 
> On Aug 25, 2009, at 6:40 PM, Dick Kriesel wrote:
> 
>> On 8/25/09 3:18 PM, "Jerry Daniels"  wrote:
>> 
>>> I agree TOTALLY with the request, but alas, Rev forbids it.
>> 
>> Hi, Jerry.  Could you proceed without Rev's traceback message?
>> 
>> on mouseUp
>>put 1 into t1
>>put 2 into t2
>>checkPoint
>> end mouseUp
>> 
>> command checkPoint
>>set the debugcontext to line -2 of the executioncontexts
>>global gREVVariableWatcherValue
>>debugdo "revDebuggerGrabValue the variableNames"
>>repeat for each item tVariableName in line 2 of
>> gREVVariableWatcherValue
>>  debugdo "revDebuggerGrabValue" && tVariableName
>>  put gREVVariableWatcherValue into tVariables[tVariableName]
>>end repeat
>>set the debugcontext to empty
>>-- ... "store the full context into a database"
>> 
>>breakpoint -- just so you can see tVariables[]
>> end checkPoint
>> 
>> 
>> ___
>> use-revolution mailing list
>> use-revolution@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


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


Re: [OT] Re: [ANN] tRev's new 'decoder' now showing...video is up!

2009-08-25 Thread Dick Kriesel
On 8/25/09 3:18 PM, "Jerry Daniels"  wrote:

> I agree TOTALLY with the request, but alas, Rev forbids it.

Hi, Jerry.  Could you proceed without Rev's traceback message?

on mouseUp
put 1 into t1
put 2 into t2
checkPoint
end mouseUp

command checkPoint
set the debugcontext to line -2 of the executioncontexts
global gREVVariableWatcherValue
debugdo "revDebuggerGrabValue the variableNames"
repeat for each item tVariableName in line 2 of gREVVariableWatcherValue
  debugdo "revDebuggerGrabValue" && tVariableName
  put gREVVariableWatcherValue into tVariables[tVariableName]
end repeat
set the debugcontext to empty
-- ... "store the full context into a database"

breakpoint -- just so you can see tVariables[]
end checkPoint


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


Re: Syllabic division of words

2009-08-21 Thread Dick Kriesel
Try WordNet: 


On 8/21/09 8:02 PM, "Randall Reetz"  wrote:

> Hierarchical thesaurus semantic chains would be a fairly simple addition as
> well.


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


Re: Inheritance and Custom Properties

2009-04-22 Thread Dick Kriesel
On 4/21/09 3:38 AM, "David Bovill"  wrote:

> Actually you don't need to use "do' dick. One of the great things about
> custom properties is that you can do this:
> 
> put "test_Prop" into myCustomPropvar
>> put the myCustomPropvar of btn 1
>> 
> 
> You can also do this with params:  so in Dicks case
> 
> put pCustomPropertySetName & "[" & quote & pCustomPropertyName & quote & "]
>> into myCustomPropvar
>> put the myCustomPropvar of tRevObject into tValue
>> 

The first suggestion works, but not the second.  The second works too after
removing both occurrences of "& quote."

Thanks for the suggestions, David.

The new, improved function follows.

-- Dick


function effectiveValue
pCustomPropertyName,pCustomPropertySetName,pRevObject
   if pCustomPropertySetName is empty then
  put pCustomPropertyName into tProperty
   else
  put pCustomPropertySetName & "[" & pCustomPropertyName & "]" into
tProperty
   end if
   if pRevObject is empty then
  put long id of the target into tRevObject
   else
  put long id of pRevObject into tRevObject
   end if
   lock messages
   repeat until tRevObject is empty
  put the tProperty of tRevObject into tValue
  if tValue is empty then
 if word 1 of tRevObject is "stack" then
delete word 1 to 3 of tRevObject
 else
delete word 1 to 4 of tRevObject
 end if
  else
 exit repeat
  end if
   end repeat
   unlock messages
   return tValue
end effectiveValue



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


Re: Inheritance and Custom Properties

2009-04-15 Thread Dick Kriesel
On 4/15/09 2:28 PM, "Jim Bufalini"  wrote:

> Hence, custom properties are not inherited in the traditional sense. ;-)

Agreed.  Even with the technique I offered, the "effective" inheritance is
based only on Rev's owner hierarchy, rather than on anyone's class
hierarchy.

But Rev 4.0 may offer something much better ...

-- Dick


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


Re: Inheritance and Custom Properties

2009-04-15 Thread Dick Kriesel
On 4/15/09 4:58 AM, "David Bovill"  wrote:

> If you want them "inherited" you need to define a "getprop" handler.

You can inherit any custom property even without getprop handlers, by
walking through the object's long id until you find a value.

Here's a function that does that for any given custom property name, and
optionally any given custom property set name as well.

If you're interested in a similar function that identifies the object that
provided the effective value, let me know.

As usual, watch out for line wraps imposed by email.

-- Dick



function effectiveValue pCustomPropertyName,pCustomPropertySetName
  put long id of the target into tRevObject
  if pCustomPropertySetName is empty then
put "put the" && pCustomPropertyName && "of tRevObject into tValue" into
tStatement
  else
put "put the" && pCustomPropertySetName & "[" & quote &
pCustomPropertyName & quote & "] of tRevObject into tValue" into tStatement
  end if
  lock messages
  repeat until tRevObject is empty
do tStatement
if tValue is empty then
  if word 1 of tRevObject is "stack" then
delete word 1 to 3 of tRevObject
  else
delete word 1 to 4 of tRevObject
  end if
else
  exit repeat
end if
  end repeat
  unlock messages
  return tValue
end effectiveValue




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


Re: RUNREV Technical support

2009-01-23 Thread Dick Kriesel
Users who agree could vote for QCC enhancement 1565.

-- Dick

On 1/23/09 1:30 PM, "J. Landman Gay"  wrote:

> What I'd really like to see is the debugger built directly into the
> engine so that we could use a keyboard combination to break into the
> debugger during runtime.


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


Re: Table field text formating

2008-12-17 Thread Dick Kriesel
Could you replace each space with an image whose width you've set?

Could you replace any character with a snapshot of itself whose width you've
set?

-- Dick


On 12/17/08 6:17 PM, "-= JB =-"  wrote:

> Brian,
> 
> Whatever way it is done Rev should include it as a standard and then
> they can advertise it
> includes the ability for kerning and tracking.  They can have a
> standard key used to enter
> the character.  Maybe something like a control-space.  Of course this
> can probably be done
> now using key commands available but if they included it as a
> standard it would mean a lot
> to those who care about it.  Since it is so simple why not include it?
> 
> -=>JB<=-
> 
> 
> On Dec 17, 2008, at 6:07 PM, Brian Yennie wrote:
> 
>> JB,
>> 
>> I think you may be vastly underestimating the task of supporting
>> kerning and tracking by using dummy spaces inserted into the flow
>> of text. Among other things, this would render your text impossible
>> to parse and be quite slow. What's appealing about strange 1 pixel
>> characters inserted into your text in a non-standard font that
>> makes it better than the image solution? At least with the images,
>> you can use any character and any font for your spacer.
>> 
>> I agree that all of these features would be useful, but I disagree
>> that 1-pixel fonts would really accomplish much towards that goal.
>> 
>> 
>>> Using an image has been discussed before.  How would you like to
>>> use an image
>>> every time you wanted to add a space?  It would be a lot nicer to
>>> not use an image
>>> instead of a text character.
>>> 
>>> Look at it this way.  With the 1 character added Rev could
>>> advertise it allows both
>>> Kerning and Tracking.  To those in the publishing industry that
>>> means a lot.  Now
>>> they can advertise you can convert a character into an image every
>>> time you need
>>> to use tracking or kerning.
>>> 
>>> What do you think is going to help sell Rev better?  Look at how
>>> many asked for
>>> text improvement.  And since it is so simple it would be idiotic
>>> for them not to add
>>> it even if only a small percentage of people are interested in
>>> serious desk top
>>> publishing capabilities.
>>> 
>>> Kerning and Tracking are extremely important in quality desktop
>>> publishing and
>>> have been and still are important in almost every newspaper,
>>> magazine etc. that
>>> is printed.  People care about it but many are not aware of it.
>>> 
>>> -=>JB<=-
>> 
>> 
>> 
>> ___
>> use-revolution mailing list
>> use-revolution@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>> 
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


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


Re: if the target is in group...

2008-11-23 Thread Dick Kriesel
if the long id of group x is in the long id of control y


On 11/23/08 3:49 PM, "Mark Swindell" <[EMAIL PROTECTED]> wrote:

> I'm losing it.
> 
> What's the right syntax for returning whether the target of a
> mouseclick is a part of a given group?
> 
> --If the target is < in,within,among the objects of, among the
> controls of, a member of, once palled around with> group "x"
> 
> Thanks.
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


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


Re: is there a way to trap the "start using" command before it happens.

2008-11-01 Thread Dick Kriesel
Hi, Andre.  If the stacks are all yours, you could just avoid invoking
"start using" except in one handler:

command startUsing pStackName
if pStackName is not empty then
if short name of stack pStackName \
is not among the lines of the stacksinuse then
try
start using stack pStackName
catch tError
breakpoint
end try
end if
end if
end startUsing

-- Dick


On 11/1/08 2:45 PM, "Andre Garzia" <[EMAIL PROTECTED]> wrote:

> Hello Chipp,
> 
> thanks for replying. I can't use startup. Let me explain the
> situation. RevHTTP server is now able to run revolution cgis as if it
> was apache. The problem is that there's no sandbox, so if a stack is
> put into use, it stays into use after the cgi ends because most cgis
> don't issue a stop using command. I keep track of what is put into use
> so I can do library caching and stuff and thus speed things up. The
> problem is, if something is already into use and a cgi tries to use it
> again, the IDE pops up that silly annoying dialog box "purge, save,
> cancel" and locks up the whole thing!!! There's no preference settings
> for that dialog, nothing, I need to prevent it from happening, this
> means prevent the opening a stack without touching the cgi source
> code... tricky...
> 
> Andre
> 
> On Sat, Nov 1, 2008 at 7:38 PM, Chipp Walters <[EMAIL PROTECTED]> wrote:
>> If you're trying to stop the standalone from autoloading any of Rev's custom
>> libs then perhaps putting this script on cd 1 of the mainstack:
>> 
>> on startUp
>>   --> DO YOUR OWN STUFF HERE
>>exit to top
>> end startUp
>> 
>>  that *might* work-- I haven't tested it. I'm assuming the startUp message
>> is accessed by some custom Rev standalone stuff-- though I'm not positive.
>> Worth a shot.
>> 
>> Maybe someone like Jacque knows more.
>>> 
>>> 
>> ___
>> use-revolution mailing list
>> use-revolution@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>> 
> 
> 


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


Re: the visible of a stack

2008-09-25 Thread Dick Kriesel
Hi, Chipp.  Here's a version that's effectively the same but that has a
couple minor advantages.  First, it has a single exit point, possibly
improving maintainability.  Second, it executes the corner functions only
once no matter how many screens there are, possibly improving performance.

-- Dick


function isStackCurrentlyVisibleOnAnyMonitor pStack
--> pStack IS THE SHORT NAME OF STACK
put "false" into tResult
if pStack is among the lines of windows() then
if the visible of stack pStack then
if the blendlevel of stack pStack < 100 then
put the topleft of stack pStack into tTopLeft
put the topright of stack pStack into tTopRight
put the bottomleft of stack pStack into tBottomLeft
put the bottomright of stack pStack into tBottomRight
repeat for each line tScreenRect in the screenrects
if tTopLeft is within tScreenRect or \
tTopRight is within tScreenRect or \
tBottomLeft is within tScreenRect or \
tBottomRight is within tScreenRect then
put "true" into tResult
exit repeat
end if
end repeat
end if
end if
end if
return tResult
end isStackCurrentlyVisibleOnAnyMonitor




On 9/25/08 12:46 PM, "Chipp Walters" <[EMAIL PROTECTED]> wrote:

> function isStackCurrentlyVisibleOnAnyMonitor pStack
>  --> pStack IS THE SHORT NAME OF STACK
>  if pStack is among the lines of windows() then
>if not the vis of stack pStack then return false
>if the blendlevel of stack pStack = 100 then return false
>repeat for each line L in the screenrects
>   if the topLeft of stack pStack is within L then return true
>   if the topRight of stack pStack is within L then return true
>   if the bottomLeft of stack pStack is within L then return true
>   if the bottomRight of stack pStack is within L then return true
>end repeat
>return false
>  else
>return false
>  end if
> end isStackCurrentlyVisibleOnAnyMonitor


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


Re: the visible of a stack

2008-09-24 Thread Dick Kriesel
Hi, Chipp.  Either of the other two corners of the stack could be the only
corner within a screenrect too.

-- Dick


On 9/24/08 6:01 PM, "Chipp Walters" <[EMAIL PROTECTED]> wrote:

> Dangit, didn't get the L again..Sorry for the multiple posts .
> 
> function isStackCurrentlyVisibleOnAnyMonitor pStack
>  --> pStack IS THE SHORT NAME OF STACK
>   set wholematches to true
>   if pStack is among the lines of windows() then
>  if not the vis of stack pStack then return false
>  if the blendlevel of stack pStack = 100 then return false
>  repeat for each line L in the screenrects
> if the topLeft of stack pStack is within L then return true
> if the bottomright of stack pStack is within L then return true
>  end repeat
>  return false
>   else
>  return false
>   end if
> end isStackCurrentlyVisibleOnAnyMonitor
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


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


Re: Arrays: new and old keys, i

2008-09-13 Thread Dick Kriesel
Maybe the benefit of unsorted keys is faster execution.  Why wait for a sort
if you don't need it?


On 9/13/08 10:25 PM, "Ken Ray" <[EMAIL PROTECTED]> wrote:

> 
>> That would do me - except the most useful would be the ability to get the
>> full ordered index.
>> 
>> put the ordered keys of theDataA
>> 
>> Because you want to things like:
>> 
>> repeat for each key sortedKey in theDataA
> 
> I've been watching this thread and I have to ask:
> 
> "What benefit is it to the Rev developer (not the engine) to have the keys
> NOT sorted?"
> 
> I mean, I understand why the *engine* may want to keep the keys in a special
> order, but every time I work with the keys of an array, either (a) I don't
> care what order they're in, or (b) I really want them sorted. Personally,
> I've never WANTED to have the keys in an unsorted order...
> 
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: [EMAIL PROTECTED]
> Web Site: http://www.sonsothunder.com/
> 
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


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


MacNN | First Look: Revolution 2.9, cross-platform compiler

2008-04-07 Thread Dick Kriesel
"If you want to write programs quickly and easily without feeling like you
need to study computer science, consider Revolution. Revolution¹s language
is simple enough for anyone to learn and understand, and its ability to
create Mac OS X, Windows, and Linux programs is an added bonus."




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


Re: Filtering array vs plain list

2008-02-02 Thread Dick Kriesel
On 2/1/08 8:35 PM, "Shari" <[EMAIL PROTECTED]> wrote:

> I've never worked with intersecting arrays, so please pardon the questions.

Actually it's just intersecting lists of values that come from different
arrays.  Use-rev pardons almost all questions.

> 
> If I understand your example, I'd have something like this:
> 
> birthYear[1976] = John Jones,Billy Bob,Mary Lou,Manny Mack,Barbie Doll
> birthYear[1977] = Ellie May,Carrie Ann,Andy Ant,Donna Mills,Jackie O
> baseballTeam[Red Sox] = Billy Bob,Manny Mack
> baseballTeam[White Sox] = Barbie Doll,Ellie May

Yes, but you wouldn't want to duplicate everyone's name in 300 places.
Instead you could use the "identifier unique to each individual" you
mentioned before.

> 
> This would produce about 300 arrays.  The [] keys would be virtually
> unlimited.  There might be a couple hundred birthYears for example.

You can use vastly more arrays and keys in Rev than you'll need.

> 
> If I wanted to get all census data for Billy Bob, I'd do a repeat
> loop for each key of each of the 300 arrays to get all info
> pertaining to Billy Bob?  I had not thought of that approach.  It's
> fast?

Mercy, no.  What's fast is the kind of querying you mentioned: retrieving
based on multiple filters.  To make it fast to get everything about Billy
Bob, your app would do some double-entry bookkeeping, maintaining arrays
like this:
  personName[3258] = "Billy Bob"
  birthyear[3258] = 1982
or like this, based on a design that uses an array for each person:
  person_3258["name"]= "Billy Bob"
  person_3258["birthYear"] = 1982
or like this, based on a design that uses a card for each person:
  person["name"] of card 123 = "Billy Bob"
  person["birthYear"] of card 123 = 1982

> 
> To get a list of all Red Sox fans born in 1976, I'd just need to
> intersect the two array/key combos?

Intersecting the values you get from retrieving each array/key combo gives
you the identifiers for all the people who match all your selection
criteria, as many as you care to specify.
  
> 
> Looking for all data on Billy Bob will happen more frequently than
> looking for all Red Sox fans born in 1976.  And it will be common to
> delete Billy Bob from all arrays, or add Billie Jean.  Most of the
> time the primary reference would be to Billy Bob, such as "What is
> Billy Bob's baseball team?" Does that change it?

That enhancement to the problem definition motivates the double-entry
bookkeeping.

> 
> Note that this is not for a database, but for a game where I need to
> track thousands of people each having about 300 pieces of info
> defining them, the defining info will change constantly, and changes
> need to be instantaneous.
> 

Noted.  Still, you could use a database management system in your solution,
even though Rev makes it appealing to roll your own.  Many threads have
addressed the relative merits of the alternatives.  If you have more
questions about rolling your own, I'd be glad to try answering.

> Shari

-- Dick


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


Re: Filtering array vs plain list

2008-02-01 Thread Dick Kriesel
On 2/1/08 2:36 PM, "Shari" <[EMAIL PROTECTED]> wrote:

> I'm trying to determine the best way to store a humungous block of
> data for both speed and accessibility.
> 
> My original plan was to do an array something like this:
> 
> Item #2 is an identifier unique to each individual.  It will not be a
> number, but text + a number.
> 
> census[Atlanta,5489,name] = John
> census[Atlanta,5489,religion] = Baptist
> census[Atlanta,5489,birthYear] = 1976
> census[Atlanta,5489,baseballTeam] = Braves
> census[Atlanta,5489,eyeColor] = blue
> census[Atlanta,9988,name] = Judy
> census[Atlanta,9988,religion] = Mormon
> census[Atlanta,9988,birthYear] = 1926
> census[Atlanta,9988,baseballTeam] = Yankees
> census[Atlanta,9988,eyeColor] = green
> census[Chicago,3258,name] = Billy
> census[Chicago,3258,religion] = Atheist
> census[Chicago,3258,birthYear] = 1982
> census[Chicago,3258,eyeColor] = blue
> census[Chicago,3258,baseballTeam] = Red Sox
> 
> Alternately of course this could be a list with each line dedicated
> to the individual.
> 
> Each individual would have 300-400 different items and there will be
> thousands of individuals.
> 
> The data needs to be accessed very very quickly, which points to an
> array as above.  And most of the time very specific pieces of data
> will be accessed and updated.  And changes will be made constantly.
> So far, so good.
> 
> But here's the glitch.
> 
> I need to also be able to make global changes to the list, for
> example, update everybody whose baseball team is "Red Sox" and
> birthYear is 1950.  For example, change all instances of Red Sox to
> White Sox if the birthYear is 1950.
> 
> Is there any way short of looking inside each element of thousands of
> keys for the matching birthYear/baseballTeam?
> 
> This would presumably be very slow.  But if the array were a list
> with thousands and thousands of lines, each line having 300-400
> items, wouldn't that be slow to access as well?
> 
> What am I missing?
> 
> Shari

Hi, Shari.  There are other ways to structure your data that can make your
"glitch" easier to handle.  Choosing the best way depends on various
factors, such as:
1) time constraints on adding, updating, and deleting people, properties,
and values
2) whether you have multiple simultaneous users
3) your time and skills

But jumping the gun, you could consider using arrays like the following:

birthYear[1976] = 5489
baseballTeam["Red Sox"] = 3258
eyeColor["blue"] = 5489 & cr & 3258

Then evaluating your compound example involves retrieving the values of
baseballTeam["Red Sox"] and birthYear[1950], deriving the intersection of
those values, removing them from baseballTeam["Red Sox"], and inserting them
into baseballTeam["White Sox"].

I've used this approach; it's fast.  I'd be glad to help you further if
you're interested.

-- Dick



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


Re: Many Cards Versus One Card and a List Field

2008-01-16 Thread Dick Kriesel
On 1/15/08 10:47 PM, "Peter Alcibiades" <[EMAIL PROTECTED]>
wrote:

> Its a childishly simple problem.  There is a file with 15k records.  Tab
> delimited.  Each record has five fields and is of the form:
> 
> number  eg 123
> description  eg Pen, Pencil
> price eg 2.00
> category eg AA, AB...
> date eg  12/4/2008, 21/5/2008 (UK style)
> 
> We then have 30 fields, which are the combination of a category and a month.
> So for instance we need to look at each record, if and only if it has both AA
> in item 4 and /4/ in item 5,  then add the price item 3 to field AAApril.  If
> and only if it has both AA and /5/ then add it to AAMay, and so on.  6
> months, five categories = 30 fields..

Hi, Peter.  Here's a technique that should work pretty fast.  Does it work
for you? 

on foo
  put "AA,AB,AC,AD,AE" into tCategories
  put "January,February,March,April,May,June" into tMonths
  repeat for each item tCategory in tCategories
repeat for each item tMonth in tMonths
  put 0 into field (tCategory & tMonth)
end repeat
  end repeat
  set itemdelimiter to tab
  put URL "file:foo.txt" into tRecords
  repeat for each line tRecord in tRecords
put item 5 of tRecord into tDate -- d/m/y
replace "/" with space in tDate
add item 3 of tRecord to tArray[item 4 of tRecord,word 2 of tDate]
  end repeat
  set itemdelimiter to comma
  repeat for each key tKey in tArray
put item 1 of tKey into tCategory
put item 2 of tKey into tMonthNumber
put item tMonthNumber of tMonths into tMonth
put tArray[tKey] into field (tCategory & tMonth)
  end repeat
end foo

Typical disclaimer: It's not tested, but at least it compiles.

-- Dick 


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


Re: Remove subset from array

2007-09-17 Thread Dick Kriesel
On 9/17/07 7:40 AM, "Mark Schonewille" <[EMAIL PROTECTED]>
wrote:

> We have the intersect and union commands to manipulate arrays. I
> would like to be able to remove the element of one array from another
> array. E.g. if a,b,c is on array 1 and a,b,c,d,e,f is in array 2, I
> would like to remove a,b,c from array 2 without using a repeat loop.
> 
> Did I miss something and is this possible already, or should I post
> an enhancement request? What would be a good name for such a command,
> if there isn't any yet?

Without a new command or function, the repeat loop is essential, I think.

A quick check of Wikipedia suggests several candidate names:
  relativeComplement
  setTheoreticDifference
  complement
  setDifference
  difference
  setDiff
  diff

See .

Here's what I use:

on set_differenceFromArrays @tArray,pArray,pCaseSensitive
  local tKey
  set the casesensitive to (pCaseSensitive is "true")
  repeat for each key tKey in pArray
delete variable tArray[tKey]
  end repeat
  delete variable tArray[empty]
end set_differenceFromArrays

Command set_differenceFromLists uses a similar repeat loop.
 
-- Dick


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


Re: Global Misbehaving

2007-09-12 Thread Dick Kriesel
Amen to that.


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


Re: placing a group inside another using code...

2007-08-14 Thread Dick Kriesel
Hi, Andre.  Rev's "owner" property is read-only, but here's a way to
overcome that limitation, as long as the new owner is a group or a card in
the same stack as the old owner.

Please let me know if it works for you, or what happened if it doesn't.

-- Dick


setprop uOwner pNewOwner
  if first word of pNewOwner is among the items of "card,group" then
put long owner of the target into tOldOwner
if first word of tOldOwner is among the items of "card,group" then
  put long name of pNewOwner into tNewOwner
  if tNewOwner is not tOldOwner then
if tNewOwner is not long name of the target then
  put the relayergroupedcontrols into tRelayerGroupedControls
  set the relayergroupedcontrols to "true"
  if first word of tNewOwner is "card" then
set the layer of the target to 1
  else
if the long name of the target is in tNewOwner then
  set the layer of tNewOwner to 1
else
  set the layer of the target to the number of controls of this
card
end if
set the layer of the target to the layer of pNewOwner + 1
  end if
  set the relayergroupedcontrols to tRelayerGroupedControls
else put "new owner is the target"
  else put "new owner is the old owner"
else put "old owner must be a card OR a group"
  else put "new owner must be a card OR a group"
end uOwner



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


Re: Can Custom Functions Return Arrays?

2007-07-19 Thread Dick Kriesel
On 7/19/07 11:31 AM, "Gregory Lypny" <[EMAIL PROTECTED]> wrote:

> So, is it that Revolution custom functions cannot return arrays or am
> I doing something wrong?

The following works for me:

on foo
  put bar() into x
  put the keys of x
end foo

function bar
  put 2 into a[2]
  put 4 into a[4]
  return a
end bar

Does it work for you?

-- Dick


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


Re: Need for Speed (postscript)

2007-07-16 Thread Dick Kriesel
On 7/15/07 12:58 PM, "Beynon, Rob" <[EMAIL PROTECTED]> wrote:

> I ran a brutal test, of 45,000 lines in massList and 16,000 lines in seqDB
> 
> My crude attempt seems to be capable, even running within the Rev IDE, of
> completing the 720million comparisons in about 30minutes (OK, admittedly
> CoreDuo 2.66GHz, 2GB RAM). That's 24million a minute! (I deliberately put some
> searches that would match at the end of seqDB, to be sure I searched through
> most of the file each time). I am pretty happy with this, and I'd be looking
> for at least a 10-fold gain in speed to code up a harder solution.
> 
>  
> 
> Do you experts thing a 10-fold gain is feasible? 100-fold?

I'd be surprised to get that big a gain.  Nonetheless, here's a version that
emphasizes arrays over lists.  In the following code, the reasons why this
version may run faster appear as comments.  If you'll try it and report the
results, we'll learn whether the extra programming is justified.

on mouseUp
  put the milliseconds into tMilliseconds1
  put gSeqDB into tPeptideArray
  split tPeptideArray using cr
  repeat for each key tPeptideKey in tPeptideArray
put word 3 of tPeptideArray[tPeptideKey] \
into tPeptideMassArray[tPeptideKey]
-- note: get word 3 once for each peptide
--  rather than once for each combination of peptide and mass
  end repeat
  put field "ppm" into tPPM
  put tPPM / 100 into tFactor
  -- note: divide by a million once for each mouseUp
  --  rather than once for each mass
  put field "massList" into tMassArray
  split tMassArray using cr
  put the milliseconds into tMilliseconds2
  put tMilliseconds2 - tMilliseconds1 && "milliseconds for setup" & cr
  
  repeat for each key tMassKey in tMassArray
put tMassArray[tMassKey] into tMass
put tMass * tFactor into tMassThreshold
repeat for each key tPeptideKey in tPeptideMassArray
  if abs(tMass - tPeptideMassArray[tPeptideKey]) <= tMassThreshold then
put empty into tOutputArray[tMassKey,tPeptideKey]
  end if
  -- note: minimize the work of the innermost loop
end repeat
  end repeat
  put the milliseconds into tMilliseconds3
  put tMilliseconds3 - tMilliseconds2 && "milliseconds for filtering" \
  & cr after msg
  
  put the keys of tOutputArray into tKeys
  sort tKeys numeric using item 2 of each
  sort tKeys numeric using item 1 of each
  repeat for each line tKey in tKeys
-- note: ignore any mass for which every peptide failed the test
put item 1 of tKey into tMassKey
if tMassKey <> tMassKeyPrev then
  add 1 to i
  put "NEW SEARCH, MASS = " & tMassArray[tMassKey] \
  & " at " & tPPM & " ppm error" into tOutputData[i]
  put tMassKey into tMassKeyPrev
end if
add 1 to i
put item 2 of tKey into tPeptideKey
put tPeptideArray[tPeptideKey] & "K" & tab \
& tPeptideMassArray[tPeptideKey] - tMass into tOutputData[i]
-- note: don't bother with the line of equal signs
  end repeat
  combine tOutputData using cr
  put tOutputData into field "Output"
  put the milliseconds into tMilliseconds4
  put tMilliseconds4 - tMilliseconds3 && "milliseconds for output" \
  & cr after msg
  
  put tMilliseconds4 - tMilliseconds1 && "milliseconds total" \
  & cr after msg
end mouseUp

If I've introduced bugs you'd like me to squash, please let me know.

The fact that you have a field "ppm" rather than a constant in the program
causes me to wonder whether you change the value and run the program again.
If so, you could use another nested repeat instead.

-- Dick


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


Re: Fastest memory based search technique (was: Adding 1 to an array)

2007-06-25 Thread Dick Kriesel
On 6/24/07 10:51 AM, "David Bovill" <[EMAIL PROTECTED]> wrote:

> So whats wrong with the idea of creating arrays and then making unions of
> these arrays to get a fast in memory result equivalent to "SQL join"?

You'd need to update your arrays when you recompile anything, when you
rename almost any stack, and when you change the owner of almost anything,
if you're doing something like the following:
put tSignature & tab & tLongID & cr after tReference[tTerm]

What arrays do you envision?

> 
> I have scripts that automatically extract keywords and link relationships
> between the handlers - so a function "xml_GetText" is split into words
> "xml,get,text" 

Does it parse based on camelCaps and embedded delimiters like underscores?

> - I usually throw away the common stuff like "get", then I
> extract all the handler calls, and the built in transcript calls and
> generate keywords, and dependency relationships from them.

Does it parse call statements, value expressions, and do expressions?

If you've got that just about under control, then please also add the
ability to distinguish between finding terms in executable code and finding
terms outside executable code, such as in comments and redundant handlers.
Then please add the ability to distinguish between public handlers and
private handlers.

If you'd like suggestions about simplifying or speeding up your code, or
beta testing, I'd like to help.

-- Dick


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


Re: altID

2007-05-26 Thread Dick Kriesel
On 5/26/07 12:16 PM, "David Bovill" <[EMAIL PROTECTED]> wrote:

> the problem is you cannot use "control id tAltID of group id" -
> thats why it does not work

That construct works for me.  Here's a working example, derived from the
first script I posted yesterday.

on mouseUp
  create stack
  go to it
  create group "aTemplate"
  put the id of it into tGroupID1
  create field in it
  set altid of it to 1
  set text of it to "template"
  clone group "aTemplate"
  put the id of it into tGroupID2
  set the text of field id 1 of it to "clone"
  put field id 1 of group id tGroupID1 && field id 1 of group id tGroupID2
end mouseUp

What makes you think the construct doesn't work?

-- Dick


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


Re: altID

2007-05-26 Thread Dick Kriesel
On 5/26/07 11:55 AM, "Joe Lewis Wilkins" <[EMAIL PROTECTED]> wrote:

> I admire in cleverness of all this, but the code is even worse to
> comprehend than assembly language. Seems to me we're going backwards.
> Can't we just keep things simple; like with put and get and
> meaningful names?
> 
> Seems to me we're defeating the whole purpose of Rev.

Rev's purpose, as I see it, stops short of making it easy to use libraries
of custom controls.  The topic has come up on use-rev quite a few times, but
it's never seemed easy or simple.

Naming things is difficult.

If you can simplify the logic and/or improve the names, please post your
code.  I'm all for simplicity and meaningful names.  I just haven't seen a
better way to serve this purpose.

-- Dick


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


Re: altID

2007-05-26 Thread Dick Kriesel
On 5/26/07 3:51 AM, "David Bovill" <[EMAIL PROTECTED]> wrote:

> I like the idea of being able to copy a template
> into a stack and still refer to the object by its altID - so everything
> keeps working. The aim is not to have to rename anything in a script as this
> gets messy in a general case.
> 
> But if I copy 10 versions to the same stack it won't work with altIDs
> because they would all have the same id and as (unlike the case with normal
> ids) - you cant use a syntax like "group id 65535 of card 1" there is no way
> to distinguish them without renaming them.

If you make ten copies of a template, you need to distinguish each of the
ten somehow.  Since you'd rather not rename them "copy1" through "copy10"
you can identify each copy in a custom property set of the object that
contains them.


function copyTemplate pTemplateName,pLibraryName,pTarget
  put the uTemplateCopies of pTarget into tTemplateCopies
  put the keys of tTemplateCopies into tKeys
  filter tKeys with pTemplateName,pLibraryName,"*"
  put number of lines in tKeys + 1 into tCopyNumber
  copy group pTemplateName of stack pLibraryName to pTarget
  set the uTemplate of it to pTemplateName,pLibraryName
  set the uCopies of group pTemplateName of stack pLibraryName to \
the long id of it
  set the uTemplateCopies of pTarget to tTemplateCopies \
& pTemplateName,pLibraryName,tCopyNumber & cr
  return tCopyNumber
end copyTemplate


Then each template knows its copies, each copy knows its template, and each
target knows which copies of which templates it contains. Your code can
refer to a control in any of the copies using an "of group id" clause to
disambiguate the altIDs.


  put the text of control id tAltID of group id \
the uTemplateCopies[tTemplateName,tLibraryName,tCopyNumber] of tTarget


Please note that the above code is a suggestion typed into an email, rather
than tested code copied from a working app.  Does the suggestion work for
you?  If you improve the code somehow, please share your results.

-- Dick


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


Re: altID

2007-05-26 Thread Dick Kriesel
On 5/20/07 5:35 AM, "David Bovill" <[EMAIL PROTECTED]> wrote:

> Has anyone got extensive experience of using altID? I am thinking of using
> it - but not sure exactly how.
> 
> The scenario I have is to do with a library of components that get copied
> all over the place, replace each other and need a good way of referring to
> each other and their library equivalents. I cant to use ids as they change
> when copied. I can't use names, because there may be other controls of the
> same name, and i want to be able to rename them without affecting anything,
> so... can I use altIDs?

Hi, David.  Yes, you can use altIDs, as in the following example:


on mouseUp
  create stack
  go to it
  create group "aTemplate"
  create field in it
  set altID of it to 1
  set text of it to "template"
  clone group "aTemplate"
  set name of it to "aClone"
  put "clone" into field id 1 of group "aClone"
  put field id 1 of group "aTemplate" && field id 1 of group "aClone"
end mouseUp


Watch out for using an altID that Rev uses as a primary id.  You could
create a thousand clones in one stack using the above technique without
clashing with Rev's ids.  If you need ten thousand, you can set the id of
the stack up by ten thousand, and used the skipped Rev ids for your altIDs.

Watch out also for the upper limit on altIDs, which is 65535.

Does that work for you?

-- Dick


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


Re: Tricky Problem

2007-05-23 Thread Dick Kriesel
On 5/22/07 2:01 PM, "Dave" <[EMAIL PROTECTED]> wrote:

> What I really want is a way of tell if the mouseUp handler has been
> called by the user pressing the mouse or if it's via the "send" command.
> 
> Any ideas?

Hi, Dave.  Another way uses the executionContexts, even though it's not
supported or documented.  It is simpler than passing parameters and
distinguishing them.


if word 1 of line -2 of the executionContexts is "button" then


You can check for a particular button as well as distinguish mouseUp from
mouseDown, if you want.


if item 1 to 2 of line -2 of the executionContexts is /
the long id of button "foo","mouseUp" then

 
-- Dick


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


to avoid making mistakes (was TARGET bug..please check)

2007-05-01 Thread Dick Kriesel
On 4/30/07 11:23 PM, "Richard Gaskin" <[EMAIL PROTECTED]> wrote:

> I got on this kick a while back about reducing the warnings in my apps,
> looking for ways to provide guidance to the user to avoid making
> mistakes in the first place.
> 
> With regard to validation, this trajectory led me to a frontScript that
> simply prevents non-numeric characters from being entered into numeric
> fields, something like this:
> 
> on keyDown k
>get the uValidationType of the target
>if it is empty then pass keyDown
>if it is "number" AND k is in "0123456789" then
>   pass keyDown
>end if
> end keyDown

Does that trajectory lead to a switch in the frontScript, or to focusIn
handlers that insert their own frontScripts, or what?

It sounds like a good topic for an article in RevJournal.  I think it'd be a
worthy feature for some Rev Standard Library too (unless it's become
proprietary, of course).

-- Dick


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


Re: How do I get the object under the mouse when mouseRelease?

2007-04-30 Thread Dick Kriesel
On 4/30/07 11:30 AM, "J. Landman Gay" <[EMAIL PROTECTED]> wrote:

> If you do have to use your own handlers, then you could scan all the
> objects when the mouse goes up:
> 
> on mouseUp
>   put the mouseloc into tXY
>   repeat with x = 1 to the number of controls
>if tXY is within the rect of control x then
>  -- do what you need
>  exit repeat
>end if
>   end repeat
> end mouseUp
> 
> But this way can be time-consuming if you have many controls. The
> built-in commands and functions are much better.


There's another way that's fast even for many controls.  Here's a
description posted last month:


On 3/19/07 3:38 AM, "Dick Kriesel" <[EMAIL PROTECTED]> wrote:

> Here's another technique for identifying the object at the mouseLoc. This
> technique is different because it works with no repeat loop, no checking the
> visible or the rect of any object, no formulas based on the mouseLoc, and no
> reference to the mouseControl.
> 
> Create a button named "mouseObject" with the following script:
> 
> -- 

click outside Rev?

2007-04-27 Thread Dick Kriesel
I¹d like to make a Rev app that drives another app by sending it clicks.  An
example of such an app is a Help app that explains how to do something in
another app, and offers a do-it-for-me button.

I¹m using Mac OS X, hoping to drive a Windows app that¹s running in
Parallels.  Could someone please tell me how, or offer any hints?

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


Re: Obtaining the size of a file

2007-04-21 Thread Dick Kriesel
On 4/21/07 1:03 AM, "Bill Marriott" <[EMAIL PROTECTED]> wrote:

> Another way to make quick work of the detailed files is to put them into an
> array:
> 
>put the detailed files into foobar
>split foobar by return and comma
> 
> then you can say,
> 
>get item 1 of foobar[urlencode(myFileName)]
> 
> to obtain the file size. How's that for a one-liner?

You can include the size of the Mac data fork and still use just one line:

get sum(item 1 to 2 of foobar[urlencode(myFileName)])

-- Dick


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


Re: Newbie Question

2007-03-28 Thread Dick Kriesel
On 3/28/07 12:49 AM, "Simon HARPER" <[EMAIL PROTECTED]> wrote:

> on mouseUp
>put the hilitedlines of field "listCats" into tLineList
>split tLineList by comma
>sort items of tLineList descending of each
>repeat for each element tLineNumber in tLineList
>  delete line tLineNumber of field "listCats"
>end repeat
>sort field "listCats" ascending
> end mouseUp

Try this, Simon:

on mouseUp
  put field "listCats" into tListCats
  put the hilitedlines of field "listCats" into tHilitedLines
  repeat with i = number of items in tHilitedLines down to 1
delete line (item i of tHilitedLines) of tListCats
  end repeat
  put tListCats into field "listCats"
end mouseUp

Also, try using the dictionary.  The entry for "repeat" will help you.

-- Dick


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


Re: dictionary question

2007-03-27 Thread Dick Kriesel
On 3/27/07 1:53 PM, "Dick Kriesel" <[EMAIL PROTECTED]> wrote:

> Unfortunately, wordcentral.com doesn't expose the search string in the url.
> When I viewed the page's source I didn't recognize how to build the url.

http://www.wordcentral.com/cgi-bin/Search?foo*

Note the wildcard, which wordnet doesn't support.  Of course, wordnet is
vastly richer.

-- Dick


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


Re: dictionary question

2007-03-27 Thread Dick Kriesel
On 3/27/07 11:47 AM, "Jim Ault" <[EMAIL PROTECTED]> wrote:

> Basically you get a URL that includes the word in the search string.
> Do a few site searches and copy the url that is in the browser, then build
> the same string in a repeat loop for each word.

Unfortunately, wordcentral.com doesn't expose the search string in the url.
When I viewed the page's source I didn't recognize how to build the url.
Can you, Jim?

-- Dick


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


Re: [TIP} co-sort variable 1 based on values in variable 2

2007-03-20 Thread Dick Kriesel
On 3/20/07 6:35 PM, "Jim Ault" <[EMAIL PROTECTED]> wrote:

> Thanks!  and this is going in my scrapbook.

You're welcome, Jim.  By the way, duplicates in your varB don't matter, so
you can do without checking for them.

-- Dick


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


Re: [TIP} co-sort variable 1 based on values in variable 2

2007-03-20 Thread Dick Kriesel
On 3/20/07 2:36 PM, "Jim Ault" <[EMAIL PROTECTED]> wrote:

> I could not find an easy way to get "sort by each" to handle this, unless it
> built a script local or global to hold the original 'x', so I just used an
> array.

Hi, Jim.  Here's a way:

split varB by comma
sort items of varA descending by varB[itemOffset(each,varA)]

-- Dick


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


Re: Mouse messages while down

2007-03-19 Thread Dick Kriesel
On 3/18/07 12:12 AM, "Sarah Reichelt" <[EMAIL PROTECTED]> wrote:

> I'm now doing the politically correct mouseMove instead of using
> repeat while mouse is down. But it still leaves me having to check the
> location all the time to see whether it is inside one of my 400
> buttons. It seems that the mouseControl should be able to report where
> the mouse is without me having to check it manually. But mouseControl
> gets stuck when you click down and never changes until the mouse comes
> up again.

Here's another technique for identifying the object at the mouseLoc. This
technique is different because it works with no repeat loop, no checking the
visible or the rect of any object, no formulas based on the mouseLoc, and no
reference to the mouseControl.

Create a button named "mouseObject" with the following script:

-- 

Re: Mouse messages while down

2007-03-18 Thread Dick Kriesel
On 3/18/07 7:56 AM, "Jerry Daniels" <[EMAIL PROTECTED]> wrote:


> on glxInspectObject
>  -- get long id of object, even if pointer is in title bar:
>  put glxGetObjectBeneathPointer() into theObjectID
>  edit the script of theObjectID
> end glxInspectObject


Hi, Jerry.  How does glxGetObjectBeneathPointer() work?  I searched the
Galaxy scripts and didn't find it.

-- Dick


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


Re: Mouse messages while down

2007-03-18 Thread Dick Kriesel
On 3/18/07 12:12 AM, "Sarah Reichelt" <[EMAIL PROTECTED]> wrote:


> But it still leaves me having to check the
> location all the time to see whether it is inside one of my 400
> buttons.


Hi, Sarah.  You could build an array using points as keys, so that when you
look up any x,y pair you get the control id.  If that would use too much
memory, you could build two arrays, one for x and one for y.  If the x array
identifies for each value of x the controls that share that value of x, any
the y array is analogous, then intersecting of the values for the current x
with the values for the current y would yield the current control id. For
buttons in a simple arrangement, you could probably use even less memory.
Whichever design you choose, you could store the arrays as custom property
sets of the card, so your user could never perceive the delay even for a
huge number of buttons.  Of course you'd need to rebuild the arrays if you
move a button.  Do you feel the need the speed enough to write the code?

-- Dick


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


Re: Simulated mouse messages

2007-03-06 Thread Dick Kriesel
Check the dictionary for "send."

send "mouseUp" to button 1

-- Dick


On 3/6/07 9:32 PM, "Brent Anderson" <[EMAIL PROTECTED]> wrote:

> Hello.
> 
> I'm working on simulating mouse messages and am hung up on how to
> simulate mouseDown, mouseStillDown, and mouseUp messages from script
> (specifically, network messages). Any thoughts?
> 
> Thanks,
> Brent Anderson
> Christa McAuliffe Space Education Center
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


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


Re: Pendingmessages

2007-03-02 Thread Dick Kriesel
On 3/2/07 2:32 PM, "Andre Garzia" <[EMAIL PROTECTED]> wrote:

> In case we had some nifty function, a cousin of the functiona
> 'variableNames' that could access all the current variables in memory
> and their context, we could then freeze the engine state to some
> container and restore it or bits of it as we needed them.

Hi, Andre.

Capturing all the variables and their values from every context in the
executionContexts is doable, I think, but restoring the state of the engine
seems like magic.  Is thorough capturing and later restoring "bits" of it
sufficient, without trying to make the executionContexts function return
exactly the same value?

-- Dick


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


Re: like pass, but without ending the handler

2007-03-01 Thread Dick Kriesel
On 2/28/07 3:27 PM, "J. Landman Gay" <[EMAIL PROTECTED]> wrote:

> The important part is the "wait  with messages", which allows user
> input to occur simultaneously. That will allow you to put in a "stop"
> button. But while "wait with messages" does allow the messages to
> happen, it does not allow them to be acted on. They will pile up in a
> queue until the loop is exited. Some of them, anyway. I think some were
> just lost.

Jacque, could you please clarify this?  What's the difference between
happening and being acted on?  If Rev loses messages, I'd like to
understand, so I don't write code that's likely to fail and that cannot be
debugged.  

-- Dick


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


like pass, but without ending the handler

2007-02-28 Thread Dick Kriesel
If you have a handler that needs to do something after letting the message
proceed along the message path, here¹s a pithy way:
call the params of the owner of me

One example scenario involves a newGroup handler that needs its owner¹s more
general handler to run before the more specific handler can finish its task.

For a demonstration, try the following:

1. create a new main stack and give it this script:
 on foo p1,p2,p3
   put "hello from" && me && "with" && the params & cr after msg
 end foo
2. give the card this script:
 on foo p1,p2
   put ""
   call the params of the owner of me
   put "hello from" && me && "with" && the params & cr after msg
 end foo
3. in the message box, enter "foo 1,2,3" without the quotes
4. see the following:
 hello from stack "Untitled 1" with foo "1","2","3"
 hello from card id 1002 with foo "1","2","3"

It works for me.  If you find a case where it doesn't, please let me know.

Or is there a better way for an initialization handler to invoke its parents
without skipping remaining statements?

-- Dick


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


QC Center and dictionary feature request?

2007-02-14 Thread Dick Kriesel
When I look up a term in the dictionary, I¹d like to see related bugs and
enhancement requests, and their votes.

If we could all do that, maybe more of us would vote.  Maybe the increase in
feedback would help RR.

How hard would it be to link dictionary and Œzilla entries?

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


Re: A Single SetProp?

2007-01-19 Thread Dick Kriesel
On 1/19/07 5:16 PM, "Scott Rossi" <[EMAIL PROTECTED]> wrote:


> wondering if there is a way to trigger a single SetProp structure (that
> contains a switch statement) when setting *any* custom property, or do you
> have to use a separate SetProp structure for *each property* you want to
> monitor.  Something like:
> 
>  setProp anyOfMyProps pValue
>switch anyOfMyProps
> case "propA"
>   doSomeStuff
> break
> case "propB"
>   doOtherStuff
>end switch
>  end anyOfMyProps


Your suggestion is a lot like what you can do for any number of custom
properties all in the same custom property set:

setprop uMyCustomPropertySet[pCustomProperty] pValue
  switch pCustomProperty
case "propA"
  put 1 into tValue
  break
case "propB"
  put 2 into tValue
default
  put 3 into tValue
  end switch
  ask the params & cr & tValue
  set the uMyCustomPropertySet[pCustomProperty] of the target to tValue
end uMyCustomPropertySet[pCustomProperty]

See "setprop" in the dictionary.

-- Dick


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


Re: calling a remote function..

2007-01-19 Thread Dick Kriesel
On 1/19/07 7:50 AM, "Chipp Walters" <[EMAIL PROTECTED]> wrote:

> Ding ding. You win the prize.
> 
> answer value("foo(" & q(param1) & comma & q(param2) & ")", btn "bar")

But note that if a param contains more than one line, the value function
does not return the expected result.  Ding dong.

Try this script for button "PressMe" to see for yourself:

on mouseUp pMouseBtnNum
  put "1,000" into param1
  put "soldiers" & cr & "coming home" into param2
  answer value("foo(" & quote & param1 & quote & comma & \
  quote & param2 & quote & ")",btn "bar")
end mouseUp

If you'd like to use the value function with multi-line params, please
consider voting for bug 2904:
Allow 'value' to evaluate expressions containing returns like 'send'

-- Dick


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


Re: private handlers in a public library

2006-12-08 Thread Dick Kriesel
On 12/6/06 10:59 PM, "Dar Scott" <[EMAIL PROTECTED]> wrote:

> I think your checking method is pretty clever and can be handy.
> Though the cost of a couple lines and a few microseconds might be
> much for small handlers, this might work OK for larger handlers.

When microseconds don't matter, it can be done in one line.

-- 

on publicHandler
  privateHandler
end publicHandler

on privateHandler
  if trespass() then pass privateHandler
  -- private stuff
end privateHandler

-- same one liner for privateFunction and uPrivateProperty

function trespass
  return item 1 of line -2 of the executionContexts is not \
 item 1 of line -3 of the executionContexts
end trespass

-- 

Function "trespass" can instead reside in some other library.

-- Dick


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


Re: private handlers in a public library

2006-12-07 Thread Dick Kriesel
On 12/7/06 10:37 AM, "Dar Scott" <[EMAIL PROTECTED]> wrote:

> 
> On Dec 7, 2006, at 12:25 AM, Dick Kriesel wrote:
>>> You might be interested in feature request 1443 listed in Bugzilla.
>> 
>> "Zarro Boogs found."  I wonder why an old bug number's data would
>> disappear.
> 
> It's a conspiracy!
> 
> Actually, this is probably the strange default for "Status".  The
> default for "Status" does not include Unconfirmed, which half of the
> Enhancements are.  (Revzilla probably fixes this, but it has been on
> my list for two years and my list is 3 years long, so I don't know
> what it does--something to do with bugs.)
> 
> So, in Bugzilla, select all of the status, put in the bug number for
> "Only include bugs numbered", and then whack Search.  (Maybe you
> should just click it, you don't want to knock the button off the page.)
> 
> Dar

That worked.  I voted.

-- Dick


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


Re: private handlers in a public library

2006-12-06 Thread Dick Kriesel
On 12/6/06 10:59 PM, "Dar Scott" <[EMAIL PROTECTED]> wrote:

> You might be interested in feature request 1443 listed in Bugzilla.

"Zarro Boogs found."  I wonder why an old bug number's data would disappear.

-- Dick


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


private handlers in a public library

2006-12-06 Thread Dick Kriesel
What are the best practices for hiding private handlers in a public library?

I Googled "'private handler' site:lists.runrev.com" and similar terms
without finding the answer.  If the topic's been covered and I missed it,
please excuse me.

Here's a technique that uses the executionContexts:

on privateHandlerInPublicLibrary
  if item 1 of line -2 of the executionContexts is long id of me then
return the params && the long time -- i.e., "private" stuff
  else pass privateHandlerInPublicLibrary
end privateHandlerInPublicLibrary

function privateFunctionInLibrary
  if item 1 of line -2 of the executionContexts is long id of me then
return the params && the long time -- i.e., "private" stuff
  else pass privateFunctionInLibrary
end privateFunctionInLibrary

getprop uPrivatePropertyInLibrary
  if item 1 of line -2 of the executionContexts is long id of me then
return the params && the long time -- i.e., "private" stuff
  else pass uPrivatePropertyInLibrary
end uPrivatePropertyInLibrary

setprop uPrivatePropertyInLibrary
  if item 1 of line -2 of the executionContexts is long id of me then
return the params && the long time -- i.e., "private" stuff
  else pass uPrivatePropertyInLibrary
end uPrivatePropertyInLibrary

Object backScripts would make it simpler, but what's best now?

-- Dick


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


Re: Fun Project: xTalk GUID Generator

2006-12-01 Thread Dick Kriesel
On 12/1/06 10:46 AM, "Ken Ray" <[EMAIL PROTECTED]> wrote:

> On 12/1/06 11:35 AM, "Bill Marriott" <[EMAIL PROTECTED]> wrote:
> 
>> And Rev's "the milliseconds" returns the total number of milliseconds since
>> the "start of the eon" -- which is midnight GMT, January 1, 1970. Ticks is
>> the same, but returns 1/60th of a second. I don't think we have a way of
>> accessing nanoseconds (billionth of a second).
> 
> No, the closest we have is microseconds (a millionth of a second), by using
> the "long seconds" function. But keep in mind the note attached to it: "this
> value is not normally accurate past the third decimal place because of
> processor delays".

Since no one will be converting GUIDs back to seconds, accuracy doesn't
matter for this purpose, right?

So functions "long seconds" and "random" can be used to fake nanoseconds.

-- Dick


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


Re: Matchtext script results

2006-12-01 Thread Dick Kriesel
On 11/30/06 3:07 PM, "J. Landman Gay" <[EMAIL PROTECTED]> wrote:

> And that is what surprised me -- that no tinkering with arrays, or
> matchtext, or anything else is faster than the most straightforward
> Revolution syntax.

At least that's true for your sample data.  If the word list were very long,
for example, some other technique(s) would win the contest.

Thanks for publishing your findings.

-- Dick


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


Re: Matchtext to find a series of words

2006-11-29 Thread Dick Kriesel
On 11/29/06 4:31 PM, "Brian Yennie" <[EMAIL PROTECTED]> wrote:

> I do think that algorithmically
> one-pass is definitely possible. You just need to pass through the
> text once, and "cross off" each word as you find it. If everything is
> crossed off when you're done, then you're done =).

Good idea, Brian.

-- Dick

on mouseUp
  put "The purple dinosaur inadvertently stepped on the cat." & cr \
& "The white dog howled." into tText
  put "dog dinosaur cat" into tWords
  put textContainsAllWords(tText,tWords)
end mouseUp

function textContainsAllWords tText,tWords
  replace "." with space in tText
  replace "," with space in tText
  split tText using space and space
  split tWords using space and space
  repeat for each key tWord in tText
delete variable tWords[tWord]
  end repeat
  return the keys of tWords is empty
end textContainsAllWords


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


Re: Matchtext for multiple words

2006-11-29 Thread Dick Kriesel
On 11/29/06 1:39 PM, "J. Landman Gay" <[EMAIL PROTECTED]> wrote:

> I need a matchtext/regex that will tell me if all supplied words exist
> in a block of text, regardless of their order, and ignoring carriage
> returns.
> 
> For example, see if all these words:  dog dinosaur cat
> 
> exist in this text:
> 
> "The purple dinosaur inadvertently stepped on the cat.
> The white dog howled."
> 
> Should return true. Is there such a thing?

Since Rev says "cat" and "cat." are different words, punctuation poses a
problem.  Here's an approach that's simple and fast but depends on the
programmer to include a replace statement for each punctuation mark.

-- Dick

on mouseUp
  put ""
  put "The purple dinosaur inadvertently stepped on the cat." & cr \
& "The white dog howled." into tText
  put "dog dinosaur cat" into tWords
  putLines textContainsAllWords(tText,tWords)
end mouseUp

function textContainsAllWords tText,pWords
  replace "." with space in tText
  replace "," with space in tText
  repeat for each word tWord in tText
put 1 into tArray[tWord]
  end repeat
  repeat for each word tWord in pWords
if tArray[tWord] is empty then return "false"
  end repeat
  return "true"
end textContainsAllWords


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


Re: what is the method you use to save a specific field reference in a variable or custom property?

2006-09-12 Thread Dick Kriesel
On 9/12/06 7:04 PM, "Ken Ray" <[EMAIL PROTECTED]> wrote:

> I don't think
> there's a downside to always using "do" when you have a long ID as a
> reference, other than that it takes slightly longer to process because it
> needs to interpret it on the fly (which really only shows itself when you
> have it in a loop).

Long IDs of objects can break when owners change, so the "do" could fail.
So could other techniques that rely on the long id.

Some time ago some folks talked about using a rugged id, that's insensitive
to changes in the group hierarchy.  If you'd like to see a resulting getprop
uRuggedID, let me know.

-- Dick


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


Re: Viewing the size of stack elements (AKA, where have all the bytes gone?)

2006-05-23 Thread Dick Kriesel
On 5/23/06 10:33 AM, "Ben Rubinstein" <[EMAIL PROTECTED]> wrote:

> Any suggestions, pointers, tools, warnings, etc gratefully received.

When I want to find out how big an object is, I copy it, create a new stack,
save it, paste into the new stack, save as some other name, and compare the
file sizes.  I imagine if you want to zoom in, a simple script could tell
you the pasted size of any given object or objects.

-- Dick


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


Re: Custom Properties

2006-04-14 Thread Dick Kriesel
On 4/12/06 6:13 PM, "Mark Wieder" <[EMAIL PROTECTED]> wrote:

> Dan-
> 
> Wednesday, April 12, 2006, 2:49:17 PM, you wrote:
> 
>> One important use of setProp in particular comes into play when you create a
>> library that has values you don't want outside programs/users to change. You
>> just set up a setProp handler that politely, silently or rudely refuses to
>> set the property's value. This is an important idea in object-oriented
>> design.
> 
> On first thought, that sounds like an interesting concept. On second
> thought, it seems like a better case for script-local variables in the
> library stack. How do you separate out a "set" command coming from
> outside the stack from one generated locally?

How about applying the executionContexts?

setProp uFoo pValue
  if word -1 of item 1 of line -2 of the executionContexts = \
  word -1 of long id of me then
-- set the value and trigger the consequences
  else
-- refuse
  end if
end uFoo

-- Dick


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


Re: Variable typing

2006-04-04 Thread Dick Kriesel
On 4/4/06 9:30 AM, "Alex Tweedly" <[EMAIL PROTECTED]> wrote:

> Of course, you still can't distinguish between a variable which is
> undefined and one which has been deliberately set to empty :-(

Here's a technique based on what revvariablewatcher.rev does:

Step 1: create a stack
Step 2: create a field
Step 3: paste the following handlers into the stack script
Step 4: click the stack

on mouseUp
  put 1 into t
  a
end mouseUp

on a
  answer callerVariableExists("t") & cr & callerVariableValue("t")
end a

function callerVariableExists pVariableName
  put empty into fld 1 of me
  set the debugContext to line -3 of the executionContexts
  debugDo "put the variableNames into fld 1 of me"
  set the debugContext to empty
  return pVariableName is among the items of line 2 of fld 1 of me
end callerVariableExists

function callerVariableValue pVariableName
  put empty into fld 1 of me
  set the debugContext to line -3 of the executionContexts
  debugDo "put the variableNames into fld 1 of me"
  if pVariableName is among the items of line 2 of fld 1 of me then
debugDo "put" && pVariableName && "into fld 1 of me"
  else
put empty into fld 1 of me
  end if
  set the debugContext to empty
  return fld 1 of me
end callerVariableValue

-- Dick



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


Re: OT: Important News

2006-04-02 Thread Dick Kriesel
On 4/2/06 12:50 PM, "Kurt Kaufman" <[EMAIL PROTECTED]> wrote:

> http://www.tidbits.com/tb-issues/TidBITS-823.html


The important news has an important dateline.

-- Dick


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


Re: OS X System Crash using 2.7 build 192

2006-03-30 Thread Dick Kriesel
On 3/30/06 1:43 PM, "Joe Brillhart" <[EMAIL PROTECTED]> wrote:

> my entire desktop went blue (no finder!)

That happened to me tonight, on quitting Rev.  I have no guess what caused
the crash.  All I could do after waiting awhile was hold in the on/off
button to restart the Mac.

There seems to be no relevant crash log.

That's the second time it's happened to me with Rev 2.7 build 192 on OS X
10.4.5.  There seemed to be no relevant crash log the first time either, so
I decided to ignore it the first time.

No other app has given me this experience on OS X.

-- Dick


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


Re: Get a handler from a script

2006-03-21 Thread Dick Kriesel
On 3/21/06 2:37 AM, "Alex Tweedly" <[EMAIL PROTECTED]> wrote:

> I suspect you have a different idea for what handler 'a' will do - in
> fact, it *always" ask the time.

You suspected correctly, Alex.  Thanks for finding another mistake.  That
example only shows that the list of tokens is insufficient to reproduce the
_appearance_ of the handler.

Despite that weak example, the point was that the list of tokens is
insufficient to reproduce the _semantics_ of the handler, and therefore not
useful to "get a handler from a script."  Here's a better-chosen example of
two handlers with different semantics but the same tokens for the bodies of
the handlers:

on a
  put "foo" into bar
  return bar
end a

on b
  put "foo" into bar
  return "bar"
end b

> I'll answer about the comments separately,when I've had more time  to
> think about it.

I'm looking forward to it.

-- Dick



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


Re: Get a handler from a script

2006-03-21 Thread Dick Kriesel
On 3/20/06 9:30 PM, "Mark Wieder" <[EMAIL PROTECTED]> wrote:

>>> The best solution I've come up with for removing block comments is
>>> 
>>> put the script of SomeObject into tScript
>>> put token 1 to -1 of tScript into tScript
>>> 
> 
>> This sounded really cool, but I can't get it to work. :(
> 
> Really? What isn't it doing? For me it removes all comments that are
> outside handlers (which is where my block comments are)...

That technique appears to me to work for block comments and line comments
that appear in the script either before the first compilable code or after
the last compilable code.  But it overlooks block and line comments that are
interspersed within the compilable code, and undelimited comments outside
handlers.

In contrast, a repeat loop through the tokens of the script does not see any
line comments anywhere in the script, and does not see the first lines of
any block comments.  In comparison, neither technique removes undelimited
comments outside handlers.

But tokenizing seems unrelated to the challenge of getting a handler from a
script, because it can lose the control structure of a handler.  For
example, consider the following handlers, whose bodies yield the same list
of tokens:

on a
  if the seconds mod 2 = 0 then ask the date;ask the time
end a

on b
  if the seconds mod 2 = 0 then ask the date
  ask the time
end b

Now that I'm considering the variety of valid circumstances for comments,
doomsayers Geoff, Alex, and David are sounding right about this challenge.
But there _ought_ to be a way...

I'd really like to be able to search selected scripts while optionally
ignoring all comments.

-- Dick


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


Re: Get a handler from a script

2006-03-19 Thread Dick Kriesel
On 3/19/06 5:12 PM, "Geoff Canyon" <[EMAIL PROTECTED]> wrote:

> I feel like the harbinger of doom here (with Alex as my able partner
> in doomsaying) but:
> 
> This would still be subject to failure if, anywhere in the script, /*
> or */ appeared _not_ as block comment delimiters, but as part of a
> string.

www.usingenglish.com/reference/idioms/fools+rush+in+where+angels+fear+to+tre
ad.html

Imagine we first remove comments that start with "--" and then start looking
for block comments.  If a "/*" follows an even number of quotes, it starts a
block comment.  If it follows an odd number of quotes, it's embedded in a
string.  After a "/*" starts a block comment, then the next "*/" ends the
comment.  Right?

Or do the angels see even more of the devil in the details?

-- Dick


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


Re: Get a handler from a script

2006-03-19 Thread Dick Kriesel
On 3/19/06 3:41 PM, "Alex Tweedly" <[EMAIL PROTECTED]> wrote:

> You should try that script on itself :-)
> The "/*" in the first 'offset' line, and the "*/" in the second 'offset'
> line are (incorrectly) recognized as a block comment, with fairly
> disastrous results.

I did, and verified that it removed the comment.  I didn't notice that it
also eviscerated the function!  A trivial fix avoids that problem:

on mouseUp
  put removeBlockComments(the script of me)
end mouseUp

/* this is a comment
as is this */function removeBlockComments pText
put pText into tText
put offset("/" & "*",tText) into tOffset
if tOffset > 0 then
  delete char tOffset to tOffset + offset("*" & "/",tText,tOffset) + 1 \
  of tText
  put removeBlockComments(tText) into tText
end if
return tText
end removeBlockComments

> I suspect that proper recognition of block comments
> isn't as easy as it might seem - need to handle all forms of string
> delimiter, which themselves may be inside comments.

Since I don't recognize that need, would you elaborate on it, please?

Thanks for catching my oversight, Alex.

-- Dick


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


Re: Get a handler from a script

2006-03-19 Thread Dick Kriesel
On 3/19/06 2:12 PM, "Geoff Canyon" <[EMAIL PROTECTED]> wrote:

> Checking the first word of each line is (I believe) certain, and is
> still reasonably fast (takes less than twice as long as the filter
> command in informal testing).
> 
> Unfortunately for anyone attempting this task, this is a perfectly
> valid script:
> 
> /* this is a comment
> as is this */on mouseUp
>answer "yes"
> end mouseUp
> 
> I don't know of a good way around that, so I have ignored it thus
> far ;-)

Here's a way:

on mouseUp
  put removeBlockComments(the script of me)
end mouseUp

/* this is a comment
as is this */function removeBlockComments pText
put pText into tText
put offset("/*",tText) into tOffset
if tOffset > 0 then
  delete char tOffset to tOffset + offset("*/",tText,tOffset) + 1 of tText
  put removeBlockComments(tText) into tText
end if
return tText
end removeBlockComments

-- Dick


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


Re: Draw spokes on a wheel

2006-03-17 Thread Dick Kriesel
On 3/17/06 8:01 PM, "Mark Talluto" <[EMAIL PROTECTED]> wrote:

> I hope this means you are coming.

Yes, as a fine southern gentleman I know said, "God willin' and the creek
don't rise."

> Thanks for taking another stab at this.

You're welcome.  You didn't note whether it worked for you.  Did it?

> Looks like Jim Hurley's turtle graphics has gotten a hold of you as well.

Long ago, it was Logo's turtle graphics that got hold of me.  Jim's
implementation enabled the simple solution.  Thanks, Jim.

-- Dick


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


Re: Mind mapping in Rev ?

2006-03-17 Thread Dick Kriesel
On 3/17/06 6:20 PM, "Kresten Bjerg" <[EMAIL PROTECTED]> wrote:

> Has anyone been experimenting with implementing elementary mind-mapping
> functions in Rev ?

Yes, I have, although I'd have to emphasize elementary.

A user creates graphic objects like ovals to represent concepts, and
connects them using the mouse to draw arrows.  When the user moves the mouse
over a concept graphic, the graphic changes color, and a field appears
showing custom text, like a tool tip, but with arbitrarily long text.  When
the user moves the mouse over an arrow graphic, the arrow and the concepts
it connects change color and show their custom text.  When the user clicks
custom text, it's unlocked and selected, so the user can edit it.  When the
user moves a graphic that has arrows to it or from it, the arrows move too.

What do you want?

By the way, according to conceptDraw.com, which offers a product called
MINDMAP 4, Mind Mapping® and Mind Map® are registered trademarks of the
Buzan Organization.

-- Dick


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


Re: Draw spokes on a wheel

2006-03-17 Thread Dick Kriesel
On 3/17/06 2:24 PM, "Mark Talluto" <[EMAIL PROTECTED]> wrote:

> One things is for sure, I owe each of you a drink of your choice at the RevCon
> in Monterey this year.

With positive reinforcement like that, I'll do even better:

on mouseUp
  drawAstig 50,200,225,2
end mouseUp

on drawAstig pSpokeRadiusInner,pSpokeRadiusOuter,pLabelRadius,pLineSize
  go url "http://home.infostations.net/jhurley/StopTurtles.rev";
  start using stack "stopTurtles" -- note: thanks, Jim Hurley
  create stack
  set the width of it to 600
  set the height of it to 600
  go to it
  lock screen
  set the textSize of the templateField to 16
  set the margins of the templateField to 1,7,0,0
  startTurtle
  setH 75 -- note: set heading
  repeat with i = 1 to 24
penUp
forward pSpokeRadiusInner
penDown
forward pSpokeRadiusOuter - pSpokeRadiusInner
penUp
if i mod 2 = 0 then
  forward pLabelRadius - pSpokeRadiusOuter
  label i div 2
  set the width of last field to the formattedWidth of last field
  set the height of last field to the formattedHeight of last field
  back pLabelRadius
else
  back pSpokeRadiusOuter
end if
right 15
  end repeat
  stopTurtle
  set the lineSize of last graphic to pLineSize
  unlock screen
end drawAstig

RevConWest is sounding better and better...

-- Dick


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


Re: Draw spokes on a wheel

2006-03-17 Thread Dick Kriesel
On 3/17/06 10:26 AM, "Mark Talluto" <[EMAIL PROTECTED]> wrote:

> I need a little help drawing spokes to a wheel.  This is actually
> used in a vision test.  I have an image here to help illustrate the
> madness.  I am sure someone like Jim Ault is shaking his head right
> now.  
> 
> I have been using an image, but would like to offer the ability to
> adjust the line length and thickness.  The new antialiasing feature
> will also be handy.  Thanks for any input.

Here's another way to draw the spokes:

on drawAstig pInnerDiameter,pOuterDiameter,pLineSize
  repeat with i = 0 to 345 step 15
create graphic
set the style of it to "oval"
set the height of it to pOuterDiameter
set the width of it to pOuterDiameter
set the angle of it to i
set the arcangle of it to 15
set the opaque of it to "true"
set the lineSize of it to pLineSize
  end repeat
  create graphic
  set the style of it to "oval"
  set the height of it to pInnerDiameter
  set the width of it to pInnerDiameter
  set the opaque of it to "true"
  set the foregroundColor of it to "white"
  create graphic
  set the style of it to "oval"
  set the height of it to pOuterDiameter+5
  set the width of it to pOuterDiameter+5
  set the foregroundColor of it to "white"
  set the lineSize of it to pLineSize + 4
end drawAstig

Applying the hour numbers seems to require a different approach.  If you use
turtle graphics, you can probably both draw the spokes and accurately
position label fields containing the hour numbers.

-- Dick


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


Re: Developer Annoyance #1

2006-03-17 Thread Dick Kriesel
On 3/17/06 12:47 AM, "Arthur Urban" <[EMAIL PROTECTED]> wrote:

> I'm sure it evaluates literals just fine, but it does not
> evaluate containers.

This works here:

on mouseUp
  put 1 into t
  send "foo t,t+1"
end mouseUp

on foo
  ask the params
end foo


Do you have a counter-example?

-- Dick


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


Re: Developer Annoyance #1

2006-03-17 Thread Dick Kriesel
On 3/17/06 12:09 AM, "Arthur Urban" <[EMAIL PROTECTED]> wrote:

> The problem with this solution is that varA and varB are not evaluated.
>
> Andre Garzia wrote:
>> send "calc VarA, VarB" to btn "source"

The dictionary entry for "send" says:

Any parameters are evaluated before they are passed to the send command. For
example, the following statement sends the mouseUp message with 2 as the
first parameter:

  send "mouseUp 1+1" to button "Example"


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


Re: Developer Annoyance #1

2006-03-17 Thread Dick Kriesel
On 3/16/06 10:32 PM, "J. Landman Gay" <[EMAIL PROTECTED]> wrote:

> Or there's a really ugly way too, but it's short:
> 
>insert script of btn "source" into back
>put calc(varA,varB) into localResult
>remove script of btn "source" from back
> 
> I know, I know...but it works.

One person's ugly is another person's beauty, it seems. The technique very
simply solved a current problem for me.

On 3/16/06 11:39 PM, "Chipp Walters" <[EMAIL PROTECTED]> wrote:

> I really like 'call' as it doesn't create a context for the
> handler/function.

My problem was that "call" and "value()" change the target, breaking some of
my handlers.

Thanks to Jacque and Jim.

-- Dick


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


Re: repeat repeat

2006-03-01 Thread Dick Kriesel
If speed matters, you could avoid nesting the loops.

on mouseUp
  repeat with i = 1 to number of buttons
put i into tArray[the label of button i]
  end repeat
  repeat for each item tSeatNo in field "seatNo"
set the backgroundColor of button tArray[tSeatNo] to "red"
  end repeat
end mouseUp

-- Dick



On 3/1/06 4:54 PM, "Mark Schonewille" <[EMAIL PROTECTED]> wrote:

> Hi Liam,
> 
> Assuming that your original code does not cause any errors, the
> following should work, although I didn't test it:
> 
> on mouseUp
>repeat for each item myLabel in fld "seatNo"
>  repeat with x = 1 to the number of buttons
>if myLabel is the label of btn x then
>  set the backgroundColor of btn x to red
>end if
>  end repeat
>end repeat
> end mouseUp
> 
> Instead of "item myLabel" you could also use "line myLabel".
> 
> Best,
> 
> Mark
> 
> 
> liamlambert wrote:
>> My fld "seatNo" has more than one line or item
>> I want to repeat the code below for each line or item
>> 
>> 
>> on mouseUp
>>   put fld "seatNo" into tseatNo
>>  repeat with x = 1 to the number of buttons
>>  if tseatNo = the label of button x then
>>   set the backgroundcolor of  button x to red
>>   end if
>>   end repeat
>> end mouseUp
>> 
>> Liam Lambert
>> [EMAIL PROTECTED]
>> IRELAND


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


... how could one create a customized object ... ? (was something else)

2006-02-28 Thread Dick Kriesel
On 2/28/06 9:37 AM, "Jonathan Lynch" <[EMAIL PROTECTED]> wrote:

> A 3D object viewer probably would not work in transcript, because of the
> intensive processing required to render an image. So, how could one create a
> customized object of that sort?

Jonathan's question in another thread deserves its own thread.

-- Dick


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


Re: [ANN] HOOT: Hacked Object Oriented Transcript

2006-02-28 Thread Dick Kriesel
On 2/28/06 2:06 AM, "Geoff Canyon" <[EMAIL PROTECTED]> wrote:

> getProp uRuggedID
>get the long id of the target
>if word 1 of it is "card" then return word 1 to 3 of it
>if "card" is among the words of it then return (word 1 to 3 of it
> && word -7 to -4 of it)
>return word 1 to 3 of it
> end uRuggedID
> 
> getProp uRuggedLongID
>get the long id of the target
>if word 1 of it is among the words of "card stack" then return it
>if "card" is among the words of it then return (word 1 to 3 of it
> && word -7 to -1 of it)
>return (word 1 to 3 of it && word -3 to -1 of it)
> end uRuggedLongID

What about a control on a card in a substack?
 
-- Dick


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


Re: [ANN] HOOT: Hacked Object Oriented Transcript

2006-02-28 Thread Dick Kriesel
On 2/28/06 12:41 AM, "Geoff Canyon" <[EMAIL PROTECTED]> wrote:

> To handle unplaced groups:
> 
> getProp uRuggedID
>get the long id of the target
>if "card" is among the words of it then return (word 1 to 3 of it
> && word -7 to -4 of it)
>return word 1 to 3 of it
> end uRuggedID
> 
> getProp uRuggedLongID
>get the long id of the target
>if "card" is among the words of it then return (word 1 to 3 of it
> && word -7 to -1 of it)
>return (word 1 to 3 of it && word -3 to -1 of it)
> end uRuggedLongID


That works for unplaced groups but not for cards.

This works for all Rev object types (I think):

getProp uRuggedID
  if word 1 of the target is "stack" then
put the long id of the target into tRuggedID
  else if (word 1 of the target is "group") \
and (word 1 of the owner of the target is "stack") then
put "bkgnd id" && the short id of the owner of the target into tRuggedID
-- note: "bkgnd" is word 1 of the long id of an unplaced group
  else
put abbr id of the target into tRuggedID
put long id of the target into tLongID
put offset(" of card id ",tLongID) into tOffset
if tOffset > 0 then
  put char tOffset to tOffset + offset(space,tLongID,tOffset + 12) \
  + 11 of tLongID after tRuggedID
  -- note: 12 is the length of " of card id "
end if
  end if
  return tRuggedID
end uRuggedID

getProp uRuggedLongID
  put the long id of the target into tLongID
  put the uRuggedID of tLongID into tRuggedLongID
  put offset(" of stack " & quote,tLongID) into tOffset
  put char tOffset to -1 of tLongID after tRuggedLongID
  return tRuggedLongID
end uRuggedLongID


Maybe Geoff will come up with a simpler and/or faster implementation...

-- Dick


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


Re: [ANN] HOOT: Hacked Object Oriented Transcript

2006-02-27 Thread Dick Kriesel
On 2/27/06 6:02 PM, "wouter" <[EMAIL PROTECTED]> wrote:

> Rugged id's are a good idea but this handler will not do the trick.
> And it is difficult to deduce from this handler from where to where
> or which parts of the long id is what you call the rugged id.

For a stack, the rugged id is the long id.
For a card, the rugged id is the abbr id.
For an unplaced group, the rugged id is the abbr id.
For a control on a card, the rugged id is the concatenation of the abbr id
and the card id.

Here's a simpler and more robust handler:

getProp uRuggedID
  if word 1 of the target is "stack" then
put the long id of the target into tRuggedID
  else
put abbr id of the target into tRuggedID
put offset(" of card id ",tLongID) into tOffset
if tOffset > 0 then
  put char tOffset to tOffset + offset(space,tLongID,tOffset + 12) \
  + 11 of tLongID after tRuggedID
  -- note: 12 is the length of " of card id "
end if
  end if
  return tRuggedID
end uRuggedID

Thanks again, Wouter.

-- Dick


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


Re: [ANN] HOOT: Hacked Object Oriented Transcript

2006-02-27 Thread Dick Kriesel
On 2/27/06 8:11 PM, "Mark Wieder" <[EMAIL PROTECTED]> wrote:

> For
> the purposes of putting parentclass handlers in a group, you shouldn't
> need to specify a particular card - there shouldn't be any ambiguity
> to resolve. I think.

I agree: unplaced groups are good for single inheritance.

-- Dick


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


Re: [ANN] HOOT: Hacked Object Oriented Transcript

2006-02-27 Thread Dick Kriesel
On 2/27/06 6:37 PM, "Dick Kriesel" <[EMAIL PROTECTED]> wrote:

> A "rugged" id is a native long id stripped of any "of group id" clause.

Close, but no cigar.  (Why do people say that?)

A "rugged id" is a native long id stripped of any "of group id" clauses and
"of stack" clauses, intended for use within a single stack.

A "rugged long id" is a native long id stripped of any "of group id"
clauses, intended for use across multiple stacks.

getProp uRuggedID
  put the long id of the target into tLongID
  if word 1 of tLongID is not "stack" then
-- note: stacks do not have rugged ids
put word 1 to 3 of tLongID into tRuggedID
put offset(" of card id ",tLongID) into tOffset
if tOffset > 0 then
  put char tOffset to tOffset + offset(space,tLongID,tOffset + 12) \
  + 11 of tLongID after tRuggedID
end if
  end if
  return tRuggedID
end uRuggedID

getProp uRuggedLongID
  put the uRuggedID of the target into tRuggedLongID
  put offset(" of stack " & quote,the long id of the target) into tOffset
  put char tOffset to -1 of the long id of the target after tRuggedLongID
  return tRuggedLongID
end uRuggedLongID


-- Dick


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


templates and instances for custom controls (was: object scripts)

2006-02-27 Thread Dick Kriesel
On 2/26/06 11:41 AM, "Geoff Canyon" <[EMAIL PROTECTED]> wrote:

> The Object Oriented way to do this is to define a new group type:
> alertGroup, say. In the definition of the alertGroup, you include the
> original mouseUp handler. Then any time you need a group that has
> this behavior you declare it to be an alertGroup (instead of a
> generic group). In every way it acts like a normal group, but when a
> control in it is clicked, it displays a dialog with the name of the
> control. If you need to make it a warning dialog, change the class
> definition and the behavior everywhere changes.

Here's a Transcript-based technique for treating any custom control as a
template, by creating and deleting instances.  Each instance invokes
handlers stored only in the template, by executing a Transcript "call."
Here's an example:

on mouseDown
  try
call the params of the uTemplate of the target
  end try
  pass mouseDown
end mouseDown

All the system message handlers like the above are stored in the instance's
top-level script.  No component control within the instance has a script.
Every control in the instance has property uTemplate.  A template can reside
in a library, but doesn't need to.  A template can override or supplement
the instance handlers like the example above, by setting properties in the
template's uInstanceScript custom property set.  Templates and instances
refer to each other using "rugged" long ids, which are native long ids
stripped of any "of group id" clause.  Rugged ids don't fail when the
developer moves a control to a different owner.

To set that up, the developer creates an instance by sending a message to
the template, passing a reference to the group that will be the owner of the
new instance:

send "template_createInstance tGroup" to tCustomControl

That's it for the overview.  Here are most of the details:

on template_createInstance pOwner
  if there is a group pOwner then
put the uRuggedLongID of the target into tTemplate
-- note: the template can be in a library stack
copy tTemplate to group pOwner
put the uRuggedLongID of it into tInstance
set the uInstances of tTemplate to \
the uInstances of tTemplate & tInstance & cr
-- note: the uInstances can guide a developer to propagate \
--   template changes out to the instances
set the uTemplate of it to tTemplate
set the script of it to the uInstanceScript of tTemplate
repeat with i = 1 to number of controls in it
  set the uTemplate of control i of it to \
  the uRuggedLongID of control i of tTemplate
  set the script of control i of it to empty
end repeat
send "choose browse tool" to me in 0
  else
breakPoint
  end if
end template_createInstance

on template_deleteInstance
  put the uTemplate of the target into tTemplate
  if tTemplate is not empty then
put the uInstances of tTemplate into tInstances
filter tInstances without the uRuggedLongID of the target
set the uInstances of tTemplate to tInstances
  end if
end template_deleteInstance

getProp uRuggedID
  put the long id of the target into tLongID
  if word 1 of tLongID is not "stack" then
-- note: stacks do not have rugged ids
put word 1 to 3 of tLongID into tRuggedID
put offset(" of card id " & quote,tLongID) into tOffset
if tOffset > 0 then
  put char tOffset to offset(space,tLongID,tOffset) - 1 of tLongID \
  after tRuggedID
end if
  end if
  return tRuggedID
end uRuggedID

getProp uRuggedLongID
  put the uRuggedID of the target into tRuggedLongID
  put offset(" of stack " & quote,the long id of the target) into tOffset
  put char tOffset to -1 of the long id of the target after tRuggedLongID
  return tRuggedLongID
end uRuggedLongID

getProp uInstanceScript
  lock messages
  put the uInstanceScript of the target into tInstanceScript
  put cr & the uInstanceScript[word 1 of the target] of me \
  after tInstanceScript
  unlock messages
end uInstanceScript

All the above handlers could be stored in a library, which could be called
something like libTemplate, and which I could produce if people are
interested.

Any feedback?

-- Dick


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


Re: [ANN] HOOT: Hacked Object Oriented Transcript

2006-02-27 Thread Dick Kriesel
On 2/27/06 6:02 PM, "wouter" <[EMAIL PROTECTED]> wrote:

> Rugged id's are a good idea but this handler will not do the trick.
> And it is difficult to deduce from this handler from where to where
> or which parts of the long id is what you call the rugged id.


Thanks for catching my error, Wouter.  I forgot what the offset function
returns, and I typed that handler in without testing it.

After testing, it looks like this:

getProp uRuggedID
  put the long id of the target into tLongID
  if word 1 of tLongID is not "stack" then
-- note: stacks do not have rugged ids
put word 1 to 3 of tLongID into tRuggedID
put offset(" of card id ",tLongID) into tOffset
if tOffset > 0 then
  put char tOffset to tOffset + offset(space,tLongID,tOffset + 12) \
  + 11 of tLongID after tRuggedID
  -- note: 12 is the length of " of card id "
end if
  end if
  return tRuggedID
end uRuggedID

A "rugged" id is a native long id stripped of any "of group id" clause.

-- Dick


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


Re: [ANN] HOOT: Hacked Object Oriented Transcript

2006-02-27 Thread Dick Kriesel
On 2/27/06 11:30 AM, "Scott Rossi" <[EMAIL PROTECTED]> wrote:

>> control id pID of this stack
> 
> Actually, that's not what I meant.  Using the long name or ID provides a
> "full" path to an object (including the card the object sits on, group its
> in, etc).  I haven't used your notation above but using a "simple" object
> reference (that excludes the card reference for example) may be what causes
> the engine barf and lose track of things.

As I discussed with Mark, the problem with storing long ids is that they can
be brittle.  A stored long id becomes invalid when a developer moves a
control to a different group.

As Scott points out, the problem with storing short ids is that they can be
ambiguous.  A stored short id isn't sufficient to set or get a property of a
control that appears on more than one card.

A rugged id would avoid the brittleness and the ambiguity.

...
set the uPropertyThatRefersToARevObject of the target \
to the uRuggedID of tRevObject
...

getProp uRuggedID
  put the long id of the target into tLongID
  if word 1 of tLongID is not "stack" then
-- note: stacks do not have rugged ids
put word 1 to 3 of tLongID into tRuggedID
put offset(" of card id " & quote,tLongID) into tOffset
if tOffset > 0 then
  put char tOffset to offset(space,tLongID,tOffset) - 1 \
  of tLongID after tRuggedID
end if
  end if
  return tRuggedID
end uRuggedID

Comments?

-- Dick


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


Re: [ANN] HOOT: Hacked Object Oriented Transcript

2006-02-27 Thread Dick Kriesel
On 2/27/06 4:00 AM, "Geoff Canyon" <[EMAIL PROTECTED]> wrote:

> HOOT takes advantage of the container based inheritance that
> Revolution provides, by representing your class hierarchy as a set of
> nested groups on a card. Each group is named for the class it
> represents. Groups are nested to make the enclosed group a subclass
> of the group that contains it.

Yeah, that's the idea!  Thanks, Geoff.  I'll try it out...

-- Dick


On 2/26/06 12:35 PM, "Dick Kriesel" <[EMAIL PROTECTED]> wrote:

> Another approach distinguishes between Rev objects and domain objects, and
> creates a Rev group for each domain object, with the new group's owner being
> the domain object's class.  A domain class has a Rev group whose owner is
> the superclass.  Then single inheritance, with inherited scripts, is nearly
> free when one sends a message to any domain object's group.
> 
> A new stack, according to "Get Info" on OS X, takes 4KB on disk.  Adding
> 1000 groups makes the stack take 84KB.  That's 80 bytes per domain object.
> On my 2GHz PowerMac, that takes 8 milliseconds per domain object.
> 
> Simple, cheap, and effective, right?


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


Re: object scripts

2006-02-26 Thread Dick Kriesel
On 2/26/06 10:08 AM, "Mark Wieder" <[EMAIL PROTECTED]> wrote:

> Inheritance is actually fairly
> easy. The hard part is that scripts are associated with screen objects
> - you can't have objects that don't have screen representations.

Another approach distinguishes between Rev objects and domain objects, and
creates a Rev group for each domain object, with the new group's owner being
the domain object's class.  A domain class has a Rev group whose owner is
the superclass.  Then single inheritance, with inherited scripts, is nearly
free when one sends a message to any domain object's group.

A new stack, according to "Get Info" on OS X, takes 4KB on disk.  Adding
1000 groups makes the stack take 84KB.  That's 80 bytes per domain object.
On my 2GHz PowerMac, that takes 8 milliseconds per domain object.

Simple, cheap, and effective, right?

-- Dick


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


Re: Transcript and Dot Notation

2006-02-25 Thread Dick Kriesel
Is there a Transcript implementation of dot syntax?  Or how do non-dot
people learn about the benefits of dots?  If the dot folks could wrap the
dots within Transcript handlers, maybe they could offer a dot library, like
libDot.  Or could a macro language do the trick?  What do dots enable that
Transcript does not?

Looking forward to more good humor on the list.

The Entourage spell checker suggests replacing libDot with libido.

-- Dick 


On 2/25/06 10:26 PM, "Judy Perry" <[EMAIL PROTECTED]> wrote:

> Scott,
> 
> Creating a .notation of Rev will NOT keep strict x-Talkers happy.  I may
> be the most vocal opponent, but I suspect I am far, far, from the only
> one.
> 
> And, well, probably *everyone's* happy that I'm not in charge... ;-)
> 
> Judy
> 
> On Sun, 26 Feb 2006, Scott Kane wrote:
> 
>> Judy,
>> The Mac end of development is pretty much cornered by Rev,
>> RealBasic, QT C++ and a few also-rans.  Many developers from
>> .notation backgrounds (Delphi, VB, C++ Builder and more recently
>> .Net) would jump at the chance to program for the Mac if they
>> didn't have to learn a new language construct - which to them
>> Revolution certainly is.  RealBasic uses .Notation - but it's
>> buggy, unstable and really rather crude (IMHO).  If a development
>> platform like Rev existed that had .Notation it would be a tremendous
>> boon to the Mac software community as it would be quicker and easier
>> to get up to speed (obvious user interface issues would still be a
>> learning curve - but then so it is anybody writing for Mac the first
>> time
>> using Rev).  Now - if I was running RunRev (and you can all be eternally
>> glad I'm not ) I'd seriously look at creating a new product that did
>> exactly that.  A .Notation version of Rev.  That would keep the
>> X-Talkers
>> happy and would bring in new blood - much faster - IMHO - than Rev does.
>> I've recommended Rev to several developers who work with Windows
>> .notation
>> platforms.  They have all been scared off by transcript as it is as
>> alien
>> to them as is .notation to many transcript people.  Interestingly they
>> have all also reject RealBasic (to buggy), QT C++ (to fragmented) and
>> several new IDE's currently in the initial stages of release.  I really
>> do believe RunRev could increase their market share by a larger factor
>> considering by considering this issue.
>> 
>> It's a compromise.  X-Talks for those that want it or .notation for
>> those
>> that do not.  It's not a far stretch as many development platform
>> companies
>> (Borland and MS for example) do exactly that with, for example object
>> Pascal, C++ etc
>> all under their wing.
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


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


when Rev fails to send mouseEnter

2006-02-24 Thread Dick Kriesel
Here's a recipe to demonstrate that Rev usually fails to send mouseEnter to
a nearly vertical line:

Create a new mainstack.
Paste the following four lines into the multiple lines message box.
  create graphic
  set the style of it to "line"
  set the points of it to 200,100&cr&208,300
  set the script of it to "on mouseEnter"&cr&"beep"&cr&"end mouseEnter"
Press enter.
Move the mouse across the line at various points along the line.
Notice how rare the beeps are.

If you change the width of the graphic, the failure rate changes:  the
steeper the line, the greater the failure rate.  If you choose the pointer
tool, you can select the graphic where the beep occurs but can't select it
where the beep does not occur.  The problem does not affect a vertical line.

So a bug report seems worthwhile.  Does someone have insight into what the
problem actually is, or related evidence?

I've tried this only in Rev 2.7 with OS X 10.4.5.

-- Dick


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


Re: deleting multiple controls all at once

2006-02-12 Thread Dick Kriesel
On 2/11/06 7:35 PM, "Josh Mellicker" <[EMAIL PROTECTED]> wrote:

> Is there a way to delete a bunch of controls whose names match a
> wildcard expression like "thing.?" or "thing.??" all at once elegantly?
> 
> example:
> 
> thing.23
> thing.46
> thing.4
> thing.142
> 
> 
> delete all controls named "thing." & ?? doesn't work :-)
> 
> 
> Friends don't let friends do this:
> 
> REPEAT with n = 1 to 300
>  IF exists  ("thing." & n) THEN
>  delete "thing." & n
>  END IF
>END REPEAT
> 
> :P

If 300 isn't a meaningful number for your app, then you can do without it:

repeat with n = number of controls down to 1
  if char 1 to 6 of the short name of control n is "thing." then
delete control n
  end if
end repeat

-- Dick


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


bringToFrontWithinOwner (was: relayering groups within groups)

2006-02-03 Thread Dick Kriesel
Here's a handler that brings a control as close to the front as possible
without affecting its owner.

No control has its owner changed.  All controls other than the one that
moves keep their original sequence within their owners.  No controls are
copied or deleted, so no system messages like newGroup and deleteGroup get
sent.  There's no "start editing" command, so stepping through the handler
doesn't cause unexpected results (see the dictionary entry for "start
editing").  The previous value of the relayerGroupedControls is restored at
the end.

The optional input parameter identifies the control to bring to the front.
With no input the handler operates on the target.

on bringToFrontWithinOwner pControl
  if pControl is empty then
put abbr id of the target into tTarget
  else
put abbr id of pControl into tTarget
  end if
  put long owner of tTarget into tOwner
  if word 1 of tOwner is "card" then
put 1 into tLayer
  else
put the layer of tOwner + 1 into tLayer
  end if
  repeat with i = number of controls down to 1
if long owner of control i is tOwner then
  if abbr id of control i is not tTarget then
put abbr id of control i & cr after tPeers
-- note: peers share the same owner
  end if
end if
  end repeat
  lock screen
  put the relayerGroupedControls into tRelayerGroupedControls
  set the relayerGroupedControls to "true"
  repeat for each line tPeer in tPeers
set the layer of tPeer to tLayer
  end repeat
  set the relayerGroupedControls to tRelayerGroupedControls
  unlock screen
end bringToFrontWithinOwner

The handler passed my tests.  If you find a problem with it, please let me
know.

-- Dick



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


Re: message hierarchy question

2006-01-05 Thread Dick Kriesel
On 1/5/06 12:07 PM, "Mark Wieder" <[EMAIL PROTECTED]> wrote:

> What I'm
> looking at for this case is not just polymorphism, but being able to
> overload functions whose default instance is in my mainstack and whose
> overloaded instance is in a separate (not sub-) stack.

If the handlers in your main stack check the target, then they can provide
the default implementations:

function foo p
  put the uStack of me into tStack
  if (tStack is empty) \
  or (the target is "stack" && quote & tStack & quote) then
-- execute the default implementation, for example:
put the long time into tResult
  else
put value(the params,stack tStack) into tResult
  end if
  return tResult
end foo

on bar p
  put the uStack of me into tStack
  if (tStack is empty) \
  or (the target is "stack" && quote & tStack & quote) then
-- execute the default implementation, for example:
put the long time into tResult
  else
send the params to stack tStack
put the result into tResult
  end if
  put tResult
  return tResult
end bar

With this technique, you can overload any handler without repeatedly
removing and inserting scripts into front or back.  I think.  I see you're
satisfied with your current approach, but do you see a problem with this
technique?

-- Dick


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


Re: message hierarchy question

2006-01-05 Thread Dick Kriesel
On 1/4/06 11:37 PM, "Mark Wieder" <[EMAIL PROTECTED]> wrote:

> put the script of stack "substack 1" of stack "A" into back

I suppose you meant "insert" rather than "put."

Are you implementing polymorphism for functions and commands?  Is only one
substack appropriate at any point in time?  Do you need to remove the script
of stack "substack 1" of stack "A" and insert the script of "substack 2" of
stack "A" when some event occurs?  And remove and insert again when other
events occur?

If yes, then there's another technique you can use.  You can insert the
script of stack "A" which can contain virtual functions and commands:

function foo
  put the uSubstack of me into tSubstack
  if tSubstack is not empty then
return value(the params,stack tSubstack)
  end if
end foo

on bar
  put the uSubstack of me into tSubstack
  if tSubstack is not empty then
send the params to stack tSubstack
  end if
end bar

Then when some event requires a change to a different substack, you can set
the uSubstack of stack "A" and not need to remove and insert scripts.  Would
that work for you?

-- Dick


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


Re: Debugging and the execution path

2005-12-21 Thread Dick Kriesel
On 12/21/05 2:31 PM, "Jerry Daniels" <[EMAIL PROTECTED]> wrote:

>  stack "save test"/button "Button"/handler "mouseUp"/line: 7
>  line "7" of handler "mouseUp" of button "button" of stack "save
> test"

I guess you mean that each line in the context button's text would identify
the object whose script is executing, and each object in the long owner of
that object.  So sometimes the string would be pretty long.  Probably some
users would want their own preferences for long vs. abbreviated vs. short,
names vs. ids, and ascending vs. descending.

Constellation already shows handler types; some users would want to see them
in the context menu rather than just the word "handler."

With the executionContexts as it is, the finest granularity is line number.
The next level of granularity would be the character offset within the line,
which could be useful for lines that invoke a handler more than once.  I
wonder whether the engine makes that level of granularity possible.

> What puzzles me is the fact that every one wanted the calling path
> when, as far as I can tell, it's already in the Rev Var Watcher. They
> call it the "execution contexts." Please tell me if I'm missing
> something.

My interest in the calling path includes not only debugging, as in the
Variable Watcher, but also use in a standalone app, where the Variable
Watcher is irrelevant.

> Conclusion: I'm not sure that the watcher I built would offer much
> new, other than the fact that it would reside in the upper two panes
> of Constellation where the props and previews sit ordinarily. I could
> make the array elements editable, I suppose.

A new variable watcher could let scripters create virtual variables, such as
"tLongNameOfTheTarget," whose values the variable watcher would derive by
evaluating an associated expression, such as "the long name of the target,"
after each breakPoint and each step.  Each object in the long owner of the
script could have its own virtual variables, to be evaluated when debugging
any handler in the object's script.  The names and expressions for the
virtual variables of each object could be stored in a custom property set of
the object.

I have an install-again-for-each-rev-version hack that does some of this in
the Rev Variable Watcher.  If you'd like to see it, let me know.  I hope
you'll extend Constellation with a new variable watcher.  I'm even willing
in principle to pay an upgrade fee for it.

-- Dick


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


  1   2   >