write fails

classic Classic list List threaded Threaded
34 messages Options
12
Reply | Threaded
Open this post in threaded view
|

write fails

Jon-3
I'm trying to log activity to a file with what I thought was a simple
approach:

put the date & " " & the long time & "  " & m & Return into s
write s to file "C:/RHOADS/EEOL2/Logs/log.txt" at end

The file is not created automatically; after creating the file manually,
the file remains empty; the path was copy-and-pasted from Windows
Explorer, so I know it is correct; the string "s" has reasonable
contents as verified with the Variable Watcher; and there are no
run-time errors.

Any thoughts?

:)

Jon

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: write fails

xbury.cs
Jon

you need to open the file first...

see Open file... Write file... and close file... Each has it's options
too...

cheers
---------------------=---------------------
Xavier


[hidden email] wrote on 25/08/2005 15:09:21:

> I'm trying to log activity to a file with what I thought was a simple
> approach:
>
> put the date & " " & the long time & "  " & m & Return into s
> write s to file "C:/RHOADS/EEOL2/Logs/log.txt" at end
>
> The file is not created automatically; after creating the file manually,

> the file remains empty; the path was copy-and-pasted from Windows
> Explorer, so I know it is correct; the string "s" has reasonable
> contents as verified with the Variable Watcher; and there are no
> run-time errors.
>
> Any thoughts?
>
> :)
>
> Jon
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution



-----------------------------------------
Visit us at http://www.clearstream.com
                                                         
IMPORTANT MESSAGE

Internet communications are not secure and therefore Clearstream
International does not accept legal responsibility for the contents of
this message.

The information contained in this e-mail is confidential and may be
legally privileged. It is intended solely for the addressee. If you are
not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful. Any views expressed in this e-mail are
those of the individual sender, except where the sender specifically
states them to be the views of Clearstream International or of any of
its affiliates or subsidiaries.

END OF DISCLAIMER
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: write fails

Eric Chatonet
In reply to this post by Jon-3
Hi Jon,

I'm used to another method which works well for me:

put "C:/RHOADS/EEOL2/Logs/log.txt" into tLogFilePath
put the date & " " & the long time & "  " & m into tData
-----
put  url("file:" & tLogFilePath) into tLog
if tLog = empty then put tData into url("file:" & tLogFilePath)
else put tLog & cr & tData into url("file:" & tLogFilePath)

The advantage is that Rev creates the file if it does not exists and  
overwrites the previous file if it already exists.
If you want be compliant with Mac OS, add a fileType setting :-)

Le 25 août 05 à 15:09, Jon a écrit :

> I'm trying to log activity to a file with what I thought was a  
> simple approach:
>
> put the date & " " & the long time & "  " & m & Return into s
> write s to file "C:/RHOADS/EEOL2/Logs/log.txt" at end
>
> The file is not created automatically; after creating the file  
> manually, the file remains empty; the path was copy-and-pasted from  
> Windows Explorer, so I know it is correct; the string "s" has  
> reasonable contents as verified with the Variable Watcher; and  
> there are no run-time errors.

Best Regards from Paris,

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        [hidden email]/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: write fails

Pat Trendler
In reply to this post by Jon-3
Jon,

I think you need to "open file" before writing to it, or, alternatively use
the "put URL"

See the docs for detail.

Pat
[hidden email]

----- Original Message -----
From: "Jon" <[hidden email]>
To: "Revolution List" <[hidden email]>
Sent: Thursday, August 25, 2005 11:09 PM
Subject: write fails


> I'm trying to log activity to a file with what I thought was a simple
> approach:
>
> put the date & " " & the long time & "  " & m & Return into s
> write s to file "C:/RHOADS/EEOL2/Logs/log.txt" at end
>
> The file is not created automatically; after creating the file manually,
> the file remains empty; the path was copy-and-pasted from Windows
> Explorer, so I know it is correct; the string "s" has reasonable contents
> as verified with the Variable Watcher; and there are no run-time errors.
>
> Any thoughts?
>
> :)
>
> Jon
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.10.15/81 - Release Date: 24/08/2005
>
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

RE: write fails

Lynch, Jonathan
In reply to this post by Jon-3
I never use open, write, close...

I did at first, but it just never occurs that I need to do it that way.

The put URL and put into URL methods are so much easier.

If you have a file named "C:/my documents/my feet stink.txt" then you
would address it like this (in Windows):

Put "file:C:/my documents/my feet stink.txt" into tFileURL
Put URL tFileURL into tMyText
-- do whatever you need to do with the text
Put tMyNewText into URL tFileURL


Now, if you are using binary data, in other words you need to make sure
Revolution does not automatically change end of line markers to its own
format, then put "binfile:" in front of the file path rather than
"file:"



-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Pat
Trendler
Sent: Thursday, August 25, 2005 9:29 AM
To: How to use Revolution
Subject: Re: write fails

Jon,

I think you need to "open file" before writing to it, or, alternatively
use
the "put URL"

See the docs for detail.

Pat
[hidden email]

----- Original Message -----
From: "Jon" <[hidden email]>
To: "Revolution List" <[hidden email]>
Sent: Thursday, August 25, 2005 11:09 PM
Subject: write fails


> I'm trying to log activity to a file with what I thought was a simple
> approach:
>
> put the date & " " & the long time & "  " & m & Return into s
> write s to file "C:/RHOADS/EEOL2/Logs/log.txt" at end
>
> The file is not created automatically; after creating the file
manually,
> the file remains empty; the path was copy-and-pasted from Windows
> Explorer, so I know it is correct; the string "s" has reasonable
contents
> as verified with the Variable Watcher; and there are no run-time
errors.

>
> Any thoughts?
>
> :)
>
> Jon
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.10.15/81 - Release Date:
24/08/2005
>
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

RE: write fails

xbury.cs
Jon

i use open file x for append... For log files, it is crucial not to erase
the logs...

And while the |put data into url thisurl" is great, and easy but i
wouldn't consider it as
a good practice if the file is over a certain size...

but of course, depends on the application...

X


[hidden email] wrote on 25/08/2005 15:34:53:

> I never use open, write, close...
>
> I did at first, but it just never occurs that I need to do it that way.
>
> The put URL and put into URL methods are so much easier.
>
> If you have a file named "C:/my documents/my feet stink.txt" then you
> would address it like this (in Windows):
>
> Put "file:C:/my documents/my feet stink.txt" into tFileURL
> Put URL tFileURL into tMyText
> -- do whatever you need to do with the text
> Put tMyNewText into URL tFileURL
>
>
> Now, if you are using binary data, in other words you need to make sure
> Revolution does not automatically change end of line markers to its own
> format, then put "binfile:" in front of the file path rather than
> "file:"
>
>
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Pat
> Trendler
> Sent: Thursday, August 25, 2005 9:29 AM
> To: How to use Revolution
> Subject: Re: write fails
>
> Jon,
>
> I think you need to "open file" before writing to it, or, alternatively
> use
> the "put URL"
>
> See the docs for detail.
>
> Pat
> [hidden email]
>
> ----- Original Message -----
> From: "Jon" <[hidden email]>
> To: "Revolution List" <[hidden email]>
> Sent: Thursday, August 25, 2005 11:09 PM
> Subject: write fails
>
>
> > I'm trying to log activity to a file with what I thought was a simple
> > approach:
> >
> > put the date & " " & the long time & "  " & m & Return into s
> > write s to file "C:/RHOADS/EEOL2/Logs/log.txt" at end
> >
> > The file is not created automatically; after creating the file
> manually,
> > the file remains empty; the path was copy-and-pasted from Windows
> > Explorer, so I know it is correct; the string "s" has reasonable
> contents
> > as verified with the Variable Watcher; and there are no run-time
> errors.
> >
> > Any thoughts?
> >
> > :)
> >
> > Jon
> >
> > _______________________________________________
> > use-revolution mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.344 / Virus Database: 267.10.15/81 - Release Date:
> 24/08/2005
> >
> >
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution



-----------------------------------------
Visit us at http://www.clearstream.com
                                                         
IMPORTANT MESSAGE

Internet communications are not secure and therefore Clearstream
International does not accept legal responsibility for the contents of
this message.

The information contained in this e-mail is confidential and may be
legally privileged. It is intended solely for the addressee. If you are
not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful. Any views expressed in this e-mail are
those of the individual sender, except where the sender specifically
states them to be the views of Clearstream International or of any of
its affiliates or subsidiaries.

END OF DISCLAIMER
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

RE: write fails

Lynch, Jonathan
In reply to this post by Jon-3
That makes sense.

I have not tried it, but can one do the same thing by saying?:

Put tNewText after URL tFileURL

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of
[hidden email]
Sent: Thursday, August 25, 2005 9:40 AM
To: How to use Revolution
Subject: RE: write fails

Jon

i use open file x for append... For log files, it is crucial not to
erase
the logs...

And while the |put data into url thisurl" is great, and easy but i
wouldn't consider it as
a good practice if the file is over a certain size...

but of course, depends on the application...

X


[hidden email] wrote on 25/08/2005 15:34:53:

> I never use open, write, close...
>
> I did at first, but it just never occurs that I need to do it that
way.

>
> The put URL and put into URL methods are so much easier.
>
> If you have a file named "C:/my documents/my feet stink.txt" then you
> would address it like this (in Windows):
>
> Put "file:C:/my documents/my feet stink.txt" into tFileURL
> Put URL tFileURL into tMyText
> -- do whatever you need to do with the text
> Put tMyNewText into URL tFileURL
>
>
> Now, if you are using binary data, in other words you need to make
sure
> Revolution does not automatically change end of line markers to its
own

> format, then put "binfile:" in front of the file path rather than
> "file:"
>
>
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Pat
> Trendler
> Sent: Thursday, August 25, 2005 9:29 AM
> To: How to use Revolution
> Subject: Re: write fails
>
> Jon,
>
> I think you need to "open file" before writing to it, or,
alternatively

> use
> the "put URL"
>
> See the docs for detail.
>
> Pat
> [hidden email]
>
> ----- Original Message -----
> From: "Jon" <[hidden email]>
> To: "Revolution List" <[hidden email]>
> Sent: Thursday, August 25, 2005 11:09 PM
> Subject: write fails
>
>
> > I'm trying to log activity to a file with what I thought was a
simple

> > approach:
> >
> > put the date & " " & the long time & "  " & m & Return into s
> > write s to file "C:/RHOADS/EEOL2/Logs/log.txt" at end
> >
> > The file is not created automatically; after creating the file
> manually,
> > the file remains empty; the path was copy-and-pasted from Windows
> > Explorer, so I know it is correct; the string "s" has reasonable
> contents
> > as verified with the Variable Watcher; and there are no run-time
> errors.
> >
> > Any thoughts?
> >
> > :)
> >
> > Jon
> >
> > _______________________________________________
> > use-revolution mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.344 / Virus Database: 267.10.15/81 - Release Date:
> 24/08/2005
> >
> >
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution



-----------------------------------------
Visit us at http://www.clearstream.com
                                                         
IMPORTANT MESSAGE

Internet communications are not secure and therefore Clearstream
International does not accept legal responsibility for the contents of
this message.

The information contained in this e-mail is confidential and may be
legally privileged. It is intended solely for the addressee. If you are
not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful. Any views expressed in this e-mail are
those of the individual sender, except where the sender specifically
states them to be the views of Clearstream International or of any of
its affiliates or subsidiaries.

END OF DISCLAIMER
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: write fails

Ken Ray
On 8/25/05 8:41 AM, "Lynch, Jonathan" <[hidden email]> wrote:

> That makes sense.
>
> I have not tried it, but can one do the same thing by saying?:
>
> Put tNewText after URL tFileURL

Yes, you can, but remember that URL is both a keyword and a function, and
although it can work without parentheses for some file operations (like
"into"), it doesn't work when using "after" or "before" without using
parentheses, and can be touchy at other times.

So I think we've been "getting away" with saying:

  put data into url "file:c:/my documents/test.txt"

when we really should be saying:

  put data into url("file:c:/my documents/text.txt")

For example, this will fail to compile:

  answer file "Get a file:"
  if it <> "" then
    put "hello" into url "file:"&it
  end if

But this compiles fine:

  answer file "Get a file:"
  if it <> "" then
    put "file:" & it into tFile
    put "hello" into url tFile
  end if

Better yet would be to use parentheses instead:

  answer file "Get a file:"
  if it <> "" then
    put "hello" into url("file:"&it)
  end if

Just my 2 cents,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [hidden email]



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

RE: write fails

Lynch, Jonathan
In reply to this post by Jon-3
Thanks Ken!

So, you could say:

Put tMyText after URL(tFileURL)

But, would this be just as good as opening a file for append, then
adding information to that file?

Basically, does the open/append/add method load the entire file into
memory, then add the text, then write the new text back to disk? Does
the put after URL method do that?

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Ken Ray
Sent: Thursday, August 25, 2005 12:22 PM
To: Use Revolution List
Subject: Re: write fails

On 8/25/05 8:41 AM, "Lynch, Jonathan" <[hidden email]> wrote:

> That makes sense.
>
> I have not tried it, but can one do the same thing by saying?:
>
> Put tNewText after URL tFileURL

Yes, you can, but remember that URL is both a keyword and a function,
and
although it can work without parentheses for some file operations (like
"into"), it doesn't work when using "after" or "before" without using
parentheses, and can be touchy at other times.

So I think we've been "getting away" with saying:

  put data into url "file:c:/my documents/test.txt"

when we really should be saying:

  put data into url("file:c:/my documents/text.txt")

For example, this will fail to compile:

  answer file "Get a file:"
  if it <> "" then
    put "hello" into url "file:"&it
  end if

But this compiles fine:

  answer file "Get a file:"
  if it <> "" then
    put "file:" & it into tFile
    put "hello" into url tFile
  end if

Better yet would be to use parentheses instead:

  answer file "Get a file:"
  if it <> "" then
    put "hello" into url("file:"&it)
  end if

Just my 2 cents,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [hidden email]



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: write fails

Jeanne A. E. DeVoto
In reply to this post by Ken Ray
At 11:22 AM -0500 8/25/2005, Ken Ray wrote:

>Yes, you can, but remember that URL is both a keyword and a function, and
>although it can work without parentheses for some file operations (like
>"into"), it doesn't work when using "after" or "before" without using
>parentheses, and can be touchy at other times.
>
>So I think we've been "getting away" with saying:
>
>   put data into url "file:c:/my documents/test.txt"
>
>when we really should be saying:
>
>   put data into url("file:c:/my documents/text.txt")

I'm afraid that's not right, Ken. URL isn't a function, and while
your example will work, Rev might not always let you get away with
leaving out the space after "URL".

The reason you need to use parentheses in statements like
    get URL ("file:" & myURL)
is that URL resolution comes before "&" when resolving expressions.
(Ken can stop reading here, since he's an expert and knows what that
implies, but for everyone else: ;-)

If you write something like
    get URL "file:" & myURL
the engine thinks you mean "get URL 'file:', then concatenate it to
the variable 'myURL'". Since "file:" by itself isn't a valid URL, you
don't get what you want.

Adding the parentheses forces the engine to do the concatenation
first, so you get the URL you're seeking. But in this case, the
parentheses have nothing to do with a function call; they're there to
straighten out the order in which the engine does the operations to
get the final value of the expression, 'URL "file:" & myURL'.
--
jeanne a. e. devoto ~ [hidden email]
http://www.jaedworks.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

RE: write fails

Robert Brenstein
In reply to this post by Lynch, Jonathan
>Thanks Ken!
>
>So, you could say:
>
>Put tMyText after URL(tFileURL)
>
>But, would this be just as good as opening a file for append, then
>adding information to that file?
>
>Basically, does the open/append/add method load the entire file into
>memory, then add the text, then write the new text back to disk? Does
>the put after URL method do that?

I haven't done any testing with newer versions of Rev but I
investigated this a couple years ago when adding a logging function
to my web cgi. Using the open for append/write/close was determined
to be somewhat more efficient than the url method (and confirmed by
Scott Raney at that time).

Robert
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: write fails

Jon-3
In reply to this post by Eric Chatonet
Excellent approach, Eric!


Eric Chatonet wrote:

> Hi Jon,
>
> I'm used to another method which works well for me:
>
> put "C:/RHOADS/EEOL2/Logs/log.txt" into tLogFilePath
> put the date & " " & the long time & "  " & m into tData
> -----
> put  url("file:" & tLogFilePath) into tLog
> if tLog = empty then put tData into url("file:" & tLogFilePath)
> else put tLog & cr & tData into url("file:" & tLogFilePath)
>
> The advantage is that Rev creates the file if it does not exists and  
> overwrites the previous file if it already exists.
> If you want be compliant with Mac OS, add a fileType setting :-)
>
> Le 25 août 05 à 15:09, Jon a écrit :
>
>> I'm trying to log activity to a file with what I thought was a  
>> simple approach:
>>
>> put the date & " " & the long time & "  " & m & Return into s
>> write s to file "C:/RHOADS/EEOL2/Logs/log.txt" at end
>>
>> The file is not created automatically; after creating the file  
>> manually, the file remains empty; the path was copy-and-pasted from  
>> Windows Explorer, so I know it is correct; the string "s" has  
>> reasonable contents as verified with the Variable Watcher; and  there
>> are no run-time errors.
>
>
> Best Regards from Paris,
>
> Eric Chatonet.
> ----------------------------------------------------------------
> So Smart Software
>
> For institutions, companies and associations
> Built-to-order applications: management, multimedia, internet, etc.
> Windows, Mac OS and Linux... With the French touch
>
> Free plugins and tutorials on my website
> ----------------------------------------------------------------
> Web site        http://www.sosmartsoftware.com/
> Email        [hidden email]/
> Phone        33 (0)1 43 31 77 62
> Mobile        33 (0)6 20 74 50 86
> ----------------------------------------------------------------
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: write fails

Ken Ray
In reply to this post by Jeanne A. E. DeVoto
On 8/25/05 11:55 AM, "Jeanne A. E. DeVoto" <[hidden email]> wrote:

> At 11:22 AM -0500 8/25/2005, Ken Ray wrote:
>> Yes, you can, but remember that URL is both a keyword and a function, and
>> although it can work without parentheses for some file operations (like
>> "into"), it doesn't work when using "after" or "before" without using
>> parentheses, and can be touchy at other times.
>>
>> So I think we've been "getting away" with saying:
>>
>>   put data into url "file:c:/my documents/test.txt"
>>
>> when we really should be saying:
>>
>>   put data into url("file:c:/my documents/text.txt")
>
> I'm afraid that's not right, Ken. URL isn't a function, and while
> your example will work, Rev might not always let you get away with
> leaving out the space after "URL".
>
> The reason you need to use parentheses in statements like
>     get URL ("file:" & myURL)
> is that URL resolution comes before "&" when resolving expressions.
> (Ken can stop reading here, since he's an expert and knows what that
> implies, but for everyone else: ;-)

Thanks for the correction, Jeanne... I think what threw me is that
apparently the engine doesn't require there to be a space after keywords
where there is something to evaluate that follows. So what appeared to me as
a function:

  put URL("file:" & myURL)

was really something that Rev was allowing me to construct. I tested this
with the "while" keyword, and it turns out that this is perfectly valid:

  put 1 into x
  repeat while(x+1) < 10
    put x after msg
    add 1 to x
  end repeat

... as is this using the keyword "word":

  on mouseUp
    put 1 into x
    put word(x+1) of "This is a test"
  end mouseUp

Although this is consistent, it still *looks* wrong to me... it looks like
"while" and "word" are functions in the example above. Is it just me, or is
this a bug that has been in the engine for a long time?

Just curious,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [hidden email]


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: write fails

Jeanne A. E. DeVoto
At 1:18 PM -0500 8/25/2005, Ken Ray wrote:
>apparently the engine doesn't require there to be a space after keywords
>where there is something to evaluate that follows.

[...]

>   repeat while(x+1) < 10
>   put word(x+1) of "This is a test"
>
>Although this is consistent, it still *looks* wrong to me... it looks like
>"while" and "word" are functions in the example above. Is it just me, or is
>this a bug that has been in the engine for a long time?

Well, it's been in the engine a long time. I'm not sure I'd
categorize it as a bug, per se... more of a "forgiveness" feature of
the parser. This kind of forgiveness appears in other areas too - for
example, you can write "firstVar&&secondVar" with no spaces, or "get
rect of field 1" (with no "the") and it will work.

I think the upside is that the syntax is a little looser, but the
downside is that someone may get used to an erroneous way of writing
code, only to get into trouble if it gets tightened up down the
line....
--
jeanne a. e. devoto ~ [hidden email]
http://www.jaedworks.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

RE: write fails

Lynch, Jonathan
In reply to this post by Jon-3
Thanks,

That makes sense, if appending is just adding on to the end of the file
on the disk, and not bothering to load the file up into memory.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Robert
Brenstein
Sent: Thursday, August 25, 2005 1:03 PM
To: How to use Revolution
Subject: RE: write fails

>Thanks Ken!
>
>So, you could say:
>
>Put tMyText after URL(tFileURL)
>
>But, would this be just as good as opening a file for append, then
>adding information to that file?
>
>Basically, does the open/append/add method load the entire file into
>memory, then add the text, then write the new text back to disk? Does
>the put after URL method do that?

I haven't done any testing with newer versions of Rev but I
investigated this a couple years ago when adding a logging function
to my web cgi. Using the open for append/write/close was determined
to be somewhat more efficient than the url method (and confirmed by
Scott Raney at that time).

Robert
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

set rect of fld f1 of cd c1 of wd w1 to rect of fld f2 of cd c2 of wd w2

Mark Waddingham
In reply to this post by Jeanne A. E. DeVoto
> >   repeat while(x+1) < 10
> >   put word(x+1) of "This is a test"
> >
> >Although this is consistent, it still *looks* wrong to me... it looks like
> >"while" and "word" are functions in the example above. Is it just me, or is
> >this a bug that has been in the engine for a long time?
>
> Well, it's been in the engine a long time. I'm not sure I'd
> categorize it as a bug, per se... more of a "forgiveness" feature of
> the parser. This kind of forgiveness appears in other areas too - for
> example, you can write "firstVar&&secondVar" with no spaces, or "get
> rect of field 1" (with no "the") and it will work.

Indeed, the engine is a little too forgiving in places but there are
actually two separate issues here - one related to tokenisation and one
related to parsing.

In regards to things such as "firstVar&&secondVar" and "word(x+1)" then
this is quite standard in the way the first step of parsing
(tokenisation) is performed. In any language's character-set a certain
set of characters will be defined as 'delimiters' that always terminate
a previous token and begin a new one. In transcript the delimiters are
(more or less):
  { | } ~ ^ [ \ ] ; : < = > / * ( ) & % # " ! <space> <tab> <cr> <lf>
  [ + plus a few high bit-set 'Mac' characters which I can't type in
Linux ]

All of these delimiter characters are considered tokens in their own
right except:
  - " which starts a string
  - # which starts a comment until the end of line
  - '--' which starts a comment until the end of line
  - /* which starts a comment until */

After splitting up by these delimiters the engine throws away all white-
space (<space>, <tab> and <cr>) and comments and is then left with a
sequence of tokens.

This means that a string such as:
  word(1+tVar[100])of("abc def ghi")
is split up as:
  'word' '(' '1' '+' 'tVar' '[' '100' ']' ')' 'of' '(' '"abc def ghi"')'


The 'the' issue is slightly different as this is do with a later stage
of processing - that of parsing (where the stream of tokens is built
into the actual commands and functions to be executed). This is a
particular case where the engine is a little lapse in making a noise
(historically this was to help enable porting SuperCard and HyperCard
stacks to Revolution).

Indeed, I am reliably informed that Scott Raney always used to
periodically remind people to always use 'the' as a prefix for property
accesses and I will continue this trend: please always use 'the'.
Indeed, caveat-those-that-do-not-use-the-the :o)

Just to clarify, 'the' should always be used when accessing properties
(it is already mandatory when using the property syntax form of engine
functions). So you should write:
  set the cCustomRect of me to the rect of me
*not*
  set cCustomRect of me to rect of me
And you should write:
  put the dontUseQT
*not*
  put dontUseQT


> I think the upside is that the syntax is a little looser, but the
> downside is that someone may get used to an erroneous way of writing
> code, only to get into trouble if it gets tightened up down the
> line....

As Jeanne looks into her crystal ball ;o)

Overall, the engine at present is quite forgiving in what syntax you
give it and this is as much a curse as it is a blessing. My general
advice is to always follow the syntax as specified in the documentation
*including* making sure you use appropriate connecting keywords.

[ I'd also hope to convince people to stop using the shortened form of
control type keywords over time but I fear that if I am too vocal about
this I might run the risk of being pummeled with fruit ;o) ]

The motivation for giving this advice is a very pragmatic one: the
tighter the syntax of Transcript becomes, the more powerful it can be in
the future. The eventual result being a great reduction in the number of
lines of code you need to write to solve a particular problem.

Warmest Regards,

Mark.

------------------------------------------------------------------
 Mark Waddingham ~ [hidden email] ~ http://www.runrev.com
       Runtime Revolution ~ User-Centric Development Tools

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: set rect of fld f1 of cd c1 of wd w1 to rect of fld f2 of cd c2 of wd w2

Ken Ray
On 8/26/05 6:02 AM, "Mark Waddingham" <[hidden email]> wrote:

> Indeed, the engine is a little too forgiving in places but there are
> actually two separate issues here - one related to tokenisation and one
> related to parsing.

Thanks for the clarification, Mark... it really helps me understand what's
going on.

> [ I'd also hope to convince people to stop using the shortened form of
> control type keywords over time but I fear that if I am too vocal about
> this I might run the risk of being pummeled with fruit ;o) ]

How about the opposite? Stop using the *long* form... it means less typing
and you get the same effect (see your subject line)...  (he said, dodging
fruit)   ;-)

> The motivation for giving this advice is a very pragmatic one: the
> tighter the syntax of Transcript becomes, the more powerful it can be in
> the future. The eventual result being a great reduction in the number of
> lines of code you need to write to solve a particular problem.

Agreed.

Thanks,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [hidden email]


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: set rect of fld f1 of cd c1 of wd w1 to rect of fld f2 of cd c2 of wd w2

mwieder
Ken-

Friday, August 26, 2005, 7:13:32 AM, you wrote:

> How about the opposite? Stop using the *long* form... it means less typing
> and you get the same effect (see your subject line)...  (he said, dodging
> fruit)   ;-)

...in that case *all* my stacks would stop working...

<fruit>

A Modest Proposal:

How about if we eliminate both and enforce just a single-character
typing convention for objects and numeric values only for object
identification? That way "field 3 of card 7" would come out to "f3c7"
for a minimum of typing. The engine's parser would, of course,
separate these into separate tokens "f 3 c 7" and be quite happy.
Developers would have to type just four characters and the code would
be much more readable because there's just one way to describe an
object instead of two. The engine's parser would also run faster
because it wouldn't have to discriminate between two different forms
of object description.

</fruit>

--
-Mark Wieder
 [hidden email]

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: set rect of fld f1 of cd c1 of wd w1 to rect of fld f2 of cd c2 of wd w2

J. Landman Gay
Mark Wieder wrote:

> Ken-
>
> Friday, August 26, 2005, 7:13:32 AM, you wrote:
>
>
>>How about the opposite? Stop using the *long* form... it means less typing
>>and you get the same effect (see your subject line)...  (he said, dodging
>>fruit)   ;-)
>
>
> ...in that case *all* my stacks would stop working...
>
> <fruit>
>
> A Modest Proposal:
>
> How about if we eliminate both and enforce just a single-character
> typing convention for objects and numeric values only for object
> identification? That way "field 3 of card 7" would come out to "f3c7"
> for a minimum of typing. The engine's parser would, of course,
> separate these into separate tokens "f 3 c 7" and be quite happy.
> Developers would have to type just four characters and the code would
> be much more readable because there's just one way to describe an
> object instead of two. The engine's parser would also run faster
> because it wouldn't have to discriminate between two different forms
> of object description.
>
> </fruit>
>

<tomato>
   HEAVE. SPLAT!!
</tomato>

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: set rect of fld f1 of cd c1 of wd w1 to rect of fld f2 of cd c2 of wd w2

Ken Ray
In reply to this post by mwieder
On 8/26/05 11:36 AM, "Mark Wieder" <[hidden email]> wrote:

> Ken-
>
> Friday, August 26, 2005, 7:13:32 AM, you wrote:
>
>> How about the opposite? Stop using the *long* form... it means less typing
>> and you get the same effect (see your subject line)...  (he said, dodging
>> fruit)   ;-)
>
> ...in that case *all* my stacks would stop working...
>
> <fruit>
>
> A Modest Proposal:
>
> How about if we eliminate both and enforce just a single-character
> typing convention for objects and numeric values only for object
> identification? That way "field 3 of card 7" would come out to "f3c7"
> for a minimum of typing. The engine's parser would, of course,
> separate these into separate tokens "f 3 c 7" and be quite happy.
> Developers would have to type just four characters and the code would
> be much more readable because there's just one way to describe an
> object instead of two. The engine's parser would also run faster
> because it wouldn't have to discriminate between two different forms
> of object description.
>
> </fruit>

See now you're getting dangerously close to dot notation:

  set c7.f3.name to "Ken"

(Hey! Who threw the watermelon?)

;-)

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [hidden email]


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
12