Re: Recreating a binary stack from xml text

2012-02-22 Thread Geoff Canyon Rev
In FileMaker, because it's inherent to the way they do it, I've never heard
of it breaking. It's kind of a chickens vs. pigs situation -- where for
breakfast the chicken is involved, but the pig is committed. If something
goes wrong with safe rename, they just issue a note saying we're looking
into it, don't use it for now. If something went wrong with FileMaker's
renaming code, no one would be able to do anything until it was fixed --
not edit a script, maybe not even edit a layout. Not that it ever has been
broken in Eclipse, just that the standard is different. It also goes to the
mindset of the developer: in FileMaker it's just understood that you might
rename something to make it clearer. For example if you and I work on a
database together and you use plural column names and I use singular, when
we inevitably fight to the death ;-) the victor would blithely change all
the offending column names, without thinking about the (non-existent)
consequences.



On Wed, Feb 22, 2012 at 10:24 AM, Mark Wieder mwie...@ahsoftware.netwrote:

 Geoff-

 Wednesday, February 22, 2012, 1:33:15 AM, you wrote:

  That sounds brittle -- or in practice does it Just Work?

 Well, it would probably be foolish to say it *always* works, but it's
 done the job for me when I've used it. I've been cautious, though, and
 done a dry run first to see what was going to change.

 --
 -Mark Wieder
  mwie...@ahsoftware.net


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

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


Re: How to use an array to solve the following...

2012-02-21 Thread Geoff Canyon Rev
Depends on how big the list is. Unless there's a faster method than the one
I used (or you're using slower hardware than I am), you should be okay up
to about 100,000 rows using something like:

   repeat for each line L in the keys of yourArray
  if L  20 and L  60 then put L  cr after R
   end repeat
-- 20 and 60 are your filter values,
-- R is your result set

On Tue, Feb 21, 2012 at 2:29 AM, Glen Bojsza gboj...@gmail.com wrote:

 If the final list is kept in sequential order based on the xs column I
 thought that either an sqlite database or arrays could be used for a basic
 query. I prefer arrays since it is probably easier to use for the desired
 result.

 The query would be based on the user selecting a starting xs value and and
 ending xs value with the resulting rows between (and including the starting
 and ending value rows).

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


Re: How to use an array to solve the following...

2012-02-21 Thread Geoff Canyon Rev
On Tue, Feb 21, 2012 at 3:52 AM, Kay C Lan lan.kc.macm...@gmail.com wrote:

  repeat for each line L in the keys of yourArray
   if L  20 then
  put L  cr after R
  if L  60 then
exit repeat
 end if
  end if
  end repeat

 Don't waste cyling through lines you don't have to.


Agreed, if the keys are sorted. I was assuming that they were coming
straight from the keys of the array (as shown in my example) so you'd have
to test the whole thing. I'd be curious which is faster:

get the keys
sort the keys
do your script

or

get the keys
do my script

My first instinct is to say your solution, for the obvious reasons, but
I've been fooled by the near-infinite speed of repeat for each too many
times to count.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to use an array to solve the following...

2012-02-21 Thread Geoff Canyon Rev
On Tue, Feb 21, 2012 at 8:36 AM, Glen Bojsza gboj...@gmail.com wrote:

 The good news is that the lists may grow as high as 1,000,000 lines and are
 as little as 30,000.


1,000,000 lines is pretty big. If you're guaranteed to be working on a
recent machine, then perhaps it would be okay. But that's certainly pushing
the limits of what makes sense in a repeat for each.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to use an array to solve the following...

2012-02-21 Thread Geoff Canyon Rev
As Richard said, the engine is smart enough to avoid this pitfall. So no,
it's perfectly fine to say

repeat for each line x in the keys of array y

even if the list of keys is large.

On Tue, Feb 21, 2012 at 12:03 PM, Bob Sneidar b...@twft.com wrote:

 Repeat for each line x in the keys of array y would seem at a glance to
 have to reevaluate the keys of array each time through the loop, wouldn't
 it? You must mean you get the keys first in a variable and then use that.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Recreating a binary stack from xml text

2012-02-21 Thread Geoff Canyon Rev
Yeah, I'm not by any means saying FileMaker is perfect. It has limitations
I can't stand as well. Every environment I know does. I wish LC also had
J's unlimited ability to handle arrays, and reversible functions, and
several other features.

I also wish -- desperately -- that LC had LISP's macros. It would be so
awesome to be able to define new syntax. First class functions are a good
idea as well.

On Tue, Feb 21, 2012 at 11:48 AM, Bob Sneidar b...@twft.com wrote:

 One of the things that frustrated me with Filemaker is that references to
 tables were constants. You could not by script save the name of a table in
 a variable, and then reference the table by name. At the time it was
 essential to me to be able to do that, so I could set some environment
 variables at the outset depending on the company being edited, and have my
 code access the set of tables via their variable names.

 Also, while a graphical code editor may seem like a good idea at first,
 in practice it turns out to be quite a slow way of doing things.

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


Re: Recreating a binary stack from xml text

2012-02-20 Thread Geoff Canyon Rev
Fair point. One thing I find interesting is how each environment I use
brings something to the table that no other environment does (as well). For
LiveCode, it's the built-in GUI builder and the interactive development.

For FileMaker, it's the easy database, but equally important, it's the fact
that all items -- scripts, layouts, columns, tables, etc. -- are abstracted
from their names. In FileMaker, if you change the name of a table, then
everywhere in any script that refers to that table, the script changes
automatically to match. Change a layout name, same thing. That's something
I wish every environment I use could have. Given that FileMaker has had
this since at least 1994 or so, it's frustrating that no one else has
picked it up. It's one of those things that seems obvious once you've
experienced it /rant

So I agree, reconciling the source when someone changes the name of an
object would be a pain.

On Mon, Feb 20, 2012 at 3:04 PM, Bob Sneidar b...@twft.com wrote:

 I only mention card locking because the elements of a card typically
 interact with each other quite a bit. Imagine someone renaming a button
 that a card script accessed by name, or a field that was critical to saving
 data to a database. Also the process of checking out and in every object in
 a card could induce insanity.

 Bob


 On Feb 20, 2012, at 10:41 AM, gcanyon+rev wrote:

  Agreed that a full implementation would be better; I'm just saying that,
 compared to the present setup, where there is no source control whatsoever,
 a system that at least allowed merging code in a controlled fashion would
 be a huge improvement.
 
  I would hope we can do better than card-level locking, but better that
 than nothing at all.
 
  Sent from my iPad


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

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


Re: How to use an array to solve the following...

2012-02-20 Thread Geoff Canyon Rev
Certainly correct, but there is not the tremendous performance advantage to
using for each element in... For items, lines, and words, using
item/line/word of myContainer gets worse the larger the container is. For
character and with arrays, it doesn't. In my quick testing here, there's
just about no performance advantage to doing repeat for each element.
There's about a 4x benefit for using repeat for each char over repeat
with i = 1 to length(myString) But note that it seems to be 4x regardless
of the string length. That isn't the case with items, lines, and words --
there, the longer your container, the more you'll suffer.


On Mon, Feb 20, 2012 at 3:02 PM, Bob Sneidar b...@twft.com wrote:

 Also each element in array

 Bob


 On Feb 20, 2012, at 10:34 AM, gcanyon+rev wrote:

  any time you find yourself writing:
 
  repeat with i = 1 to the number of lines|words|items of someContainer
 
  stop. Rewrite it as:
 
  repeat for each line|word|item in someContainer


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

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


Re: Recreating a binary stack from xml text

2012-02-20 Thread Geoff Canyon Rev
I'm looking at the docs for Eclipse and I see safe rename. Is that what
you're talking about? Out of curiosity does it mean that when you rename
something, it goes through all your source files looking for references to
that thing, and changes them?

I understand that this is nitpicking, but I think FileMaker does something
more robust. At least I think it does, I could be wrong. When FileMaker
stores your script, it stores within it any references to tables, columns,
scripts, etc., by some underlying id, not by name. Then, when it is time to
display the script to you in the editor, it re-constitutes the names at
that point. In any case, there is only the one tool for renaming things,
and it always does the right thing.

As I said, I could be wrong about how FileMaker does it. But by comparison,
I'm fairly confident that in Eclipse what's going on is that, if you use
the appropriate tool, you can not break things by renaming them because the
tool will run around to all the source files and rename things for you.

So while it is possible to not break names in other tools, in FileMaker it
is literally impossible (other than if there is a bug, obviously) to break
names.

That said, I'd love to have in LC what Eclipse and Visual Studio have.

gc

On Mon, Feb 20, 2012 at 8:38 PM, Mark Wieder mwie...@ahsoftware.net wrote:

 Both Visual Studio and Eclipse support that for refactoring. And yes,
 I miss it here.

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


Re: Recreating a binary stack from xml text

2012-02-20 Thread Geoff Canyon Rev
On Mon, Feb 20, 2012 at 9:05 PM, Alejandro Tejada capellan2...@gmail.comwrote:

 This is exactly the reason that drive me to ask
 if it is possible to rebuilt a binary stack from xml
 source: Does every control keeps its original ID?


Not with the tool I created. It sounds like it's possible now.



 Because if that were the case, then it's only a matter
 of use only IDs to reference controls in the scripts and
 never, never use their names.


This sounds like cutting off your scalp to cure your dandruff. I want to
use names.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to use an array to solve the following...

2012-02-20 Thread Geoff Canyon Rev
You can get away with straight text for small data sets, but I would never
suggest using a single variable and line references for random access on
anything more than a few tens of thousands of lines -- although I will
point out that in your test, even working with a million lines meant a
worst case scenario of 1/10th of a second.

But that isn't what repeat for each is about. It's for doing something
with all the data, either sequentially or in aggregate.

If you need random access to a large data set, then an array or a database
is clearly the way to go.

On Mon, Feb 20, 2012 at 11:37 PM, Kay C Lan lan.kc.macm...@gmail.comwrote:

 Excellent rules of thumb, though there is a caveat to all this.

 Unfortunately I haven't seen a further response from Glen, as I was going
 to wait to ask one more question, before offering further suggestions; but
 I'll now offer it anyway.

 Glen doesn't mention what the final use/access of the data will be. If you
 are only every going to deal with the data as a whole, then repeat for each
 line will generally be the fastest. On the other hand, if after preparing
 all your lists and merging them, the final purpose is to pick small bits
 and pieces out of it from here, there and anywhere, arrays (or a db) might
 be better.

 So the caveat is, always test and compare. It might be faster to create and
 merge the data using repeat for each, but slower to access it that way. It
 might be slower to merge the data using arrays, but faster to access it
 final format.

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


Re: Math problem

2012-02-19 Thread Geoff Canyon Rev
On Sun, Feb 19, 2012 at 12:58 AM, Kay C Lan lan.kc.macm...@gmail.comwrote:

 I've tweaked your solution only slightly as you solution only worked for
 quarter hour increment, whilst both mine and Paul's would work for any
 required increment . I simply replace your fixed 4 with the 3600/increment
 that both Paul and I were using.


Bother -- I saw the optimization for my own routine but forgot to apply it
to the other two.



 With this correction it seems Paul slips into the lead:

 For 100 cycles
 K's solution = 2378ms
 Paul's solution = 2021ms
 Geoff's solution = 2283ms


I'm surprised that a div isn't faster than a /, but since (on checking) a
div seems to work perfectly well with non-integers -- 4.5 div 1.5 = 3, for
example -- I have to think that within the engine it's really just a / with
the results trunc'd.


 To include a variable increment I've used an array rather than the simple
 list you used in your script, which seems to have slowed things down, as I
 got similar times to your original output, but still I'm surprised it's
 twice as slow.


repeat for each line is incredibly fast, so I'm not surprised that it
beats an array. Interestingly, I was able to speed up all three solutions
by doing this:

  get aTime[i][Increment]

and then using it in the math makes things faster. Arrays aren't just
slow, they're slow every time. Here's my latest optimization. All three
options are similar. Here are a couple runs:

For 100 cycles
K's solution = 1643ms
Paul's solution = 1496ms
Geoff's solution = 1533ms

For 100 cycles
K's solution = 1618ms
Paul's solution = 1544ms
Geoff's solution = 1577ms

For 100 cycles
K's solution = 1667ms
Paul's solution = 1584ms
Geoff's solution = 1530ms

I tried longer tests, but they're still really close.



on mouseUp
   put 100 into tRepeats
   put 1329494400 into tStartTime
   --create an array of variable end times and increments
   repeat with i = 1 to tRepeats
  put  (1329494400 + random(36000)) into aTime[i][End]
  put 300 * random(6) into aTime[i][Increment]
   end repeat

   --K solution
   put the millisec into tStartClock
   repeat for each key i in aTime
  get aTime[i][Increment]
  put round(((aTime[i][End] + (it/2) - 1 - \
 tStartTime)/it),0) * it /3600  cr after tStore2
   end repeat
   put the millisec - tStartClock into tTotalTime1


   --Paul's  maxless solution
   put the millisec into tStartClock
   repeat for each key i in aTime
  get aTime[i][Increment]
  put round(((aTime[i][End] -tStartTime)/it)+\
  0.4999,0) * it /3600  cr after tStore3
   end repeat
   put the millisec - tStartClock into tTotalTime2
   if (tStore2  tStore3) then
  put Paul's solution doesn't = K's  cr after tErrors
   end if


   --Geoff's revised any increment solution
   put the millisec into tStartClock
   repeat for each key i in aTime
  get aTime[i][Increment]
  put (aTime[i][End] - tStartTime + it - 1) \
 div it * it / 3600  cr after tStore4
   end repeat
   put the millisec - tStartClock into tTotalTime3
   if (tStore2  tStore4) then
  put Geoff's solution doesn't = K's  cr after tErrors
   end if
   if (tStore3  tStore4) then
  put Geoff's solution doesn't = Paul's  cr after tErrors
   end if

   put For   tRepeats   cycles  cr into R
   put K's solution =   tTotalTime1  ms  cr after R
   put Paul's solution =   tTotalTime2  ms  cr after R
   put Geoff's solution =   tTotalTime3  ms  cr after R
   put R  tErrors
end mouseUp
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: 6 Is A Mystery Number

2012-02-19 Thread Geoff Canyon Rev
Fair point -- no clue here.

On Sun, Feb 19, 2012 at 1:02 AM, J. Landman Gay jac...@hyperactivesw.comwrote:

 I was wondering if the engine counts it regardless of its visibility.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: New Math

2012-02-18 Thread Geoff Canyon Rev
Not exactly one line, but this works for all the combinations I could think
of:

function incTo x,i -- increments x to the next i
   if i = 0 then
  return x
   else if x mod i  0 and x * i  0 then
  return x div i * i
   else
  return x div i * i + i
   end if
end incTo

Here's my test results. First column is x, second is i, third is expected
result, fourth is actual result, fifth is whether test passed:

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


Re: Math problem

2012-02-18 Thread Geoff Canyon Rev
? That is the definition (and not a call).

On Sat, Feb 18, 2012 at 2:24 PM, Joe Lewis Wilkins pepe...@cox.net wrote:

 Certainly better than nothing; but, if you put it in the function
 definition instead of the calls, you only have to do it one time.

 Joe Wilkins

 On Feb 18, 2012, at 12:04 PM, gcanyon+rev wrote:

  I'm curious what you think of this, which is what I try to do regularly
 when I create one-liners (which I favor).
 
  function roundUp x,i -- rounds x up to the next i
 
  On Feb 18, 2012, at 11:23 AM, Joe Lewis Wilkins pepe...@cox.net wrote:
 
  If you're going to use one liners like this, you'd better add some
 commentary.
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode


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

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


Re: Math problem

2012-02-18 Thread Geoff Canyon Rev
This is the entire function definition, with the comment in place:

function roundUp x,i -- rounds x up to the next i
  return x div i * i + item itemoffset((x mod i  0),true,false) of (i,0)
end roundUp

I only included the first line in my original question because it's the
only line with a comment.

gc

On Sat, Feb 18, 2012 at 9:39 PM, Joe Lewis Wilkins pepe...@cox.net wrote:

 Kind of true Geoff, but the call would have arguments in place of
 parameters, whereas
 function roundUp x,i  isn't the function's definition either. Not
 intending to nit-pick.

 Joe Wilkins
 Architect

 On Feb 18, 2012, at 7:01 PM, Geoff Canyon Rev wrote:

  ? That is the definition (and not a call).
 
  On Sat, Feb 18, 2012 at 2:24 PM, Joe Lewis Wilkins pepe...@cox.net
 wrote:
 
  Certainly better than nothing; but, if you put it in the function
  definition instead of the calls, you only have to do it one time.
 
  Joe Wilkins
 
  On Feb 18, 2012, at 12:04 PM, gcanyon+rev wrote:
 
  I'm curious what you think of this, which is what I try to do regularly
  when I create one-liners (which I favor).
 
  function roundUp x,i -- rounds x up to the next i
 
  On Feb 18, 2012, at 11:23 AM, Joe Lewis Wilkins pepe...@cox.net
 wrote:
 
  If you're going to use one liners like this, you'd better add some
  commentary.
 


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

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


Re: Math problem

2012-02-18 Thread Geoff Canyon Rev
On Fri, Feb 17, 2012 at 7:55 PM, Kay C Lan lan.kc.macm...@gmail.com wrote:

 Guys I thought I'd speed test these.


Given that we're dealing in seconds (and therefore integers), the very
clever itemoffset idea Peter came up with is unnecessary. Here's a
comparison of the three options, with mine tweaked to be similar to my
original idea (and to return hours, so it matches the output of the other
two).

I took the liberty of removing the max function from Paul's code, since
all it does is restrict the rounding interval to a one minute interval,
which was not part of the original spec, and also since this test uses a
constant 15 minute interval, completely unused here. I got this on my
MacBook:

For 100 cycles
K's solution = 1342ms
Paul's solution = 1226ms
Geoff's solution = 1095ms

Which is to say that, at about 1 million calculations per second, any of
these solutions would be fine in practice.

gc

on mouseUp
  put 100 into tRepeats
  --to create a list of times to use.
  --900 is used as fixed 1/4 hour interval
  put 1329494400 into tStartTime
  put 900 into tIncrement
  repeat with i = 1 to tRepeats
 put  (1329494400 + random(36000))  cr after tStore
  end repeat

  --K solution
  put the millisec into tStartClock
  repeat for each line tEndTime in tStore
 put round(((tEndTime + (tIncrement/2) - 1 - \
 tStartTime)/tIncrement),0)/(3600/tIncrement)  cr after tStore2
  end repeat
  put the millisec - tStartClock into tTotalTime1

  --Paul's  max solution
  put the millisec into tStartClock
  repeat for each line tEndTime in tStore
 put round(((tEndTime-tStartTime)/tIncrement)+\
 0.4999,0)/(3600/tIncrement)  cr after tStore3
  end repeat
  put the millisec - tStartClock into tTotalTime2
  if (tStore2  tStore3) then
 put Paul's solution doesn't = K's  cr after tErrors
  end if


  --Geoff's revised mod solution
  put the millisec into tStartClock
  repeat for each line tEndTime in tStore
 put (tEndTime - tStartTime + tIncrement - 1) \
 div tIncrement / 4  cr after tStore4
  end repeat
  put the millisec - tStartClock into tTotalTime3
  if (tStore2  tStore4) then
 put Geoff's solution doesn't = K's  cr after tErrors
  end if
  if (tStore3  tStore4) then
 put Geoff's solution doesn't = Paul's  cr after tErrors
  end if

  put For   tRepeats   cycles  cr into R
  put K's solution =   tTotalTime1  ms  cr after R
  put Paul's solution =   tTotalTime2  ms  cr after R
  put Geoff's solution =   tTotalTime3  ms  cr after R
  put R  tErrors
end mouseUp
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Math problem

2012-02-18 Thread Geoff Canyon Rev
On Sat, Feb 18, 2012 at 9:57 PM, J. Landman Gay jac...@hyperactivesw.com
 wrote:

 function whichOne var,fld1,fld2
 -- from a handler by Tony Root
 -- Handles a case where you need to return one value if your key is empty,
 another if not.

  return (item offset(char 1 of (var = empty),tf) of quote  fld1 ,
 fld2  quote)
 end whichOne


This seems unduly specialized. I use this function:

function iff b,t,f --inline if statement
   if b is true then return t else return f
end iff

For your particular use case you would call it like this:

return iff(var = empty,fld 1,fld 2)

One drawback of this function is that all arguments must evaluate without
error, so you can't replace something like this:

if y = 0 then return x else return x/y

with

return iff(y = 0,x,x/y)

because x/y will fail. Way back when in my crazy days I wrote a macro
parser for the script editor, and one of the macros I wrote would take
something like the above iff statement and expand it into the other
statement so you could use the iff with impunity, but as I said, that was
about ten years ago, and it was buggy.

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


Re: 6 Is A Mystery Number

2012-02-18 Thread Geoff Canyon Rev
I just tested with Rev 4.0 -- exact same issue.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: [OT] HyperCard and the Interactive Web

2012-02-18 Thread Geoff Canyon Rev
http://www.diybookscanner.org/

1000 pages per hour, and as gentle as you can turn the pages.

On Wed, Feb 15, 2012 at 11:18 AM, Bob Sneidar b...@twft.com wrote:

 Someone needs to make a machine something like a cat scanner but that can
 take a 3D image of an entire book so that the pages can be singled out and
 OCR applied to them without damaging the book. Then we could get on much
 better! :-)
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Recreating a binary stack from xml text

2012-02-18 Thread Geoff Canyon Rev
I didn't store the ID because when I wrote it (and for long after that) the
ID was immutable, so there was no need to store it because it couldn't be
set.

That said, I'm guessing that a monolithic XML file is not the way to go
here. Someone who knows git better than I will correct me, but it would be
more useful to store each item as a separate file within a directory
(hierarchy).

I'm tempted to say that there are some things that wouldn't be
worth/necessary to put into version control. Heck, you could start with
just the scripts. So if I'm working on a project with you, we could agree
ahead of time that I'm not in charge of design, but just code. You could
send me a copy of the stack at some point, and an IDE tool would be able to
use basic git commands to refresh/update the scripts of all the objects.
But because we agreed, I know that if I move an object, or create a new
one, or delete one, that won't be captured. Maybe that's not ideal -- if I
find that something is a pixel off, that's a pain not to be able to fix it
right there. But it would be somewhat simpler to implement.

On Sat, Feb 18, 2012 at 8:43 PM, Alejandro Tejada capellan2...@gmail.comwrote:

 Interesting enough, it does not include the ID among
 the properties saved as XML:
 http://www.inspiredlogic.com/mc/ripperoutput.html

 But adding this, and others new properties, should be a
 piece of cake for professionals developers in
 this platform. ( Not me! :-D )

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


Re: 6 Is A Mystery Number

2012-02-18 Thread Geoff Canyon Rev
I turned it off -- no change. Same with the actual border.

On Sat, Feb 18, 2012 at 11:25 PM, J. Landman Gay
jac...@hyperactivesw.comwrote:

 Not a clue. Could it be due to the focusborder? We can toggle the
 visibility, but the engine may still be counting it whether it is showing
 or not.

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


Re: Math problem

2012-02-17 Thread Geoff Canyon Rev
Obviously you could do this inline, but then it wouldn't be reusable. I'd
go with a function:


function roundUp x,i -- rounds x up to the next i
   return ((x - .1) div i + 1) * i
end roundUp

function test T1,T2
   -- returns the difference between two times in seconds
   -- rounded up to the next 15 minutes
   convert T1 to seconds
   convert T2 to seconds
   put roundUp(T2 - T1,900) into D
   return D
end test

The roundUp function will take any two numbers and return the first rounded
up to the nearest increment of the second. Obviously the .001 aspect is
a limitation -- if I were being particular I suppose I'd use an if
statement there, but you wanted math and this seems good enough. So:

put roundUp(60,10) -- puts 60
put roundUp(61,10) -- puts 70

Having this function makes it easy to do the time math you were talking
about, as shown in the test function.

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


Re: Math problem

2012-02-17 Thread Geoff Canyon Rev
My original function took the number to be rounded and the increment to
round up to, so I think your version would become:

function roundUp x,i -- rounds x up to the next i
  return x div i * i + item itemoffset((x mod i  0),true,false) of (i,0)
end roundUp

On Fri, Feb 17, 2012 at 1:49 PM, Peter M. Brigham, MD pmb...@gmail.comwrote:

 function roundUp x
   return trunc(x) + char itemoffset((x mod 1  0),true,false) of 10
 end roundUp

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


Re: A shorter way to express this?

2012-02-16 Thread Geoff Canyon Rev
As David suggested, you should definitely use for each line... As your data
grows it will operate in linear time, while using line x of... will be
something like quadratic time I think.

If fully numerical indexes for your array are acceptable, this would work

   put 1 into i
   repeat for each line L in fld 2
  split L using tab
  put L into x[i]
  add 1 to i
   end repeat
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Android stats

2012-02-07 Thread Geoff Canyon Rev
It's just my assumption, but I would think that the *vast* majority of
Android users leave in place whatever is on their device. It takes some
geek-ish effort to root, and most people want nothing to do with that.

On Mon, Feb 6, 2012 at 11:14 PM, J. Landman Gay jac...@hyperactivesw.comwrote:

 Very true, and I don't see much hope for improvement. On the other hand,
 it's pretty much expected you'll jailbreak an Android tablet so people
 update that way.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Android stats

2012-02-07 Thread Geoff Canyon Rev
Have you read the latest on how ATT is treating those of us hanging onto
our unlimited plans? (I do the same thing) I've seen demonstrations of
how they throttle your connection once you exceed about 2GB per month. You
pay as much as someone with a 3GB plan, but beyond 2.1GB or so, you get
roughly 1/10th the bandwidth :-/

gc

On Tue, Feb 7, 2012 at 12:40 PM, Bob Sneidar b...@twft.com wrote:

 I rooted my iPhone ONLY because I could tether it without having to pay
 YET AGAIN for the unlimited data I was grandfathered into.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Problem with Latin 1 (I think)

2012-02-06 Thread Geoff Canyon Rev
I'm retrieving a url and parsing the HTML. If I view the URL in Safari (all
of this on a mac) there are places where safari shows isn’t but livecode
shows isn’t

I'm using 5.0.2, and isotomac doesn't seem to fix this. Any suggestions?

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


Re: Menu Builder

2012-01-12 Thread Geoff Canyon Rev
One thing that I've often thought would make a lot of sense is to have an
array of starter projects, from Single window with menubar to splash
screen with multiple document windows etc. It seems like a small handful
of these would save a lot of beginners (and the rest of us!) a lot of time.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: [OT}] Hypercard and an uneasy read.

2011-12-02 Thread Geoff Canyon Rev
On Thu, Dec 1, 2011 at 5:37 PM, Bob Sneidar b...@twft.com wrote:

 Let me propose that a solution cannot be simpler than the problem it is
 meant to solve.


Assuming that this is true, it is nevertheless possible for a solution to
be far, far more complex than the problem it is intended to solve. One
quote representing this concept is:

Some people, when confronted with a problem, think “I know, I'll use
regular expressions.”   Now they have two problems.

I'll go further than my original statement and say that *every* solution is
far more complex than the problem it is intended to solve. HyperCard was no
exception. If the problem to be solved is build a rolodex (and you're
not allowed to simply use the built-in one) consider how much work went
into the built-in rolodex. By comparison, my problem statement is nearly
complete; add a few semi-obvious statements about searching, printing,
etc., and you have a working product spec, but to implement that in
HyperCard would take significant effort. Anyone know how many lines of code
there are in the built-in rolodex stack?

Every language I've used has some feature that I wish every other language
I use has. As one example, in FileMaker, all references are abstracted, so
if you rename a table, or a column, or a layout, etc., all references to
that object in your code will automatically adjust. *That* is a feature I
would pay serious money for, but I don't know any other
language/environment that has it.

Not to be a grump (warning, I'm about to be grumpy) but there are several
aspects of LiveCode as it stands that are significantly more complex than
they should be. The one that has been tormenting me over the last few weeks
is the datagrid, and its lack of native syntax.

put row 3 to 8 of column firstname,column lastname

or something like it should just work. Stepping away from the soap box
now...
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Indirect reference

2011-11-17 Thread Geoff Canyon Rev
You can't use

   put something into myVariable

but as Andrew says you can make it work with a do statement.

As long as the variable contains a valid object reference, you can set
properties on the variable, so this will work also:

   *put* field  quote  test  quote into x

   *set* the text of x to hello -- the field now contains hello.

On Thu, Nov 17, 2011 at 11:39 PM, Howard Bornstein
bornst...@designeq.comwrote:

 I want to put something into field Time via this variable.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Am I misunderstanding data grids?

2011-10-30 Thread Geoff Canyon Rev
Do I really need to edit the script of each column's template object
to insert an exit mouseDoubleUp if I want that column not to be
editable?

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


Re: List of handlers

2011-09-13 Thread Geoff Canyon Rev
Interesting -- I'd forgotten about the token keyword. It still doesn't
handle block comments though:

on mouseUp
   /*this is a
   on aCommentedCommand
  comment*/
  put token 1 to -1 of the script of me into tText
  put empty into tMenuText
  repeat for each line L in tText
 if word 1 of L is among the items of
on,function,getprop,setprop,command,private
 then put L  cr after tMenuText
  end repeat
  put tMenuText
end mouseUp

That puts

on mouseUp
   on aCommentedCommand

gc

On Sun, Sep 11, 2011 at 4:20 PM, Mark Schonewille
m.schonewi...@economy-x-talk.com wrote:
 Geoff,

 Try this:

 put token 1 to -1 of the script of tID into tText
 put empty into tMenuText
 repeat for each line L in tText
    if word 1 of L is among the items of 
 on,function,getprop,setprop,command,private
 then put L  cr after tMenuText
 end repeat

 --
 Best regards,

 Mark Schonewille

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

 Send me a friend request on Facebook if you like 
 https://www.facebook.com/marksch

 On 11 sep 2011, at 23:07, Geoff Canyon Rev wrote:

 This doesn't work with block comments, but this is what I used in 
 revNavigator:

 put the script of tID into tText
 put empty into tMenuText
 repeat for each line L in tText
     if word 1 of L is among the items of on,function,getprop,setprop
 then put L  cr after tMenuText
 end repeat


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


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


Re: List of handlers

2011-09-11 Thread Geoff Canyon Rev
This doesn't work with block comments, but this is what I used in revNavigator:

put the script of tID into tText
put empty into tMenuText
repeat for each line L in tText
    if word 1 of L is among the items of on,function,getprop,setprop
then put L  cr after tMenuText
end repeat

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


Re: [OT] More Apple Foolishness

2011-07-28 Thread Geoff Canyon Rev
I used to do this. Then I realized that it was quicker (if more complex and
less intuitive) to:

1. Drag something off the shelf at the bottom of the screen if necessary to
make room
2. Drag the item I want to move onto the shelf
3. Go to the home screen, either by swiping (easier than dragging) or by
dropping out of rearrange mode, clicking the home button, and going back
into rearrange mode
4. Drag the item I want to move onto screen 1
5. If step 1 was necessary, go back to the original screen and put the item
I dragged off the shelf back onto the shelf.

I agree, this aspect of the UI is not optimal.

On Wed, Jul 27, 2011 at 9:49 PM, Chipp Walters ch...@chipp.com wrote:

 Try dragging an icon across 7 pages of OTHER icons to deposit in a
 folder on page 1.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to add something to a group

2011-07-26 Thread Geoff Canyon Rev
There are several; Navigator (mine) is one, but it is ancient, unmaintained
and somewhat buggy at this point. I believe I already said this, but anyone
who still wants to use it can do so for free at this point. An even more
ancient version of navigator comes with your standard installation; you can
get an updated (but still ancient) version here:
http://inspiredlogic.com/navigator/Navigator.html

gc

On Tue, Jul 26, 2011 at 12:03 PM, Pete Haworth lists.p...@haworths.orgwrote:

 Another way is:

 - Place the button where you want it.
 - Select the group
 - Click Ungroup
 - Shift click the new button so it's selected along with all the original
 members of the group
 - Click Group

 LC remembers all the properties of the group and reinstates them (as long
 as
 you don't close the card before grouping).

 I believe there's a plugin available somewhere that provides ways of adding
 controls to a group by re-layering but I can't remember what it's called.

 Pete



 On Tue, Jul 26, 2011 at 9:25 AM, Bob Sneidar b...@twft.com wrote:

  Graphically:
 
  1. Click group to be edited
  2. Click Edit Group on your button bar, or select it in the Object menu
  3. Add your button (or paste it if you cut it previously)
  4. (very important) Click the Edit Group button (or menu) again or
  everything else you do from here on out will be done to the group!
 
  (ask me how I know)
 
  Bob
 
 
  On Jul 26, 2011, at 3:23 AM, Matthias Rebbe wrote:
 
   Hi,
  
   maybe a dumb question, but how do i add for example a button to an
  already existing group?
  
   Matthias
  
  
   ___
   use-livecode mailing list
   use-livecode@lists.runrev.com
   Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
   http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

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


Re: what RGB is blue?

2011-07-01 Thread Geoff Canyon Rev
I guess I'm playing devil's advocate, but if you were testing for
blue-ness, wouldn't you convert to HSV and compare the H, regardless of S
or V?

gc

On Fri, Jul 1, 2011 at 4:52 AM, Mark Schonewille 
m.schonewi...@economy-x-talk.com wrote:

 Tiemo,

 The distance between any colour (1) and a colour chosen by you (2; e.g.
 r=0, g=0, b=255) can be calculated as

 sqrt((r1-r2)^2+(g1-g2)^2+(b1-b2)^2) = T

 where T is a threshold between 0 and 442 set by you. Change the colour of
 the background pixel whenever the distance between the colour of that pixel
 and your selected colour is less than the threshold.

 I use this technique in Color Converter http://www.color-converter.com

 --
 Best regards,

 Mark Schonewille

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

 New: Download the Installer Maker Plugin 1.6 for LiveCode here
 http://qery.us/ce

 On 1 jul 2011, at 11:39, Tiemo Hollmann TB wrote:

  Hello,
 
  I am taking the mousecolor at different points from an image by script
 (not
  by clicking). I would like to analyse if the color I've taken is a kind
 of
  blue, or another color. I want to change the backgroundcolor of an
 image.
  The background is always blue, but different blues and changing over the
  background. So what I want to do is to verify, what is background and
 what
  is foreground of my image.
 
  100% pure blue would be 0,0,255. But for a human being 25,75,130
 (greyblue)
  is also still blue, but 240,20,180 is pink, though the third RGB value is
  higher as in my greyblue.
 
  So I can't just check only the third RGB value, neither the sum or cross
  total. Has anybody ever heard, if you can define at all by math what is
  blue?
 
  Any color specialist around here?
 
  Tiemo
 

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

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


Re: Has anyone experimented with memo functions in LC?

2011-06-16 Thread Geoff Canyon Rev
This would work for a particular function. I was looking for a general
solution that would allow memo-ing any function without further
consideration. In J, for example, you just and M. to the function
definition, and you're done. If I were to do something like this in LC I'd
want to implement something similarly robust and simple to use.

As to why I want to: no particular reason, other than memo seems vaguely
possible in LC, and a useful thing to have. I like pushing the language
forward.

gc

On Tue, Jun 14, 2011 at 4:27 PM, Dick Kriesel dick.krie...@mail.com wrote:

 Hi, Geoff.  Here's a way to memoize without parsing the functions'
 arguments, so commas won't be a pain.

 local sMemo
 function memoize pFunctionName, pParam1, pParam2
   local tDigest
   put md5( the params ) into tDigest
   if tDigest is among the keys of sMemo then
  get sMemo[ tDigest ]
   else
  get value( pFunctionName  (  item 2 to -1 of the params )
  put it into sMemo[ tDigest ]
   end if
   return it
 end memoize

 Calling MD5 makes the array's keys shorter.  IIRC, that's good, although
 when I tried to find evidence about it in the current docs, I couldn't find
 it.

 Does this help?

 -- Dick


 On Jun 11, 2011, at 2:23 PM, Geoff Canyon Rev wrote:

  http://en.wikipedia.org/wiki/Memoization
 
  I'm wondering if anyone has experimented with creating an automatic
  memoization function within LC? Given that we can access argument lists,
 and
  have do, it seems possible, but I'm betting commas in the arguments
 would
  be a pain. Something like this:
 
  function m functionName
local callHistory,callHistoryValue
 
-- parse out addition arguments to m
-- concatenate functionName  arguments into functionCallString
 
if callHistory[functionCallString] is not empty then
   return callHistoryValue[functionCallString]
end if
 
-- get the function result
 
put it into callHistoryValue[functionCallString]
put 1 into callHistory[functionCallString]
 
return it
 
  end m
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode



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

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


Re: 5000 lines of code

2011-06-11 Thread Geoff Canyon Rev
Richmond, you could rewrite that to be much more efficient, both in code,
and I'm guessing in performance.

Instead of this:

case (numToChar(2339)  numToChar(2325))
set the unicodeText of fld fPROC to numToChar(61953)
put 2 into DDROP
break
case (numToChar(2339)  numToChar(2326))
set the unicodeText of fld fPROC to numToChar(61954)
put 2 into DDROP
break
case (numToChar(2339)  numToChar(2327))
set the unicodeText of fld fPROC to numToChar(61955)
break

etc.

Do this:

First, set up a custom property (or preference file, if you like). It should
contain this:

numToChar(2339)  numToChar(2325)  tab  numToChar(61953)
numToChar(2339)  numToChar(2326)  tab  numToChar(61954)
numToChar(2339)  numToChar(2327)  tab  numToChar(61955)

etc.

Then during startup, do this:

global fPROCTable
put the fPROCCustomProc of this stack into fPROCTable
split fPROCTable by cr and tab

Then, in place of that amazing switch statement, use this one line of code:

set the unicodeText of fld fPROC to subTable[the unicodeText of fld
fBUILT]

If you also want to set DDROP then you could tweak that first array or just
create a second array, which is probably better. The line of code for that
would be something like:

if DDROPTable[the unicodeText of fld fBUILT] is not empty then
put DDROPTable[the unicodeText of fld fBUILT] into DDROP

regards,

Geoff

On Sun, Jun 5, 2011 at 10:13 AM, Richmond Mathewson 
richmondmathew...@gmail.com wrote:

 If anybody really cares here is a PDF of the code in
 ONE object in my Devawriter Pro: read it and weep . . .  :)

 http://andregarzia.on-rev.com/**richmond/PRO/KODE/5000.pdfhttp://andregarzia.on-rev.com/richmond/PRO/KODE/5000.pdf

 you never know; you might learn something, get a headache, or both!

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

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


Has anyone experimented with memo functions in LC?

2011-06-11 Thread Geoff Canyon Rev
http://en.wikipedia.org/wiki/Memoization

I'm wondering if anyone has experimented with creating an automatic
memoization function within LC? Given that we can access argument lists, and
have do, it seems possible, but I'm betting commas in the arguments would
be a pain. Something like this:

function m functionName
   local callHistory,callHistoryValue

   -- parse out addition arguments to m
   -- concatenate functionName  arguments into functionCallString

   if callHistory[functionCallString] is not empty then
  return callHistoryValue[functionCallString]
   end if

   -- get the function result

   put it into callHistoryValue[functionCallString]
   put 1 into callHistory[functionCallString]

   return it

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


Re: I need advise on slow start standalone

2011-03-05 Thread Geoff Canyon Rev
curious how you're going from an 80mb stack to an 8mb standalone. In any
case, likely you should change it so you only load content when you need it.

If you have any openstack, preopenstack, opencard, preopencard handlers,
throw some diagnostics in them to keep track of time as they execute, to
figure out where the time is going, something like:

put ticks()  step one  cr after displayThisWhenStartupIsComplete

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


Re: Getting a list of groups on a card

2011-02-27 Thread Geoff Canyon Rev
This should work:

*function* allGroupNames X

   *-- returns all groups for id X*

   *repeat* with i = 1 to the number of groups of X

  *put* the short name of of *group* i of X  cr after R

   *end* *repeat*

   *return* R

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


Re: Performance issue with groups

2011-02-18 Thread Geoff Canyon Rev
Not sure what's specifically going on in your case, but any time you work
with fields the engine works to render all the text whenever something
changes. It can really add up.

gc


On Fri, Feb 18, 2011 at 2:43 AM, JosepM jmye...@mac.com wrote:


 Yes, with lock screen the performance is the normal. But why this big
 difference to group the fields into 4 groups?

 Salut,
 Josep
 --
 View this message in context:
 http://runtime-revolution.278305.n4.nabble.com/Performance-issue-with-groups-tp3311867p3312216.html
 Sent from the Revolution - User mailing list archive at Nabble.com.

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

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


Re: Performance issue with groups

2011-02-17 Thread Geoff Canyon Rev
My guess would be screen updates -- lock screen before you show/hide and see
if the delay goes away.

On Thu, Feb 17, 2011 at 5:50 PM, JosepM jmye...@mac.com wrote:


 Hi,

 I experimented a slow (very) slow performance when I grouped the fields of
 one card into 4 groups showing one of each as required. But the problem
 seems that isn't show and hide the groups, the problem is located when
 click
 the datagrid and then the fields of the visible group are showed. if I
 ungroup the 4 groups and show all the fields at same time the performance
 is
 the normal.

 Any idea why?


 Salut,
 Josep
 --
 View this message in context:
 http://runtime-revolution.278305.n4.nabble.com/Performance-issue-with-groups-tp3311867p3311867.html
 Sent from the Revolution - User mailing list archive at Nabble.com.

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

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


Re: An idea on multithreading implementation

2011-01-31 Thread Geoff Canyon Rev
How would you handle race conditions and deadlock in a livecode-like way? If
the engine could make it as easy as with new thread that would be awesome,
but I think we'd also need ways to prevent/handle the issues that come with
concurrency.

gc

On Mon, Jan 31, 2011 at 11:56 AM, Bob Sneidar b...@twft.com wrote:

 When I started this whole thread, what I had in mind was a simple method
 for allowing commands and even whole stacks to run concurrently with other
 stacks, while still being able to communicate with each other through the
 engine. All the stuff about enabling and disabling communications between
 things is to me irrelevant. Just compile 2 apps and they will not be able to
 talk natively to each other. Done deal.

 Some tell me that multithreading is not that simple. Well nothing under the
 hood of any app is simple, and triply so for a development environment. My
 idea was for the engine to handle communications between all of it's objects
 the way it does now, but have concurrent processes IF YOU WANTED.

 By default, I envision LiveCode working just the way it does now, with the
 OPTION to say something like:

 open stack Accounts Receivable with new thread
 or
 do ReportGen with new thread

 I could then check in on the state of a global from time to time in my
 Progress Bar modal stack or switch back to my Order Entry stack and
 continue entering my customer's order while the report generator was
 running. See? I personally do not have any interest whatsoever managing all
 the threading myself. I use LiveCode so I do not HAVE to know or understand
 that sort of thing. I am only one person. One of the things that LiveCode
 allows us to do, which is not talked about much, is to produce really nice
 and functional applications with incredibly minimal resources (like only one
 developer!)

 Bob


 On Jan 31, 2011, at 9:35 AM, form wrote:

  Even discounting games, I'd love to be able to designate a substack to
 being
  threaded, disabling its access to objects in other stacks, and limiting
  communication to event/message passing.
 
  It would be very much like using the open process command with a Windows
  command line program. (WHY doesn't it work with Mac command line
  programs?!?!)
 
  I use open process is a stack to start a makefile and monitor its output
  while keeping the interface perfectly responsive. I do the same on a mac
  using a shell command outputting to a text file that I sample the tail
 from
  in another shell command. Hackier, but it gets the basic job done.
 
  But if I have LiveCode that I want to start and monitor, I'm out of luck.
  (Without getting REALLY hacky, that is.)
 
  ~ Chris Innanen
  ~ Nonsanity
 
 
  On Mon, Jan 31, 2011 at 11:57 AM, Bob Sneidar b...@twft.com wrote:
 
  Well now that there is Livecode for iApps, a lot of people may want it,
 but
  I for one am never going to develop a game, even a simple one.
 
  Bob
 
 
  On Jan 29, 2011, at 5:06 PM, Alejandro Tejada wrote:
 
  Hi All,
 
  It's nice to read discussions about features that
  enhance this platform, but now I have one doubt:
 
  How many developers (who use Livecode) want
  to see this platform converted in a game engine?
 
  Notice that the only DLL in my wish list for this
  platform is a SWF player, that allows to run
  movies inside a stack, just like the Quicktime
  externals. I do not want to see a Timeline
  in this platform...
 
  At least in my mind, you could not build (easily)
  the kind of applications created with Livecode
  if it were a game engine. Am I wrong?
 
  Or There are no boundaries anymore among
  Software Development tools?
 
  Al
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode


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

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


Re: An idea on multithreading implementation

2011-01-29 Thread Geoff Canyon Rev
I think we're talking apples and oranges. As I said, the difference between
yield() and wait 0 ticks is that one supports two (or more) pieces of code
running in parallel (not simultaneously) with state, and the other doesn't.
This would be a big benefit when programming things like:


  Currently it is very difficult simply to program any sort of
  background task whatsoever: processing a log file, making aliens attack,
  etc. wait 0 ticks simply isn't a good answer for those sorts of issues.
  Ask Malte what he could do for animationEngine (and how much more simply)
  with coroutines.

 Agreed that wait 0 ticks isn't a good solution to these sorts of issues,
 and I wasn't trying to imply that it was (if my original email came across
 that way).


So I think we're agreed that coroutines would make this easier than wait 0
ticks.


 Coroutines are not pre-emptive.


I didn't say they were. I also didn't say they'd improve performance.
Coroutines would make several types of programming problems much easier to
code. I'm not saying they'd make them run faster, except that there are
things that are prohibitively hard to do with wait that would be easy with
yield. Those things would run much faster, since they can't run at all now.


 As long as someone took the time to make an OpenGL plugin for LC, rendering
 could be made fast enough for most simple 2D games


Yes, of course if you bolt an engine on your bicycle it will go faster. I'm
not saying LiveCode _can't_ be made faster, just that threads + the current
architecture is still way too slow. Threading current LiveCode
graphics across 2, 4, or even 8 cores is going to give you a sucky game that
eats batteries and still can't compete with Flash on graphics, let alone
native code.

The problem with yielding (or waiting in LC terms) is that it basically
 puts me back into the Atari 2600 days of cycle counting, without the
 precision of being able to actually count cycles ;-). I have no idea how
 often I should yield in order to make things nice and smooth. It would be
 SOOO much more convenient if I could just make LC pre-emptive and wait for
 me like so:

 send renderFrame to me every 30 milliseconds


Agreed that pre-emptive threads (or messages if you like) would make this
easier to manage.

Summary:

 * What people seem to want here is pre-emption (however that happens).


Well, _I_ would be happy with coroutines, and I think I I understand what
I'm asking for ;-)


 * Coroutines are cooperative threads, which means they are not pre-emptive.


Yep, totally agreed. I still want them.


 * If you have to yield, it doesn't matter how many HW threads you use.


Perhaps agreed. If the underlying engine breaks up tasks and can run them
across multiple cores your whole app will be faster, but that's independent
of what we're doing above the engine. And based on your OpenGL comment, I
think we're both agreed that for game-style graphics performance, neither
coroutines nor threads will fix the problem -- what's needed (if indeed
people want this) is a new graphics library, either as a plugin or directly
in the engine.

regards,

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


Re: An idea on multithreading implementation

2011-01-29 Thread Geoff Canyon Rev
On Sat, Jan 29, 2011 at 3:31 PM, Jeffrey Massung mass...@gmail.com wrote:

 Geoff (btw, Jeff here ;-)),

 Okay, I think I completely understand where the disconnect lies - and it's
 with my understanding of the LC internals. I put together a very simple
 stack that's nothing more than a field Test and a button. The button
 script looks like this:

...


 Now, if LC essentially already had coroutines, when done, the output in the
 field should be something like 1a2b3c... (with newlines of course).
 However, that's not what's in the field. Instead the output is
 123456...abcdef... This is likely what you were alluding to and I wasn't
 getting, and this puts an entirely different face on the conversation.


Yep, that's what I was talking about. Sorry I wasn't clearer.



 The issue isn't coroutines vs. whatever so much as LC doesn't actually
 allow (from what I can tell) for multiple execution contexts. Coroutines -
 obviously - is one method of achieving this goal, and I would agree that it
 is a preferred solution.


 I hope the test above puts this discussion to rest and is a hint to the Rev
 team on a direction they can take.


I'd vote for that.



 Now, not to be pedantic, but your last paragraph didn't really make much
 sense [to me]. Coroutines - since they must yield and don't run in parallel
 - are are still single-threaded. This means that you could run 100 contexts
 on 100 HW threads, and your program will run at exactly the same speed as if
 they were on 1 HW thread (this assumes that the OS isn't hyperthreading your
 application with others).


In what way do you think threads would speed up performance?
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: An idea on multithreading implementation

2011-01-29 Thread Geoff Canyon Rev
To those proposing a SWF player, why would that be better than an
improvement in native LC graphics performance?
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: An idea on multithreading implementation

2011-01-28 Thread Geoff Canyon Rev
On Fri, Jan 28, 2011 at 1:16 AM, Jeffrey Massung mass...@gmail.com wrote:


 Coroutines have absolutely no advantage over what's already provided by LC.
 There's zero difference between saying yield() and wait 0 ticks with
 messages.


I realized that, apart from the fact that this isn't true, it's also kind of
my point: from a developer standpoint, coroutines work fairly similarly to
what many already do when they want to have two or three things going at
once. Hence they would be a significant improvement (because they maintain
state automatically) with very little effort required on the part of
livecode developers.


 The purpose of mutli-threading is to take advantage of one or more of the
 following: a completely separate hardware thread (program/code runs 100% in
 parallel with another program/set of code - the only bottlenecks being
 memory and I/O) or preemptive threading, typically by way of hyper-threading
 on a single hardware thread (basically letting the hardware or OS decide
 when to context switch for you).


This is true, but it's not a fair description of the current limitations of
livecode. Currently it is very difficult simply to program any sort of
background task whatsoever: processing a log file, making aliens attack,
etc. wait 0 ticks simply isn't a good answer for those sorts of issues.
Ask Malte what he could do for animationEngine (and how much more simply)
with coroutines.

Yes, threads are filled with awesome powah, but they're also a lot of work
to get right, and filled with pitfalls. Coroutines, by comparison, are easy,
and would make a lot of things easy to do that are currently hard or
impossible.

One other thing, just in case -- anyone who thinks threads will make
livecode a powerhouse for developing videogames is mistaken. That would
require an overhaul of the graphics engine. You can devote 100% of
livecode's attention to moving stuff around on the screen and come up short
on performance by a couple orders of magnitude. I don't say that to
criticize livecode, it's just that graphics performance isn't their focus,
never has been, and doesn't seem as though it will be any time soon.

Flight Control is well within livecode's capabilities now. Angry Birds might
be a stretch. Fruit Ninja would be a real achievement, and forget about Real
Racing.

I'd be happy to be proven wrong.

Ooo -- I just had an idea for a flight-control-like game. Guess I need to
get that iOS license after all...

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


Re: Layers, revNavigator, DataGrids

2011-01-15 Thread Geoff Canyon Rev
I'm looking at it now...

On Thu, Jan 13, 2011 at 12:43 PM, Peter Brigham MD pmb...@gmail.com wrote:

 On Jan 13, 2011, at 11:25 AM, Chipp Walters wrote:

  AltLayerTools
 http://www.gadgetplugins.com/altplugins/altLayerTools.rev
 It keeps you from moving objects in and out of groups. It only move groups
 around.

 just put in msg box:
 go URL http://www.gadgetplugins.com/altplugins/altLayerTools.rev;
 then save to plugins. I use with my toolbar palette.

 here's another which is most helpful:
 AltGroupMgr
 http://www.gadgetplugins.com/altplugins/altGroupMgr.txt

 It does a great job of placing and removing groups on different cards.

 Both use ZERO frontscripts in favor of a 'refresh button,' mostly for
 robustness and lack of conflict with some of my other frontscripts. I
 really
 need to create a single frontscript library which manages everything.
 C'est
 la vie.


 But no replacement for the really great ability that revNavigator used to
 have, of moving a control (or a group) in or out of a group? That's what I
 miss!

 Geoff Canyon, can you convince that developer of yours to do something
 about this...?  :-)


 -- Peter

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



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

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


Re: Layers, revNavigator, DataGrids

2011-01-12 Thread Geoff Canyon Rev
Hi Paul --

I, too, have been limping along with a revNavigator that I can't stop using
but which has fallen behind the dev environment in a few areas. I should
really talk to the developer and convince him to update that thing...

I'll try to find some time this weekend to have a look at the layering code
to see what's going wonky. The whole thing needs a re-write in the worst
way. I hadn't done much development in Rev for several years, but in the
past year I've built three tools critical to my place of employment. If I
gave as much attention as I gave to those tools to revNavigator it would be
shining your shoes right now.

gc

On Wed, Jan 12, 2011 at 1:20 PM, Paul Looney supp...@ahsomme.com wrote:

 Fellow Programmers,
 For many years I've used the revNavigator plugin to layer objects - to move
 objects to any layer, into and out of groups, from one group to another,
 etc.

 Somewhere around Rev 3.5 the revNavigator broke. Dragging objects in the
 list would only put bookmarks at the top of the list - leaving the selected
 object in its original layer. Using the Option key to move objects in groups
 (per the instructions) did not help. I am referring to revNavigator 3.0 RC
 1.

 I can open the stack in an older version of Rev, with the older version of
 the Navigator and relayering works properly. BUT...

 Having adjusted the object layers in an older version of Rev, the DataGrids
 will not work on the stack when it is reopened in LC 4.0 or 4.5.1. All of
 the grid objects are there but they have no intelligence:
 1. setting the dgText of the grid group does nothing - does not produce an
 error, using a try/catch shows nothing
 2. the columns are the same size but have no column widths in the Columns
 tab on the object inspector
 3. the behavior of group 'DataGrid' returns empty, not button id 1005 of
 stack revDataGridLibrary
 The original grids in the stack are broken.

 I can add new grids and they work properly. BUT...
 If I replace the old grids with new ones, I have no way to put them in the
 proper layers - short of completely rebuilding a very complex stack.

 So, two questions:
 1. Can you recommend something for layering objects in LC 4.5.1 and later?
 2. Is there a way to fix the broken datagrid described above?

 FYI, LC 4.0 tested on OS X 10.4.11 on a G4 PowerBook and LC 4.5.1 tested on
 OS X 10.6.6 on an Intel Mac Mini.

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

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


Re: What with all it's features and platforms I sometimes forget

2010-12-27 Thread Geoff Canyon Rev
On Fri, Dec 24, 2010 at 12:41 AM, Richmond richmondmathew...@gmail.comwrote:


 Well; good, effective programming is rarely either EASY or FUN; and more
 often
 than not involves a lot of prolonged effort, thought, and hard work.


Programming is like playing tennis. I'm sure there are professional tennis
players who don't enjoy playing the game. They've either grown tired of it,
or they simply discovered they had the knack, or fell into it somehow and
now they're stuck. But in general, good players like the game, or even love
it. It's just so much easier to be good at something you enjoy doing, and it
is absolutely possible to find programming fun, even when it's hard.

To tell would-be end-users that they can create wonderful things without a
 fairly serious
 investment of time and effort is simply disingenuous.


I disagree. Granted I have more than a few years invested, but most of the
things I've created over the years have been quick and simple. LC's
advantage over other languages/environments starts near infinity, and drops
to zero or even negative as the size of the project grows. At the one
extreme is the fact that I can create a workable program and compile it for
several platforms in five minutes or less. In the middle, I have many times
prototyped something in less than an hour or two that dropped jaws. At the
other extreme there are the times I would kill or die for real handler-level
integrated source control. Or macros -- what I'd give for macros.

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


Re: Livecode iOS app live in the app store

2010-12-25 Thread Geoff Canyon Rev
Not arguing what will look good -- in that I would always defer to Scott --
in real life shadows from the sun do not change size in any appreciable way
no matter how high something is, because compared to 93 million miles, 1
foot above the ground is much the same as 1000 feet above the ground.

Congratulations, John, the game looks good!

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