[REBOL] [REBOL] Error Message Re:(5)

2000-03-23 Thread VoToNi

In einer eMail vom 23.03.00 23:25:19 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Hi Volker,
>  
>  you wrote:
>  >use and /local have another bug: you can't look in after an error!
>  
>  I'm not sure how you were trying to "look in":
>  
>  >> f: func [/local a] [a: 1 1 / 0]
>  
>  will cause a divide by zero error:
>  
>  >> f
>  ** Math Error: Attempt to divide by zero.
>  ** Where: 1 / 0
>  
>  Now let's look at the value of a:
>  
>  >> first second :f
>  == a:
>  
>  >> get first second :f
>  == 1
>  
>  "Looked in" and saw that a evaluates to 1. You must mean something quite
>  different?
>  

No. I meant that. Just have not known this way. thanks.

>  >a question: [a: do [print "1"]] does not work, how can i handle this too?
>  >i wanted to return the result of [do b] this way, with some lines after it
>  >[.. e: do b  if a-option [..]  "return" e ] ?
>  
>  print returns nothing, and nothing is a value of type unset!:
>  >> type? print "hello"
>  hello
>  == unset!
>  
>  >> type? do [print "hello"]
>  hello
>  == unset!
>  
>  >> print mold do [print "hello"]
>  hello
>  ** Script Error: mold is missing its value argument.
>  ** Where: print mold do [print "hello"]
>  
>  When type? returns the datatype unset! it is reporting that there was no
>  value:
>  
>  >> type?
>  == unset!
>  
>  There is no value to assign to 'a in your example. Otherwise it works as
>  you expect (?):
>  >> f: func [] [a: do [1 + 1] return a]
>  >> f
>  == 2
>  

My problem is: i dont know the arg of 'do. its a parameter. 
type? destroys the result. i can not store it before, because 
this can cause an error. i can not [try [a: do b] because the error
can be caused by code in 'b . maybe something like
[try [ a: try [b]], but this gets complicated. 
hm. someone more clever than me? 

>  >"code"
>  >local: func[a "vars" b "script" /local c d ][
>  >c: copy[]   foreach i a[ append c to set-word! i]   append c none
>  
>  You could simplify your foreach loop:
>  
>  foreach i a [
>append c compose [(to set-word! i) none]
>  ]
>  
Ah!

>  
>  


Volker




[REBOL] [REBOL] Error Message Re:(3)

2000-03-23 Thread VoToNi

In einer eMail vom 23.03.00 15:52:35 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Hi another_bob,
>  
>  I believe I've seen this error message when I've used hidden contexts. Were
>  experimenting or using a use block, something like this?
>  
>  use [a b] [a: 1 b: 2 [a b]]
>  
>  I believe it's an error that is not supposed to happen and indicates that
>  REBOL's garbage collection has been corrupted.
>  
>  
Have a crash after use too, and read somewhere it has a bug (script at 
rebol.org?)
use and /local have another bug: you can't look in after an error!
i fixed (?) this yesterday with my 'local : it creates an object for the 
context and returns it.
locals are set to none initially. if all /locals moved in the 'local -level, 
last bug's values are available.

a question: [a: do [print "1"]] does not work, how can i handle this too?
i wanted to return the result of [do b] this way, with some lines after it
[.. e: do b  if a-option [..]  "return" e ] ?
"code"
local: func[a "vars" b "script" /local c d ][
c: copy[]   foreach i a[ append c to set-word! i]   append c none
d: make object! c   bind b in d 'selfdo b   d]

"test" do [
a: "-a" b: "-b"
probe the-locals: local[a b][ a: 10 b: 20]
probe a probe b probe the-locals
]


Volker




[REBOL] R: under HTML Re:(2)

2000-03-23 Thread VoToNi

In einer eMail vom 22.03.00 18:40:13 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Re: [REBOL] [REBOL] under HTMLHi Paolo
>  
>  thank for the suggestion.
>  Just for training I'm trying to make a script for downloading all the 
> scripts from those .org-directories.
>  But I need simply to know why a common example like inthtml.r, for the 
> script embedding, doesn't work with IE 5.0 (it causes no one effect 
> absolutely and no one message). Really is it due to my browser IE 5.0, not 
> supporting rebol in script-tag ? Or is my rebol setup incomplete ?
>  
>  
>  Carlo Petriccione
>  
>  [EMAIL PROTECTED]
>  
Do you see the script-text in the browser? 
then somewhere in explorer application-settings is
rebol-script : text/plain . similar like .txt. 
if you clear text/plain, it will use the typical application, 
with open/save question and that.



Volker




[REBOL] First public version of RUI available Re:(3)

2000-03-18 Thread VoToNi

In einer eMail vom 16.03.00 22:51:17 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Hello [EMAIL PROTECTED],
>  
>  
>  On 16-Mar-00, [EMAIL PROTECTED] wrote:
>  
>  > Except for the dirutil.rui problem, it runs ok on Linux.
>  > 
>  > This is pretty cool, although I had to laugh when I used the calculator. 
>  > HTTP/HTML does not make for a very responsive user interface :).
>  
>  Nope :-)
>  (allthough you can just enter the expression in the text-field :-)
>  
>  I mainly made it (RUI) because I wanted something along the lines of ASP
>  but without VBScript and HTML, and I wanted it to run on my Amiga.
>  (I don't have access to a Windows box when at home)
>  
>  I guess /View will be better for many things, but /View doesn't run on
>  Amiga, and RUI doesn't require anything but a browser on the client...
>  
>  > Thank you Thomas!
>  You're welcome!
>  
>  
>  Best regards
>  Thomas Jensen
>  
Why is this stuff so slow? other rebservers answer immediate here.
can you give some explanations of the main-loops?

Volker



[REBOL] Finding current dir? Re:(2)

2000-03-15 Thread VoToNi

In einer eMail vom 15.03.00 06:44:43 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> The trick seems to be calling 'change-dir system/script/parent/path' near 
the
> start of the script to get 'normal' current directory behavior.
> If there are associated scripts that live in the same directory as
> the main script then do these before change-dir
> (e.g. 'do join system/script/path %shared_data.r') or save 
system/script/path
> for later use.


> It just occured to me that perhaps REBOL is designed to be used primarily
>  inside of itself (using the interpreter as a shell and do-ing scripts from
>  inside it) rather than calling scripts from a host OS.
>  
A rebol-scripts often relies on helper-scripts, and the typical place is in 
the 
start-script-directory. it is nort allways designed to load them at start 
only.
So changed this dir is not preferable?

i suggest something like
 home: system/script/parent/path ; at start
 read home/myfile1
nearly as short. 

Volker



[REBOL] "{" in strings - workarounds? Re:(3)

2000-03-14 Thread VoToNi

In einer eMail vom 14.03.00 16:49:23 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

<< Thanks for the rescue. will paste it. BTW, one missing thing is "^^"? :)
 
"^^"?? Hahaha, no, Your code is ok :-) 
I changed it a bit for my needs, see below. Thank you, database runs again :)
(Have not really testet the 'save-history yet, should be the right syntax)

Volker

;
; nearly History save and load by Christoph Mammitzsch
;
save-history: func[
   "Saves system/console/history to file."
   file [ file! ] "the file to save to"
][write file mold-string-series system/console/history]

mold-string-series: func [
   history [ series! ] "the series to save"
   /nocopy "trashs input, but saves memory. >2mb mails yet"
   /local line subst
][
   if not nocopy [history: copy history]
   forall history [
  line: mold first history
  if equal? first line #"{" [
 line: change line #"^""
forall line [
subst: select [
#"^""   "^^^""
#"^/"   "^^/"  
  ;There must be more. I'm sure I forgot something :)
] first line
if not none? subst [
remove line
line: back insert line subst
]
]
change back line #"^""
 line: head line
  ]
  change/only history line
   ]
   history: head history  
]

load-history: func [
   "Restores system/console/history from file."
   file [ file! ] "the file to load from"
   /local history
][
   system/console/history: load file
   exit
]


 In einer eMail vom 14.03.00 13:08:23 (MEZ) Mitteleuropäische Zeit schreibt 
 [EMAIL PROTECTED]:
 
 << Hi Volker,
  
  this problem has been found before, when trying to save
  history to files, here's a history save function, that 
  does it right ...
  
  >>


Volker



[REBOL] "{" in strings - workarounds? Re:(2)

2000-03-14 Thread VoToNi

Thanks for the rescue. will paste it. BTW, one missing thing is "^^"? :)

In einer eMail vom 14.03.00 13:08:23 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

<< Hi Volker,
 
 this problem has been found before, when trying to save
 history to files, here's a history save function, that 
 does it right ...
 
 ;
 ; History save and load by Christoph Mammitzsch
 ;
 save-history: func [
"Saves system/console/history to file."
file [ file! ] "the file to save to"
/local history line subst
 ][
history: copy system/console/history
forall history [
   line: mold first history
   if equal? first line #"{" [
  line: change line #"^""
 forall line [
 subst: select [
 #"^""   "^^^""
 #"^/"   "^^/"  
   ;There must be more. I'm sure I forgot something :)
 ] first line
 if not none? subst [
 remove line
 line: back insert line subst
 ]
 ]
 change back line #"^""
  line: head line
   ]
   change/only history line
]
history: head history
write file history
exit
 ]
 
 load-history: func [
"Restores system/console/history from file."
file [ file! ] "the file to load from"
/local history
 ][
system/console/history: load file
exit
 ]
 
 
 I hope this helps,
 
 Ingo
 
 Those were the words of [EMAIL PROTECTED]:
 > my little email-database is crashed.
 > Caused by some emails which contained
 > unpaired "{".
 
  >>


Volker



[REBOL] Finding current dir? Re:(3)

2000-03-14 Thread VoToNi

system/script/parent/path
seems to be the current directory (maybe a bug ;-)
After this there is a rebol-script in %test/, another bat in %test2/ and
a bat in %test3/, which sets the paths to %test2/ and calls the bat there.
the path is set to %wherever/test3/, which is the current directory.
well, it would be more a problem to get the name of the starting bat in 
windows?
except as passing with %0.

secure ask; quick scripts may have quick bugs :-) this will give you 
trace-dialogs

print "the fundamental results:"
probe system/options/script
probe system/script/parent/path

print "making the test: script in test, bat-dir in test2"
error? try [make-dir %test/]
error? try [make-dir %test2/]
error? try [make-dir %test3/]
save %test/where.r [rebol[] probe system/options probe system/script  
print "script-path, script, start path (resp. of super-script)"
probe system/script/path
probe system/options/script
probe system/script/parent/path
make error! "hack to hold console. better way?"
]
write %test2/where-view.bat form ["echo %0^/" {"C:\Program 
Files\REBOL\View\rebol"} "..\test\where.r"]
write %test2/where-core.bat form [{"C:\rebol031\rebol"} "..\test\where.r"]
write %test3/where-path.bat form ["path ..\test2;%path%^/" "where-core"]
exit


In einer eMail vom 14.03.00 12:22:09 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

<< Thema:[REBOL] Finding current dir? Re:(2)
 Datum: 14.03.00 12:22:09 (MEZ) Mitteleuropäische Zeit
 From:  [EMAIL PROTECTED]
 Reply-to:  [EMAIL PROTECTED]
 To:[EMAIL PROTECTED]
 
 
 >If you want to use the directory of the bat file that launched the script
 >then technically it is the parent of the script.
 >
 >You will find that path of that in system/script/parent/path
 
 True, but if trim.bat and trim.r are both in the same
 directory in the path, say N:\UTL, and I run from the
 "current dir" say N:\C\410, don't I still get N:\UTL\ as the
 path to the parent batch file, instead of the "current dir",
 N:\C\410?
 
  >>


Volker



[REBOL] Gizmo .... Re:

2000-03-14 Thread VoToNi

In einer eMail vom 14.03.00 08:23:38 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

<< Hi,
 
 I've just read one article about some new Internet technology. You can
 read the article at:
 http://www.zdnet.com/pcweek/stories/news/0,4153,2461323,00.html
 
 btw: I just wonder, what RT strategy is. Will RT look for technology
 partners? Does RT marketing work outside RT website area?
 
 I hope we will see some nice articles on upcoming RT products anytime
 soon to see REBOL spreaded to many platforms/devices :-)
 
 -pekr-
  >>
Hope they will figure out first what REBOL really is. 
Not to get trapped like java, which fits well in a nutshell (by Dave Flanagan)
and then needs a whole christmas tree a 0.1-step later.
Because they add features before concepts now?
Well, they can't avoid splitting in sun/m$-java without that, but.. 
where's Asterix?

Volker



[REBOL] Function without argument ... Re:

2000-03-13 Thread VoToNi

In einer eMail vom 13.03.00 19:34:33 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

<< s it possible to test a lack of argument in a function ? 
 I try things like this but... it doesn't work !
 
 tst: func [
 {help for tst...}
x [integer!]
 ][ 
if none? x [help tst]
print  x
 ]
 
 tst
 ** Script Error: tst expected x argument of type: integer.
 ** Where: tst
  >>

Yes, i saw something in the userguide by functions. i hope it was
x [anytype?], no [any-type?]
--
users/expfunctions.html#OptionalArguments :

Optional Arguments 
Functions can be created that take arguments optionally. Do this by 
specifying the any-type! datatype identifier in the argument specification 
block: 


print-val: func [val [any-type!]] [
print either value? 'val [val]["No value given"]
]

print-val 1234
1234

print-val
No value given

(...and a bit more)

Volker



[REBOL] "{" in strings - workarounds? Re:(2)

2000-03-13 Thread VoToNi

In einer eMail vom 13.03.00 18:09:09 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

<< > Caused by some emails which contained
 > unpaired "{".
 > they are stored in a block which is wrong molded by 'save.
 > When will this be fixed?
 
 Hi, would it be possible to do a search/replace before going to do
 something with your emails? Or check if the braces are unbalanced
 (IIRC you just sent a good piece of code for this problem ;-))
 
  >>
search/replace for the workaround, i think.
but, rebols databases with load/save are so handy.
Currently  i save only a block of strings, a loop of some lines extra will do 
it.
But for searching I have something pre-parsed in mind like 
[  content from to ..   content2 from2 to2 ..2  ]
or 
[ [ from: "from" to: "to" .. ] [ ..] ]
and then i have to change the string in a more nested structure.
so i have to write  [append bag from append bag to .. append bag my-convertet 
content ],
or convert all long kind of strings to something mold-hard on save and 
deconvert on load.
and that for every long kind of string, like content, header and so on.
And for example a sourcecode-database will have the same problem.
not the quick cool rebol i like.. this trippels every member-change..

The work for a hand-written my-mold would be shorter in the long run, 
specially subjective.

Volker



[REBOL] Is there a shorter way to pass refinements? Re:(2)

2000-03-13 Thread VoToNi

In einer eMail vom 12.03.00 08:09:17 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

Thanks. I needed a simple path! The way i can't find :-). I try to understand 
it. 

Volker

<< Volker asked:
 > Is there a shorter way to pass refinements?
 > 
 > for example
 > a: func[  /header][]
 > b: func[ /header][ either header [ a/header ][ a ]]
 
 Yes. For example:
 
 SNA_switch: function [
  "Selects a choice and evaluates what follows it."
  value "Value to search for."
  cases [block!] "Block of cases to search."
  /case "Value is case-sensitive."
  /only "Treats a series value as a single value."
  /any "Enables the * and ? wildcards."
  /default Default_Case "Default case if no others are found."
  ][
  Refined_Select
  ][
  Refined_Select: to path! 'select
  if case [head insert tail :Refined_Select 'case]
  if only [head insert tail :Refined_Select 'only]
  if any [head insert tail :Refined_Select 'any]
  either found? value: Refined_Select cases value [
   do value
   ][
   either default [
do Default_Case
][
none
]
   ]
  ]
 
 I hope that helps.
 
 Andrew Martin
 I >>


Volker



[REBOL] "{" in strings - workarounds?

2000-03-13 Thread VoToNi

my little email-database is crashed.
Caused by some emails which contained
unpaired "{".
they are stored in a block which is wrong molded by 'save.
When will this be fixed?

Now i have to think about workarounds
Is there something like another mold out there?
Should i do store of the long content-strings by hand?
(short strings are quoted right).

If i try my own mold: is the block-parser ok now?
how do i handle the "make object! []" and that?
is 
>> a: #123
== #123
>> compose [make (type? a) (mold a)]
== [make issue! "#123"]
with a recursive my-mold enough?
And so one.
any hints/ideas welcome.


Volker



[REBOL] Command Line Args Re:(5)

2000-03-12 Thread VoToNi

In einer eMail vom 12.03.00 15:33:15 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Yes please.  In the case of 'simple things should be simple
>  to do':
>  
>  probe system/options/args
>   gets args
>  
>  probe system/options
>   shows the options object
>  
>  probe system
>   crashes rebol and requires me to use browse-system.r script???
>  
>  
_never_ probe system/words ! never mold anything with circular lists !
mold cannot detect it and runs and runs..

%browse-system.r (@ rebol.org too) forbids the access fully.
with  [probe first system/words] you get a list of all used words in the 
system
(even undefined, 'abcdef will stay there nothing too).
[source what] says more.

Volker



[REBOL] Is there a shorter way to pass refinements?

2000-03-11 Thread VoToNi

Is there a shorter way to pass refinements?

for example
a: func[  /header][]
b: func[ /header][ either header [ a/header ][ a ]]

Volker



[REBOL] getting Rebol "OK" Re:(5)

2000-03-11 Thread VoToNi

In einer eMail vom 11.03.00 09:20:12 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Hi Volker,
>  
>  This is kind of  off target here, but..
>  The method below would solve that problem in rebol/view. It ensures that
>  processes don't keep running in the task manager after the window is closed
>  for a rebol/view script that has an infinite loop.
>  Hopefully the event scheme could be added to rebol/core too. or Perhaps 
some
>  of the rebol/core gurus have similar solution for rebol/core?
>  
>  event-port: open [scheme: 'event]
>  forever [
>  ; do stuff...
>  ; do more stuff
>  wait event-port ; since time events are always firing it won't have to
>  wait long.
>  event: first event-port
>  if event/type = 'quit [break]
>  do event
>  ]
>  close event-port
>  ; end of script..
>  

Hm, this is not asynchrone?
i need a "programmable escape key". The problem is, what i do
with _buggy_ infinite loops when i test over the net (the "do stuff" hangs, 
not the main-loop)? 
there is no escape-key
then. Think i want _really_ to use one of this nice rebol-cgi-servers, or, 
Yea,
the wicki server (:-)), and my script has a bug. 
happily the server hangs.
if i could say [after 5 seconds escape with 'server-restart], it would be 
much safer.
running the server in a extern shell-loop, it could free itself nearly 
allways.
having memory-limits, context-protection (Gabrieles?) too and a really 
crash-hard kernel 
would make this stuff really portable, but a simple "start: rebol server.r ^/ 
goto start" 
is so short that porting is acceptable :)
Killing rebols, especially on windows, is another thing. for example, in my 
perl
"kill" does not work, and external communication would be needed to say 
"ok, iam well, let me continue".
Having a "escape-key" and controlled pre-buffering would make more threading 
nearly
unneccessary, i think. (Maybe full threading looks cool, but, write Java with 
and without it..
And than look at Oberon (well, partly:). And think you write REBOL in 
minutes, not java-like system-design :)
Hopefully iam missing something :)
Note: the realtime JBed (mentioned in Dr Dobbs) preferres this approach..
Note2: the original message was "can't stop rebol, bad script"..

>  Cheers,
>  
>  Allen K

Cheers back :)

Volker




[REBOL] getting Rebol "OK" Re:(3)

2000-03-10 Thread VoToNi

In einer eMail vom 10.03.00 18:54:38 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> 
>  >  The only problem I have had is with a bad script. It spawned a copy
>  > of  rebol.exe and it  never went away  until I stopped and restarted
>  > the web  server. If I knew  of a way to  stop this happening I would
>  > happily host REBOL for everyone.
>  >  Melvin Mudgett-Price Director ofDevelopment
>  
>   Howdy Melvin:
>  
>   If REBOL is invoked with -c or -qw command line switches then
>  any error that occurs in the script should cause REBOL to fully exit
>  (after printing out the error).  If you've found otherwise, please
>  send in a feedback with information about your set up and we'll try to
>  figure out why.  Thankya kindly. :-)
>  
>   -jeff
>  
>  
What with infinite loops?
"rebol.exe" says Windows?
my 95 can stop rebol's with the task-manager, but for instance old textpad
can't do it (maybe textpads fault)?
And all are named REBOL..
Could there be a timeout which triggers like escape? 

Volker



[REBOL] How do I save and restore an array of objects Re:(5)

2000-03-10 Thread VoToNi

In einer eMail vom 10.03.00 07:52:56 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Hi Bob,
>  
>  A) do works when you only want to load a single object. It's like saying:
>  
>  do [make object! [word: 'something]]
>  
>  which - of course - returns a single object, namely the last object (and
>  here only object) found in the block (returned by load), and not a block
>  containing all objects that were in the file.
>  
>  
Oops. Yes. Thanks too.

Volker

Volker



[REBOL] How do I save and restore an array of objects Re:(2)

2000-03-09 Thread VoToNi

In einer eMail vom 10.03.00 01:12:44 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:
[do load], not [load] ?
Your Database contains [make object[..]] ? This are, simply loaded, 
three elements, 'make , 'object! , [..]
they must be [do]ne to create the structure.

rugly, try this:

a: make object! [ a: none ]
probe a
save %t.txt a
print "dump file, load, do load"
print read %t.txt
probe load %t.txt
probe do load %t.txt

gives (editied)
; original:
make object! [
a: none
]
dump file, load, do load
; code in file
make object! [
a: none
]
; simply loaded, wrong!
[
make object! [
a: none
]]

; do loaded, ok:
make object! [
a: none
]

and correct my english :)
Volker

> The example below reads a web page of alternating headlines and
>  associated stories.  If the same headline appears on a later scan
>  the story is ignored.  It saves elements parsed from the webpage
>  as an array (block) of structs (object!s).
>  It cannot seem to restore them cleanly when rerun later.
>  why? How do I get around it for now?
>  
>  I have simplified the example below.
>  
>  REBOL [title: "sample story fetcher" ]
>  
>  stories: make block! 25
>  story-tmpl: make object! [
>   head: none
>   body: none
>   topics: none
>   dest: none
>   fileto: none
>   ]
>  
>  page-parser-rules: [
>   any [
>   thru "headline:"
>   copy headl  to "story:"
>   thru "story:"
>   copy story-body  [ to "headline:" | to  | to end ]
>   (store-story)
>   ] ]
>  
>  headl: make string! 30
>  topic: make string! 30
>  story-body: make string! 300
>  
>  store-story: func [ /local  sry ] [
>  ; drop dupes...
>  foreach st stories [
>if st/head = headl [ return false ]
> ]
>  
>  ; fill in struct
>  sry: make story-tmpl []
>  sry/head: copy headl
>  append stories sry
>  ]
>  
>  go: func [ /local c ] [
>  if exists? %articles/stor  [ stories: load %articles/stor ]
>  c: read  http://localhost/storygenerator.cgi
>  
>  parse c page-parser-rules  ; calls store-story when "headl" filled
>  save %articles/stor stories
>  ]
>  
>  go
>  q
>  
>  
>  ;# mailto: [EMAIL PROTECTED]
>  


Volker



[REBOL] Some niggley things Re:(3)

2000-03-09 Thread VoToNi

In einer eMail vom 10.03.00 00:35:31 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> What I ended up using was:
>  
> FOREACH [f-1 f-2 f-3 f-4 f-5] files [ 
>   portfolio: MOLD TO STRING!
>   REDUCE [f-1 "+" f-2 "+" f-3 "+" f-4 "+" f-5]
>  
>  When I do it this way, I get a string. That's what I told it to do.
>  
>  This causes an error, and the page is returned minus the first and last 
(f-1 
> &
>  f-5) entries. When the quote marks are removed after copying the completed 
> URL
>  into the brower, it works fine, so the quote marks are the problem.
>  
> tmp: READ JOIN QAN-URL [ "?tick=" portfolio decimals ]
>  
>  Hmm, this is the *same line* used elswhere in the program, which worked 
last
>  night. Am I missing something?
>  
>  In what form can I get the above "string" without quotes, so that I can 
> build
>  the URL properly?
>  
>  
maybe probe some values for us?!
Note,
>> print to-string [1 2]
12
>> print mold to-string [1 2]
"12"
Maybe simply no mold (which says "make rebol-code from it, quote strings") ?

Volker



[REBOL] Some niggley things Re:(2)

2000-03-09 Thread VoToNi

In einer eMail vom 09.03.00 06:33:20 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> >
>  >#2
>  >"files" (above) will, eventually, be a block of about 300 file names. I 
> need
>  >to know how to take five file names at a time and make a string that is:
>  >"name+name+name+name+name", to add to a URL.
>  
>  One possibility would be:
>  
>  >> files: [%a %b %c %d %e %f %g %h %i %j]
>  >> foreach [f-1 f-2 f-3 f-4 f-5] files [ 
>print mold to string! 
>   reduce [f-1 "+" f-2 "+" f-3 "+" f-4 "+" f-5] ]
>  
>  which results in:
>  
>  "a+b+c+d+e"
>  "f+g+h+i+j"
>  
>  ;- Elan >> [: - )]
>  
with 
files: [%a %b %c %d %e %f %g %h %i %j %k] ; ( 11 // 5 <> 0)
gives
"a+b+c+d+e"
"f+g+h+i+j"
"k+none+none+none+none"

Volker



[REBOL] solved: dynamic words 2 Re:(2)

2000-03-09 Thread VoToNi

In einer eMail vom 09.03.00 03:39:36 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Trying to figure out what you are trying to accomplish I ran your code and
>  get an error message:
>  
>  >> count: 50
>  == 50
>  >> out: make string! 1000
>  == ""
>  >>
>  >> for build 1 count 1 [
>  [builder: reform ["messagebuilder:" rejoin ["message" build]]
>  [do builder
>  [append out messagebuilder
>  []
>  ** Script Error: message1 has no value.
>  ** Where: messagebuilder: message1
>  
>  You don't? How come?
>  
Cause he snippt a bit, i think? he wished to create words 'message1 'message2 
.. with values,
in this thread before, then to access them in a loop. 
The first step was solved there? Bad snipping, of course :)

Volker



[REBOL] Some niggley things Re:

2000-03-08 Thread VoToNi

In einer eMail vom 09.03.00 02:48:04 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> 
>  Hello, Rebols:
>  
>  #1
>  files: READ %. gets the current directory, but how do we do it with a
>  set-word? Example:
>  
> directory: %/partition/drawer/drawer
> files: READ %directory(how to deal with "."?)
>  
>  doesn't work because (among a few things) it tries to read the current
>  directory. I don't want to use CHANGE-DIR because then REBOL persists to 
> look
>  at that drawer, which is *very* annoying when trying to re-run the program.

files: READ directory; no %! type? directory is file..
maybe use %path/ to say you mean directories (at least here(windows)).

>  
>  #2
>  "files" (above) will, eventually, be a block of about 300 file names. I 
need
>  to know how to take five file names at a time and make a string that is:
>  "name+name+name+name+name", to add to a URL.
>  
>  I didn't see an example of how to parse a string in this way (take five
>  elements at a time until the end of block), nor did I see how to 
efficiently
>  make a string using a repeated separator.
>  
>  Do I need to deal with the end of the block or is it automatic?
>  
print "..the c way"
a: [ 1 2 3 4 5 6 7 ]
until[
n: min length? a 2
for i 1 n 1 [
prin first a
a: next a
]
print []
tail? a
]
print "..the rebol way?"
a: head a
until[
b: copy/part a 2
foreach i b [ prin i ]
print []
a: skip a 2
tail? a
]


>  -- 
>  
>  ---===///||| Donald Dalley |||\\\===---
>  


Volker



[REBOL] solved: dynamic words 2 Re:

2000-03-08 Thread VoToNi

In einer eMail vom 08.03.00 23:28:20 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:
>   builder: reform ["messagebuilder:" rejoin ["message" build]]
>   do builder
messagebuilder: do rejoin ["message" build]
should work to? 
But knowing how to reform is never wrong :-)

> got it!
>  
>  appending the value of a dynamically created word name to a word...
>  
>  count: 50
>  out: make string! 1000
>  
>  for build 1 count 1 [
>   builder: reform ["messagebuilder:" rejoin ["message" build]]
>   do builder
>   append out messagebuilder
>  ]
>  
>  
>  "reform" was the missing link.  thanks for directing me to use "do."
>  
>  -ryan
>  


Volker



[REBOL] dynamic word names 2 Re:

2000-03-08 Thread VoToNi

In einer eMail vom 08.03.00 19:11:18 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> What if I want to append a dynamically created word with a value that 
>  belongs to a word the representation of which must also be dynamically 
>  created in the script?
>  
>  Assume an earlier script created the following word values:
>  
>  lineword1: {hello}
>  lineword2: {good morning}
>  lineword3: {good day}
>  
>  Now I want to append them in order to the word "messagebuilder."
>  
>  The value of "count" is the total number of "lineword" word values with a 
>  numeral appendage.
>  
>  How can I accomplish what lies within the parenthesis?
>  
>  for build 1 count 1 [
>   append messagebuilder (with the value of a dynamically created word)
>  ]
>  
>  Thanks.
>  
>  -Ryan
>  
do (with the value of a dynamically created word) ?

>> a: "print 1 + 1"
== "print 1 + 1"
>> do a
2
>>

Volker

Volker



[REBOL] communicate with program with stdin/stdout - end markers?

2000-03-08 Thread VoToNi

I want to communicate with another program with stdin/stdout.
i need a way to detect the end of a message,
and i want to use the normal print/input.
since a data-string can contain my end-marker,
i have to mask it out.
Can this protocoll-stuff be used to generate a filter
for the normal stdin/stdout to do this? and how?

Volker



[REBOL] security-requester a risk?

2000-03-08 Thread VoToNi

When rebol asks for lowering security, it makes "yes" the default.
a occasionaly return gives free way.
i think "no" should be the default, at least as an %user.r-option?

Volker



[REBOL] Why doesn't this work? Re:

2000-03-04 Thread VoToNi

In einer eMail vom 04.03.00 06:28:26 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> obj: make object! [a: "" b: ""]
>  t: 'obj
>  new-obj: make t []
>  
>  When I try it, I get the following response:
>  
>  >> obj: make object! [a: "" b: ""]
>  >> t: 'obj
>  == obj
>  >> new-obj: make t []
>  ** Script Error: Expected one of: word! - not: block!.
>  ** Where: new-obj: make t []
>  
>  How does one make a derived object using a variable to specify the parent
>  object?
>  
t: obj
not 'obj ! you needs the value. like this:

>> probe make (make object! [a: 1])  [ b: 2 ]

make object! [
a: 1
b: 2
]


Volker



[REBOL] [REBOL] Rebol/Command and the kitchen sink Re[2]: Re:

2000-03-03 Thread VoToNi

In einer eMail vom 03.03.00 06:16:03 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> >>   Personally, I'd like to do all of my web development in Rebol/Core, 
>  >>but it's looking like I'm going to need to create and access some MySQL 
>  >>databases. Now I can do that with PHP, but not Rebol/Core, and I have no 
>  >>idea when Rebol/Command is going to actually show up. 
>   
>  >Er, can you use PHP to gateway between Rebol and MySql? ( a Rebol script 
>  >to read a PHP page, and post to a PHP form?
>  
maybe a start:
have started rebol -w from perl with ipc::open2, then perl can get commands 
from rebol and send results back. rebol acts with input/print.
have not done more. maybe a way to a database-server?
note the first message must come from rebol, earlier perl-writes are lost. 
have windows& activeware-perl.
trying to kill rebol from perl failed here, on unix should work?

hm. with perls eval you can even send source from rebol.. 
perl as another dialect :)
Maybe this perl-script (or whatever language can play shell) 
can be extended as a message-dispatcher between rebols?
with [start-rebol [name [string!] command [block! string!]]] and [send-rebol 
[receiver [string!] message [block! string!]]] and [kill[name[string!]]]
then running downloaded code can't hang the server.
console-io is there at every security-level, nothing else needed.

Hm, starting applications is not portable, starting rebols should be?


---
#
use IPC::Open2;   

$rebol_exe="C:\\Program Files\\REBOL\\View\\rebol.exe";
$pid = open2(\*RDR, \*WTR, "$rebol_exe","-wq test.r");
$|=1;
print "begin\n";
while(){
print "from rebol:", $_;
print WTR "hi rebol ",$_;
}
print "done\n";
-
rebol[]
print "hello from rebol"
print ["hi perl" input]
-
begin
from rebol:hello from rebol

from rebol:hi perl hi rebol hello from rebol

done


Volker



[REBOL] need help with internet traffic counter Re:

2000-03-03 Thread VoToNi

There is a proxy.r at rebol.org. For http, it should be able to count this.
How can one write proxies for ftp, email and that? 

another way: is a "DU Meter"s output text, and includes size and url in a 
log, rebol should be able to parse it, and sum.
Hopefully so short that porting would not be a problem :)

Volker
---
In einer eMail vom 02.03.00 01:35:17 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> short version: I need a multiplatform internet traffic counter that counts 
> all upload and download internet traffic from my PC to beyond my ISP. 
> Something very simple like "DU Meter" (www.tucows.com) for win9x would do 
> just fine except that it calculates ALL traffic. I just want to know my 
> traffic beyond my ISP. 
>  Rebol seems well suited for the job but I don't know enough about it, nor 
> about the TCP/IP protocol. Any help is appreciated: from a pointer to a TCP/
> IP newbie guide to a ready-to-use program (whishful thinking?). TIA.
>  
>  long version: I am on a permanent cable connection, like 20.000 other 
> customers from my ISP. They have a limit for *external* traffic, but they 
don'
> t give us a stats page where every client can keep track his traffic. If 
you 
> pass the limit once: you get a warning; twice: 2 days out; third time = 1 
> week out; 4th time = banned permanently! 
>  With external traffic I mean every byte that travels from my PC to outside 
> my ISP's domain (or vice versa). Traffic from the ISP newsserver, 
mailserver, 
> ftp server etc. and traffic between customers from my ISP is unlimited, so 
> these shouldn't be counted. From www.ripe.net we know what ip-ranges belong 
> to my ISP: this should be a parameter because its a growing list. Uploads 
and 
> downloads to these ip's shouldn't be counted except the proxy-server at 
proxy.
> pandora.be:8080, this is *always* calculated as external, even if the files 
> were on the proxy!
>  The limit is 2GB per week (OK I agree this sounds silly if you have a 56K 
> modem but once you're on a fast & permanent connection you'll understand, 
so 
> plz don't yell at me). It is calculated as follows:
>  at 0600 here in Belgium the sum of your external traffic (upload + 
download) 
> of the past 168 hours (or 7 days) is made. If this exceeds 2GB you get 
> warning +1. The program that I need help with should have to be able to 
> display total external volume at all times, preferable giving a warning or 
> block all external upload & download traffic as soon as 2GB/7=286MB has 
been 
> reached since 6am. It should be able to "remember" the last count to be 
able 
> to continue after a reboot
>  Why multiplatform? 20.000 customers aren't all Windows users, but they're 
> all very interested in such a program.
>  
>  Every little bit of help is very much appreciated. TIA
>  
>  



[REBOL] How can i lock files for multitasking-access

2000-03-03 Thread VoToNi

How can i lock files for multitasking-access?
Does open this everywhere?

Volker



[REBOL] Rebol/Command and the kitchen sink Re:(3)

2000-03-03 Thread VoToNi

In einer eMail vom 03.03.00 08:11:02 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> On Thu, Mar 2, 2000,  <[EMAIL PROTECTED]> wrote:
>  
>  >Having done something similar with ASP and MS-SQL Server 7, using ASP to

snip
.
>  >I can say it works.  It's ugly, but it gets the job done.  On the other
>  >hand - what [EMAIL PROTECTED] is trying to accomplish is just better
>  >done in PHP alone.  
>  
>  >Why bother to add another layer on top of it?  Just to
>  >use Rebol?  That kind of solution flies in the face of the Rebol
>  >phillosophy.
>  >
>  >K   I   S   S
>  >
>  >Keep it Simple, Stupid.
>  
>  That's what I'm trying to do. I don't think reading a PHP page to get
>  the time with millisecond resolution is a particularly complex task.
>  Reading PHP pages to access a database might very well be too hairy to
>  try. I haven't attempted it yet, so I don't know.
>  But for the real meat of what I want to do, Rebol's flexible syntax
>  really seems like a boon, i.e. what I want will probably take a lot more
>  PHP code to implement than Rebol code. 
>  
>  >The simple solution is usually the best, and most correct one.  When
>  >Rebol/Command comes out, and you can access deeper functionality using
>  

A library for rebol could be written in perl, with a bit thinking about 
protokoll
(a quick look at http://www.zend.com/ says PHP is similar to perl, so it may 
usable too:)
look at rebols "predecessor" perl. When it needs a tricky function, it simply 
mix
C in. or whatever. pretty factored in a library, and after that, it is perl. 
No one needs to know C to use it.
perl has a similar level as rebol in handling strings and eval (do) 
sourcecode.
So a library for rebol could be written in perl, with a bit thinking about 
protokoll.
which can do nearly all and if not, it can C.
if REBOL can communicate with things email, http and other servers, why not 
with a specialised
proxy-server for databases or whatever?
First would be a REBOL-Block <--> perl-struct converter, after that one can 
do pretty messaging between them.
if perl starts rebol, communication with stdin/stdout between them is *very* 
private, i think.
Then REBOL (&carl) has much (em, more) time to find ways of doing this things 
easy, elegant and everywhere.
The old communication-protokoll should be re-implementable with /command or 
whatever intern,
rest of code continues with "ask-db[select x y from table..]" as before..

snip
>  .:Eric
>  

Volker



[REBOL] Return value from a Script??? Re:

2000-03-03 Thread VoToNi

In einer eMail vom 03.03.00 02:43:40 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Is it possible for a script to return a value in a similar manner that a
>  function does? I've suddenly realised that i have been developing scripts
>  but don't seem to have any way for them to communicate with each other?
>  
'do returns its last value.

and scripts in own context:
>> save %t.r [rebol[] a: func[][print 123 + 234]] 
>> b: make object! load %t.r
>> b/a
357
 
Volker



[REBOL] save/load with "{" in long strings broken!

2000-03-01 Thread VoToNi

comment[
save/load with "{" in long strings broken!
Long Strings looks like
{{xx}
when molded. No escaping of inner "{"!
found bug when trying {a ^{ in a string} . "^}" exits, "^{" does not!
This comments cannot be embedded..
]
comment [ --- TEST GIVES:
"save:"
["hello" "world"]
"reloaded"
filedump: "hello" "world"
["hello" "world"]
"save:"
[{{xx} 
"world"]
"reloaded"
filedump: 
{{xx} "world"
** Syntax Error: Invalid string -- 
{{xx} "world".
** Where: (line 1) 
{{xx} "world"
]

[rebol[ "THE SOURCE" ]
dump: func[blk][probe blk comment {probe first blk probe second 
blk}]
test: func["saves and loads back the blk" blk ][
probe "save:"
dump blk
save %test.txt blk
probe "reloaded"
print ["filedump:" read %test.txt]
blk: load %test.txt
dump blk
]
test [ "hello" "world" ]
test ["{xx" 
"world"]
]



 
 



[REBOL] RIP Re:

2000-02-25 Thread VoToNi

In einer eMail vom 25.02.00 03:48:44 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:


> For whoever it was who was having problems using RIP:
>RIP saves the archive's file name in the extraction code, and needs
>  this to open the archive in binary mode - as a result you cannot rename 
the 
>  file...  perhaps a solution to this should be the next enhancement?  
Anyway 
>  in the mean time just don't change the name of the archive after you 
create 
>  it.
>  
>  -

system/options/script gives the script-name. So why saving it?
modify file: .. in carls code:
...
Note: (reform [{To extract, type REBOL} filename {or run REBOL and 
type: do} filename])
]
>>file: system/options/script ;ex (filename)
size: (length? archive)
path: (path)
...

Tested on windows. OK?
Gruss Volker



[REBOL]

2000-02-24 Thread VoToNi

In einer eMail vom 24.02.00 19:38:22 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Thanks
>  
>  Sorry for my ignorance but, how can I do it in Windows95?
>  I am not going to develop app for web servers but I´d like to give my rebol
>  scripts an html interface for local use. Rather than giving command-line
>  parameters or getting input from the rebol prompt I would use html forms 
and
>  buttons for getting input and use hyperlinks for creating menus and 
navigate
>  over my scripts.
>  
>  
>  [EMAIL PROTECTED] escribió:
>  

Use REBOL! Somewhere at rebol.org i found a web-server in rebol !! 
(%web-microweb_r.htm)
Well, its _SO_ short - copy/paste it from this mail .. hope this is ok, 
Tyler, Jeff? WOW this is good!
Oh yes, or use %web-proxy_r.htm. Which can kill javascripts "window.open", in 
a similar way you can
handle your rebol-scripts there. A bit longer, but then you can handle 
rebol-scripts over the net,
where your proxy runs. needs a standart..

For microweb:
use http://127.0.0.1:8080/ for the base-url ( http://localhost:8080/ ), 
%htdocs/ for the docs, start it !!
modify 'data just before the 'write-io -line (parse for your marks, then do 
them.. somehow..)
hum, start it again.. 
maybe you have to say some [offline? NO!] in internet explorer when offline 
to access local servers, at least by me (aol).
Cool!
an idea: Since localhost can be linked by external pages, a download of rebol 
with this server extended can be combined
with the net for local processing? What to do from referrer? Would this work? 
And how secure is rebol?

 
REBOL [
Title:"Micro Web Server"
Date: 24-June-1999
File: %microweb.r
Author:   ["Tyler Booth" "Jeff Kreis"]
Email:[EMAIL PROTECTED]
Purpose:  { Very small web server. ( 20 lines of code ) }
Category: [web advanced]
]

print 'hello" ; by Volker, to open a console on rebol/view for shutdown :)

wwwpath: %htdocs/   html: "text/html" gif: "image/gif"  jpg: "image/jpeg"
listen:  open/lines tcp://:8080  ;Port to listen on

not-found: ["404 Not Found" 
[

ERROR




 "REBOL Webserver error 404"
*"File not found"]] 
bad-perms: ["400 Forbidden" 
[

ERROR



*"REBOL Webserver" 
 "error 400"
*"You do not have permission to view the file"]] 
http-head: func [type mime][
reform ["HTTP/1.0" type newline "Content-type:" mime newline newline]
] 
error: func [err][insert conn append http-head err/1 html err/2]
while [on] [
conn: first wait listen
if  "HTTP" = htfile: third parse first conn "/" [htfile: "index.html"]
mime: either 2 > length? mime: parse htfile "." [html][get to-word mime/2]
any [all [not exists? file: join wwwpath htfile error not-found]
 all [error? try [data: read/binary file] error bad-perms]
 write-io conn data: append http-head "200 OK" mime data length? data
] close conn
]

Wishing i could write like this :)
Volker



[REBOL] Script return code Re:(2)

2000-02-24 Thread VoToNi

In einer eMail vom 24.02.00 12:24:36 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Maybe I wasn't clear enough, my posting was referring to situations in 
which 
> one
>  has to "glue" together the execution of multiple scripts, not necessarily 
> all of
>  them written in Rebol. A motivation could be legacy applications (if we 
call
>  "legacy" whatever is already there and we won't/can't modify/rewrite).
>  To give a real example, I need to integrate a number of Perl scripts with 
> Rebol
>  scripts; I'm doing that via a main shell script - though this detail is not
>  relevant. In my case it's not a question of legacy software - I had to 
write
>  some pieces in Perl because I need to access a RDBMS, something I can't do 
> today
>  in Rebol.
>  So the "driver" script (the high-level shell script in my case) needs to 
> know
>  what's going on with the execution of the Perl and Rebol scripts. Perl 
poses 
> non
>  problem, but with Rebol I can't use the same mechanism. Of course I can 
have 
> it
>  worked out - I was wondering if anybody else felt my same need.
>  I think the matter may be considered on the level of "design principles" 
or, 
> in
>  some sense, on the "philosophycal" side of what one expects from a 
> programming
>  language...
>  
>  Ciao
>  
>  Mauro
>  
Why not using perl for the main-script, it can start external programs, so 
also rebol. 
i think rebol can write to stdout, so simply pipe the result to perl?
i don't know mutch perl, if it can make bidirectional pipes when starting, 
both can even communicate over it.
i searched for perl with bidirectional pipes once a bit, but did not find 
them. So if you know, please tell :)


Gruss Volker



[REBOL] select question Re:

2000-02-24 Thread VoToNi

In einer eMail vom 24.02.00 03:25:34 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> I have a series with multiple identical entries, but different values:
>  
>  [ "book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M" ]
>  
>  I want to search the series for each occurrence of say "book" and then 
>  evaluate it for a match.  How can I do this?  Or, is select perhaps not 
the 
>  right hammer to beat this puzzle with?
>  
>  
>> i: a  s: "book"
== "book"
>> while[i: find i s][ probe i  i: next i ]
["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
["book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]

Trick: find itself returns position in a series, you can simple continue from 
here. Good Design :)
Attention! This does not work with hash!

stepwise beyond:

>> s: "book"
== "book"
>> a: [ "book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" 
"M&M" ]
== ["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
>> b: find a s
== ["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
>> c: next b
== ["The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
>> d: find c s
== ["book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
>> ;...
>>
>> ;so
>> i: a  s: "book"
== "book"
>> while[i: find i s][ probe i  i: next i ]
["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
["book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
== none
>>
>> i: a  s: "M&M" ; make shure it works on end..
== "M&M"
>> while[i: find i s][ probe i  i: next i ]
["M&M"]
== none


Gruss Volker



[REBOL] empty context possible? Re:(3)

2000-02-20 Thread VoToNi

Hello GabrieIe!

n einer eMail vom 19.02.00 13:47:37 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> On 18-Feb-00, you wrote:
>  
>   V> I did and got something similar to this, but was able to hack
>   V> it with going to global scope by "/probe" instead of "probe".
>  
>  Actually, it doesn't work, or at least it doesn't here. I just get
>  "hello" returned (just because it is the last value in the block);
>  indeed, /probe is a refinement, not a word, so it is not evaluated
>  as a word.
>  

My mistake, overlooked "last command is return value". Found something with 
contexts and a word with a beginning "/". Thought, maybe "/" is something 
like root-dir in unix, tryed a bit and what i expected was printed. No 
error-messages! I thought i was clever :)
Thanks for the correction. Trust it now :o) 

- Maybe unused blocks and that should give a warning, optional? They are 
pretty to obfuscate code.
Is there another reason for them (except return-value) ? Specially me is able 
to edit in outcomments and wondering why nothing happens a while :-)

Gruss Volker



[REBOL] New? programming construct Re:

2000-02-18 Thread VoToNi

rules maybe like this (full code below)

; example
gui: make object! [
a: rule-var "a0"
b: rule-var "b0"
c: rule-var "c0"
rule [ a b ] func [][ trace-state "one of [a b] changed" c/set 
'c-by-rule-ab ]
rule[ c ] func[][ trace-state "c changed" ]

trace-state: func[id][print ["rule[" id "]"   a/get b/get c/get]] ; 
tool
]

I prefer the browser-like approach of Rebol/View: 
one page per action, create a new page after each action. No hidden 
Recursion, no bugs.

In einer eMail vom 17.02.00 04:39:17 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Those interested in new and unusual programming constructs, take a look at
>  R++ from AT&T, where Bjarne Stroustrup, the inventor of C++, works. Here's
>  the link:
>  http://www.research.att.com/sw/tools/r++/
>  
>  
>  R++ extends the C++ language with a single new programming construct -- the
>  rule. In addition to data-members and member functions, R++ adds a new kind
>  of member to C++ classes namely "member rules". A rule is a statement
>  composed of a condition and an action that specifies what to do when the
>  condition becomes true. Whenever some program data changes, rules whose
>  conditions involve that data are examined, and if a rule's condition
>  evaluates to true, its action is executed. The action may of course modify
>  data and therefore trigger other rules. Currently R++ is implemented as a
>  pre-processor. It translates R++ rules into C++ code.
>  
>  
>  What would this look like in REBOL?
>  
>  Andrew Martin
>  ICQ: 26227169
>  http://members.xoom.com/AndrewMartin/
>  

[REBOL[]

;
; tools: rule-var rule
;
rule-var: func [ init-value ][
make object! [
value: init-value
listeners: copy []
set: func [ new-value ] [ 
value: new-value
foreach here listeners  [ here ]
]
get: func[][value]
listen: func[ listener ][ append listeners :listener ]
]
]
rule: function[vars method][sum vals][
foreach here vars [
val: get here
val/listen get 'method
]
]
;
; example
;
gui: make object! [
a: rule-var "a0"
b: rule-var "b0"
c: rule-var "c0"
rule [ a b ] func [][ trace-state "one of [a b] changed" c/set 
'c-by-rule-ab ]
rule[ c ] func[][ trace-state "c changed" ]

trace-state: func[id][print ["rule[" id "]"   a/get b/get c/get]] ; 
tool
]

print "set a"
gui/a/set 'a1
print "set b"
gui/b/set 'b1
print "set c"
gui/c/set 'c1
print "done"
]




Gruss Volker



[REBOL] empty context possible? Re:

2000-02-18 Thread VoToNi

In einer eMail vom 16.02.00 14:05:52 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Is it possible to create an empty context and put only selected words in? 
for 
> 
>  security-reasons, like postscript does.
>  
(i lost her mail, so by hand :)

Gabrielle answered ([EMAIL PROTECTED])
>Yes, it is, but you actually need to create a context with all the
>words set to UNSET!. You can refer to the message 95706 I posted
>to this list on 31st January for an example (you can find it on
>http://www.rebol.org/ or request it to SELMA).

I did and got something similar  to this, but was able to hack it with going 
to global scope by "/probe" instead of "probe". so for security this is not 
enough!! (Gabrielle, please don't try this with "/delete rebol.exe"!!! 
But thank you for the adding-of-contexts-example! I understand this stuff now 
much better! :)

REBOL[]

allowed: make object! [ ; only this two allowed, not "probe" for 
example..
 print: get in system/words 'print
 none: system/words/none
]
all-unsets: use first system/words ['system]

code: [print "Hello!"]
malicious-code: [/probe "hello"] ; the "/" breaks out!

bind code all-unsets
bind code in allowed 'self
do code

bind malicious-code all-unsets
bind malicious-code in allowed 'self
do malicious-code


Gruss Volker



[REBOL] empty context possible?

2000-02-16 Thread VoToNi

Is it possible to create an empty context and put only selected words in? for 
security-reasons, like postscript does.


Gruss Volker



[REBOL] security-suggestion: timeout

2000-02-16 Thread VoToNi

how about a trigger for a timeout when "do"ing something, like a auto-escape? 
together with restricted contexts a server could run client-scripts relative 
secure.

Gruss Volker



[REBOL] URL-encoding Re:

2000-02-16 Thread VoToNi

In einer eMail vom 16.02.00 01:06:43 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> Is there any way to convert a string to an URL-encoded form in REBOL
>  yet?
>  A la "Chris L" to "Chris%20L"?
>  Or do I have to write a translator for special characters myself?
>  

as rebol-url (to use encoded, but print converts back):
to-url "Chris L"

for strings ( to print encoded )
mold to-url "Chris L"

Gruss Volker



[REBOL] How can i get rebol/view

2000-02-10 Thread VoToNi

Can't find it on the webpage. Peoples here are talking about.
how can i test it?

Gruss Volker