[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]string to series function Re:(3)

2000-04-11 Thread icimjs

Hi tim,

just-one: pick parse/all "one#two%three four" "#% " 1

or

just-one: first parse/all "one#two%three four" "#% " 


or, if want to continue collecting the complete block in my-series:

just-one: pick my-series: parse/all "one#two%three four" "#% " 1

and 
just-one: first my-series: parse/all "one#two%three four" "#% "

Note that pick is safer, it will return none if parse returns none or if
parse returns an empty block, whereas first will fail with an error
exception in both cases.



At 09:07 PM 4/10/00 -0800, you wrote:
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





;- Elan  [: - )]




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

2000-04-11 Thread icimjs

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] first second third ... last

2000-04-11 Thread Al . Bri

Elan wrote (in another thread):
 Note that pick is safer, it will return none if parse returns none or if
parse returns an empty block, whereas first will fail with an error
exception in both cases.

'second, 'third and so on do the same as well as 'last. I'm of the opinion
that these functions should return 'none instead. So instead of:

 first []
** Script Error: Out of range or past end.
** Where: first []

they should return:

 first []
== none

YMMV.

Andrew Martin
"Move along now, nothing to see here."
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--




[REBOL] network setting

2000-04-11 Thread FSubr

hello,
i have problem with network setting. I set up proxy host name, port number
and type
and it did not work. Please tell me what is the problem. 

error message:

 read http://www.rebol.com
connecting to: www.rebol.com
** Access Error: Port none not open.
** Where: read http://www.rebol.com

thanks for reply

Filip Subr




[REBOL] network setting Re:(2)

2000-04-11 Thread FSubr

 [EMAIL PROTECTED] wrote:

 hello,
 i have problem with network setting. I set up proxy host name, port number
 and type
 and it did not work. Please tell me what is the problem.

 error message:

  read http://www.rebol.com
 connecting to: www.rebol.com
 ** Access Error: Port none not open.
 ** Where: read http://www.rebol.com


Send in your settings, please (just change name and password if used :-).
Well, you can probably use browser behind the firewall, so send us your
browser proxy setting too ...

-pekr-


 thanks for reply

 Filip Subr

here is my %user.r

REBOL [
Title: "User Preferences"
Date:  11-Apr-2000/11:52:14+2:00
]

set-net [ [EMAIL PROTECTED] oskar.ssw.cz none socks.ssw.cz 1080 socks ]

my browser is IE5 
proxy server addres: 
socks: socks.ssw.cz port: 1080



Filip

 




[REBOL] network setting Re:(3)

2000-04-11 Thread Petr . Krenzelok



[EMAIL PROTECTED] wrote:

  [EMAIL PROTECTED] wrote:

  hello,
  i have problem with network setting. I set up proxy host name, port number
  and type
  and it did not work. Please tell me what is the problem.
 
  error message:
 
   read http://www.rebol.com
  connecting to: www.rebol.com
  ** Access Error: Port none not open.
  ** Where: read http://www.rebol.com
 

 Send in your settings, please (just change name and password if used :-).
 Well, you can probably use browser behind the firewall, so send us your
 browser proxy setting too ...

 -pekr-

 
  thanks for reply
 
  Filip Subr

 here is my %user.r

 REBOL [
 Title: "User Preferences"
 Date:  11-Apr-2000/11:52:14+2:00
 ]

 set-net [ [EMAIL PROTECTED] oskar.ssw.cz none socks.ssw.cz 1080 socks ]

hmm, try socks5 or socks4 respectively 

I am also sending you Sterling's proxy type identifier script off-list ...

-pekr-


 my browser is IE5
 proxy server addres:
 socks: socks.ssw.cz port: 1080

 Filip






[REBOL] Return types Re:(6)

2000-04-11 Thread dankelg8



On Mon, 10 Apr 2000 [EMAIL PROTECTED] wrote:

 Hi Gisle,
 
 note that Gabriele discovered some early hints of work being done on return
 types in REBOL/View.
 
 Possibly there will be some return type handling in future versions of REBOL.

Yes, I had a look at it, (Thanks Gabriele!) and it looks interesting...
If I understand correctly the format would be:

f: func [return: [block!]] [[]]

Jeff also suggested that there might be more uses for set-words in the
argument block, so I wonder what these could be?

Gisle





[REBOL] free web hosting with rebol Re:(3)

2000-04-11 Thread victor

Hello kracik,

Monday, April 10, 2000, 10:37:16 AM, you wrote:

kmdc Since you are the third person to ask on this ML in a week, I give up
kmdc and post my incomplete guide written in terrible English at:
kmdc http://hammer.prohosting.com/~rebol/rebol-cgi-prohosting.html

Thanks Kracik for giving up and post your guide :-)

kmdc Write me if you succeed in running REBOL on Prohosting following this
kmdc guide.

I  will.BTW  how  could one  query  a  server  about what OS is running
from REBOL command-line?


-- 
Best regards,
 VICTORmailto:[EMAIL PROTECTED]





[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:

2000-04-11 Thread icimjs

Hi Tim,

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


Within tims-object print replaces the global print, which you can continue
to access using system/words/print

 tims-object: make object! [
  print: func [][ 
system/words/print "this is the global print." 
  ] 
]

 tims-object/print
this is the global print.

Outside of the object's context print is not affected by your re-definition
of print in the object.

;- Elan  [: - )]




[REBOL] Using Rebol with HTML templates, reading dynamic data -- is it possible? Re:

2000-04-11 Thread chris

[EMAIL PROTECTED] wrote:

 1. A Rebol script can be used to fetch data from a textfile and put the
 data
 into a HTML template, thus creating an unique web page? In this way one may
 render lots of documents of the same kind, but with unique data, such as a
 list of products where each product is linked to a script-generated
 information page?

 2. A Rebol script can be used in the way above, but on the server side,
 reading data from a text file for input to the HTML template. In this way,
 Rebol may serve the same function as Visual Basic or Javascript within an
 Active Server Page?

 3. Which one of the two above methods is preferred -- rendering unique web
 pages with a script or having the script read data "on the fly" thus
 providing dynamic web pages?

With your first method you mean 'static rendering' I suppose - this is a viable
method for high-traffic sites (but almost certainly not necessary). In general,
you're more flexible with method 2 - although I don't know if 'HTML-embedded
Rebol' is possible (well, it is certainly possible but I haven't come along a
standard way to deploy it).

 I would be really glad to get some ideas on this, and maybe even some code
 that I can play around with to learn from. Thanks!

You can play a bit with my Vanilla system (http://www.langreiter.com/vanilla) -
it's easy to understand, supports templating and editing over the web, extension
scripts and so on ... If you want to try it out without installing it on your
own server, have a look at http://iw2.infowerk.co.at/cgi-bin/vanilla.rBest
wishes,
Chris Langreiter





[REBOL] fun with 'switch

2000-04-11 Thread mjelinek

Just a note to warn unsuspecting REBOLers.

Consider the following. I want to 'switch based on the return value of a
function. If the function returns none, I don't want to do anything, but I
want to make it clear in the code that none is an acceptable value. I know I
can code this multiple ways, but I thought the following should have worked:

 retval: curr-func
 switch retval [none [print "val-none"] "abort" [print "val-abort"]]
== none

Notice that the == none is the value returned from 'switch, not the
execution of the none block. To further illustrate:

 switch/default retval [none [print "val-none"] "abort" [print
"val-abort"]][print "val-default"]
val-default

Which was what I was getting in my program. I consider this a bug, but it's
easy enough to work around.

- Michael Jelinek




[REBOL] Vanilla sample-space

2000-04-11 Thread chris

Hi folks,

since Vanilla is a lil' bit awkward to deploy at the moment (eventually,
it should be download-doubleclick-deploy kind of thing, but for now it
certainly isn't), I've set up a 'playground' at

http://iw2.infowerk.co.at/cgi-bin/vanilla.r?selector=displaysnip=playground

I'm sure that there are still bright people on this world (and maybe
even on this list) who haven't been exposed to the wiki principle yet.
Everyone edits everything. It's human. There may be vandals, but usually
we know how to behave.

Over the next few days I'll enhance the extension script capability of
Vanilla, so that it will become possible to write full-fledged web
applications with it. DynaSnip-caching is waiting, too. And WML
rendering. And a 'history' aka revision control facility. Lots of
things, some even exciting. Get in touch.

Enjoy!

Chris Langreiter

_
c h r i s langreiter - - - unterlangkampfen 3 2 7
f o r m  is function -- autriche 6322 langkampfen
0 0 4 3 / (0) 5 3 3 2 / 8 7 6 0 7 c a l l - n o w
w   w   w   .  l a n g r e i t e r  .   c   o   m

There are three kinds of lies:
lies, damn lies, and statistics.
--Benjamin Disraeli





[REBOL] Searchable archive/ tcp/ip questions Re:(4)

2000-04-11 Thread mailinglists

Hello,

It does print 192.168.0.1 again, so, uhm, is there any other way to get
around this? I can't access the network settings on a remote computer... ;o)

Thanks,
Rachid

 it's easy, try this:

  print system/network/host-address
 194.213.219.17

 If it prints your other IP address (in your example 192.168.0.1), try to
 change the order of network adapters in Windows network settings.





[REBOL] fun with 'switch Re:

2000-04-11 Thread icimjs

Hi Michael,

1. The Problem
2. The Solution

1. The Problem:
 retval: curr-func
 switch retval [none [print "val-none"] "abort" [print "val-abort"]]
== none

Notice that the == none is the value returned from 'switch, not the
execution of the none block. To further illustrate:


The reason it didn't work is that

the none in a block, [none], is a value of type word! the none "as we know
and love it" is a value of type none!:

 type? first [none]
== word!
 type? none
== none!

The none in brackets is not an evaluated none. Evaluation makes the word
none a value-of-type-none! none. 

 type? do [none]
== none!
 type? do first [none]
== none!

The same is true for other values/words such as false, true, on, off.

2. The Solution:
You can do or reduce (you get the value, or a block containing the value:)

 type? first reduce [none]
== none!
 type? do [none]
== none!

To apply it to your problem. Simply reduce the block you pass to switch:

 retval: none
== none
 switch retval reduce [none [print "val-none"] "abort" [print "val-abort"]]
val-none

Hope this helps,






;- Elan  [: - )]




[REBOL] Vanilla sample-space Re:

2000-04-11 Thread icimjs

I did download your earlier version (it needed a little more configuration
than I expected).

Why not package it in the REBOL rip compressed archive format?

At 09:53 PM 4/11/00 +0200, you wrote:
Hi folks,

since Vanilla is a lil' bit awkward to deploy at the moment (eventually,
it should be download-doubleclick-deploy kind of thing, but for now it
certainly isn't), I've set up a 'playground' at

http://iw2.infowerk.co.at/cgi-bin/vanilla.r?selector=displaysnip=playground

I'm sure that there are still bright people on this world (and maybe
even on this list) who haven't been exposed to the wiki principle yet.
Everyone edits everything. It's human. There may be vandals, but usually
we know how to behave.

Over the next few days I'll enhance the extension script capability of
Vanilla, so that it will become possible to write full-fledged web
applications with it. DynaSnip-caching is waiting, too. And WML
rendering. And a 'history' aka revision control facility. Lots of
things, some even exciting. Get in touch.

Enjoy!

Chris Langreiter

_
c h r i s langreiter - - - unterlangkampfen 3 2 7
f o r m  is function -- autriche 6322 langkampfen
0 0 4 3 / (0) 5 3 3 2 / 8 7 6 0 7 c a l l - n o w
w   w   w   .  l a n g r e i t e r  .   c   o   m

There are three kinds of lies:
lies, damn lies, and statistics.
--Benjamin Disraeli





;- Elan  [: - )]




[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