Re: sorting advice

2009-06-18 Thread Kay C Lan
On Fri, Jun 19, 2009 at 1:56 PM, Nicolas Cueto  wrote:

> Well, I found a solution. But maybe
> someone's got something more
> elegant.
>

How about:

replace "."  with "/" in tNaiyo
  sort lines of tNaiyo ascending dateTime by word 2 of each
replace "/" with "." in tNaiyo

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


changing the first occurrence only of a string in a line

2009-06-18 Thread Peter Alcibiades
How would you do the following in Rev?

We have a file consisting of records with tab separated fields.  Each field 
has a tag followed by contents.  Some tags occur more than once in some 
records which thus have varying numbers of fields. Duplicates are always 
consecutive.  I want to eliminate all the occurrences of any tag except 
the first one.  The duplicate tags can occur any place in the record, but 
if they are duplicated, will always be consecutive.

Doing this in SED is not particularly difficult, but it does require going 
out to shell, and so its not cross platform.  You just change the tag 
using the local scope to something else.  SED then only changes the first 
occurrence in a record.  Then you use the global scope and change all of 
them.  Then you go back and change the first one back to what it was.  In 
fact, if using SED like this, the only thing you need it for is to do the 
local, first tag, change - once this is done, the rest can be done in Rev.  
But it would be nice to stay in Rev for the whole thing.  

Is there a way in Rev to pick the first occurence of a string in a record, 
change it and not subsequent occurences, and then move on to the next 
record and do the same thing? 

That is, mimic the 'local' editing mode of SED?  

Bet you all thought them dinosaurs like SED had to be extinct by now!  But 
no, they are still trampling around in the swamps of text manipulation

For the sake of clarity, a record might look like this:

A aa TAB B bb TAB B bb TAB B bb TAB C cc TAB D dd TAB D dd

and what is wanted is to change the first occurrence of B to, for 
example !1, and the first occurence of D to, for example !2, or anyway 
something that will not occur by chance, to allow the subsequent editing 
to work globally on the file.  This is what SED does in local mode.

Peter
___
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: convert a current date into a future date

2009-06-18 Thread Kay C Lan
On Fri, Jun 19, 2009 at 12:35 PM, Nicolas Cueto  wrote:

> Oh, now I get Kay C Lan's suggestion.


Sorry, I often have problems explaining things ;-)
___
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 advice

2009-06-18 Thread Nicolas Cueto
Well, I found a solution. But maybe
someone's got something more
elegant.

Here's mine:

repeat for each line tLine in tNaiyo -- the list of data, unsorted
put word 2 of tLine && word 1 of tLine & cr after tSwitched
end repeat
delete the last char of tSwitched
put tSwitched into tNaiyo
put the itemdel into tSavedDel
set the itemdel to "."
sort lines of tNaiyo ascending numeric by item 2 of each
sort lines of tNaiyo ascending numeric by item 1 of each
sort lines of tNaiyo ascending numeric by item 3 of each
put empty into tSwitched
repeat for each line tLine in tNaiyo
put word 2 of tLine && word 1 of tLine & cr after tSwitched
end repeat
delete the last char of tSwitched
put tSwitched into tNaiyo -- the list of data, sorted by date
set the itemdel to tSavedDel

Cheers,
Nicolas Cueto
___
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


Accessing Google Spreadsheets with RunRev

2009-06-18 Thread Jim Schaubeck
Folks,
Has anyone had success in accessing cell data with google docs from within your 
scripts?  I've researched Googles API reference URL (fairly straightforward) 
and here is their reference format for 'Cell-based feed':
http://spreadsheets.google.com/feeds/cells/key/worksheetId/visibility/projection/cellId

Here's my simple script:
on mouseup
  put URL 
"http://spreadsheets.google.com/feeds/cells/rXtefVGMQhHdB4U2saE2Qxw/1/public/basic/R1C1";
 into cd fld "data"
end mouseup

I wish to get the test data in cell A1 (which is "120") into cd fld "data" but 
I get a long response.  If I get this right I plan to extract other data from 
spreadsheets I use for my company.  I think I have the formatting close to 
correct because if I change any of it, I get an error msg instead of the loang 
response (which I intentioally left out of this email).

Has anyone tried to access google spreadsheets using their API's?

As always folks, thankyou for any feedback
Jim Schaubeck
___
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


sorting advice

2009-06-18 Thread Nicolas Cueto
Still avoiding thinking too much...

Given this list (a ref-number followed
by a dot-separated date):

 bg2334 12.21.09
 bg9788 1.10.02
 bg6554 11.30.11
 bg8902 6.6.04
 bg4021 2.29.12
 bg1210 1.2.02
 bg3008 12.3.09
 bg5526 5.29.04

what sort-command combo would
re-order it ascending by the date
to become:

  bg1210 1.2.02
  bg9788 1.10.02
  bg5526 5.29.04
  bg8902 6.6.04
  bg3008 12.3.09
  bg2334 12.21.09
  bg6554 11.30.11
  bg4021 2.29.12


Note that the ref-number and the date
are space-separated, and I'm using
"." instead of the english date's "/".
Also, the date form is "month[1-12,
no leading zero], day[1-31], year [00-
09, leading zero].

I'll be experimenting on my own to hit on
the magic combination, but in the meantime
I thought I'd post a plea since someone is
very likely to reply a solution sooner than I
can guess one up.

Thank you.

--
Nicolas Cueto
___
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: convert a current date into a future date

2009-06-18 Thread Nicolas Cueto
Oh, now I get Kay C Lan's suggestion. After adding a figure
to a dateitem item, I then simply had to use convert tDate
to english date.

Thanks.

--
Nicolas Cueto
___
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: convert a current date into a future date

2009-06-18 Thread Nicolas Cueto
> What is the relationship of the future date to the present one?
> Are you trying to add a specific number of days to the present date?

Yes.

I'm working with the english date. So, given the current
date of 6/19/09, what is the date one week from now?
two weeks from now? three weeks from now?

Tried Kay C Lan's suggestion of converting to dateitems
and then adding figures to individual items. But that
doesn't automatically step-up to the next month or
year.

Plus, I really want to avoid thinking about how many
seconds in a day, or how many days in each month,
or days in a year.

Basically, don't want to think at all. Just let Rev do it.

--
Nicolas Cueto
___
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: convert a current date into a future date

2009-06-18 Thread DunbarX
You know, the whole point is to spend time fooling around. One might say 
the whole point is to spend enormous quantities of time fooling around. Don't 
miss that boat. This is a perfect task to learn on.

Craig Newman

In a message dated 6/18/09 10:38:50 PM, nicon...@gmail.com writes:

> Trying to save time having to do it myself.
> 




**
Download the AOL Classifieds Toolbar for local deals at your 
fingertips. 
(http://toolbar.aol.com/aolclassifieds/download.html?ncid=emlcntusdown0004)
___
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: convert a current date into a future date

2009-06-18 Thread Kay C Lan
On Fri, Jun 19, 2009 at 10:38 AM, Nicolas Cueto  wrote:

>
> Of course, it'd need to take into account the
> number of days in a month, a change in year,
> and leap years. Centenial or millenial changes
> can be ignored.
>

I think you'll find it's easier than you think. Using dateItems solves all
these problems for you, try this in your message box:

put the date into startDate
convert startDate to dateitems
add 1 to item 1 of startDate --year item
add 24 to item 2 of startDate --month item
add 1095 to item 3 of startDate --day item
convert startDate to long date
put startDate

Basically it adds 1 year to the current date using years, then 2 years using
months, then three years using days.
You can also use hours ( item 4), minutes (item 5) or seconds (item 6). It
doesn't matter, so if you want to know the date and time 3000 hours from
now, you can just by adding 3000 to item 4 and Rev will figure out how many
days in each of the intervening months and do all the hard work for you :-)

If you add 3000 to item 3 (days) Rev will figure out all the leap year stuff
for you.

Not sure how accurate it is with Centenial and Millenial stuff but if you
add 3000 to item 1 it does give an answer.

It also automatically figures out the day of the week for you :-)

HTH
___
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: convert a current date into a future date

2009-06-18 Thread DunbarX
How do you mean?

You can get the seconds of your future date (and time), the seconds of 
today's date (and time), subtract, and that will take into account all your 
issues about leap centuries and such.

But what do you want to get out of, or put into, into that function?

Craig Newman


**
Download the AOL Classifieds Toolbar for local 
deals at your fingertips. 
(http://toolbar.aol.com/aolclassifieds/download.html?ncid=emlcntusdown0004)
___
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: convert a current date into a future date

2009-06-18 Thread Paul Looney

What is the relationship of the future date to the present one?
Are you trying to add a specific number of days to the present date?
Paul Looney

On Jun 18, 2009, at 7:38 PM, Nicolas Cueto wrote:


Hello All,

I'm looking for a ready-made script/formula for
converting a current date into a future date.
Of course, it'd need to take into account the
number of days in a month, a change in year,
and leap years. Centenial or millenial changes
can be ignored.

Something that, for example, would convert
the english date "12/29/09" to "1/5/10", or
"2/22/12" to "2/29/12".

Trying to save time having to do it myself.

Thanks.

--
Nicolas Cueto
___
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


convert a current date into a future date

2009-06-18 Thread Nicolas Cueto
Hello All,

I'm looking for a ready-made script/formula for
converting a current date into a future date.
Of course, it'd need to take into account the
number of days in a month, a change in year,
and leap years. Centenial or millenial changes
can be ignored.

Something that, for example, would convert
the english date "12/29/09" to "1/5/10", or
"2/22/12" to "2/29/12".

Trying to save time having to do it myself.

Thanks.

--
Nicolas Cueto
___
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: errorDialog, executionContexts, debugContext

2009-06-18 Thread Mark Wieder
Phil-

Wednesday, June 17, 2009, 2:20:03 PM, you wrote:

> So my question is:
> When 'errorDialog' is executed, is its  parameter (which
> contains error description info) the only data that's available to help
> us get at the cause of the error? I can live with that, but I would just
> like to know. Or am I missing something?

Can you handle the traceError message instead (put this into a
frontscript)?

on traceError pHandlerName, pLineNumber, pCharOffset, pErrorInfo, pObjectID, 
pErrorType
   answer "got traceError"
   put "executionContexts=" & the executionContexts & cr after msg
   set the debugContext to line 1 of the executionContexts
   --put "debugContext=" & the debugContext & cr after msg
   debugdo "put the variableNames & cr after msg"
   debugdo "put myVar & cr after msg"
   set the debugContext to empty
   pass traceError
end traceError

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

___
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: Charset problem (Was: Re: Weather reporting in Rev)

2009-06-18 Thread Dom
Mark Smith  wrote:

> They will convert to and from whatever you're local charset is.

Thank you!
Exactly what I needed :-)

By the way, I overlooked these functions - I thought they were there
only for translating between single/double byte characters langages (as
the Dictionary states)

___
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: Getting Mutiple files

2009-06-18 Thread Hershel Fisch
Thanks to every one.
Hershel


On 6/17/09 6:57 PM, "Phil Davis"  wrote:

> Try this:
> 
> function filesInFolder pTargetPath
>if the platform = "Win32" then
>   replace "/" with "\" in pTargetPath
>   return shell("dir" && quote & pTargetPath & quote && "/B")
>else return shell("ls" && quote & pTargetPath & quote)
> end filesInFolder
>  
> 
> However, you can always do it the way others have suggested without
> causing any problems.
> 
> 
> Hershel Fisch wrote:
>> Hi, how can I get a list of files in a folder (without changing the
>> defaultFolder)?
>> Thanks, Hershel
>>   


___
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: Tab in datagrid

2009-06-18 Thread Hershel Fisch
Ok, thanks
Hershel


On 6/18/09 2:08 AM, "Trevor DeVore"  wrote:

> On Jun 17, 2009, at 11:04 PM, Hershel Fisch wrote:
> 
>> Sorry was off track for a few days.
>>> 
>>> So are you using your own editable field or the built-in editable
>> The built-in. How do make my own editable fld?
>>> field? The built-in editable field traps CloseField and doesn't send
>>> it on.
>> I'm sorry for not explaining it properly.
>> Here is the scenario, created a dg, flds editable (enabled) I put a
>> closeFieldEditor and there was an error in the script so the field
>> stayed
>> selected and the tab key didn't trigger or rather out cursor from the
>> selected fld and by exiting the fld via mouse it didn't unselect the
>> fld
>> even the other fld got selected.
> 
> Thanks for the additional info. That should be fixed in the version I
> linked to two days ago on this list.
> 
> Regards,


___
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: Charset problem (Was: Re: Weather reporting in Rev)

2009-06-18 Thread Mark Smith

Dom, I use these two functions in my library to deal with utf8:

function utf8decode pString
  return unidecode(uniencode(pString,"UTF8"))
end utf8decode

function utf8encode pString
  return unidecode(uniencode(pString),"UTF8")
end utf8encode

They will convert to and from whatever you're local charset is.

Best,

Mark Smith

On 18 Jun 2009, at 15:09, Dom wrote:


Ken Ray  wrote:

I'd probably use "screen scraping" techniques; for example, my zip  
code is
54701, so I go to weather.com and enter my zip. That takes me to a  
page

which is this URL:

http://www.weather.com/weather/local/54701? 
lswe=54701&lwsa=WeatherLocalUndec

lared&from=searchbox_localwx


Here in France, we have a subsidiary of weather.com named  
meteo123.com*

:-)

Anyway, your technique is working -- but, as the web is coded  
according

to the UTF-8 charset, there are some woes with the accented characters
;->

The "charset" property of a stack is read-only - and can only be  
"MacOS"

or "ISO" (i.e. ISO 8859, Latin)

Is it possible to work around this, not by hand?
Will the UTF-8 charset be implemented in the future?
something like "UTFTo mac" and "MacToUTF" ;-)


* "http://m.meteo123.com/xhtml/cc/59270";
I preferred to take the "Mobile" version, as the code is simpler to
parse

___
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: Best practice: how to write local plugin functions for library handlers?

2009-06-18 Thread Andre Garzia
David,

I don't know if I really understood the problem so pardon me if I give you a
non-solution. When I don't know in advance what functions I will be calling
during runtime, I usually do the following. First I create a global array
with elements which are also arrays, this stored elements have the following
keys:

name  -  a generic name for a given function, it need not be tied to the
function real name.
method - the real function/handler name of a given function or handler
type - if it is a function or a handler/command
target - a long id to the function/handler is available.

so a hello world might look like this:

myHelloA["name"] =  "helloworld"
myHelloA["method"] = "mySweetHelloWorld"
myHelloA["type"] = "command"
myHelloA["target"] = "stack "hello.rev""

With an array of such elements, I have a dictionary of available functions.
If you loops this array you can depending on the type, assemble a dispatch
or a value call. So to add more tests, you just add more elements to the
global storage array.

I use a similar code in my xmlrpc server and it works fine. Generating code
chunks at runtime and executing them might be easier to maintain than a
catch all code. I like generating code at runtime. If you're only executing
inside the IDE then you don't need "do", you can create a temp stack, set
the script of it to your runtime generated piece and call it. No penalty
there.

Hope this helps
andre

On Thu, Jun 18, 2009 at 8:07 AM, David Bovill  wrote:

> Say we have a complex, but generally useful handler that loops through a
> lot
> of things, and want to call a function on each element found. For example
> it
> may be a "search" function that loops through all objects in a stack, or a
> "process' function that loops through certain nodes in an XML file. Now
> there may be all sorts of "test functions" that we would like to call
> during
> this search - the question is how to structure the library handler and be
> able to call custom test functions / handlers in the local script you are
> working on?
>
>

-- 
http://www.andregarzia.com All We Do Is Code.
___
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


Charset problem (Was: Re: Weather reporting in Rev)

2009-06-18 Thread Dom
Ken Ray  wrote:

> I'd probably use "screen scraping" techniques; for example, my zip code is
> 54701, so I go to weather.com and enter my zip. That takes me to a page
> which is this URL:
> 
> http://www.weather.com/weather/local/54701?lswe=54701&lwsa=WeatherLocalUndec
> lared&from=searchbox_localwx

Here in France, we have a subsidiary of weather.com named meteo123.com*
:-)

Anyway, your technique is working -- but, as the web is coded according
to the UTF-8 charset, there are some woes with the accented characters
;-> 

The "charset" property of a stack is read-only - and can only be "MacOS"
or "ISO" (i.e. ISO 8859, Latin)

Is it possible to work around this, not by hand?
Will the UTF-8 charset be implemented in the future?
something like "UTFTo mac" and "MacToUTF" ;-)


* "http://m.meteo123.com/xhtml/cc/59270";
I preferred to take the "Mobile" version, as the code is simpler to
parse

___
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


Best practice: how to write local plugin functions for library handlers?

2009-06-18 Thread David Bovill
Say we have a complex, but generally useful handler that loops through a lot
of things, and want to call a function on each element found. For example it
may be a "search" function that loops through all objects in a stack, or a
"process' function that loops through certain nodes in an XML file. Now
there may be all sorts of "test functions" that we would like to call during
this search - the question is how to structure the library handler and be
able to call custom test functions / handlers in the local script you are
working on?

I've no real elegant way of doing this in Rev. The best I can think of is to
get the library handler to call out to the script that the local handler is
in, and allow the scripter to define a local function there. To make the
example concrete using some pseudoCode, lets say we have a function in a
library called "stack_SearchAllScripts" and we have a local search button in
another stack that is going to call this function to search scripts in a
given stack for the phrase "Hello World". So we have something that looks
like (in simplified pseudo code):

Library Stack Script
> -
>
> function stack_SearchAllScripts stackName, pluginFunctionName
> put the long id of the target into callingObject


> repeat for each line testObject in allStackObjects
> if the script_ContainsHello [testObject] of callingObject is true
> then
>
> put callingObject & CR after callingObjects
>
> end if
> end repeat
> return callingObjects
> end stack_SearchAllScripts
>
>
> Local Button Script
> -
>
> on mouseUp
>  put stack_SearchAllScripts ("Test", "script_ContainsHello")
> end mouseUp
>
> getprop script_ContainsHello [testObject]
> return the script of testObject contains "Hello World"
> end script_ContainsHello


I find it more elegant and faster to use "getprop handlers" than "send" or
"dispatch" - especially for functions that you want to return results, but
whichever way you choose, it is still ugly though - especially if you start
to get fussy about really determining which object "called" the library
handler. That is because the "calling object" is not the same as the target,
and you need to use a handler like this:

function script_CallingObject
>put line -3 of the executioncontexts into callingObject
>delete item 2 to -1 of callingObject
>return callingObject
> end script_CallingObject
>

With all of Rev's built in ability to send messages around in various ways,
it seems to me that there may be a more elegant way of writing these sorts
of library handlers that you can effectively plug in smaller function tests
into. I don"t want to use "do" for speed reasons as you want to search
through hundreds of items as fast as possible. Does anyone have a neat way
of doing this?
___
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: Tab in datagrid

2009-06-18 Thread Trevor DeVore

On Jun 17, 2009, at 11:04 PM, Hershel Fisch wrote:


Sorry was off track for a few days.


So are you using your own editable field or the built-in editable

The built-in. How do make my own editable fld?

field? The built-in editable field traps CloseField and doesn't send
it on.

I'm sorry for not explaining it properly.
Here is the scenario, created a dg, flds editable (enabled) I put a
closeFieldEditor and there was an error in the script so the field  
stayed

selected and the tab key didn't trigger or rather out cursor from the
selected fld and by exiting the fld via mouse it didn't unselect the  
fld

even the other fld got selected.


Thanks for the additional info. That should be fixed in the version I  
linked to two days ago on this list.


Regards,

--
Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com-www.screensteps.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