[REBOL] [REBOL]Hex decoding Re:(2)

2000-04-24 Thread tjohnson

Thanks: I'm still a newbie... but I
actually thought of that myself later. Thank
you very much for the help!
regards
tim
At 06:05 AM 4/24/00 +0100, you wrote:


hex2str: func[a][  dehex join "%" a  ]

 I have a 2-byte string: value is "74"
 
 I want to convert this value to a 't'
 
 hint : 't' is ascii 116
 
 116 is hex 74;
 
 de-hex doesn't do it. I'm trying to write
 a variation of de-hex.
 
 Thanks for the help as always!!
 Tim
 

Volker
 






[REBOL] [REBOL]Hex decoding Re:(2)

2000-04-24 Thread tjohnson

Hi: I tried a different approach,
which now works. I will set up both
approaches, and submit them to the
list and see if I get input on the
most efficient approach. 
Thank you much!
tim
At 10:28 AM 4/24/00 +0100, you wrote:
Hi, REBOL can do it all, although with some type conversions.

Encoding, step by step:

 string: "this is a string"
== "this is a string"
 binary: to-binary string
== #{74686973206973206120737472696E67}
 binary-as-string: form binary
== "#{74686973206973206120737472696E67}"
 hex-string: copy next next head remove back tail binary-as-string
== "74686973206973206120737472696E67"

Decoding, step by step:

 binary-as-string-again: join "#{" [ hex-string "}" ]
== "#{74686973206973206120737472696E67}"
 binary-again: do binary-as-string-again
== #{74686973206973206120737472696E67}
 string-again: to-string binary-again
== "this is a string"

-- 
Michal Kracik

[EMAIL PROTECTED] wrote:
 
 Hello all:
 I'm trying to set up a system for encoding
 a string into a target string that represents
 the hex values of the original string.
 I've got the encoding set up. Now I want
 to decode the string:
 So here's where I run into a dead-end.
 
 I have a 2-byte string: value is "74"
 
 I want to convert this value to a 't'
 
 hint : 't' is ascii 116
 
 116 is hex 74;
 
 de-hex doesn't do it. I'm trying to write
 a variation of de-hex.
 
 Thanks for the help as always!!
 Tim






[REBOL] ex decoding Re:(2)

2000-04-24 Thread tjohnson

Wow! Now I have three approaches. Since
reading the other two, this looks like the
most efficient.
thank you Gabriele!
Tim
At 12:00 PM 4/24/00 +0200, you wrote:
Hello [EMAIL PROTECTED]!

On 24-Apr-00, you wrote:

 t I'm trying to set up a system for encoding
 t a string into a target string that represents
 t the hex values of the original string.

 s: enbase/base "A string" 16
== "4120737472696E67"

 to-string debase/base s 16
== "A string"

Have a look at the help for enbase and debase. :-)

Regards,
Gabriele.
-- 
Gabriele Santilli [EMAIL PROTECTED] - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/






[REBOL] Evaluating Rebol Data Types with a switch Re:(2)

2000-04-23 Thread tjohnson

Hi Allen:
Thank you. That does it! I'm just 
barely beginning to get ahold of rebol's
feature of string words together.

Best regards!! :) Tim
At 02:29 PM 4/23/00 +1000, you wrote:
Hi Tim,

If you want to use switch you could try something like this

my-blk: ["one" "two" "three"]  
switch/default form type? my-blk [
"block" [print "block!"]
"string" [print "string!"]
][print "not a string or a block"]


Cheers,

Allen K

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, April 23, 2000 1:07 PM
Subject: [REBOL] [REBOL] Evaluating Rebol Data Types with a switch


 Thanks Allen:
 the following is what I was looking for:
 my-blk: ["one" "two" "three"]
  either block? my-blk
  [print "yup"]
  [print "nope"]
 BUT: Now I have tried switch with no luck
 ; code I tried is below
 my-blk: ["one" "two" "three"]  
 switch my-blk
   [
 block? [print "block!"]
 string? [print "else!"]
   ]
 == none
 At 10:58 AM 4/23/00 +1000, you wrote:
 
 Hi Tim,
 
 With all types there is an evaluator for the type. It is the data-type's
 name with a "?" on the end.
 e.g
 
 block? ["one" "two" "three"]
 ==true
 
 block? http://www.rebol.com
 ==false
 
 url? http://www.rebol.com
 ==true
 
 Hope that helps.
 
 Cheers,
 
 Allen K
 
 
 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, April 23, 2000 10:18 AM
 Subject: [REBOL] [REBOL] Evaluating Rebol Data Types
 
 
  Hello Again:
  I want to be able to internally evaluate
  rebol data types:
  the following code :
 
  my-blk: ["one" "two" "three"]
  print reform ["my-blk is a " type? my-blk]
either equal? type? proj-args "block"
[print "my-blk's type is block"]
[print "my-blk's type is something else"]
 
  ; returns
  my-blk is a block
  my-blk's type is something else
 
  ; It appears that
  either equal? [type? proj-args] "block"
  ; evaluates as false.
 
  How may I rewrite this code so that it evaluates
  as true?
 
  Thanks in advance
  tim
 
 
 
 
 
 






[REBOL] [REBOL]How do I change my email address

2000-04-23 Thread tjohnson

I am changing my email address. 
What's the best way to do this for both the
[REBOL] and [ALLY] lists?
thanks
tim




[REBOL] [REBOL]Hex decoding

2000-04-23 Thread tjohnson

Hello all:
I'm trying to set up a system for encoding
a string into a target string that represents
the hex values of the original string.
I've got the encoding set up. Now I want
to decode the string:
So here's where I run into a dead-end.

I have a 2-byte string: value is "74"

I want to convert this value to a 't'

hint : 't' is ascii 116

116 is hex 74;

de-hex doesn't do it. I'm trying to write
a variation of de-hex.

Thanks for the help as always!!
Tim





[REBOL] [REBOL] Evaluating Rebol Data Types

2000-04-22 Thread tjohnson

Hello Again:
I want to be able to internally evaluate
rebol data types:
the following code : 

my-blk: ["one" "two" "three"]
print reform ["my-blk is a " type? my-blk]
  either equal? [type? proj-args] "block"
  [print "my-blk's type is block"]
  [print "my-blk's type is something else"]

; returns
my-blk is a block
my-blk's type is something else

; It appears that 
either equal? [type? proj-args] "block"
; evaluates as false.

How may I rewrite this code so that it evaluates
as true?

Thanks in advance
tim




[REBOL] [REBOL] Evaluating Rebol Data Types with a switch

2000-04-22 Thread tjohnson

Thanks Allen:
the following is what I was looking for:
my-blk: ["one" "two" "three"]
 either block? my-blk
 [print "yup"]
 [print "nope"]
BUT: Now I have tried switch with no luck
; code I tried is below
my-blk: ["one" "two" "three"]  
switch my-blk
  [
block? [print "block!"]
string? [print "else!"]
  ]
== none
At 10:58 AM 4/23/00 +1000, you wrote:

Hi Tim,

With all types there is an evaluator for the type. It is the data-type's
name with a "?" on the end.
e.g

block? ["one" "two" "three"]
==true

block? http://www.rebol.com
==false

url? http://www.rebol.com
==true

Hope that helps.

Cheers,

Allen K


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, April 23, 2000 10:18 AM
Subject: [REBOL] [REBOL] Evaluating Rebol Data Types


 Hello Again:
 I want to be able to internally evaluate
 rebol data types:
 the following code :

 my-blk: ["one" "two" "three"]
 print reform ["my-blk is a " type? my-blk]
   either equal? type? proj-args "block"
   [print "my-blk's type is block"]
   [print "my-blk's type is something else"]

 ; returns
 my-blk is a block
 my-blk's type is something else

 ; It appears that
 either equal? [type? proj-args] "block"
 ; evaluates as false.

 How may I rewrite this code so that it evaluates
 as true?

 Thanks in advance
 tim








[REBOL] [REBOL] passing args to another script

2000-04-21 Thread tjohnson

How do I pass arguments to another script?
Haven't had much success with the /args
refinement.
I've written two scripts. One "do's" the
other as follows:
;CALLING script
REBOL [
Title: "testload.r (loading another file)"
Date:   21-Apr-2000
Author: ["newbie"]
]
do %loadtest.r
;CALLED script
REBOL [
Title: "loadtest.r loaded from testload.r"
Date:   21-Apr-2000
Author: ["newbie"]
]
print "in load test"
print ["Command Line Arg: " system/script/args]

;I would like to pass one or more arguments to
;loadtest.r. What would be the correct way to do
;it?

Thanks to all!! :) tim





[REBOL] [REBOL] Traversing object values

2000-04-17 Thread tjohnson

Given an object:

let's use system/options/cgi 

I would like to traverse the object
and print out the values only, each preceded by
a custom label.

I know that to use print mold system/options/cgi
will dump the object. But I want to
just extract the values and concatenate them
with a customized label.

So that instead of 
make object! [
server-software: none
server-name: none
gateway-interface: none
server-protocol: none
server-port: none
request-method: none
path-info: none
path-translated: none
script-name: none
query-string: none
remote-host: none
remote-addr: none
auth-type: none
remote-user: none
remote-ident: none
Content-Type: none
content-length: none
other-headers: []
]
I will have:

Server Software:  none
Server Name: none
; etc..

I believe that I will also need to code a block like
cgi-labels: ["Server Software" "Server Name"]

and iterate simultaneously through the object and
the block.

Will give a nice professional looking "dump" of
the cgi environment, and will also edify me on
the process of interating blocks and objects.

Thanks in advance 
Tim




[REBOL] Traversing object values Re:(2)

2000-04-17 Thread tjohnson

Thanks Allen!
tim
At 08:17 AM 4/18/00 +1000, you wrote:
Hi Tim,

The function your are looking for is net-utils/export
This will return all values in the object that have a value.

result: net-utils/export system/options/cgi

if you want a list of 'none as well use this modified version
(I just commented out the value? test of the original net-utils/export)

result: export2 system/options/cgi

export2: func [
{Export an object to something that looks like a header}
object [object!] "Object to export"
/local words values result word
][
words: next first object
values: next second object
result: make string! (20 * length? words)
foreach word words [
   ; if found? first values [
insert tail result reduce [word ": " first values newline]
   ; ]
values: next values
]
result
]


And here are some other ways to play with object words and values

 cgi-labels: ["Server Software" "Server Name"]

cgi-label: next first system/options/cgi

== [server-software server-name gateway-interface server-protocol
server-port request-method
 path-info path-translated script-name ...

values: next second system/options/cgi
== [none none none none none none none none none none none none none none
none none none []]


Cheers

Allen K


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 18, 2000 4:49 AM
Subject: [REBOL] [REBOL] Traversing object values


 Given an object:

 let's use system/options/cgi

 I would like to traverse the object
 and print out the values only, each preceded by
 a custom label.

 I know that to use print mold system/options/cgi
 will dump the object. But I want to
 just extract the values and concatenate them
 with a customized label.

 So that instead of
 make object! [
 server-software: none
 server-name: none
 gateway-interface: none
 server-protocol: none
 server-port: none
 request-method: none
 path-info: none
 path-translated: none
 script-name: none
 query-string: none
 remote-host: none
 remote-addr: none
 auth-type: none
 remote-user: none
 remote-ident: none
 Content-Type: none
 content-length: none
 other-headers: []
 ]
 I will have:

 Server Software:  none
 Server Name: none
 ; etc..

 I believe that I will also need to code a block like
 cgi-labels: ["Server Software" "Server Name"]

cgi-label: next first system/options/cgi

== [server-software server-name gateway-interface server-protocol
server-port request-method
 path-info path-translated script-name ...

values: next second system/options/cgi
== [none none none none none none none none none none none none none none
none none none []]



 and iterate simultaneously through the object and
 the block.

 Will give a nice professional looking "dump" of
 the cgi environment, and will also edify me on
 the process of interating blocks and objects.

 Thanks in advance
 Tim








[REBOL] Removing lines... Re:(3)

2000-04-14 Thread tjohnson

At 09:43 AM 4/14/00 +0200, you wrote:
Hi,
Uhm.. yeah, but where's the attachment? =)

//Best Regards
Stefan Falk


 -Original Message-
 From:[EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Sent:Thursday, April 13, 2000 5:55 PM
 To:  [EMAIL PROTECTED]
 Subject: [REBOL] Removing lines... Re:
 
 Hi Stefan:
  I have attached a file called "remove.r". It has
 two functions that were provided to me by other members
 of the mailing list. Perhaps there are others that
 would find it useful. The first one is the one that I
 was looking for. It will replace text between two markers,
 so that it has the effect of rewriting a record in a simple
 database.
 I hope you find this helpful.
 Regards
 Tim
 At 10:55 AM 4/13/00 +0200, you wrote:
 Hi list,
 I've read a textfile with read/linesis there an easy way to remove a
 line from the data?
 
 it goes something like:
 
 data: read/lines %blaah.txt
 
 if find data "plupp" [remove the line] --- of course there oughta be
 some
 easy code there.. ;)
 
 Best Regards
 Stefan Falk
 
 



REBOL
[
  Title:  "Test File Insertion"
  Date:   9-Feb-2000
  Author: "Tim Johnson via Ladislav and others"
  Email:  [EMAIL PROTECTED]
  File:   %Remove.r
  Purpose:{To test removing text from a block}
]
remove-text: func
  [fp1[file!] ins_series[series!] begin_marker[string!] end_marker[string!]]
[
  ;insert_txt: ["first new line" "second new line" "third new line"]
  fp: open/lines fp1
  remove_flag: false
  lines-done:  0
  while[not tail? fp];test for end of block
  [
if find first fp begin_marker   ;"begin insert here"
  [remove_flag: true]  ;prepare to insert but pointer must move to next
either remove_flag ;we will now remove nodes from fp
[
  either find first fp end_marker ;"end insert here" ; check for end marker
  [
remove_flag: false  ; turn flag off
foreach txt ins_series  ; insert the new series
  [fp: insert fp txt]
fp: next fp ; and proceed read/write
  ]
  [ {else}
either zero? lines-done  ; begin insertion
[
  lines-done: 1
  fp: next fp
]
[{else} remove fp]
  ]
]
[{else} fp: next fp]
  ]
  update fp
  close fp
]
insert_txt: ["first new line" "second new line" "third new line"]
begin_marker: "begin insert here"
end_marker: "end insert here"
nfile: "test.txt"
file_name:  make file! nfile
print file_name
remove-text file_name insert_txt begin_marker end_marker

;file begins here
;!--begin insert here--
;original line one
;original line two
;original line three
;!--end insert here--
;file ends here
replace-text: func [
fp [file!] "text file with lines to be updated"
rp [file!] "text file holding lines to be inserted"
][
fp: open/lines fp
rp: read/lines rp
lines_removed:  0
lines_inserted: 0
while [ not tail? fp ] [
if find first fp "begin replace here" [
print "found"
fp: next fp
lines_inserted: lines_inserted + length? rp
fp: insert fp rp
while [all [
not tail? fp
not find first fp "end replace here"
]][
lines_removed: lines_removed + 1
remove fp
]
break
]
fp: next fp
]
print [lines_removed "lines removed"]
print [lines_inserted "lines inserted"]
update fp
close fp
]







[REBOL] Removing lines... Re:

2000-04-13 Thread tjohnson

Hi Stefan:
I have attached a file called "remove.r". It has
two functions that were provided to me by other members
of the mailing list. Perhaps there are others that
would find it useful. The first one is the one that I
was looking for. It will replace text between two markers,
so that it has the effect of rewriting a record in a simple
database.
I hope you find this helpful.
Regards
Tim
At 10:55 AM 4/13/00 +0200, you wrote:
Hi list,
I've read a textfile with read/linesis there an easy way to remove a
line from the data?

it goes something like:

data: read/lines %blaah.txt

if find data "plupp" [remove the line] --- of course there oughta be some
easy code there.. ;)

Best Regards
Stefan Falk






[REBOL] [REBOL] [REBOL] Redefining functions with objects Re:(4)

2000-04-12 Thread tjohnson

Hi Ingo: In reply to your statement:
When your 'op was named 'open, did you change the line
fp: open/new/write %objone.txt
to
fp: system/words/open/new/write %objone.txt
-
??

otherwise it has called itself, again and again ...
I didn't - and that's why I got a stack overflow,
because of unending recursion.
Thanks!
I'm glad you caught that!
Tim
At 01:20 PM 4/12/00 +0200, you wrote:
Hi Tim,

I haven't closely looked at your code, but a
short notice on ...

Those were the words of [EMAIL PROTECTED]:
 I have probably answered my own question:
 I'm still a newbie, but am pleased to return
 results -
 ; == consider the following code: the two objects work
 ;  independently. They use the same named methods
 ; op, prn, and close
 ; When I named those methods open, print,and close,
 ;  I got stack overflows, which suggests to me
 ;  that rebol doesn't like me overridding their
 ;  own system functions. 
...
 object-one: make object!
 [
   op: func [] [fp: open/new/write %objone.txt]
   prn: func [value]
 [append fp value]
   cls: func[] [close fp]
 ]

--  _ ._
ingo@)|_ /|  _| _  We ARE all ONE   www._|_o _   _ ._ _  
www./_|_) |o(_|(/_  We ARE all FREE ingo@| |(_|o(_)| (_| 
http://www.2b1.de/Rebol/ ._|  ._|






[REBOL] [REBOL]string to series function Re:(2)

2000-04-11 Thread tjohnson

Sterling showed me how the following code
gives me a block
 parse "one#two%three four" "#%"
== ["one" "two" "three" "four"]

that's great! Now if I write:
my-series: parse "one#two%three four" "#%"
just-one: my-series/1
just-one is returned as "one"

now how do I get "one" into just-one with 1 line
of code instead of two?

thanks again
tim





[REBOL] [REBOL] [REBOL]string to series function Re:(4)

2000-04-11 Thread tjohnson

I can't tell all of you enough how much I appreciate
this mailing list. As a programmer who earns my
living in "C/C++" and doesn't have a RD budget
this is wonderful! 

I'm getting the impression from the various discussions
of this thread, that parse is very powerful function
that needs much investigation. 
From the clarity of Sterling and Elan's messages,

I am hopeful that we will see much revealed in the
Official Guide.

parse is going to be a major tool when/if I implement
rebol professionally. I'm sure that I will have more
questions, and perhaps a tutorial will come of it.

Maybe I'll do it. In six months. Hah!!

Thanks so much
tim

At 11:28 PM 4/10/00 -0700, you wrote:
At 09:55 PM 4/10/00 -0700, you wrote:

Fair enough.
I have little time to give a complete course on parse so I went for
the shortest version.  

Yikes! Of course. I was worried that tim may eventually want to exclude
spaces from his parse rule, and then he'd be frustrated, because he
wouldn't know how to control space parsing. 

(Actually, I'd already written my response, and before I sent it off I
checked my email to avoid duplicate answers, and lo and behold, there was
your message. But I'd chosen a slightly different approach, and I thought
it was still worth mentioning it ...)

So he gets more than he asked for ;-).

I expected to see a few other responses to this 
thread as well and sure enough the old-time REBOL-masters of the
outside world give a more full answer than us insiders have time for.

Time? I have time? ...

Me?


Take it easy guys,
Sterling


You to Sterling.

;- Elan  [: - )]






[REBOL] [REBOL] Redefining functions with objects

2000-04-11 Thread tjohnson

I'm thinking of developing a class.
Let's call it 

tims-object

Suppose I write a function for this
class and I call it 

print 

Will 
tims-object/print 
redefine rebol's own print? 

I don't really want to do this, so
I would welcome comments on this.

thanks
tim






[REBOL] [REBOL] Redefining functions with objects Re:(2)

2000-04-11 Thread tjohnson

Hi Michael -
At 12:42 PM 4/11/00 -0700, you wrote:
I'm currently defining a 'print element of an object as a function. I'm
assuming that the REBOL definition of 'print will be hidden in the
definition of this object (and definitions of functions local to the object)
Actually .
print would write to a port, which could be standard
output OR a physical file. The port would be defined
as a member of the object as well.

let's call this content-object ; will build virtual
; pages OR could be used to build a physical web page
; let me know what you think of the following:
; thanks for your interest :) 
; tim
content-object: make object!
[
  write_to_file: func []
  [
; is this being run from a server?  
either equal? system/options/cgi/server-name none
[return true]
[{else}return false]
  ] 
  init_output: func[fname[string!] /local fpl]
  [
either write_to_file ; no server so open a write port
; to fname 
[
  file_name:  make file! fname
  fp1: open/new/write file_name
]
; yup, we're on the server so keep writing to stdout
[{else} fp: system/ports/output]
return fpl
  ]
  ; what the hay!! We can call this anything, but
  ; print would be great if it didn't screw up implicit
  ; output to stdout for the "original print"
  fp: init_output "hello.htm"
  print: func [fp[port!] value]
[append fp value]
]
; If this process works with out conflict, then I would
;  create a debug object which would write to a file that
;  would be created every time the application runs 
;  and an errorlog object that would be appended every
;  time the application ran, given an error or warning
; condition appeared. Standard parts of the my C/C++/CGI
;  toolkit and expected by sysops that my cgi programs
;  run on. They could all have a print element (method)
;  OR I could call it something else.
- which is ok. Outside of the element 'print, the REBOL definition works
just fine. Following is the relevant piece of my object:

player-def: make object! [
   name: none
   connection: none
   ; METHODS
   ; - - - - - - - - - - - - - - - - - - - - - - 
   print: function [
   "Print a message to this player, with trailing new-line"
   msg [string! block!]
   ][new-msg][
   ; Cleanup the message suitable for telnet display
   new-msg: player-format-print msg
   append new-msg new-line
   append connection new-msg
   ]
   ; - - - - - - - - - - - - - - - - - - - - - - 
   prin: function [
   "Print a message to this player"
   msg [string! block!]
   ][new-msg][
   ; Cleanup the message suitable for telnet display
   new-msg: player-format-print msg
   append connection new-msg
   ]
]

- Michael Jelinek

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 11, 2000 11:32 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] [REBOL] Redefining functions with objects


I'm thinking of developing a class.
Let's call it 

tims-object

Suppose I write a function for this
class and I call it 

print 

Will 
tims-object/print 
redefine rebol's own print? 

I don't really want to do this, so
I would welcome comments on this.

thanks
tim







[REBOL] [REBOL] [REBOL] Redefining functions with objects Re:(2)

2000-04-11 Thread tjohnson

I have probably answered my own question:
I'm still a newbie, but am pleased to return
results -
; == consider the following code: the two objects work
;  independently. They use the same named methods
; op, prn, and close
; When I named those methods open, print,and close,
;  I got stack overflows, which suggests to me
;  that rebol doesn't like me overridding their
;  own system functions. 
;  I'm happy with the result. Less typing eh!
REBOL
 [
Title: "object"
Date:  011-Apr-2000
File:  %object.r
Purpose: {testing rebol objects}
]
;=== make first object
object-one: make object!
[
  op: func [] [fp: open/new/write %objone.txt]
  prn: func [value]
[append fp value]
  cls: func[] [close fp]
]
;=== make first object
object-two: make object!
[
  op: func [] [fp: open/new/write %objtwo.txt]
  prn: func [value]
[append fp value]
  cls: func[] [close fp]
]
;=== test first object
object-one/op
object-one/prn "testing object-one once more"
object-one/cls
;=== test second object
object-two/op
object-two/prn "testing object-two once more"
object-two/cls

At 05:10 PM 4/11/00 -0800, you wrote:
Hi Michael -
At 12:42 PM 4/11/00 -0700, you wrote:
I'm currently defining a 'print element of an object as a function. I'm
assuming that the REBOL definition of 'print will be hidden in the
definition of this object (and definitions of functions local to the
object)
Actually .
print would write to a port, which could be standard
output OR a physical file. The port would be defined
as a member of the object as well.

let's call this content-object ; will build virtual
; pages OR could be used to build a physical web page
; let me know what you think of the following:
; thanks for your interest :) 
; tim
content-object: make object!
[
  write_to_file: func []
  [
; is this being run from a server? 
either equal? system/options/cgi/server-name none
[return true]
[{else}return false]
  ]
  init_output: func[fname[string!] /local fpl]
  [
either write_to_file ; no server so open a write port
; to fname 
[
  file_name:  make file! fname
  fp1: open/new/write file_name
]
; yup, we're on the server so keep writing to stdout
[{else} fp: system/ports/output]
return fpl
  ]
  ; what the hay!! We can call this anything, but
  ; print would be great if it didn't screw up implicit
  ; output to stdout for the "original print"
  fp: init_output "hello.htm"
  print: func [fp[port!] value]
[append fp value]
]
; If this process works with out conflict, then I would
;  create a debug object which would write to a file that
;  would be created every time the application runs 
;  and an errorlog object that would be appended every
;  time the application ran, given an error or warning
; condition appeared. Standard parts of the my C/C++/CGI
;  toolkit and expected by sysops that my cgi programs
;  run on. They could all have a print element (method)
;  OR I could call it something else.
- which is ok. Outside of the element 'print, the REBOL definition works
just fine. Following is the relevant piece of my object:

player-def: make object! [
  name: none
  connection: none
  ; METHODS
  ; - - - - - - - - - - - - - - - - - - - - - - 
  print: function [
  "Print a message to this player, with trailing new-line"
  msg [string! block!]
  ][new-msg][
  ; Cleanup the message suitable for telnet display
  new-msg: player-format-print msg
  append new-msg new-line
  append connection new-msg
  ]
  ; - - - - - - - - - - - - - - - - - - - - - - 
  prin: function [
  "Print a message to this player"
  msg [string! block!]
  ][new-msg][
  ; Cleanup the message suitable for telnet display
  new-msg: player-format-print msg
  append connection new-msg
  ]
]

- Michael Jelinek

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 11, 2000 11:32 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] [REBOL] Redefining functions with objects


I'm thinking of developing a class.
Let's call it 

tims-object

Suppose I write a function for this
class and I call it 

print 

Will 
tims-object/print 
redefine rebol's own print? 

I don't really want to do this, so
I would welcome comments on this.

thanks
tim









[REBOL] System object documentation Re:(2)

2000-04-10 Thread tjohnson

Thanks Allen K.
This is what I need all right!
Tim
At 09:03 AM 4/10/00 +1000, you wrote:
Hi Tim,

Best way to learn what is in the system object, is to use Bo's
browse-system.r script
from Rebol.org archives. http://www.rebol.org/utility/browse-system.r.

Many of the entries in the system can also be accessed through mezzanine
functions.

e.g

 source what-dir
what-dir: func [
"Prints the active directory path"
][system/script/path
]

The note on not using source system is in the FAQ.
http://www.rebol.com/faq.html

From the FAQ
"
Q. I find that when I type SOURCE SYSTEM, SOURCE REBOL, or PRINT SYSTEM, the
computer will lock up. Why?

A.  Viewing the system object should only be done with care. Future
revisions of the system object are going to change, therefore, use the
mezzanine level functions to access system object information when possible.
With that said, here is an example of viewing the system object:
 print mold first system
[self version product words options user script console ports
 network schemes error standard]
 print system/product
Core

WARNING: DO NOT enter 'print mold second system' or 'print mold system'
since this will cause the interpreter to hang.
"

Cheers

Allen K






- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 10, 2000 8:36 AM
Subject: [REBOL] [REBOL] System object documentation



 I can't seem to find documentation on the system
 object. Dictionary says:
 "For advanced discussion on system, see the Users Guide"
 But I find little or nothing on the subject.
 I also note that even Rebol/View locks up (on Windows NT)
 when I attempt
 print mold system or probe system.
 Where can I find complete documentation?
 thanks
 tim









[REBOL] official guide, again Re:(3)

2000-04-10 Thread tjohnson

Unfortunately, vaporware is every where. 
I ordered
a book on Python from Amazon in August, and just got
it. It is worth the wait, however. The authors
indicated both that the publisher tends to jump
the gun, and that they were held up by delays
in Windows 2000. Life is a chain of contingencies!!
tj
At 07:57 AM 4/10/00 +, you wrote:

Is anyone else seeing a close similarity to Micro$oft here?

Paul

From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [REBOL] official guide, again Re:
Date: Sun, 9 Apr 2000 23:05:38 -0700

 Is the book available yet, or not?


No, but soon.

 
 Thanks.
 
 
 

;- Elan  [: - )]


__
Get Your Private, Free Email at http://www.hotmail.com






[REBOL] [REBOL]string to series function

2000-04-10 Thread tjohnson

I would like to have a function to do
the following
1)take two strings as arguments
  a)arg one is source
  b) arg two is delimiters
2)return a series

it would work like this:

my-series: string-to-series "one#two%three four" "#% "
my-series is returned as ["one" "two" "three" "four"]

BTW: I have a c function that does this. With
subsequent function calls, it is about 40 lines of
code. I'm pretty lost when it comes to parse, but
I bet the rebol function would be shorter.
thanks
tim




[REBOL] [REBOL]string to series function Re:(2)

2000-04-10 Thread tjohnson

Sterling:
Wow!! That's just what I wanted. 
tj
At 09:06 PM 4/10/00 -0700, you wrote:

You really ought to just try these things. ;)
You'll be surprised at what you find.

 parse "one#two%three four" "#%"
== ["one" "two" "three" "four"]
 

Sterling

 I would like to have a function to do
 the following
 1)take two strings as arguments
   a)arg one is source
   b) arg two is delimiters
 2)return a series
 
 it would work like this:
 
 my-series: string-to-series "one#two%three four" "#% "
 my-series is returned as ["one" "two" "three" "four"]
 
 BTW: I have a c function that does this. With
 subsequent function calls, it is about 40 lines of
 code. I'm pretty lost when it comes to parse, but
 I bet the rebol function would be shorter.
 thanks
 tim






[REBOL] Reading REBOL header Re:(2)

2000-04-09 Thread tjohnson

Excellent!
thanks :)
tj
At 03:32 PM 4/9/00 +0200, you wrote:


[EMAIL PROTECTED] a écrit :

 According to rebol documentation, the
 rebol header is an object.

  True ! It can be access by the system/script/header not by REBOL
object !!
 You need REBOL for filling values of the object system/script/header
only !
  try this :
 probe system/script/header

 and now try this
probe REBOL  ... to make sleep REBOL/core ;-) !



 If so, how does the rest of the script file
 access the header?

 Given the following code:

 REBOL
 [
 Title: "Scan Web Sites"
 Date:   12-Nov-1997
 Author: ["Ema User" "Wasa Writer"]
 ]


Your example becomes :
header-script: system/script/header
print ["Title : " header-script/Title]
print ["Date : " header-script/Date]
foreach person header-script/Author [ print person ]

 what would be the correct syntax.
 Thanks
 Tim






[REBOL] [REBOL] System object documentation

2000-04-09 Thread tjohnson


I can't seem to find documentation on the system
object. Dictionary says: 
"For advanced discussion on system, see the Users Guide"
But I find little or nothing on the subject. 
I also note that even Rebol/View locks up (on Windows NT)
when I attempt 
print mold system or probe system.
Where can I find complete documentation?
thanks
tim
 




[REBOL] [REBOL] Reading REBOL header

2000-04-08 Thread tjohnson

According to rebol documentation, the 
rebol header is an object.

If so, how does the rest of the script file
access the header?

Given the following code:

REBOL
[
Title: "Scan Web Sites"
Date:   12-Nov-1997
Author: ["Ema User" "Wasa Writer"]
]
print REBOL/Title
; the line above generates the error message:
** Script Error: Invalid path value: Title.
** Where: print REBOL/Title

what would be the correct syntax.
Thanks
Tim




[REBOL] [REBOL]CGI script problems on Linux

2000-04-06 Thread tjohnson

I have written a test cgi script works as
expected on my own machine using Person Web
Server.

It's acting strangely on a linux server using
Apache server.

On PWS, I see for content:
hello world from rebol script
as I would expect

On the Linux Server, the only content I see is:
REBOL 

I am enclosing first the SOURCE of the content
from the Linux server, and then the script itself.
thanks in advance.
tim

Here is the source of the content as posted
when I run it:
; content source below
REBOL options script arguments

All fields are optional. Supported options are:

--cgi (-c)   Check for CGI input
--do exprEvaluate expression
--help (-?)  Display this usage information
--nowindow (-w)  Do not open a window
--quiet (-q) Don't print banners
--script fileExplicitly specify script
--secure level   Set security level:
 (none write read throw quit)
-s   Shortcut: no security
+s   Shortcut: full security
--trace (-t) Enable trace mode

Examples:

REBOL script.r
REBOL script.r 10:30 [EMAIL PROTECTED]
REBOL script.r -do "verbose: true"
REBOL --cgi -s
REBOL --cgi -secure throw --script cgi.r "debug: true"
REBOL --secure none

Content-Type: text/html

HTMLheadtitle hello world /title/head 
h1hello world from rebol script/h1/body/html

;===
;now, hello-world.r script source below
;

#!/usr/bin/rebol -cs
REBOL
 [
Title: "Test Rebol CGI script"
Date:  28-Mar-2000
File:  %hello-world.r
Purpose: {just to see if we can get anything to work}
]
; functions
;
fprint: func [fp1[port!] value]
[ append fp1 value ]
;
write_to_file: func []
[
  either equal? system/options/cgi/server-name none
  [return true]
  [{else}return false]
]
;
init_output: func[fname[string!] /local fpl]
[
  either write_to_file
  [
file_name:  make file! fname
fpl: open/new/write file_name
  ]
  [fpl: system/ports/output]
  return fpl
]
;
text_html_header: func [fp1[port!]]
[either write_to_file [][fprint fp1 "Content-Type: text/html^/^/"]]
;
html_header: func [fp1[port!] title[string!]]
[fprint fp1 reform ["HTMLheadtitle" title "/title/head" newline]]
;
html_footer: func [fp1[port!]] [fprint fp1 "/body/html^/"]
;
fp: init_output "hello.htm"
text_html_header fp
html_header fp "hello world"
;
fprint fp "h1hello world from rebol script/h1"
html_footer fp
either write_to_file [close fp][]






[REBOL] [REBOL]CGI script problems on Linux Re:(2)

2000-04-06 Thread tjohnson

Hi Michael:

that is EXACTLY what the problem was.
I'm up and running. Fortunately I am using
a nifty windooz editor that lets me edit Unix LF
style and still look like it's using CRLF. Notepad
won't do that.

thanks so much!!
tim

At 11:06 PM 4/6/00 +0100, you wrote:
Hi,

I don't know if it's the problem, but as you run the script on PWS it
may have MS-DOS end-of-line characters.

make sure the first line starting with #! does end with LF alone and
not CRLF, because Linux does not like it.

-- 
Michal Kracik






[REBOL] [REBOL]Formatting variables in strings Re:(4)

2000-04-04 Thread tjohnson

I like that too... and perhaps less overhead than
using reform?
tj
At 09:16 AM 4/4/00 -0700, you wrote:
Also

 print ["the numbers are:" test "and" test + 1]
 print ["the numbers are:" test "and" add test 1]

At 11:19 AM 4/3/00 -0800, you wrote:
Thanks:
  That did it!
tj
At 10:12 AM 4/3/00 -0800, you wrote:

print reform ["the numbers are:" test "and" (test + 1)]











[REBOL] [REBOL]Advice in using global values Re:(3)

2000-04-04 Thread tjohnson

Thank you. Very good information and well
explain. My hat's off to you!
Tim
At 03:52 PM 4/4/00 -0700, you wrote:
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 04, 2000 10:05 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] [REBOL]Advice in using global values Re:

 As Rebol reads through a script, when it encounters begin-block symbol (
"[" ) it sets aside a special place (?) for any variables that are
subsequently defined. When Rebol encounters the corresponding end-block
symbol ( "]" ) all the variables in that special place are freed(?). So, to
keep the number of variables low, you want to insure that variables are
defined as late as possible, and freed as early as possible. The way to do
this is to divide your script into blocks ( "func" blocks ), and do not
introduce variables until you reach the block you need them.

It kinda works this way for locally defined words of a function, but not for
blocks in general.

For REBOL it's better though of as: any local definition of a word "masks"
the previous definition. The word isn't really "freed up" when the local
definition falls out of context. The word is still defined in system/words.
The very first time a word is referred to, it is immediately defined in
system/words with a value of unset!. If you assign a value (to a "new" word)
in a global context, this unset! is changed to the value. If you assign a
value (to a "new" word) in a local context - masking the previous value of
unset! - then fall out of that context, the value of the word reverts to
unset!.

If you work long enough in the same REBOL session - not just doing the same
thing over and over - you'll fill up system/words even though most of them
were defined as local variables which are out of context (and/or set to
unset!).

- Michael Jelinek






[REBOL] [REBOL]Formatting variables in strings Re:(2)

2000-04-03 Thread tjohnson

Thanks:
That did it!
tj
At 10:12 AM 4/3/00 -0800, you wrote:

print reform ["the numbers are:" test "and" (test + 1)]







[REBOL] my most frequent complaint Re:(2)

2000-04-03 Thread tjohnson

Thought I would throw a little different take on
this thread:
I'm a modestly accomplished C/C++ programmer. I use
C++ extensions carefully and conservatively. I love
C because of it's great extendability. I've done a lot
of CGI programming in this medium
and will most likely continue with it as my main programming
language for the foreseeable future, especially for
large databases.

I'm using rebol because it is a C program written by  
far better programmers than I am. (Carl S and company).
I know it will be a valuable addition to my tool kit.

And I am also looking at Python. Rebol has got a lot
to learn from Python, but I think they WILL learn
from python and be better than either python or perl.

just my point of view.
tim 
At 01:05 PM 4/3/00 +0100, you wrote:
Re the "ideal scripting language": have you looked at Python?
Rebol is great for internet related scripting, but as a general scripting 
system, Python is about as good as it gets right now (in my humble opinion).

At 09:19 AM 4/3/00 -0700, you wrote:

about scripting languages is that they let you do a whole lot *very*
quickly and then you're stuck.  My current case in point, is this program
I'm writing to sync files from the three different computers I use to a
central location.  (bookmark files, address books, etc.)

All the stuff that I expected to be hard was easy: querying a FTP site,
uploading and downloading files, comparing file dates and times.

The part that I expected to be easy seems impossible: setting the time on a
file in the local file system.  I never once imagined that I wouldn't be
able to do this.

It's incredibly frustrating.  Is there a way to make calls to custom DLL's?

Thanks,

Brad






= Original Message from [EMAIL PROTECTED] at 4/03/00 8:06 am
 Hi
 
 Does anyone know the SERIES package for CommonLisp
 (http://series.sourceforge.net/) and can explain difference and common 
 referring to Rebol ?
 
 Thanks
 
 AR
 
 --
 Sent through GMX FreeMail - http://www.gmx.net








[REBOL] [REBOL]Problem with function argument Re:(2)

2000-04-02 Thread tjohnson

Hi Ladislav:
Thanks, you got it! All I was doing was
using the wrong data type in the function arg.

Obviously, I am not entirely clear about the
distinction between "port" and "file" data types.

Can anyone enlighten me, or point me to the
documentation that will clarify for me?
regards :) 
tim

At 11:13 AM 4/2/00 +0200, you wrote:
Hi,

- Puvodní zpráva -
Od: [EMAIL PROTECTED]
Komu: [EMAIL PROTECTED]
Odesláno: 2. dubna 2000 7:33
Predmet: [REBOL] [REBOL]Problem with function argument


 Hello All:

 I am getting an error message when attempting
 to pass a value as a argument to a user-defined
 function:

 the error message is:
 fprint expected fp argument of type: file.
 ** Where: fprint fp "line one"

 code follows: thanks in advance to all!!
 tim

 ; first the function
 fprint: func [fp[file!] value[string!]]
 [
   either not-equal? fp none
   [
 write/append fp value
 write/append fp newline
   ]
   [ print value ]
 ]
 fp: none
 ; check for server name in cgi environment variables
 either equal? system/options/cgi/server-name  none


; value is empty, presume the script is run from commad line
print "no server name, application run from console"
fp: open/new/write %hello.htm
 ]
 ; script is invoked via server, yes, I know we need
 ;   a content-header string, etc here.


   prin "Server name: "
   print system/options/cgi/server-name
 ]
 ; call function
 fprint fp "line one" ; rebol doesn't like this
 ; if the file has been opened, close it
 if not-equal? fp none [close fp]


The header of your function should probably be as follows:

fprint: func [fp[port! none!] value[string!]]

to allow open ports and none as the valid arguments.

Moreover, the following:

   either not-equal? fp none
   [
 write/append fp value
 write/append fp newline
   ]
   [ print value ]
 ]


will not work for ports. You can change it to:

either fp [
append fp value
append fp newline
] [print value]

Regards,
Ladislav







[REBOL] [REBOL]Problem with function argument Re:(4)

2000-04-02 Thread tjohnson

Thanks Elan:
Your discussion is very helpful. As to your
question:

I haven't been following this thread, so I don't know why you are using
ports. Generally speaking, it is often more convenient to use higher 

As to the above, I want re-usable code that will allow me
to easily write to a file OR  to standard output. My approach
is to set up a value that could point EITHER to a file or
to standard output. 
EX: in C: 
FILE *f;
if(write_to_file)
  f = fopen("test.txt","w")
else
  f = stdout;
fprintf(f,"line one");
That in
part is my choice of using ports. Part of that is circumstance,
as well, perhaps the upper level functions would be better,
given this need. I would welcome your advice.
As well, I come from the c/c++/assembler background,
I try to think in terms of minimizing machine overhead.
I do primarily CGI programming, and like to use
the same code to do either web content or send that 
web content to file. Either for testing purposes or in
case a client wants me to enable him/her to build or update
a page on the machine end.
Keep up the good work Elan, you are always helpful.

tim
At 01:19 PM 4/2/00 -0700, you wrote:
Hi t,

A file! type is a filename with a leading % character. Example: %myfile.r
%/c/mydir/. A file! may be any type of file, including a directory.

A port! datatype is a low-level i/o abstraction that REBOL uses to
serialize different types of i/o channels, such as files (here we are not
talking about the filename, but access to the file's contents), and socket
i/o. 

The access to ports is typically controlled by protocols that define how
information is read and written to a port, and also commonly implement some
convenient navigation functions for the port's datastream, such as first,
next, insert, pick, etc. These functions work in a sensible way on a port!
datatype. They enable you to treat ports as though they were series values
(i.e. blocks, paths, hashes ...) to a degree, hence the term serialize is
used to describe this type of access to i/o channels. 

There are some limitations, since not all ports lend themselves to being
treated as a series effectively with respect to all series! functions.

level
functions when dealing with files, then accessing them as ports. read,
write, read/lines, write/append write/lines, write/append/lines, save,
load, come to mind. All of these functions take a filename (type file!),
and do not require that you manage the file on the port level, for instance
with respect to positioning, etc.


Hope this helps.



;- Elan  [: - )]






[REBOL] [REBOL]Advice in using global values

2000-04-02 Thread tjohnson

How do I make a value global? That is, so that
it can be "seen" by any code in a file, include
user-define functions?

I would also welcome advice as to the pro and cons
of using globals, as well as when best to use
them, and what under what circumstances where such
usage would be a bad idea.

thank in advance.
tim

At 01:19 PM 4/2/00 -0700, you wrote:
Hi t,

A file! type is a filename with a leading % character. Example: %myfile.r
%/c/mydir/. A file! may be any type of file, including a directory.

A port! datatype is a low-level i/o abstraction that REBOL uses to
serialize different types of i/o channels, such as files (here we are not
talking about the filename, but access to the file's contents), and socket
i/o. 

The access to ports is typically controlled by protocols that define how
information is read and written to a port, and also commonly implement some
convenient navigation functions for the port's datastream, such as first,
next, insert, pick, etc. These functions work in a sensible way on a port!
datatype. They enable you to treat ports as though they were series values
(i.e. blocks, paths, hashes ...) to a degree, hence the term serialize is
used to describe this type of access to i/o channels. 

There are some limitations, since not all ports lend themselves to being
treated as a series effectively with respect to all series! functions.

I haven't been following this thread, so I don't know why you are using
ports. Generally speaking, it is often more convenient to use higher level
functions when dealing with files, then accessing them as ports. read,
write, read/lines, write/append write/lines, write/append/lines, save,
load, come to mind. All of these functions take a filename (type file!),
and do not require that you manage the file on the port level, for instance
with respect to positioning, etc.


Hope this helps.



;- Elan  [: - )]






[REBOL] [REBOL]Problem with function argument

2000-04-01 Thread tjohnson

Hello All:

I am getting an error message when attempting
to pass a value as a argument to a user-defined
function:

the error message is:
fprint expected fp argument of type: file.
** Where: fprint fp "line one"

code follows: thanks in advance to all!!
tim

; first the function
fprint: func [fp[file!] value[string!]]
[
  either not-equal? fp none
  [
write/append fp value
write/append fp newline
  ]
  [ print value ]
]
fp: none
; check for server name in cgi environment variables
either equal? system/options/cgi/server-name  none
[ 
   ; value is empty, presume the script is run from commad line
   print "no server name, application run from console"
   fp: open/new/write %hello.htm
]
; script is invoked via server, yes, I know we need
;   a content-header string, etc here.
[ 
  prin "Server name: "
  print system/options/cgi/server-name
]
; call function
fprint fp "line one" ; rebol doesn't like this
; if the file has been opened, close it
if not-equal? fp none [close fp]





[REBOL] [REBOL] stand output handle?

2000-03-31 Thread tjohnson

Does rebol have a standard output handle like c?
Example : In "C" I can write something like this:
//===
FILE* f;
IF write_to_file THEN
  f = fopen("test.htm","w")
ELSE
  f = stdout;
ENDIF
fprintf(f,"This could be written to the console\n"
  "OR to the console OR as web content");
// thanks in advance
Tim
BTW, that's not psuedo-code




[REBOL] [REBOL]CGI Bug in rebol?

2000-03-29 Thread tjohnson

If I follow the link that Jan gave me below,
I see reference in code that Jan has written
to decode-cgi as being redefined because the
original is is buggy in rebol/core 2.2. 

Is this being fixed?
Just what are the symptoms of these bugs?

Thanks
Tim
At 01:50 PM 3/29/00 +0200, you wrote:

 Hi Tim.

If you are playing with CGI and REBOL, 
maybe you can found this stuff interesting:

http://www.rebol.cz/cgi/

Regards,
Jan

--
Jan Strejcek
[EMAIL PROTECTED]






[REBOL] [REBOL]Where's CGI Documentation?

2000-03-28 Thread tjohnson

I am looking at the rebol guide that I recently downloaded.
I see no documentation for CGI scripting.
Example:
OPERATION,EXPRESSIONS,SCRIPTS,SERIES,MATH,FILES
NETWORK,PARSE,VALUES
Under NETWORK I see:
URLs,http,ftp,smtp,pop,dns,daytime,finger,whois,nntp,ports
No mention of cgi.

I must be looking in the wrong place.
Where should I be looking?
Thanks
Tim

 





[REBOL] [REBOL]Where's CGI Documentation? Re:(2)

2000-03-28 Thread tjohnson

Hi Allen:
Thanks... that's good help!
tim
At 09:53 AM 3/29/00 +1000, you wrote:
Hi Tim,

CGI is covered in the how-to

http://www.rebol.com/howto.html#cgi-scripts.html

Example scripts in the library area

http://www.rebol.com/examples.html#cgi 

And some scripts at rebol.org

http://www.rebol.org/cgi/index.html


Cheers

Allen K


- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 29, 2000 8:02 AM
Subject: [REBOL] [REBOL]Where's CGI Documentation?


 I am looking at the rebol guide that I recently downloaded.
 I see no documentation for CGI scripting.
 Example:
 OPERATION,EXPRESSIONS,SCRIPTS,SERIES,MATH,FILES
 NETWORK,PARSE,VALUES
 Under NETWORK I see:
 URLs,http,ftp,smtp,pop,dns,daytime,finger,whois,nntp,ports
 No mention of cgi.
 
 I must be looking in the wrong place.
 Where should I be looking?
 Thanks
 Tim
 
  
 
 
 






[REBOL] [REBOL]Redirecting CGI Content

2000-03-28 Thread tjohnson

Hello All:

As a CGI programmer writing in C++, I use
a CGI Object to test whether or not there is
a server present (the SERVER_NAME environment
variable). If a server name is not present, my
CGI application redirect output (content) to
a text file. This enables me to test the application
from the console. This is often convenient for me.

How may I do this in Rebol?

Consider the following code: How may I test
for a a server, and if not present redirect
that content to a text file?
; code follows:

;If not server_name open port or file, call it hello-world.htm
print "Content-Type: text/html^/"
print "HTMLheadtitleHello world!/title/head"
print "body bgcolor=^"#FF^"h1Hello world!/h1"
print "/body/html^/"
;If port or file opern, close port or file

Thanks in advance!! You guys are always helpful.
Tim




[REBOL] [REBOL] How to write text one line at a time Re:(2)

2000-03-28 Thread tjohnson

Thanks Andrew!

At 05:39 PM 3/29/00 +1200, you wrote:
tim wrote:
 I would like to open a text file.
 like FILE *f = fopen("text.txt","w")
 in C.
 
 Then I would like to write text one string at a time. 
 Then close it.

 f: open/new/write %test.txt
 append f "Hello from Andrew!^/"
 append f "Goodbye!^/"
 close f
 prin read %test.txt
Hello from Andrew!
Goodbye!

 info on how and where to find documentation
 would be appreciated.

From:
netports.html

Andrew Martin
Nothing up my sleeves...
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--





[REBOL] [REBOL] hello-world script Re:(2)

2000-03-27 Thread tjohnson

I haven't tested it yet, Sysop says that rebol
is installed yet, but I must ask a question.
shouldn't there be a 
/body/html
in your code?
At 11:31 PM 3/27/00 +0100, you wrote:
At 12:56 27/03/00 -0900, you wrote:
what would be a basic hello-world cgi script?
would be running on Linux RedHat 6.1 server.

Well, here's a small script I did for testing CGI a while back. Note: the
top line should be the path to where rebol is:



#!/coding/rebol/rebol.exe -cs
REBOL [
Title: "Small Rebol CGI"
Date:  30-October-1999
File:  %hello_world.r
Purpose: {
   The classic "Hello World" example just to see if we can get anything to work
}
]

print "Content-Type: text/html^/"  ;-- Required Page Header

print {
HTMLBODY
H1Hello World.../H1
BRBR
I guess it worked then !
}


There you go :)

Barry Jones
(signature coming up - pages generated via the lovely REBOL)
---
Just launched: HOOKERY COOKERY! Currently contains Easter and 
Welsh recipes. Recently added PANCAKE recipes. Now with search engine.
http://www.therightside.demon.co.uk/cooking/index.htm






[REBOL] [REBOL]How to remove email headers Re:(2)

2000-03-04 Thread tjohnson

Thanks Elan:
Your answers are always well-put and 
well-documented!!
regards
:)
Tim
At 02:30 PM 3/2/00 -0800, you wrote:
Hi tim:

message-with-headers: none
message-without-headers: none

forall inbox [
 message-with-headers: import-email first inbox
 message-without-headers: message-with-headers/content
]

or:

forall inbox [
 message-without-headers: get in import-email first inbox 'content
]


Note that message-without-headers will point at a different message body at
each iteration and will not preserve the last message. If you want to save
the message you will have to insert the messages one by one into a block.

messages: []

forall inbox [
 append messages get in import-email first inbox 'content
]

Also note that when a message is a reply to a previous message, the message
body may quote a message it is responding to and include that previous
message's headers in its own body. In this case you will end up with the
complete body of the message you received, including possibly quoted
headers of previous messages it responds to, provided they are included in
its body.



;- Elan  [: - )]





[REBOL] C++ Value Class Re:

2000-02-16 Thread tjohnson

Hello:
Is that class code still available? I attempted to
download it, but I got a "Not in Service" message.
Tim
At 07:58 PM 1/22/00 -0800, you wrote:
Fellow REBOLers,


I have created a C++ REBOL value class to load and save a small sub-set of
REBOL
formatted values.  In my project I am using it to read and write
configuration
files.  One of these config files is a plug-in database upon which I run
another REBOL script to genterate an HTML listing of the current plug-ins.

The code and associated HTML documentation are in an archive at
http://members.home.com/krobillard/rvalue.tar.gz.  This version is released
under the MIT License (it will also be release under the GPL with my
project).

Here is part of the RValue class declaration:


typedef unsigned long RTuple;
 
 
class RValue
{
public:
 
enum eType
{
kNull,
kBlock,
kDecimal,
kInteger,
kLogic,
kString,
kTuple,
};
 
static RValue* parse( const char* buffer, const char** pos = 0 );
static const char* typeName( RValue::eType );
 
RValue();
RValue( const char* n );
RValue( const char* n, const char* str );
RValue( const char* n, int i );
RValue( const char* n, float d );
RValue( const char* n, RTuple t );
 
~RValue();
 
RValue::eType type() const { return _type; }
 
const char* name() const { return _name; }
void setName( const char* );
 
RValue* find( const char* ) const;
RValue* find( const char*, RValue::eType checkType ) const;
 
void write( FILE*, int nest = -1 ) const;
 
void assign( RValue* );
 
void setDecimal( float );
void setInteger( int );
void setLogic( bool );
void setString( const char* );
void setTuple( RTuple );
void setTuple( RTuple a, RTuple b, RTuple c, RTuple d = 0 );
 
bool isBlock() const { return _type == kBlock; }
bool isDecimal() const { return _type == kDecimal; }
bool isInteger() const { return _type == kInteger; }
bool isLogic() const { return _type == kLogic; }
bool isString() const { return _type == kString; }
bool isTuple() const { return _type == kTuple; }

// These are valid only if type() is appropriate.
 
const char* string() const { return _string; }
 
float decimal() const { return _decimal; }
 
int integer() const { return _integer; }
 
bool logic() const { return _logic; }
 
RTuple tuple() const { return _tuple; }
unsigned char tuple0() const { return _tuple  0xff; }
unsigned char tuple1() const { return (_tuple  8)  0xff; }
unsigned char tuple2() const { return (_tuple  16)  0xff; }
unsigned char tuple3() const { return (_tuple  24)  0xff; }
 
void append( RValue* );
RValue* remove( RValue* );
void clear();
 
class iterator
{
public:
iterator() {}
iterator( RValue* p ) : v(p) {}
iterator( const iterator it ) : v(it.v) {}
RValue* operator*() { return v; }
iterator operator=( const iterator it ) { v = it.v; return *this; }
bool operator==( const iterator it ) { return v == it.v; }
bool operator!=( const iterator it ) { return v != it.v; }
iterator operator++() { v = v-_next; return *this; }
private:
RValue* v;
};
 
iterator begin() const { return _block; }
iterator end() const { return 0; }

private:
// ...more here
};


I hope someone finds this useful.  Still eagerly awaiting Rebol/Command...


Cheers,
-Karl Robillard





[REBOL] [REBOL] Philosophising (Karl's C++ port)

2000-02-16 Thread tjohnson

Hello All:
I have seen references to Karl's C++ port,
is that still available and where can I get 
it?
Thanks
:)
At 02:25 AM 2/15/00 -0800, you wrote:
Hi, pekr!
You wrote:
 Well, first - why me? :-) I am not familiar with low level stuff as
language compilers, etc.

Why not? I wanted to get people's opinion on the end result. :-)

 So now to your vision, Andrew. Can we make it without RT support? Rebol
doesn't offer any plug-in, modules, whatever mechanisms YET. I think we will
have to wait for /Command release to see, what RT thinks about the direction
you suggested. I know interpreted Matlab for e.g. allows generation of C
code too ...

It could be done now with using Karl's C++ port that talks to REBOL.
Unfortunately, I can't untar/unzip his archive. :-(

 IIRC, REBOL/Author was one of planned REBOL products. During 1.x times,
Jrm tried to implement Rebol compiler (or Rebol compatible language?) called
Scherman. Official words of Carl (not related to Scherman) were something
like it would be possible to partially compile some set of expressions, or
something like that. I don't know it is still planned or essential for RT.
Similar discussions were held here already.

I've passed by the Sherman site a while back. It looked liked development
had stopped.

 I feel one and only REBOL.exe and /View, /Draw, and others in the form of
loadable, unloadable modules is essential, as it could prevent us from
dealing with two (or more?) different versions of Core. My friends which are
in web development feel that Apache module has to get database support, or
it will fail. Some of us would like to prevent the code to be seen by
others, from whatever reasons. Runtime Rebol? Embeddable rebol? Script
compilation and obj generation? You and others would like to see C code
generated.

 Where is the answer? What to do first? What to do at all? :-)

 However, I would be really glad, if everyone could express his opinion
without the fear of negative reactions 

Me, too.

As for REBOL and REBOL/View, if they were separate modules, what would they
be good for? It's a rhetorical question. More on Ally list, as it discusses
View more deeply.

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--





[REBOL] Philosophising Re:

2000-02-15 Thread tjohnson

Hello Martin:
I'm a C/C++ programmer just beginning to learn rebol. If you want
a different slant on this, check the mailing list for last week, on 
a letter I sent with "imbedding rebol" in the subject header. If you
want a copy, I will send it. It didn't engender much comment, except
on a mistaken reference that I made in the opening allegory.
I'm using the Boxer 99 editor for rebol (on WinNT). I believe that
there are rebol extensions for emacs (and emacs is now available
for Windooz)
regards
tim
At 12:00 AM 2/15/00 -0800, you wrote:
I'm philosophising about directions REBOL could take. I've been working on a
C based editor/IDE for REBOL (just Ctrl+R, your script is saved and REBOL is
run on the script), and I've also downloaded two varieties of SmallTalk and
had a little play with both.
So what do C and SmallTalk have to do with REBOL? Well, at least one of
the SmallTalks had been self-extended by having (as I understand it) a
SmallTalk to C translator. With this, development for a new interface (for
example, reading, playing and writing midi or other media files) is done in
the SmallTalk environment, then when the code works correctly, C code is
generated and compiler, then included into the SmallTalk 'image'.
With the aid of REBOL/Command (when it comes out), a malleable REBOL
environment with _native_ look and feel (or with a default look and feel),
could be developed. With a simplistic REBOL to C or machine code translator
(one that operates on script that isn't self modifying), a fast, intuitive,
easily enhanced environment could be created. This could lead to, as with
SmallTalk, a environment or even operating system, based entirely on REBOL.

pekr and others, what do you think?

Andrew Martin
REBOLution the OS...
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--





[REBOL] Philosphizing/Imbedding and Extending Rebol Re:

2000-02-15 Thread tjohnson

Hi All:
Am reposting this in reponse to Andrew Marting..
Having said that, look at Python: With Python, you can both
call other programs from the script, AND you can imbed the
script in C/C++ by linking in Python Libraries. 

As a C/C++ programmer, I would guess that there would be some
hurdles to overcome with multiple platforms as targets to implement
system calls in Rebol.

Looking at the reverse: that is imbedding Rebol in C/C++ (I can
only comment on this medium, not other languages).
If the necessary resources were provided, it shouldn't be too
difficult to arrange for a rebol library to be linked into a C
executable. And I don't think then, that it would be too difficult
to make the first step a very simple interface like so:

use_rebol(char* rebol_syntax_string);
//and overloading in C++
use_rebol(char* rebol_syntax_string, char* simple_data_string);
OR use_rebol(int number_of_args,/*variable argument list*/)
// etc
The implementation would be VERY simple, and definitely limited,
but it would be a first step, and wouldn't have to be made obsolete
by later enhancements.

Even at that very simple first step, I could see an easier implementation
of ftp, cgi, and email than the components provided to me by Borland.
(And Borland CGI services are available to the programmer only with a VERY
expensive "interprise" version. 

By overlaying the code with the preprocessor, one could then create any number
of very powerful calls with very brief coding.

As cesar state quite correctly resolving datastructure would be somewhat
more complicated, but doable.

On a related note, I have seen comments about databases: And I do a lot of
CGI database programming. Let me put in a plug here:

I recently purchased the Mix C/Database Library, it is available for differnt
Windows modes, as well as for Linux. And is very complete and powerful.
Now I don't pretend to advise rebol
as to purchasing someone else's work or joint ventures, but if I could find
a way to compile rebol's core with Mix's database libraries, I would be
one VERY happy camper. 

Just a thought.
Thanks for listening
Tim
At 09:22 AM 2/10/00 -0600, you wrote:


[EMAIL PROTECTED] wrote:

 And what do you think about a Rebol extension language tool?


I think Rebol would make a fine extension language.  The major problem all
extension language integrators face is how to glue to language to the
application's core datastructures.  Series are a simple yet obviously
powerful
abstraction;  RT has given us ample examples of how to bridge that
abstraction to
a variety of problem domains with their tight integration of series and
various
network protocols.  I suspect that a thoughtful way to wrap host-app
datastructures up in series would in a natural way lead to very
expressive, very
tight extension code.

$0.02,

jb


 thanks   /cesar





[REBOL] Your invaluable assistance Re:(2)

2000-02-14 Thread tjohnson

Hi Eric:
I will definitely take a look at your script.
To give you an example of the scope of what I do online:
I have one project in "c" that is 19,000 lines of code.
I have another that is about 9,000 plus the Borland
Database Engine (am rewritting THAT project to eliminate
the BDE, am considering a Rebol dbase module as one
alternative, although I have other resources.)
Thanks Eric.
:) tim
At 09:52 AM 2/13/00 +0900, you wrote:

Hi Tim,

I enjoyed reading your description of your personal history and
your project. I don't know very much about web programming, but
I'll help when I can.

You wrote:

P.S. I've got some ideas for a rebol "librarian",
that could fetch reusable subroutines like the one
the Eric wrote, and insert them into a project file.
More about that later.

I'm not sure how necessary a project file is for REBOL programming,
at least at this stage. I never got to the point in C where I needed
a project file, but my understanding is that project files are handy
to speed up the process of compilation (so that you don't have to
recompile files if their code hasn't changed), and to link in compiled
libraries.

I think with REBOL you don't have to do (can't do) anything more
complicated than including files. A lot of us have written utilities
for this. I have one on rebol.org called dore.r that is a big help.
It indexes all the *.r files below the REBOL home directory. Then you
can do my-script.r with just:

   dore my-script; takes a word! argument

and,

   dore/maybe my-script

will do that script only if it hasn't been done. This is the statement
I use as an equivalent to an include statement. Also,

   dore/list my-script

will print out a list of functions and objects defined in that script.
I could send you the latest version if you're interested.

See you,
Eric





[REBOL] [REBOL] Imbedding and Extending Rebol Re:(2)

2000-02-11 Thread tjohnson

I stand corrected re the mac, but that really wasn't the point
of the message my comments were really about the
subject header !
:)Tim
At 02:25 PM 2/10/00 -0500, you wrote:
FWIW, I certainly don't mean to start a thread on this and I may be mistaken
but...I believe that the Mac debuted in 1/84 and the Amiga 1000 appeared
in 1/85.

[EMAIL PROTECTED] wrote:

 Hi All:
 Imitation is the sincerest form of flattery, right? In terms
 of OS interfaces (As I see it, anyway) Macintosh followed Amiga's
 lead (and I think Carl S. was in on that). Windows followed Macintosh,
  and Linux followed Windows.





[REBOL] [REBOL]HELP!! Inserting text problems Re:(2)

2000-02-11 Thread tjohnson

Hi Elan:
Thanks for the advice as always, I think I will
email you a little later about what I'm up to in the 
big picture might interest you.
Let me comment your include code as follows:
I will include entire code and text file at end
of this message.
At 10:48 AM 2/9/00 -0800, you wrote:
Hi Tim,

why don't you simply use save or write? You don't need to open a port (fp),
I want to read/write a file on an ftp site. That's a whole
'nother issue, I seem to have turned up some Rebol bugs in
that area, have been dealing with Holger and Help desk,
but as I test I used the port approach..
just use:

foreach txt insert_txt [
  write/append/lines %some-file.txt txt
]  


and you're done.

insert always inserts at the head of a series, that's why your getting the
stuff in reverse. If for some reason you prefer using a port, then use
insert tail like this:

foreach txt insert_txt [
  insert tail fp txt 
]  
This actually inserts(appends) the text at the END of the file, 
I want to insert it between two markers.
You can also use append instead of "insert tail".

If you want a newline, this works as well:

foreach txt insert_txt [
  insert tail fp txt 
  insert tail fp newline
]  
This generates an error message from rebol:
** Script Error: find expected series argument of type: series
port bitset.
** Where: if find first fp "begin insert here"
or

foreach txt insert_txt [
  insert tail fp join txt [newline]
]  
This inserts three BLANK lines (carriage returns
only at the END of the file. Again, not what I'm
after
remove-text: func [fp1[file!]]  ;[any-type!]] 
[
  insert_txt: ["first new line" "second new line" "third new line"]
  fp: open/lines fp1
  remove_flag: false
  lines-done:  0
  while [ not tail? fp ]
  [
if find first fp "begin insert here"
[
  print "found"
  remove_flag: true
]
either remove_flag
[
  either find first fp "end insert here"
  [
remove_flag: false
print "done"
foreach txt insert_txt
[
  insert tail fp txt
  insert tail fp newline
  ;insert tail fp join txt [newline]
]  
;insert first fp insert_txt
fp: next fp
  ]
  [ {else}
either zero? lines-done
[
  print "setting lines-done"
  lines-done: 1
  fp: next fp
]
[ {else}
  print ["Removing " first fp]
  remove fp
]
  ]
] 
[{else} fp: next fp ]
  ]
  update fp
  close fp
]
remove-text %test.txt
;; input test file is as follows
file begins here
!--begin insert here--
original line one   
original line two   
original line three 
!--end insert here--  
file ends here  
;; The output that I am looking for would be:
file begins here
!--begin insert here--
first new line  
second new line 
third new line 
!--end insert here--  
file ends here  






[REBOL] [REBOL]HELP!! Inserting text problems Re:(2)

2000-02-11 Thread tjohnson

Hi Ladislav:
That did it!!
I hope you don't mind, but later I will send you
a break-down of the entire project. At the
finish it may a good one to post or archive
at rebol site, or you might want to use it.
thanks as always
tim
At 07:40 PM 2/9/00 +0100, you wrote:
Hi, Tim,

I see three issues in your code. The first one:

if you want to insert something you can try:

foreach txt insert_txt [
fp: insert fp txt
]

Ladislav


 I am attempting to insert text into a file:
 I have a series of strings defined thus:
 insert_txt: ["first new line" "second new line" "third new
line"]
 ;; at some point in the file, I attempt to insert
 ;; the strings with the following code:
 foreach txt insert_txt
 [
   ;insert first fp newline
   insert first fp txt
 ]
 with "insert first fp newline" commented out
 the elements are inserted
 in REVERSE order.
 Why is this happening? What am I doing wrong?

 with "insert first fp newline" enabled, nothing
 at all is inserted. Why is this?
 if I use the code: insert first fp "**",
 "**" is inserted.

 I would greatly appreciate anyone's help here!
 Thanks
 Tim









[REBOL] [REBOL] Imbedding and Extending Rebol

2000-02-10 Thread tjohnson

Hi All:
Imitation is the sincerest form of flattery, right? In terms
of OS interfaces (As I see it, anyway) Macintosh followed Amiga's 
lead (and I think Carl S. was in on that). Windows followed Macintosh,
 and Linux followed Windows. 

Having said that, look at Python: With Python, you can both
call other programs from the script, AND you can imbed the
script in C/C++ by linking in Python Libraries. 

As a C/C++ programmer, I would guess that there would be some
hurdles to overcome with multiple platforms as targets to implement
system calls in Rebol.

Looking at the reverse: that is imbedding Rebol in C/C++ (I can
only comment on this medium, not other languages).
If the necessary resources were provided, it shouldn't be too
difficult to arrange for a rebol library to be linked into a C
executable. And I don't think then, that it would be too difficult
to make the first step a very simple interface like so:

use_rebol(char* rebol_syntax_string);
//and overloading in C++
use_rebol(char* rebol_syntax_string, char* simple_data_string);
OR use_rebol(int number_of_args,/*variable argument list*/)
// etc
The implementation would be VERY simple, and definitely limited,
but it would be a first step, and wouldn't have to be made obsolete
by later enhancements.

Even at that very simple first step, I could see an easier implementation
of ftp, cgi, and email than the components provided to me by Borland.
(And Borland CGI services are available to the programmer only with a VERY
expensive "interprise" version. 

By overlaying the code with the preprocessor, one could then create any number
of very powerful calls with very brief coding.

As cesar state quite correctly resolving datastructure would be somewhat
more complicated, but doable.

On a related note, I have seen comments about databases: And I do a lot of
CGI database programming. Let me put in a plug here:

I recently purchased the Mix C/Database Library, it is available for differnt
Windows modes, as well as for Linux. And is very complete and powerful.
Now I don't pretend to advise rebol
as to purchasing someone else's work or joint ventures, but if I could find
a way to compile rebol's core with Mix's database libraries, I would be
one VERY happy camper. 

Just a thought.
Thanks for listening
Tim
At 09:22 AM 2/10/00 -0600, you wrote:


[EMAIL PROTECTED] wrote:

 And what do you think about a Rebol extension language tool?


I think Rebol would make a fine extension language.  The major problem all
extension language integrators face is how to glue to language to the
application's core datastructures.  Series are a simple yet obviously
powerful
abstraction;  RT has given us ample examples of how to bridge that
abstraction to
a variety of problem domains with their tight integration of series and
various
network protocols.  I suspect that a thoughtful way to wrap host-app
datastructures up in series would in a natural way lead to very
expressive, very
tight extension code.

$0.02,

jb


 thanks   /cesar





[REBOL] Why doesn't remove work? Re:(2)

2000-02-09 Thread tjohnson

Hello Eric:
That did it!! Thanks so much. I have to say that
I haven't looked at the list too much, so let me ask
you this:
I've been programming in C/C++ for years, and have
built numerous libraries of reusable code and useful
classes. 
Does rebol have a parallel strategy?
Any suggestions?
Thanks, Eric 
:) Tim
At 11:25 AM 2/9/00 +0900, you wrote:

Hi Tim,

REMOVE removes by default the first element of a series. So when you say

remove first fp

the first element of FP is a string, and REMOVE will remove the first
element of that string. You want to zap the whole string, I take it,
so you should do:

remove fp

Here's a function based on your code to do what you want. I changed
remove-flag to a true/false flag, which is easier to test for. Also,
when you go through a series deleting some items and skipping others,
FORALL doesn't give you enough control. You have to use

while [ not tail? series-value ] [ ... ]

and use either NEXT or REMOVE every time you go through the loop.

remove-text: func [fp [file!]][
fp: open/lines fp
remove-flag: false
lines-done:  0
while [ not tail? fp ] [
if find first fp "begin insert here" [
print "found"
remove-flag: true
]
either remove-flag [
either find first fp "end insert here" [
remove-flag: false
print "done"
fp: next fp
][
either zero? lines-done [
print "setting lines-done"
lines-done: 1
fp: next fp
][
print ["Removing " first fp]
remove fp
]
]
][
fp: next fp
]
]
update fp
close fp
]

See you,
Eric





[REBOL] [REBOL] Why doesn't remove work?

2000-02-08 Thread tjohnson

;; I am attempting replace text in a file between
;; two delimiters. 
;;  The first step is to remove original text:
;; code as follows (the line with code 
remove first fp
;; doesn't do what I would expect it to
;; code follows, after that is text file
fp: open/lines/mode  %test.txt [read write lines]
remove_flag: 0 
lines_done:  0
forall fp
[
  if(find first fp "begin insert here")
  [
print "found"
remove_flag: 1
;insert next fp insert_txt
  ]
  if(find first fp "end insert here")
  [
remove_flag: 0
print "done"
  ]
  if(remove_flag  0)
  [
either lines_done  0
[
  print["Removing " first fp]
  remove first fp  ;; I want this line removed
]
[
  print "setting lines_done"
  lines_done: 1
]
  ]
]
update fp
close fp
;; text file text as follows:
file begins
!--begin insert here--
original line one
original line two
original line three
!--end insert here--
file ends



[REBOL] [REBOL] Rebol/view crashes at FTP read/write

2000-02-07 Thread tjohnson

I am using rebol/view beta;
code is as follows:
;;===
username: "x"
password: "xx"
site: "www.matnet.com/"
ftp_site: join ftp:// [username ":" password "@" site]
file: "test.txt"
dest_file: join ftp_site file
;;===
;fp: open/lines/mode  %test.txt [read write lines] 
; the code at the line above works
fp: open/lines/mode dest_file [read write lines]
forall fp
[
  if(find first fp "three")
  [
print first fp
insert next fp "line four" ; script crashed here
  ]
]
close fp
;;The code above generates a Application Error in 
;;  Windows NT 4.0 Workstation, Service pack 3
;;  Rebol/view is then aborted
;;===
;;  Let me also list what DOES work:
;; appending time/date stamp as thus:
write/append dest_file join "date: " now
;; is successful

;; if fp is pointed to the same file on my hard drive
;;   as thus:
fp: open/lines/mode  %test.txt [read write lines]
;; the text "line four" is successfully inserted

;; It appears to me that the program failure is at the
;;  code :
insert next fp "line four"
;; because if that code is commented out, the script
;;  enables a read at the remote site file.





[REBOL] [REBOL]Illegal PORT Command Re:

2000-02-01 Thread tjohnson

Hello Holger:
Your information seems very helpful: I am
not yet sure what to do with it though:
Here is my program output: (machine name is "bart")

read dns://
== "bart"

read dns://www.bart.com
== 194.158.170.46

read dns://194.158.170.46
== "www.bart.nl"

The last output doesn't appear right, but what should 
I be doing?

I have Windows NT on this machine, the configuration allows
ws_ftp, command-line ftp and many desktop applications that
I have written using Borland/Fastnet work with ftp without
any problems. 

What configuration changes should I make on
my machines?

Where is rebol's documentation on these matters?
Thank you very much ... 
:) Tim
At 03:00 PM 1/31/00 -0800, you wrote:
On Mon, 31 Jan 2000, you wrote:
 The following code;
 read ftp://jazz.trumpet.com.au/
 result in the following error message from rebol:
 connecting to: jazz.trumpet.com.au
 ** User Error: Server error: tcp 500 Illegal PORT Command.
 ** Where: read ftp://jazz.trumpet.com.au/
 ;;NOTE: This site has anonymous ftp access.
 What am I doing wrong here?

The error message means that the ftp server is rejecting the
PORT command from REBOL. The typical reason for this is
that REBOL is sending the wrong IP address for the ftp data
connection, and that is usually caused by an incorrect system
configuration of your machine (at the operating system level,
not in REBOL), most likely a bad DNS setup.

"read dns://" should return the correct fully qualified hostname
(i.e. including domain) of your machine, and
"read dns://host.name.com" (with your hostname) should return
the IP address. "read dns://1.2.3.4" (with your IP address) should
return the hostname again (but that last part is not critical for FTP).

--
Holger Kruse
[EMAIL PROTECTED]





[REBOL] [REBOL]Illegal PORT Command Re:(3)

2000-02-01 Thread tjohnson

Hi Joe:
At 11:31 AM 2/1/00 -0600, you wrote:
You're in the Netherlands?
 Nope, I'm in Alaska

Who's handling your DNS support?  I.e., what IP address do you have
in the DNS section of your TCP/IP control panel, who's running that
box, who told you to put it as your DNS server?
 primary DNS = 205.159.147.2
 secondary DNS = 205.159.147.3
 My provider is www.matnet.com
 I am not only a cgi programmer, but have
   provided tech support for these folks and
   have configured 100's of computer for the
   internet, but perhaps we have gotten used
   to some bad practices.
 If you ping www.matnet.com, you should see
   either the primary or secondary coming back
   at you.
 the dns numbers that you see as output from rebol are
   a fixed or static I.P. address that has been assigned 
   to me. I just called their current tech support
   and asked for that feature to be removed. 
   (Don't need it and didn't ask for it).  

I'm seriously puzzled, too, but it's beginning to sound more and
more like a networking issue, not a REBOL issue.
  I have felt that from the outset, but what blows my
  mind is that ftp works from ws_ftp, the command line
  AND from my own applications, which are written in
  C++, using Borland's package FTP components. 
  
  Whats' more, I have had the same problem on 
  a Win 98 machine, a Win NT machine, AND with
  two different providers. (Same problem with ATT).

REALLY APPRECIATE YOUR HELP: ANY MORE IDEAS???
thanks :) tim

[EMAIL PROTECTED] wrote:
 
 read dns://
 == "bart"
 
 read dns://www.bart.com
 == 194.158.170.46
 
 read dns://194.158.170.46
 == "www.bart.nl"
 


 
 What configuration changes should I make on
 my machines?
 



 Where is rebol's documentation on these matters?


SherlockHolmes: "The plot thickens!"
DaffyDuck: "The plot sickens!"

-jn-





[REBOL] [REBOL]Illegal PORT Command Re:(3)

2000-02-01 Thread tjohnson

Hello Holger:
I appreciate your input, but unfortunately, this
procedure has made things worse. Now, the ONLY thing
that works is email. I can't surf, I can't use ANY
ftp programs (like ws_ftp32).

Any other ideas?
tim

At 09:50 AM 2/1/00 -0800, you wrote:
On Tue, 01 Feb 2000, you wrote:
 Hello Holger:
  Your information seems very helpful: I am
 not yet sure what to do with it though:
 Here is my program output: (machine name is "bart")
 
 read dns://
 == "bart"
 
 read dns://www.bart.com
 == 194.158.170.46
 
 read dns://194.158.170.46
 == "www.bart.nl"

It looks like your correct host name is "www.bart.nl". To configure this
in NT open Control Panel-Network, select the "Protocols" tab, select
"TCP/IP", click on "Properties", and select the "DNS" tab. Then enter
"www" as the host name and "bart.nl" as the domain. Save and reboot :).

--
Holger Kruse
[EMAIL PROTECTED]





[REBOL] [REBOL]Illegal PORT Command Re:(3)

2000-02-01 Thread tjohnson

Hello Holger:
I appreciate your input, but unfortunately, this
procedure has made things worse. NOTHING will work
at all with that setting. I've had to change back.
Any other ideas?
tim
P.S. Read on... I'm CC'ing this to Carl Sassenrath,
as at least one other member of this list has suggested 
that the RT team may have to look at this
==
Carl:
I do a lot of CGI programming and have done so since
the internet starting breaking lose here in Alaska.
I currently use C/C++ and have used and written for
NT platforms.

For the last year, I have been aware of rebol and have
followed your progress with great interest. I have 
identified rebol as the scripting language for the 
internet.

Furthermore, I have identified rebol as the platform
for a test project that will serve several state and
municipal agencies. I agreed to donate my time and
learn rebol to get this project off the ground. I'm
putting my professional self on the line here, and
to a certain extent rebol.

A little bit about Alaska here:

Highest investment per capita in the internet of
any state in the nation.

The third highest investment by state and municipal agencies
of any state in the nation.

There's a high probability that Alaska could become a 
global crossroad in internet and telecommunications
technology - given proximity to asia and the investment
interest here in the state.

This offers a potential market penetration for rebol as
a programming medium for Internet and telecommunications
applications.

I'm a rebol newbie, and I'm no genius, (my knowledge of
TCP/IP and DNS is limited), but with my background
I can give rebol a showcase. AND I just may be able
to save some lives too.

Only, I just can't get rebol to do anything with FTP!

The support of the mailing list has been great, but
this just might be something that a member of the
rebol development team may have to take a look at.

Carl, I hope to hear from you.
regards
Tim Johnson 

At 09:50 AM 2/1/00 -0800, you wrote:
On Tue, 01 Feb 2000, you wrote:
 Hello Holger:
  Your information seems very helpful: I am
 not yet sure what to do with it though:
 Here is my program output: (machine name is "bart")
 
 read dns://
 == "bart"
 
 read dns://www.bart.com
 == 194.158.170.46
 
 read dns://194.158.170.46
 == "www.bart.nl"

It looks like your correct host name is "www.bart.nl". To configure this
in NT open Control Panel-Network, select the "Protocols" tab, select
"TCP/IP", click on "Properties", and select the "DNS" tab. Then enter
"www" as the host name and "bart.nl" as the domain. Save and reboot :).

--
Holger Kruse
[EMAIL PROTECTED]





[REBOL] [REBOL]Illegal PORT Command Re:(5)

2000-02-01 Thread tjohnson

bart is just my machine name, it isn't a registered
domain.
:)
At 10:41 AM 2/1/00 -0800, you wrote:
Hi Tim, Holger, Joel

The mystery grows. From whois I get:

 print read whois:[EMAIL PROTECTED]
connecting to: whois.networksolutions.com
deleted boring legal info---
Registrant:
bART Internet Services Nederland (BART4-DOM)
   Weena 723
   Rotterdam, 3013 AM
   NL

   Domain Name: BART.COM

   Administrative Contact:
  Dijkstra, Jouke  (DJ50-ORG)  [EMAIL PROTECTED]
  010 - 2403970
Fax- 010 - 2403971
   Technical Contact, Zone Contact:
  Vergeer, R.W.  (VRW-ORG)  [EMAIL PROTECTED]
  +31 10 2403970
Fax- +31 10 2403971
   Billing Contact:
  Sjoerd Latenstein  (IB-ORG)  [EMAIL PROTECTED]
  +31 - 10 - 2403970
Fax- +31 - 10 - 2403971

   Record last updated on 22-May-1997.
   Record created on 22-May-1997.
   Database last updated on 31-Jan-2000 14:44:43 EST.

   Domain servers in listed order:

   NS.BART.NL   194.158.160.10
   NS.BART.NET  194.158.191.254

Note that BART.NL is their name-server in the Netherlands.

 print read whois:[EMAIL PROTECTED]
connecting to: whois.networksolutions.com
snip
Registrant:
Matnet, Inc. (MATNET-DOM)
   165 East Parks Highway, STE 104
   Wasilla, AK 99654
   US

   Domain Name: MATNET.COM

   Administrative Contact, Technical Contact, Zone Contact:
  Savoie, Todd  (TS1081)  [EMAIL PROTECTED]
  (907) 762-4313 (FAX) (907) 762-4717
   Billing Contact:
  Scott, Nena  (NS48802)  [EMAIL PROTECTED]
  907-762-4579 (FAX) 907-762-4717

   Record last updated on 24-Dec-1999.
   Record created on 28-Sep-1995.
   Database last updated on 31-Jan-2000 14:44:43 EST.

   Domain servers in listed order:

   NS.MATNET.COM205.159.147.2
   NS.ANCH.NET  12.17.139.30

Hope this helps someone figure out your problem.

Larry

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 01, 2000 10:25 AM
Subject: [REBOL] [REBOL]Illegal PORT Command Re:(3)


 Hi Joe:
 At 11:31 AM 2/1/00 -0600, you wrote:
 You're in the Netherlands?
  Nope, I'm in Alaska
 
 Who's handling your DNS support?  I.e., what IP address do you have
 in the DNS section of your TCP/IP control panel, who's running that
 box, who told you to put it as your DNS server?
  primary DNS = 205.159.147.2
  secondary DNS = 205.159.147.3
  My provider is www.matnet.com
  I am not only a cgi programmer, but have
provided tech support for these folks and
have configured 100's of computer for the
internet, but perhaps we have gotten used
to some bad practices.
  If you ping www.matnet.com, you should see
either the primary or secondary coming back
at you.
  the dns numbers that you see as output from rebol are
a fixed or static I.P. address that has been assigned 
to me. I just called their current tech support
and asked for that feature to be removed. 
(Don't need it and didn't ask for it).  
 
 I'm seriously puzzled, too, but it's beginning to sound more and
 more like a networking issue, not a REBOL issue.
   I have felt that from the outset, but what blows my
   mind is that ftp works from ws_ftp, the command line
   AND from my own applications, which are written in
   C++, using Borland's package FTP components. 
   
   Whats' more, I have had the same problem on 
   a Win 98 machine, a Win NT machine, AND with
   two different providers. (Same problem with ATT).
 
 REALLY APPRECIATE YOUR HELP: ANY MORE IDEAS???
 thanks :) tim
 
 [EMAIL PROTECTED] wrote:
  
  read dns://
  == "bart"
  
  read dns://www.bart.com
  == 194.158.170.46
  
  read dns://194.158.170.46
  == "www.bart.nl"
  
 
 
  
  What configuration changes should I make on
  my machines?
  
 
 
 
  Where is rebol's documentation on these matters?
 
 
 SherlockHolmes: "The plot thickens!"
 DaffyDuck: "The plot sickens!"
 
 -jn-
 
 
 





[REBOL] [REBOL] HELP! FTP Access problems

2000-01-31 Thread tjohnson

I can't do an append to a text file on ftp site:
following the first line of asterisks is rebol
output. Following the second line is script.
In the rebol output I have inserted a comment
begining with NOTE:
*
 do %test.r
Script: "Test FTP Access now" (28-Jan-2000)
ftp://usr:[EMAIL PROTECTED]/autoexec.bat
URL Parse: usr pass w3.interfacefire.com none none autoexec.bat
Net-log: ["Opening tcp for" FTP]
connecting to: w3.interfacefire.com
Net-log: [
none ["220" "230"]]
Net-log: "220-Serv-U FTP-Server v2.2  for WinSock ready..."
Net-log: "220 W3.Neptune.Com"
Net-log: [["USER" port/user] "331"]
Net-log: "331 User name OK, send password"
Net-log: [["PASS" port/pass] "230"]
Net-log: "230 User usr logged in";NOTE: my username is lower case, here
it 
;printed out as upper case
Net-log: [
"TYPE I" "200"]
Net-log: "200 TYPE set to IMAGE (binary)"
Net-log: [["PORT" port/locals/active-check] "200"]
Net-log: "200 PORT Command OK"
Net-log: [["CWD ~"] "250"]
Net-log: "250 Directory changed to /c:/netscape/suitespot"
Net-log: [["CWD" either empty? port/path ["./"] [join "./" port/path]] "250"]
Net-log: "250 Directory changed to /c:/netscape/suitespot"
Net-log: [[join "LIST " port/target] ["150" "125"]]
Net-log: "150 Opening data connection"
Net-log: [
    none "226"]
** Access Error: Network timeout.
** Where: read site
*
REBOL
[
  Title:  "Test FTP Access now"
  Date:   28-Jan-2000
  Author: "Tim Johnson"
  Email:  [EMAIL PROTECTED]
  File:   %Test.r
  Purpose:{To test FTP Access}
]
site: ftp://tjohnson:[EMAIL PROTECTED]/autoexec.bat
print site
trace/net on
read site
*
At 12:34 PM 1/29/00 -0800, you wrote:
Try doing a "trace/net on" and try it again. That will provide more useful 
information. If you post it, look for and edit out your user and password 
information. Hope this helps.

  - jim

At 11:19 AM 1/29/00 -0900, you wrote:
The following code:
;;==
site: ftp://usr:[EMAIL PROTECTED]/
read site
;;==
generates the folowing error message from Rebol:
** Access Error: Network timeout.
** Where: read site
Of course, in my code, I have my correct login
in place of "usr" and my correct password in place
of "pass".

In fact, if I substitute an incorrect login or
password, I do get a response from Rebol to that
effect.

;;=
Since this is a site that I routinely FTP to,
then I presume that I need to do something with
my Rebol network configuration, but I can't find
from the documentation where that information is.

Can anyone help with this?

Thanks
Tim






[REBOL] user guide/dictio in pdf Re:

2000-01-31 Thread tjohnson

Sorry, but I'm getting a Not Found from that link.
At 09:24 AM 1/31/00 +, you wrote:
I have posted a copy of the latest user's guide and dictionary in .pdf 
format in a .zip file at

http://www.fargonews.com/rebol/rebolpdf.zip

Even zipped up, it is a rather large file (1.2 MB.)

-Ryan





[REBOL] [REBOL]Illegal PORT Command

2000-01-31 Thread tjohnson

The following code;
read ftp://jazz.trumpet.com.au/
result in the following error message from rebol:
connecting to: jazz.trumpet.com.au
** User Error: Server error: tcp 500 Illegal PORT Command.
** Where: read ftp://jazz.trumpet.com.au/
;;NOTE: This site has anonymous ftp access.
What am I doing wrong here?
Tim



[REBOL] [REBOL]HELP! FTP Access problems

2000-01-31 Thread tjohnson

This is turning into a nightmare: I've banked on
rebol (and advertised it) as a medium for a project
for fire safety here in the State Of Alaska. I've
run into a dead-end, and despites some helpful
hints from the mailing list, I'm dead in the water.

Here's where I am at right now: I've gone from attempting
to append to a text file in a site where I've got 
privileges to testing a site with anonymous access.
code:

;;;
REBOL
[
  Title:  "Test FTP Access now"
  Date:   28-Jan-2000
  Author: "Tim Johnson"
  Email:  [EMAIL PROTECTED]
  File:   %Test.r
  Purpose:{To test FTP Access, for fire saftety site project}
]
site: ftp://jazz.trumpet.com.au/
print site
read site

rebol returns:
 do %test.r
Script: "Test FTP Access now" (28-Jan-2000)
ftp://jazz.trumpet.com.au/
connecting to: jazz.trumpet.com.au
** User Error: Server error: tcp 500 Illegal PORT Command.
** Where: read site

I'm just flabbergasted here. If one refers to users\NETFTP.HTML
and goes to the documentation: the following text is read
by me

Authentication 
Networking must be configured to connect to remote sites. If the remote
site accepts anonymous login and the FROM email address has been
configured, simply executing the expression 

read ftp://host.com/

;using:
dir-list: load site
;returns 
** User Error: Server error: tcp 500 Illegal PORT Command.
** Where: dir-list: load site
;;looking at the documentation again I see the following:
Reading, Traversing And Creating Directories 
Both read and load can be used to retrieve a directory listing: 

dir-list: load ftp://host.com/

;; yet in both cases I get error messages





[REBOL] [REBOL]Illegal PORT Command The myster deepens

2000-01-31 Thread tjohnson

Thanks for all the quick responses!!
This problem persists on both windows 98 and Windows NT machines.
I have used two different internet service providers.
I have tested several sites that I can access via WS_ft32.
I am a full-time programmer, and I write both CGI programs
and desktop applications that have FTP services.
Those application are accessing and writing to, and listing
those sites.
;; what follows the asterisks is a full list with trace on
;; I'm guessing that something is amiss with my network configuration
;; Perhaps someone who is more familiar with TCP/IP can glean
;; something from the trace dump, or suggest what I have
;; probably neglect in my own setup
;; thanks in advance. In the meantime, I will recheck your
;; documentation on networks
***
 do %test.r
Script: "Test FTP Access now" (28-Jan-2000)
URL Parse: none none jazz.trumpet.com.au none none none
Net-log: ["Opening tcp for" FTP]
connecting to: jazz.trumpet.com.au
Net-log: [
none ["220" "230"]]
Net-log: {220 jazz-1.trumpet.com.au FTP server (Version wu-2.4.2-academ[
BETA-15](1) Fri Oct 17 17:07:33 PDT 1997) ready.}
Net-log: [["USER" port/user] "331"]
Net-log: {331 Guest login ok, send your complete e-mail address as passw
ord.}
Net-log: [["PASS" port/pass] "230"]
Net-log: "230-"
Net-log: {230-Welcome to the Trumpet Software International ftp site.}
Net-log: "230-"
Net-log: {230-This server is located in Hobart, Tasmania, Australia.}
Net-log: "230-The local time is Tue Feb  1 10:18:08 2000."
Net-log: "230-"
Net-log: {230-We now have an alternative FTP site "ftp.trumpet.com" loca
ted in }
Net-log: {230-Los Angeles which will be more accessible to US and Europe
an customers.}
Net-log: "230-"
Net-log: {230-You are user number 1 out of a maximum of 100 in your acce
ss category.}
Net-log: "230-"
Net-log: {230-Please note that ALL transfers are logged - Disconnect now
 if you do not}
Net-log: "230-like this policy!"
Net-log: "230-"
Net-log: {230-Please report any problems with this archive to www-admin@
trumpet.com.au.}
Net-log: "230-"
Net-log: "230 Guest login ok, access restrictions apply."
Net-log: [
"TYPE I" "200"]
Net-log: "200 Type set to I."
Net-log: [["PORT" port/locals/active-check] "200"]
Net-log: [
"PASV" "227"]
Net-log: "227 Entering Passive Mode (203,5,119,51,14,153)"
Net-log: [["CWD ~"] "250"]
Net-log: [["CWD /"] "250"]
Net-log: "250 CWD command successful."
Net-log: [["CWD" either empty? port/path ["./"] [join "./" port/path]] "
250"]
Net-log: "250 CWD command successful."
Net-log: [["LIST" "."] ["150" "125"]]
Net-log: {150 Opening BINARY mode data connection for /bin/ls.}
Net-log: [
none "226"]
Net-log: "226 Transfer complete."
** User Error: Server error: tcp 500 Illegal PORT Command.
** Where: read ftp://jazz.trumpet.com.au/
At 01:22 PM 1/31/00 -0800, you wrote:
Hi Tim

The code you posted works for me:

 print read ftp://jazz.trumpet.com.au/
beta/ bin/ dostrump/ etc/ fanfare/ firesock/ ipv6/ irc/ lwp-vers/
mailreader/ pr
iv/ private/ scripts/ slipper/ tcp-abi/ tmp/ winirc/ winsock/ wintrump/

There may be a problem with your network setup or it may just be one of
those occasional Internet glitches.

Larry


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 31, 2000 1:03 PM
Subject: [REBOL] [REBOL]Illegal PORT Command


 The following code;
 read ftp://jazz.trumpet.com.au/
 result in the following error message from rebol:
 connecting to: jazz.trumpet.com.au
 ** User Error: Server error: tcp 500 Illegal PORT Command.
 ** Where: read ftp://jazz.trumpet.com.au/
 ;;NOTE: This site has anonymous ftp access.
 What am I doing wrong here?
 Tim





[REBOL] [REBOL]FTP Read/Write problems Continue

2000-01-29 Thread tjohnson

Hello Andrew:
Your advice below was followed:
Rebol continues to hang: This is an FTP site
that I use very regularly.
Do you have any other ideas? I'm stumped!!
Thanks 
Tim
Wouldn't it be easier to read %test.txt, make the changes locally, then
write %test.txt? Something like:

Site: ftp://.
File: read/lines site
print File
forall File [
; blah blah blah...
]
write/lines Site File

That way you can more easily see what's going on.


At 02:26 AM 1/29/00 -0800, you wrote:
Tim wrote:
 I have also written my own script, which goes as follows:
 ;;===
 site: ftp://usr:[EMAIL PROTECTED]/webs/interfacefire/temps/test.txt
 print read site
 fp: open/lines/mode site [read write lines]
   forall fp
   [
 if(find first fp "three")
 [
   print first fp
   insert next fp "line four"
 ]
   ]
 close fp

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--






[REBOL] [REBOL]Controlling security from script Re:(2)

2000-01-28 Thread tjohnson

Thanks Tim and Ted:
I currently program in C++ on NT and am familiar with the
procedure outlined. I don appreciate the tips however. 
This procedure will be good enough for testing on my desktop
pc until I get my feet a little wetter with rebol.

Maybe I jumped the gun before testing FTP and CGI features,
but this is what I eventually want to be able to do:
1)Automatically (without user input) update a file via 
ftp. From my PC at home. Haven't done this before, I think
rebol is the media for this.
2)Read/write files on web server via CGI. I do this all 
the time using executables compiled in C, but I think that 
rebol may be a better media in may cases.

At 04:43 AM 1/28/00 -0500, you wrote:
 This is dangerous if you're running scripts that other people gave
you.

Good point. One idea would be to use a different extension for "safe
scripts", like .RS

One extension is as good as another to REBOL.

-Ted.

*** REPLY SEPARATOR  ***

On 1/28/2000 at 1:14 AM [EMAIL PROTECTED] wrote:

Hi. There is a way to turn off security every
time you run a .r script. If you don't know about
win95 and how to assosciate a file extension with
an exe program then double click on .r and it will
ask you what program to use to open it.
Choose rebol.exe and write -s after it before you choose
ok. If you want I can email you screen pictures of what
to write and where. -- If rebol.exe is already assosciated
with .r scripts then in "exploer", go to 'options' and then
'file types'. Find your .r extention and then choose 'edit'
THEN choose 'edit' again in the 'next' window. THEN all
yo have to do is write -s after rebol.exe . Now every time
you run a script, security will automatically be turned off
without asking you permission first. THis is dangerous if
you're running scripts that other people gave you.

..timmy [EMAIL PROTECTED]








[REBOL] [REBOL] Update file as port/Security Re:Shells

2000-01-28 Thread tjohnson

Hi Elan:
I wanted a quick and dirty way to bypass
the security check for testing purposes. I had
thought of the Windooz shortcut and will use it,
probably with a extension like .rsecure, .rs or
whatever (suggested by other list members).
I currently work in Windooz, but am migrating
to Linux. You serendipitously brought up something
else:
I recently downloaded CygWin (Gnu C/C++ Windooz port).
It comes with a bash shell adapted to microsoft. I think
I will try running rebol from it. I'll let you know what
happens.
Regards
Tim
Hi Tim,

it would help if you mentioned what system you are running on.

you wrote:
;If I run rebol from the command line as thus: 
; rebol -s FileIO.r to disable the security check
; is disabled

; I would like to be able to disable the security check from
; the code itself:
; After review example files, it appears that the following as
;  the first line should do it:
#!rebol -s


REBOL does not interpret this line. It is a shell command and will be
interpreted by bash or whatever shell you are using.. It will work if the
the file is set executable (under Linux or some other Unix system) and you
start the script up under the shell:

./some-script.r

provided that REBOL is accessable from your current directory. 

It will not work, if you expect REBOL to interpret that:

rebol some-script.r

If you're using MS Windows it won't work, since MS Windows off the shelf
does not have a shell that supports the bang notation for scripts, as Unix
does. Here you will have to 

- set the REBOL file properties command line to rebol.exe -s

or 

- if you registered REBOL script files in the Windows registry to launch
REBOL.exe when they are double-clicked, you will need to include -s in the
command line of the windows registry tool, where you do the file
assoications.

you wrote:
  Actually, what I was really wanting to do
is disable the security check from the code itself.
I am reposting and rewording, so that others in the
list may review. Don't work too hard!! 
:)

I thought you meant to do it programmatically, i.e. so that REBOL
interprets your request and does it.

In that case 

help secure

would help you with that. IMHO it's the only way to disable security check
programmatically. 

Since a rogue script running on your Web site cgi may want to reduce
security settings for itself, if you reduce security level programmatically
you have to ok the change. 

For instance, going from tight security to
secure allow

will request permission once, while it remains in secure allow mode, it
will not reuqest permission if you set secure allow again later. 

If you go from secure allow for instance to secure throw, now permission is
required, since you are raising security level. Going back to secure allow
will again require your explicit permission.

That's the only way there is to
disable the security check from the code itself.

as far as I know. 

Hope this helps,



;- Elan  [: - )]





[REBOL] [REBOL]FTP Read/Write problems

2000-01-28 Thread tjohnson

Hello:
I am attempting to read and write test files 
via ftp.
I began by copying ftpappend.r from the examples site.
The code was modified as follows:
;;===
REBOL
[
  Title: "Append to a Text File"
  File:  %ftpappend.r
  Date:  26-May-1999
  Purpose: {Append to a text file using FTP.}
]
write/append
ftp://usr:[EMAIL PROTECTED]/webs/interfacefire/temps/log.txt join
"date: " now
;;===
;I believe that I can verify that I am contacting that site, because
; if I put in an invalid password or an nonexistant file name, I
; get an error message.
; Given that password and filename is correct: 
;  Rebol hangs; i.e the "progress prompt" 
;   |\- etc just keeps spinning and I have to abort the script

I have also written my own script, which goes as follows:
;;===
site: ftp://usr:[EMAIL PROTECTED]/webs/interfacefire/temps/test.txt
print read site
fp: open/lines/mode site [read write lines]
  forall fp
  [
if(find first fp "three")
[
  print first fp
  insert next fp "line four"
]
  ]
close fp
;;===
;;Same results as in ftpappend.r rebol hangs, no error
;;  messages, I have to abort the script
As always, I really appreciate the input, hope I can
be of some help some day.
regards
Tim



[REBOL] [REBOL]Update file as port/Security

2000-01-27 Thread tjohnson

Hi Elan:
Thanks as allways for your help. I note that I'm not
the only C/C++ programmer dealing with paradigm shifts.
Now I can insert a line... great! Next step is to disable
the Rebol-Security Check prompt. I note that it can be accomplished
by Rebol start-up. 
;==
1)How may I do that from the code itself?
2)How may I control other options from the code?
3)Where is that info contained in the Rebol system? (the
  more I can help myself, the less I have to "bug" you)
Note the following code that I have written:
;==
fp: open/allow/mode  %test.txt [read write] [lines]
  forall fp
  [
if(find first fp "three")
[
  print first fp
  insert next fp "line four"
]
  ]
update fp
close fp
;== 
Hi Tim,

1. Your code causes an error, before it completes executing:
 fp: open/lines/write %test.txt
   forall fp
** Script Error: forall expected body argument of type: block.
** Where: forall fp


2. help open states that:
 help open
Opens a new port connection.
Arguments:
spec --  (file url port object block)
Refinements:
/write -- Write only.  Disables read operations.

The /write refinement disables read operations!


Solution:

Use the /mode refinement with a block [lines read write] like this:

 print read %test.txt
line one
line two
line three
line five

 fp: open/mode %test.txt [lines read write]

forall fp [ 
  if found? find first fp "three" [ 
insert next fp "line four" 
  ] 
]
== false
 update fp
 close fp
 print read %test.txt
line one
line two
line three
line four
line five



;- Elan  [: - )]





[REBOL] [REBOL] Updating a file as a port

2000-01-26 Thread tjohnson

Hello All:
test file is test.txt
contents are:
line one 
line two
line three
line five

;The following code seeks to identify the third line and
;inset a line after it:
fp: open/lines/write %test.txt
  forall fp
  [
if(find first fp "three") ; identify third line
[
  print first fp  ; tell user it's been found
  insert fp "line four"   ; insert?
]
  ]
update fp ; "post"
close fp
;;Two questions:
;; 1)the inserted line ist not being inserted. Why and How?
;; 2)What code can I insert so that rebol will not prompt
;;   for permission.

Thanks
Tim



[REBOL] [REBOL] Reading text a line at a time

2000-01-20 Thread tjohnson

I would like to read a text file a line at
a time. What's more, I would like to read each
line into a variable.
After looking at the draft manual and reading 
fillines.html, I attempted the following code:
;;
file: open/read %test.txt
foreach line file [print line]
;like to replace the above line of code
;with one that reads into a variable
;perhaps for parsing or modification
;and then prints it
close text
;;
{The second line of code generates an error message}

I'd like to make a comment here:
I learned C starting about 9 years ago, with
my main reference called (if I remember correctly),
"The C Users Bible". It had a very special rule.
EVERY EXAMPLE WAS FULLY EXECUTABLE!! Nothing taken
out of context.

I believe if Rebol makes this a goal, for a manual,
you can kick some Perl butt out there in Cyber Land. 
These first tiny steps for any newbie are as important 
as showing off the power of Rebol. 

Now you have it in writing: If I can help to this end,
just ask.
Thanks
Tim



[REBOL] How do I simulate CGI? Re:(2)

2000-01-20 Thread tjohnson

Thanks!! It worked.
Tim
At 02:47 PM 1/19/00 -0800, you wrote:
  
;;;query-string is redefined to simulate input from a form
query-string: "name=tim[EMAIL PROTECTED]phone=9005551212"   
cgi: make object! decode-cgi system/options/cgi/query-string

cgi: make object! decode-cgi query-string

will work in your example, as will

system/options/cgi/query-string:
"name=tim[EMAIL PROTECTED]phone=9005551212"   
cgi: make object! decode-cgi system/options/cgi/query-string


Explanation:

You are creating a global word query-string here =
query-string: "name=tim[EMAIL PROTECTED]phone=9005551212"   

however you are passing decode-cgi a different query-string word embedded
in an object here:
cgi: make object! decode-cgi system/options/cgi/query-string

this .../cgi/query-string is a different query-string from your query-string.

This has to do with contexts. The object cgi, in the path system/options
has its own context and system/options/cgi/query-string is limited to the
cgi object's context (unless its context is extended by referencing it from
outside the cgi object. Don't worry about that just now.) When you create
query-string as a glocal word - which is what happens by default when you
do what you did - it does not affect the query-string in the context of cgi
object.

use probe system/options/cgi

to see the contents of the cgi object.

use =
system/options/cgi/query-string:
"name=tim[EMAIL PROTECTED]phone=9005551212"   

to more realistically simulate the situation you will encounter when you
run the script as a cgi script.

Hope this helps

;- Elan  [: - )]





[REBOL] [REBOL] How do I simulate CGI? Re:

2000-01-20 Thread tjohnson

Hi Elan:
Thanks for that tip. Actually, I use a 
multi-stage process (I've been using compiled
apps with C/C++);
1)First write and debug in a console mode, redirecting
  html stdout to a test file.
2)Then run with web browser against Microsoft
Personal Web Server.
3)Then port to server. 
In many cases, Rebol will be more suitable, and
I know that my approaches to the development
cycle may have to change.

My next step, I suppose, will be to configure
Microsoft Personal Web Server to work
with Rebol. Any tips or comments?
Regards
Tim

At 02:48 PM 1/19/00 -0800, you wrote:
At 12:28 PM 1/19/00 -0900, you wrote:
I am a CGI programmer new to Rebol.

In previous work, I have begun a project
by simulating the CGI environment on my
desktop and redirecting output from stdout 
to a file.

I have installed Apache on my MS Windows desktop machine and run a Web
browser against it to simulate cgi.

;- Elan  [: - )]





[REBOL] Openletter to Rebol HQ. Re:(8)

2000-01-20 Thread tjohnson

I'm new to Rebol, and have been only slightly
informed of this thread. In matters of both
Open-source and ODBC, there are both advantages
and disadvantages. 

I would like to offer a slight different
train of thought:

Why not consider offering object modules (not
source) that could be optionally compiled
into the rebol interpreter, depending on
the user's needs?

As a C/C++ programmer, who does a lot
of Database/CGI work, I've been under-impressed
by the different external DB resources out there.

I'm just in the process of implementing the
Mix Database Toolchest. ISAM/BTree library
written in C. Maybe the Rebol folks and the
Mix folks coul talk? Could be a marriage made
in heaven!
Just a thought.
tim
At 09:56 AM 1/20/00 -0600, you wrote:
[EMAIL PROTECTED] wrote:
 
 Whether the beta ships this week or next week, let us not lose from
 sight, what it is that we are talking about. We are not talking
 about extending REBOL with a GUI interface!
 
 We are talking about adding REBOL to GUI applications. GUI
 applications become programmable in REBOL! This is GUI applications
 with Internet processing programmable in REBOL! This is Internet
 applications with GUIs programmable in REBOL! Big difference!
 
 ...
 
 There are millions and millions of people out there, who are
 comfortable with a mouse and who expect that they can start up an
 application and make choices from menus in order to accomplish
 their tasks. These people will be able to use our scripts.
 This is important!
 

It's really too bad that experienced users like Elan have become
so jaded that they can't get excited about the future of REBOL...

;-}

Seriously, I think Elan's right on target about the importance of
GUI capabilities to the great masses.  Those of us that are happy
with a text-based interaction (or who write server scripts, etc.)
are definitely in the minority.  As long as we are writing code
just for ourselves to use, or to be hidden in a server somewhere,
text mode is fine.  However, if I want to write scripts for non-
technical human users, I want the tools to make it easy for them
to appreciate the beauty of my work! ;-)

I think there's a significant market for REBOL code which will
only open up when T. C. Mits can drive it with pretty pictures.

-jn-

P.S.:  The prospect of early availability of REBOL/View only
increases my desire for comprehensive docs.  Please, please,
please, please





[REBOL] How do I simulate CGI?

2000-01-19 Thread tjohnson

I am a CGI programmer new to Rebol.

In previous work, I have begun a project
by simulating the CGI environment on my
desktop and redirecting output from stdout 
to a file.

How may I create a test query string to run
directly from my desktop?

The attempt that I made was to copy cgiform.r
and modify it as below: Rebol returns 
** Script Error: decode-cgi expected args argument of type: any-string.
** Where: cgi: make object! decode-cgi system/options/cgi/query-string
;
print "Content-Type: text/html^/"  ;-- Required Page Header
  
;;;query-string is redefined to simulate input from a form
query-string: "name=tim[EMAIL PROTECTED]phone=9005551212"   
cgi: make object! decode-cgi system/options/cgi/query-string

print   
[   
htmlbodyh2*"CGI Results:"/h2
"Name:"  B cgi/name /BP   
"Email:" B cgi/email /BP  
"Phone:" B cgi/phone /BP  
/bodyhtml   
]