• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp13
r3wp181
total:194

results window for this page: [start: 1 end: 100]

world-name: r4wp

Group: #Red ... Red language group [web-public]
DocKimbel:
17-Oct-2012
I'm perfectly fine with the current BSD/BSL licensing model we use 
for Red. I don't see the need for any change there for now.


I'm not sure what you mean precisely with "product". I don't see 
why third-parties redistributing the current Red compilers would 
have problem distributing a copy of the BSD license with them. For 
end-user binaries, users have no obligations to give a copyright 
reference or distribute a copy of the license.


If you are wondering about including possible future R3 code parts 
under APL-2 in Red codebase, I see no problem with that so far (as 
long as they are separate files or modules, we don't want to start 
having several licenses per file).
Pierre:
11-Jan-2013
REBOL []

do/args %makedoc2.r 'load-only
doc: scan-doc read file: system/options/script
set [title out] gen-html/options doc [(options)]

file: last split-path file
replace file ".txt" ".html"
file2: copy file
insert find file2 "." "-light"
replace out "$DARK$"  file
replace out "$LIGHT$" file2

write file out
replace out "dark.css" "light.css"
write file2 out
Bo:
1-Jul-2013
OK.  I have this snippet of Red/System code that is giving me an 
access violation.  I can't seem to find why:

dirs-file: as-c-string 64
dirs-file: "to-process/dirs.txt"
dirs: as-c-string 1024

dirs: read-file dirs-file	;'dirs now contains the contents of %to-process/dirs.txt
eol: as-c-string 1024
eol: find-char dirs #"^/"	;Finds the first end-of-line character
line-len: as-integer eol - dirs

print-line line-len	;In my example, this returns 24, which is correct

first-line: as-c-string (line-len + 1)	;An extra byte for #"^(00)" 
to be safe

copy-string-part first-line dirs as-integer eol - dirs	;Access violation. 
 Why?
Bo:
2-Jul-2013
With the updated ANSI.reds, I get the following error when compiling 
now:


*** Compilation Error: argument type mismatch on calling: copy-string
*** expected: [integer!], found: [c-string!]
*** in file: %motion-detect.reds
*** at line: 47
*** near: [
    append-string file1 first-line
    file3: as c-string! allocate 128
]
Bo:
2-Jul-2013
Here's the troubling bit of code:

	dirs: make-c-string 1024
	dirs: read-file "to-process/dirs.txt"

	eol: make-c-string 1024
	eol: find-char dirs #"^/" ;Finds the first end-of-line character

 line-len: as-integer eol - dirs + 1 ;Add one byte for the end-of-string 
 character
	first-line: make-c-string line-len
	copy-string-part dirs first-line as-integer eol - dirs ;reversed
	first-line/line-len: #"^(00)"

Shouldn't 'find-char dirs #"^/" return the first newline byte?
Group: Ann-Reply ... Reply to Announce group [web-public]
Cyphre:
5-Jan-2013
yes, networking is not done yet.

You just download a *.r script (or copy on your sdcard in the phone). 
Then you can just clik on the script file and file association requester 
should popup so you can run *.r scripts just by clicking on them 
instead of execution from console.
Group: Rebol School ... REBOL School [web-public]
MagnussonC:
18-Sep-2012
I read a file, line by line and want parts of each line in certain 
variables. First is an integer then a space and then a 3-4 character 
word then a space and then the rest of the line in a string. I guess 
there is no way like in Perl to match those variabels at once and 
put the value in numbered variables. I suppose I need to parse that 
line with something like (thru "a" copy b to "c") once for each variable 
(or perhaps first char with line/1)!?
Ladislav:
5-Oct-2012
Rebol [
    Title: "Catch"
    File: %catch.r
    Date: 5-Oct-2012/17:49:58+2:00
    Author: "Ladislav Mecir"
    Purpose: {
    	Catches local throw'
    	Ignores non-local throws
    }
]

; Error definition
system/error: make system/error [
	throw': make object! [
		code: system/error/throw/code + 50
		type: "throw' error"
    	not-caught: ["throw' not caught"]
    ]
]

catch': func [
    {Catches a throw' from a block and returns the value.}
    [throw]
    block [block!] "Block to evaluate"
    /local err disarmed
] [
	use [throw'] copy/deep compose/only [
		; "localize" 'throw' in the block
		block: (block)

		throw': func [[catch] value [any-type!]] [
			disarmed: disarm err: make error! [throw' not-caught]
			set/any in disarmed 'arg1 get/any 'value
			disarmed/arg2: 'throw'
			throw err
		]

		get/any either all [
			error? set/any 'err try block
			(
				disarmed: disarm err
				disarmed/type = 'throw'
			)
			disarmed/id = 'not-caught
			disarmed/arg2 =? 'throw'
		] [
			in disarmed 'arg1
		] [
			'err
		]
	]
]
JohnM:
14-Nov-2012
Thanks for the welcome back message.
 

 I left off asking about the mySQL driver. So I want to insert into 
 a database a random number the code already generated and associate 
 it with an email address that was provided by a CGI form. Have yet 
 to create this in the real world but for now let us assume I will 
 call the database "customers". The people who process the credit 
 card and collect the email address advised me that the address will 
 be labelled "trnEmailAddress".


 After finding the mySQL driver Here is what I figured out using placeholders 
 for things like password, etc. Would appreicate knowing if this is 
 correct.

; Loads MySQL driver
do %mysql-driver/mysql-protocol.r
; Opens connection to MySQL server
db: open mysql://[[user][:pass]@]host[:port]/database


; Send query to database server. Enters random number from above. 
customers is probably the name of the database I will create

insert db ["INSERT INTO customers VALUES (?,?)" "trnEmailAddress" 
"token"]



 Next I need to insert an existing PDF file (an e-book) into a directory 
 created by the script. The directory will be named after a random 
 number that was earlier generated by the script. I am astounded that 
 I can not find the command to copy a file. So the variable assigned 
 to this random number is called "token".

 So I have the following.

make-dir %token/


 How do I copy a file into this new directory? Also, is that the corecct 
 way to make a directory?
Group: Databases ... group to discuss various database issues and drivers [web-public]
Pekr:
4-Jul-2013
Or differently, has anyone worked with excel files via ODBC, using 
either R2 or R3? I tried Graham's code, which works for .xls files, 
but not .xlsx files. When I convert my file to .xls, R2 returns - 
not enough memory :-(

p: open [
     scheme: 'ODBC

     target: "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=c:\path-to-file\file.xls"
]
conn: first p
insert conn "select * from [Sheet1$]"
result: copy conn
Group: !Syllable ... Syllable free operating system family [web-public]
Arnold:
14-Apr-2012
I can not copy any file by dragging and dropping also ctrl-c ctrl-v 
didn't work. Copying a file should be easy?
Arnold:
14-Apr-2012
I think delete should not be in the right-click menu only if you 
push shift or alt maybe. And there should definitely be an option 
to select move or copy a file.
Kaj:
14-Apr-2012
Dragging moves a file. Hold Control to copy or Alt to make a symlink

world-name: r3wp

Group: All ... except covered in other channels [web-public]
Graham:
1-Feb-2005
it can do an incremental backup .. but I don't if it will or will 
not copy over a later file if they are different
Group: !AltME ... Discussion about AltME [web-public]
Izkata:
10-Mar-2005
Yep Brian, that's it.


I'm gonna try something.. I was looking around the AltMe folders, 
and found a file that looked like all it contained were dividers. 
 I'll copy AltMe to a new folder (backup) and copy the Worldmaster 
one over my Custom on
[unknown: 9]:
29-Mar-2005
I think of communication software a little differently (in general), 
so I will share this.  

Read states

 (like the Red we are talking about) are a very interesting issue. 
  


Most computer software does a very poor job of replicating empirical 
or visceral conversations.  Email for example has a method of describing 
the "direction" you are speaking.  TO: Bob, CC: Carry.  Where the 
TO: indicates you are speaking directly to Bob, and that Carry is 
standing somewhere to the left or right of you.  BCC is someone hiding 
behind you. 


Email could have an interface where you first pick the people in 
the "room." And then use something like a 2D interface to move the 
listeners around a symbolic version of you.  This would be both silly, 
time consuming, and somewhat confusing, but you get the point.


What you have read and what you have not read though has a similar 
analogy.   There are thousands of sub states and markers people use 
to sort things they have read, will read, need to read again, need 
to respond to, etc.


In Box, Out Box, Papers upside down, putting papers you need to sign 
under your car keys on the floor in front of the door leading to 
the car, etc.


I have one friend who re-wrote some open source email program to 
have some huge number of states and then some simple filters.  It 
works VERY WELL, if you know his system.  He never forgets anything.


So the current model AltME has (right now) is a very simple interface. 
 Tantimount to "Have I ever seen this before."


We are playing with some other models in Qtask, which may get adopted 
into AltME.  I'm working on a system I call Venn Chat.  Some features 
include:

Have I read this before? (like AltME)
Mark this:  

Follow up (add to a list of messages you want to think about more)
Note (All should read this when they come into the group)
All Must Read (converts it into an AltME-like alert)


Convert to a task (and keep the context of the chat in place, this 
is opens up a whole other area)
Branch (something like forum threading)
Re-file (move from one group to another)

Re-post (copy to another group, at the same time, similar to branch).
Trigger (tell me when someone has finally read this).
Status (tell me who has read this so far).
Attach (files, links, etc)
Henrik:
16-Oct-2006
Only the last test above was done in Windows XP. The others were 
done in OSX.


When I paste from TextEdit in MacOSX into a VID textarea, ^M is pasted, 
and it doesn't work right. When I paste from Notepad in Windows into 
a VID textarea, ^/ is pasted and it works correctly. So the results 
are different, yes.


When I copy and paste from a VID textarea to TextEdit, it looks alright, 
but this might be due to how TextEdit handles different line ending 
chars the same. I can't see the line endings in TextEdit. When I 
save the TextEdit file to disk in Windows Latin 1 format and read 
it in REBOL, the line endings are correct.


When I copy and paste between two VID text areas in OSX, it looks 
alright.


OSX Rebol/View has also another bug in which, when using cursor up 
or down in a text area, the cursor also moves one char to the left.
ManuM:
20-Feb-2009
Vladimir: CTRL+C works for me ( Kubuntu 8.10 ), but I only can paste 
( CTRL+V ) at any area of Altme ( New message area, Your current 
status area, Search area, ... ). If I want to copy one url to paste 
at other program, I export messages ( top-right button ) and save 
to a file ( I think html file is better ). Then I can open the file 
and copy the url
Sunanda:
2-Jun-2010
Glad it's close enough for your current purpose.

If you need better searches for a specific research project, consider 
writing a few lines of REBOL and scanning your own local copy of 
/altme/worlds/rebol3/

The users.set file is simply a text file from which you can map group 
numbers and poster-ids/poster names
/chat/*.set is a series of text files, one per chat group.
It is pretty easy to do.

Or take a look at modifying this:
   http://www.rebol.org/view-script.r?script=skimp-my-altme.r
Group: RAMBO ... The REBOL bug and enhancement database [web-public]
Romano:
9-Feb-2005
rebol[
	Author: "Romano Paolo Tenca"
	Date: 10/02/2005
]
split-path-3: func [

 "Splits a file or URL pos. Returns a block containing path and target."
    target [file! url!]
	/local dir pos
][
	parse/all target [
		[#"/" | 1 2 #"." opt #"/"] end (dir: dirize target) |
		pos: any [thru #"/" [end | pos:]] (

   all [empty? dir: copy/part target at target index? pos dir: %./]
			all [find [%. %..] pos: to file! pos insert tail pos #"/"]
		)
	]
	reduce [dir pos]
]
DideC:
19-May-2005
init-connection: func [
		new /service server 
		/local proto evt list len names i fun
	][
		new/locals: context [
			handler: any [
				all [service server/server-type]
				proto: select protocols new/locals/1
			]
			write-queue: copy []
			file-chunk: 64 * 1024
			stop: handler/stop-at
			in-buffer: make binary! 64 * 1024
			file: flag-close: events: none
		]
		if proto [
			evt: reduce new/user-data
			help new/locals
			list: array len: length? names: new/locals/handler/events
			i: 1
			until [
				if fun: select evt pick names i [poke list i :fun]
				len < i: i + 1
			]
			new/locals/events: list
		]
		actives/add new
	]
Anton:
22-May-2005
; find version
cont: read/binary file
version: none
result: parse/all cont [
	some [

  [to "REBOL/View " "REBOL/View " mark: version-rule end: (version: 
  copy/part mark end) to end]
		| thru "REBOL/View "
	]
]
Anton:
27-Jun-2005
file: %/volume/directory/file.r
path: find/match file %/volume/  ;== %directory/file.r
split-path path  ;== [%directory/file.r %file.r]  ; <--- wrong !!
split-path copy path  ;== [%directory/ %file.r]
btiffin:
19-Nov-2006
Graham: I might not quite be getting it but this style works for 
me.  Wrap your code in a "go" function and then ; Loop forever
forever [
    if error? result: try [go] [
        errobj: disarm result
        errorlog [mold errobj]
        either noask [
            alert reform ["There has been an error logged"
                  newline copy/part mold errobj 200

                  newline "See File/Configure/View Error File/ for more info"]
        ][

            unless question/title reform ["There has been an error logged."

                                  newline copy/part mold errobj 200] "Continue?" [
                print ["Type Q to quit, GO to restart FirM"]
                halt
            ]
        ]
    ]
    ; halt
    recycle
]
Group: Core ... Discuss core issues [web-public]
Brock:
15-Apr-2005
Is this a bug?

1)  I read a directory on our ftp server and return a set of files 
of which  02 EN AR final.pdf is one of them

2)  I then copy a URL address that returns a 404 indicating it couldn't 
find the file in question ie.  http://www.cpcpension.com/files/2002EN AR final.pdf

3)  I do a  split-paths to-url on the contents of the clipboard:// 
that contains item in step 2)

4)  I compare the file names for equality either using "=" or equal? 
and both return false
5)  I check the type of each file, they are both 'file' types

6)  I check the length of each file, the one from step 1) returns 
20, step 2) returns 26


So, somewhere it is changing the   representation of a space into 
the actual string " ".
Any ideas?
6)
Janeks:
9-May-2005
How to set correctly progress function for read-net? Or what causes 
following error and :                                            
                >> myProgr: func [ tot bt ] [ print bt / tot ]

>> read-net/progress to-url "http://maps.dnr.state.mn.us/cgi-bin/mapserv36?map=/usr/loca

l/www/docs/mapserver_demos/tests36/expressions/test.map&map_counties_class_expression=(%

5bAREA%5d %3e 7577272785.15339)&layer=title&map_title_class_text=Counties+Larger+Tha
n+Itasca+County&mode=map" :myProgr
0.425625
** Script Error: not is missing its value argument
** Where: read-net

** Near: all [:callback size not callback size length? buffer data: 
true break]
not data
>> source read-net
read-net: func [

    {Read a file from the net (web). Update progress bar. Allow abort.}
    url [url!]

    /progress callback {Call func [total bytes] during transfer. Return 
    true.}
    /local port buffer data size
][
    vbug ['read-net url]
    if error? try [port: open/direct url] [return none]

    size: to-integer any [port/locals/headers/content-length 8000]
    buffer: make binary! size

    set-modes port/sub-port [lines: false binary: true no-wait: true]
    until [
        if not data: wait [60 port/sub-port] [data: true break]
        if data: copy port/sub-port [append buffer data]

        all [:callback size not callback size length? buffer data: true break]
        not data
    ]
    close port
    if not data [buffer]
]
>>
Pekr:
7-Aug-2005
>> prefix: func [filename][copy/part file find/last file "."]
>> prefix file
== %movie.cd1.divx-rel6
Pekr:
7-Aug-2005
but prefix is wrong :-) body uses my global 'file variable - should 
be prefix: func [filename][copy/part filename find/last filename 
"."]
Volker:
7-Aug-2005
i guess parse-rule would be longer in this case. now trying

re-suffix: func [file suffix][append copy/part file find/last file 
"." suffix]
Henrik:
21-Aug-2005
Suggestion: ATTEMPT offers no possibility to provide a default value 
in case of failure. How about:

attempt/failure [2 / 0] "Invalid!"
== "Invalid!"

attempt [2 / 0]
== none

default-values: [a b c]

values: copy attempt/failure [read %values-file] default-values

2% more elegance? Or a debugging trap?
Volker:
21-Aug-2005
inbuild:
values: copy any[attempt [read %values-file] default-values]
Ladislav has something like your suggestion, called 'default.
[unknown: 5]:
5-Oct-2005
At work we have an issue with supporting extremely large pst (outlook 
personal folder files).  The issue is that we wont to make sure these 
files get backed up when the sales force connects with the network. 
 Problem is that the M$ solutions built into Windows XP cause problems 
because if it sees a changed file it then trys to copy the entire 
file - I believe this to be the case with offline folders files and 
briefcase files also.  What I would like to see is a solution whereby 
only certain contents of the file detected as changed are copied 
over the network and update the master file.  It occurred to me that 
 this should be a capability of any X-Internet application that deals 
with significant file sizes.  So my question is - does anyone know 
of any method's, algorithms or such that currently do such work?
Luca:
22-Jan-2006
Gregg: Thank you, you are right, I forgot the 'THIRD problem. In 
other scripts I used the following solution to bypass it.

'prefs is an object containing various data types.
'rp2pcprefs is the file to save it to

save-prefs: func [/local prefstmp][
	prefstmp: copy/deep [] 
	foreach w next first prefs [
		append prefstmp reduce [to-word w get in prefs to-word w]
	]
	save rp2pcprefs prefstmp
]

load-prefs: func [/local prefstmp][
	prefstmp: make object! [] 
	if exists? rp2pcprefs [
		foreach [w v] load rp2pcprefs [

   prefstmp: make prefstmp reduce [to-set-word w ""] set in prefstmp 
   to-word w v
		]
	]
	prefstmp
]


Henrik: 'difference is a good point I didn't think to, then I like 
the one-liner :), thank you.
Volker:
19-May-2006
p: open file
p: skip p 123
data: copy p
IIRC
Oldes:
31-May-2006
Anton, yout ftp patch was not working, but I solved the issue with 
missing directories using this code:
while [

 error? set/any 'err try [trgp: open/direct/new/write rejoin [ftp-url 
 trg-dir trg-file]]
][
	err: disarm err
	if all [
		err/code = 800
		parse err/arg1 [thru "tcp 550 " copy missingdir to ":" to end]
	][
		print ["Making directory:" join ftp-url missingdir]
		if error? try [make-dir join ftp-url missingdir][
			trgp: none
			break
		]
	]
]
Group: Script Library ... REBOL.org: Script library and Mailing list archive [web-public]
Ammon:
8-Mar-2009
Sunanada, I have another question for you.  While I was poking around 
the library earlier I noticed that I have named some of my scripts 
very poorly and would like to change the FILE: value in the header, 
which apparently just creates a new copy of the script.  Is there 
a way to remove the old script such that I really am renaming the 
script rather than uploading a new one?
Sunanda:
16-Mar-2009
Of the various editors / word processors I have immediately to hand:

-- credit.exe -- [my usual editor] shows incorrect chars, and has 
no option to switch to UTF-8

-- open office writer -- works fine if you take the UTF-8 option 
when asked
-- ms word -- claims file is corrupt
-- word perfect -- makes a complete mess

-- R2/View's built in editor ( editor %/c/path to my local copy//ascii-math.r) 
-- shows incorrect chars
sqlab:
14-Apr-2009
Mike

I checked your library example from the I'm new group producing errors.

There is probably a weakness, as the script does not regard comment 
lines.
A short enhancement would be
   
parse-ini-file: func [
    file-name [file!]
   /local ini-block
    current-section
    parsed-line
    section-name
][
 ini-block: copy []
    current-section: copy []
    foreach ini-line read/lines file-name [
		if #";" <> first ini-line [ ; do not process comment lines
			section-name: ini-line
			error? try [section-name: first load/all ini-line]
			either any [
				error? try [block? section-name]
				not block? section-name
			][
				parsed-line: parse/all ini-line "="
				append last current-section parsed-line/1
				append last current-section parsed-line/2
			][
				append ini-block current-section
				current-section: copy []
				append current-section form section-name
				append/only current-section copy []
			] ;; either
		]
    ] ;; for
 append ini-block current-section
 return to-hash ini-block
 ]
Group: View ... discuss view related issues [web-public]
Anton:
9-May-2005
As a minimum copy the notes into a text file...
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public]
RobertS:
31-Aug-2007
; this now makes sense
>> file: %image.jpg

>> print copy/part file find file "."  ; == "image"   I will focus 
on this example in my tutorial but only AFTER
>> fileName: "image.jpg"
>> print copy/part fileName find fileName "."  ; == "image"
mhinson:
16-Apr-2009
The mist maybe slowly clearing (sorry to be so slow to catch on).

The 2 stage process may be the answer, perhaps I can add a key char 
at the first line position when I read the file, then use this as 
the line start reference, but continue to use the end of line as 
normal.


I think I understand Peter's example & have tweaked it a bit to make 
it work for me.


lines: {~junk Interface fa0
~!
~interface fa1
~interface fa2 point-to-point
~!
~interface Fa3
~ description test three
~ ip address 1.1.3.3 255.255.255.0
~!
~interface Fa4
~ ip address 1.1.4.4 255.255.255.0
~!
~interface Fa3
~ description test four etc
~}

spacer: charset "^/"
name-char: complement spacer
stopwords: "point-to-point"

keywords: ["~interface " | "~ description " | "~ ip address"]

parse/all lines [any
  [ 

     copy int-keyword keywords copy int-text [to stopwords | some name-char] 
     (
       print  [int-keyword ": " int-text]
    )
    |
    skip
 ] 
]
Pekr:
16-Apr-2009
uh, was on slow connection, so my reply got lost. Mhinson - there 
is no symbolic way to represent beginning of the line. I don't know 
any in any system. The only thing I know is end-of-line (newline). 
I know what you probably mean - you want to identify beginning of 
your lines, but even for first line (so not a rule, matching newline 
first, then next char = beginning of line). But - there is still 
various ways of how to do it. First - I think that your config files 
are chaos. Do they have any rules for some sections at all? :-) I 
also like what sqlab mentioned - sometimes it is easier to break 
stuff into 2 pass strategy. Read/lines is your friend here. You can 
try it on text files and you'll see, that the result is going to 
be a block of lines. I usually do:

data: read/lines %my-data-file.txt

;--- remove empty lines from block of lines ...
remove-each line data [empty? trim copy line]

foreach line data [do something with data ....]


Simply put - if rules for parser are out of my scope of capabilities 
(which happens easily with me :-), I try to find my other way around 
...
mhinson:
18-Apr-2009
I have written my first bit of code that is starting to do something 
useful.

All the bad bits are mine & all the good bits are from the help I 
have been given here.

My main intention is to start off with code that I can understand 
& develop so any criticism would be most welcome.


My next step is to remove the debug code & replace it with code that 
stores all the information in a structured form for searching & further 
analysis.
Thanks for all your help with this.

filename: copy %/c/temp/cisco.txt   ;; cisco config file
host: copy []
interface: copy []
intDescription: copy []
intIpAddress: []
ipRoute: []
IntFlag: false
spacer: charset " ^/"
name-char: complement spacer

lines: read/lines filename

foreach line lines [          ;; move through lines

 parse/all line [copy temp ["interface" to end] ( ;; evaluated if 
 "interface" found preceeded by nothing else
		interface: copy temp 
		print interface           ;; debug code
		IntFlag: true)   

 | copy temp2 [" desc" to end] (  ;; evaluate if " desc" found preceeded 
 by nothing else
		if IntFlag [print temp2]     ;; debug
	) 
	| copy temp3 [" ip address" to end] ( ;; " ip address"
		print temp3    ;; debug
	)
	| copy temp4 ["hostname" to end] ( ;; "hostname"
		print temp4      ;; debug
	)

 | copy temp5 [name-char to end] ( ;;  any char except space or newline. 
 this must be last 
;		if IntFlag [print temp5]      ;; debug
		if IntFlag [print "!"]      ;; debug
		IntFlag: false
	)
	] 
]

;######################################

 the input file contains these lines which are extracted (except the 
 !) plus it has a load more lines that are ignored at the moment.

hostname pig
interface Null0
!
interface Loopback58
 description SLA changed this
!
interface ATM0
!
interface ATM0.1 point-to-point
!
interface FastEthernet0
 description my first port
!
interface FastEthernet1
 description test1
!
interface FastEthernet2
 description test2
!
interface FastEthernet3
!
interface Dot11Radio0
!
interface Vlan1
 description User vlan (only 1 vlan allowed)
!
interface Dialer0
 description $FW_OUTSIDE$
 ip address negotiated
!
interface BVI1
 description $FW_INSIDE$
 ip address 192.168.0.1 255.255.255.0
!
!########### end ##########
mhinson:
19-Apr-2009
ok. I follow your extraction of rules idea & this is what you had 
in your original suggestion.  Now I am getting more familiar with 
what I am looking at I can understand the benefit of that & will 
start to work that way now.

[copy .. [" ip address" to end]]  was to get the interface address 
in the interface section of the file. It is identified by
1) some line after the line containing "interface"

2) at the begining of the line always starting with one space before 
the word "ip address"

3) before any line with a non-blank first char unless it is a new 
instance of "interface" (hence my IntFlag which Steeve didn't like 
my method of use)


I found from testing that [to "ip address" copy temp to end] or [to 
" ip address" copy temp to end] found the string anywhere in the 
line, but [copy .. [" ip address" to end]] only finds the string 
if it is at the start of the line which is what I was trying to achieve. 
Have I made a mistake here & need to retest my assumptions perhaps?


I always appreciate lots of different views on issues so I am loving 
the multiple responses. 

Sunanda you have reminded me about line numbers. I will tackle them 
after the extraction of rules I think, as I want them in my output 
for data output quality & validation checking.


I have been looking at your parse-ini.r to see how you have read 
a file into a Rebol block, but I may stick with read/line for a bit 
longer while get my head round parsing each line in turn.  I get 
the impression that once I have a final block of code there will 
be someone who can turn it into 2 short lines including a built in 
Easter egg game.
mhinson:
19-Apr-2009
I have tried to understand & take on what I have been told, thanks. 
Is this worse or better. It does what I was looking to do & I know 
how to extend it in the same structure.  I am sure it would be educational 
for me if anyone has time to tear it to shreds please.


Should I stop using read/line now?  Would I get the benefit still? 
Or is the requirement too fragmented for this approach now?
Should I use functions anywhere instead?
Have I initialised my variables in the right & appropriate way?

filename: copy %/c/temp/cisco.txt   ;; cisco config file
outFile: copy %/c/temp/outFile.log  ;; tab separated output
hostname: copy []
interface: copy []
intDesc: copy []
intIpaddr: []
ipRoute: []
IntFlag: false
spacer: charset " ^/"
name-char: complement spacer

lines: read/lines filename


outInterface: [ write/append outFile reduce 

 [filename tab i tab hostname tab interface tab intDesc tab intIpaddr 
 newline]
]

clearInterface: [
	interface: copy []
	intDesc: copy []
	intIpaddr: []
]


interfaceRule: [ ["interface " copy temp-interface to end] (   ;; 
captures point-point as well

  if IntFlag outInterface           ;; start of new interface section 
  so output data collected previously.
		if IntFlag clearInterface        
		interface: copy temp-interface
		print ["! found at line " i]      ;; debug
		print current-line                ;; debug
		IntFlag: true
	)
]

descRule: [ [" description " copy intDesc to end] (  
		if IntFlag [print current-line]     ;; debug
	)
]
	
ipAddrRule: [[" ip address " copy intIpaddr to end] ( 
		print current-line                  ;; debug
	)
]

hostnameRule: [["hostname " copy hostname to end] ( ;; "hostname"
		print current-line                  ;; debug
	)
]

iprouteRule: [copy iproute ["ip route" to end] ( ;; "ip route"
		print current-line                  ;; debug
	)
]



IntFlagRule: [copy tempZZ [name-char to end] ( ;; not space or newline. 
this must be out of the int section

  if IntFlag outInterface      ;; end of interface section so output 
  data collected.
		if IntFlag clearInterface
		if IntFlag [print "!"]       ;; debug
		IntFlag: false               ;; 
	)
]

i: 0


foreach line lines [i: i + 1 ;; move through lines & track line number
	current-line: line       ;; for debug output
	parse/all line [         ;; parse only using rules below

  interfaceRule        ;; evaluated if "interface" found preceeded 
  by nothing else

  | descRule           ;; evaluate if " desc" found preceeded by nothing 
  else
		| ipAddrRule         ;; " ip address"
		| hostnameRule       ;; " hostname"
		| iprouteRule        ;; "ip route"

  | IntFlagRule        ;; unset interface flag if no longer in interface 
  section (no " ^/")
	] 
]
Graham:
19-Apr-2009
filename: copy %/c/temp/cisco.txt   ;; cisco config file
outFile: copy %/c/temp/outFile.log  ;; tab separated output
Steeve:
19-Apr-2009
What the need of flags and splitted lines, uh ?
you can't write simple semantic ?
Reading, your example file , you've got these simple rules.

1/ counting the lines
line: [ thru newline (n: n + 1)]


2/ one interface mays contain several lines (infos) and is terminated 
by a line beginning by "!"  
interface: [
	"interface" copy interface* line 
	any [infos | #"!" line break]
]

3/ infos may be description, ip-adrr, ip-tables
infos: [
	  " description " copy desc* line 
	| " ip route " copy route* line
	| "ip address" copy ip-add* line 
]

That''s all folks, just parse the whole file with:
parse/all [any [interface | line]]


Please don't use read/lines or internal flags for such simple rules.
Gregg:
11-May-2009
REBOL []

do %include.r
include %file-list.r


flash-wnd: flash "Finding test files..."

if file: request-file/only [
    files: read first split-path file
]
if none? file [halt]

items: collect/only item [
    foreach file files [item: reduce [file none]]
]

unview/only flash-wnd



;-------------------------------------------------------------------------------
;-- Generic functions

call*: func [cmd] [
    either find first :call /show [call/show cmd] [call cmd]
]

change-each: func [
    [throw]

    "Change each value in the series by applying a function to it"

    'word   [word!] "Word or block of words to set each time (will be 
    local)"
    series  [series!] "The series to traverse"

    body    [block!] "Block to evaluate. Return value to change current 
    item to."
    /local do-body
][
    do-body: func reduce [[throw] word] body
    forall series [change/only series do-body series/1]

    ; The newer FORALL doesn't return the series at the tail like the 
    old one

    ; did, but it will return the result of the block, which is CHANGE's 
    result,
    ; so we need to explicitly return the series here.
    series
]

collect: func [
    "Collects block evaluations." [throw]
    'word
    block [block!] "Block to evaluate."
    /into dest [block!] "Where to append results"
    /only "Insert series results as series"

    /local fn code marker at-marker? marker* mark replace-marker rules
][
    block: copy/deep block
    dest: any [dest make block! []]

    fn: func [val] compose [(pick [insert insert/only] not only) tail 
    dest get/any 'val

        get/any 'val
    ]
    code: 'fn
    marker: to set-word! word
    at-marker?: does [mark/1 = marker]
    replace-marker: does [change/part mark code 1]
    marker*: [mark: set-word! (if at-marker? [replace-marker])]
    parse block rules: [any [marker* | into rules | skip]]
    do block
    head :dest
]

edit-file: func [file] [
    ;print mold file

    call* join "notepad.exe " to-local-file file ;join test-file-dir 
    file
]

flatten: func [block [any-block!]][
    parse block [

        any [block: any-block! (change/part block first block 1) :block | 
        skip]
    ]
    head block
]

logic-to-words: func [block] [

    change-each val block [either logic? val [to word! form val] [:val]]
]

standardize: func [

    "Make sure a block contains standard key-value pairs, using a template 
    block"
    block    [block!] "Block to standardize"
    template [block!] "Key value template pairs"
][
    foreach [key val] template [
        if not found? find/skip block key 2 [
            repend block [key val]
        ]
    ]
]

tally: func [

    "Counts values in the series; returns a block of [value count] sub-blocks."
    series [series!]
    /local result blk
][
    result: make block! length? unique series

    foreach value unique series [repend result [value reduce [value 0]]]
    foreach value series [
        blk: first next find/skip result value 2
        blk/2: blk/2 + 1
    ]
    extract next result 2
]


;-------------------------------------------------------------------------------

counts: none

refresh: has [i] [
    reset-counts
    i: 0
    foreach item items [
        i: i + 1
        set-status reform ["Testing" mold item/1]
        item/2: random/only reduce [true false]
        show main-lst
        set-face f-prog i / length? items
        wait .25
    ]
    update-counts
    set-status mold counts
]

reset-counts: does [counts: copy [total 0 passed 0 failed 0]]

set-status: func [value] [set-face status form value]

update-counts: has [pass-fail] [
    counts/total: length? items

    pass-fail: logic-to-words flatten tally collect res [foreach item 
    items [res: item/2]]
    ;result (e.g.): [true 2012 false 232]
    standardize pass-fail [true 0 false 0]
    counts/passed: pass-fail/true
    counts/failed: pass-fail/false
]

;---------------------------------------------------------------


main-lst: sld: ; The list and slider faces
c-1:           ; A face we use for some sizing calculations
    none
ml-cnt:        ; Used to track the result list slider value.
visible-rows:  ; How many result items are visible at one time.
    0

lay: layout [
    origin 5x5
    space 1x0
    across

    style col-hdr text 100 center black mint - 20

    text 600 navy bold {

        This is a sample using file-list and updating progress as files are
        processed. 
    }
    return
    pad 0x10

    col-hdr "Result"  col-hdr 400 "File" col-hdr 100
    return
    pad -2x0

    ; The first block for a LIST specifies the sub-layout of a "row",

    ; which can be any valid layout, not just a simple "line" of data.

    ; The SUPPLY block for a list is the code that gets called to display

    ; data, in this case as the list is scrolled. Here COUNT tells us

    ; which ~visible~ row data is being requested for. We add that to 
    the

    ; offset (ML-CNT) set as the slider is moved. INDEX tells us which
    ; ~face~ in the sub-layout the data is going to.

    ; COUNT is defined in the list style itself, as a local variable 
    in
    ; the 'pane function.
    main-lst: list 607x300 [
        across space 1x0 origin 0x0
        style cell text 100x20 black mint + 25 center middle
        c-1: cell  cell 400 left   cell [edit-file item/1]
    ] supply [
        count: count + ml-cnt
        item: pick items count
        face/text: either item [
            switch index [
                1 [

                    face/color: switch item/2 reduce [none [gray] false [red] true [green]]
                    item/2
                ]
                2 [mold item/1]
                3 ["Edit"]
            ]
        ] [none]
    ]

    sld: scroller 16x298 [ ; use SLIDER for older versions of View

        if ml-cnt <> (val: to-integer value * subtract length? items visible-rows) 
        [
            ml-cnt: val
            show main-lst
        ]
    ]
    return
    pad 0x20
    f-prog: progress 600x16
    return
    status: text 500 return
    button 200 "Run" [refresh  show lay]
    pad 200
    button "Quit" #"^q" [quit]
]

visible-rows: to integer! (main-lst/size/y / c-1/size/y)

either visible-rows >= length? items [
    sld/step: 0
    sld/redrag 1
][
    sld/step: 1 / ((length? items) - visible-rows)
    sld/redrag (max 1 visible-rows) / length? items
]

view lay
Group: Make-doc ... moving forward [web-public]
btiffin:
8-Jul-2007
%template.html  is a "one-of" default.  If it is not found it uses 
the embeded copy.  This code here
	if not no-template [

  template: any [select opts 'template select doc 'template template-file]
		if file? template [template: attempt [read template]]
		if not template [template: trim/auto default-template]
	]
It's actually pretty handy.
Group: Parse ... Discussion of PARSE dialect [web-public]
Izkata:
23-Oct-2005
I'm gonna try again:

>> s: {=image
{    file: images/a picture.gif
{    size: 200x300
{    caption: some caption below the picture
{    desc: some description for the picture}
== {=image
file: images/a picture.gif
size: 200x300
caption: some caption below the picture
desc: some description for the pictu...
>> parse head append s {^/} [
[    some [
[        thru {file: } copy file to {^/} |
[        thru {size: } copy size to {^/} |
[        thru {caption: } copy cap to {^/} |
[        thru {desc: } copy desc to {^/}
[        ]
[    ]
BrianH:
1-Nov-2005
f: open/direct file
a: copy/part f 4096

parse a [some [rule1 | rule2 | b: if (if a: copy/part f 4096 [b: 
join b a]) :b]]
BrianH:
4-Nov-2005
So if you copy your test data to the clipboard, you would assign 
it to a variable like this:
obx: read clipboard://

If you are reading it from a file with the read or open functions, 
there is no escaping.
Gordon:
29-Jun-2006
I'm a bit stuck because this parse stop after the first iteration. 
 Can anyone give me a hint as to why it stops after one line.

Here is some code:

data: read to-file Readfile

print length? data
224921


d: parse/all data [thru QuoteStr copy Note to QuoteStr thru QuoteStr 
thru quotestr

    copy Category to QuoteStr thru QuoteStr thru quotestr copy Flag to 
    QuoteStr
    thru newline (print index? data)]
1
== false


Data contains hundreds of "memos" in a csv file with three fields: 

 Memo, Category and Flag ("0"|"1")  all fileds are enclosed in quotes 
 and separated by commas.
  

It would be real simple if the Memo field didn't contain double quoted 
words; then 
parse data none
would even work; but alas many memos contain other "words".
It would even be simple if the memos didn't contain commas, then
parse data "," or parse/all data ","
would work; but alas many memos contain commas in the body.
james_nak:
10-Oct-2006
I have an easy one for you gurus. Let's say I want to parse a file 
and get all the "www..." out of it. The thing is that they end in 
either a space or a linefeed. How do I do a (written in pseudo parse 
to give you an idea) "to "www" copy tag to 'either a linefeed or 
a space'"? I've tried charsets, vars, blocks but the best I can do 
is one or the other. Note, finding the "www" is the easy part, it's 
ending the string that is giving me fits. Thanks in advance.
Group: Syllable ... The free desktop and server operating system family [web-public]
Graham:
15-Sep-2008
#!/sbin/rebol  -qw
Rebol [
 file: %update.r

 purpose: {Update the system clock based upon the nist.gov time server}
 author: {Graham Chiu}
 date: 15-Apr-2007
]

get-nist-correction: func [/local nist-time cpu-time mjd hms] [
 nist-time: read daytime://time-a.nist.gov
 cpu-time: now

 parse/all nist-time [skip copy mjd 5 skip 2 thru " " copy hms 8 skip]
 nist-time: 17/Nov/1858 + to integer! mjd
 nist-time/time: to time! hms
 nist-correction: difference nist-time cpu-time
]

forever [
 if error? set/any 'err try [
 print [ "Current time was: " now ]
 current-time: now + get-nist-correction
 print [ "New time is: " current-time ]

 s: rejoin [ "date -s " {"} current-time/month "/" current-time/day 
 "/" current-time/year " " current-time/time {"} ]
 probe s
 call s 
 ][ probe mold disarm err ]
 wait 00:02:00 ;; wait 2 mins
]
Evgeniy Philippov:
13-Jan-2012
Also got a Permission denied (13) while attempt to copy a kernel 
log file to ext3 partttion. Under root.
Group: Linux ... [web-public] group for linux REBOL users
Graham:
17-Dec-2006
request-file: func [

    {Requests a file using a popup list of files and directories.} 
    /title "Change heading on request." 
    title-line "Title line of request" 
    button-text "Button text for selection" 
    /file name "Default file name or block of file names" 
    /filter filt "Filter or block of filters" 
    /keep "Keep previous settings and results" 
    /only "Return only a single file, not a block." 
    /path "Return absolute path followed by relative files." 
    /save "Request file for saving, otherwise loading." 
    /local where data filt-names filt-values
][
    if none? out start-out 
    either file [

        either block? name [picked: copy name] [picked: reduce [to-file name]]
    ] [
        if not keep [picked: copy []]
    ] 
    if none? picked [picked: copy []] 
    if file: picked/1 [where: first split-path file] 
    while [not tail? picked] [
        set [name file] split-path first picked 
        either name <> where [remove picked] [
            change picked file 
            picked: next picked
        ]
    ] 
    picked: head picked 
    if any [not where not exists? where] [where: clean-path %.] 
    if not keep [
        fp/data: head fp/data 
        so/data: head so/data 
        si: 1
    ] 
    either filter [
        filters: either block? filt [filt] [reduce [filt]]
    ] [if any [not keep not block? filters] [pick-filter]] 
    ff/text: form filters 
    tt/text: either title [copy title-line] ["Select a File:"] 
    ob/text: either title [copy button-text] ["Select"] 
    if all [
        error? done: try [
            filt-names: copy head fp/data 
            filt-values: copy filter-list 
            either filter [
                insert head filt-names "Custom" 
                insert/only filt-values filters
            ] [
                filt-names: at filt-names index? fp/data
            ] 
            done: local-request-file data: reduce 

            [tt/text ob/text clean-path where picked filt-names filt-values found? 
            any [only] found? any [save]] 
            if done [
                dir-path: data/3 
                picked: data/4 

                if not filter [fp/data: at head fp/data index? data/5]
            ] 
            done
        ] 
        (get in disarm done 'code) = 328
    ] [
        done: false 
        read-dir/full either where [where] [dir-path] 
        show-pick 
        inform out 
        unfocus
    ] 
    if error? done [done] 
    if all [done picked any [path not empty? picked]] [
        either path [
            done: insert copy picked copy dir-path 
            either only [done/1] [head done]
        ] [
            foreach file picked [insert file dir-path] 
            either only [picked/1] [picked]
        ]
    ]
]
Anton:
17-Dec-2006
request-file: func [

    {Requests a file using a popup list of files and directories.}
    /title "Change heading on request."
    title-line "Title line of request"
    button-text "Button text for selection"
    /file name "Default file name or block of file names"
    /filter filt "Filter or block of filters"
    /keep "Keep previous settings and results"
    /only "Return only a single file, not a block."
    /path "Return absolute path followed by relative files."
    /local where
][
    if none? out start-out
    done: false
    either file [

        either block? name [picked: copy name] [picked: reduce [to-file name]]
    ] [
        if not keep [picked: copy []]
    ]
    if none? picked [picked: copy []]
    if file: picked/1 [where: first split-path file]
    while [not tail? picked] [
        set [name file] split-path first picked
        either name <> where [remove picked] [
            change picked file
            picked: next picked
        ]
    ]
    picked: head picked
    if any [not where not exists? where] [where: clean-path %.]
    if not keep [
        fp/data: head fp/data
        so/data: head so/data
        si: 1
    ]
    either filter [
        filters: either block? filt [filt] [reduce [filt]]
    ] [if any [not keep not block? filters] [pick-filter]]
    ff/text: form filters
    tt/text: either title [copy title-line] ["Select a File:"]
    ob/texts/1: either title [copy button-text] ["Select"]
    read-dir/full either where [where] [dir-path]
    show-pick
    inform out
    unfocus
    if all [done picked any [path not empty? picked]] [
        either path [
            done: insert copy picked copy dir-path
            either only [done/1] [head done]
        ] [
            foreach file picked [insert file dir-path]
            either only [picked/1] [picked]
        ]
    ]
]
Kaj:
18-Jun-2007
You can use a file tree on disk or through FTP. Not sure how to copy 
the mulyiple CDs into one tree
Graham:
29-Sep-2008
how copy a file from a samba server with a space in it ?
Janko:
27-May-2009
Any ideas how to do this? I am trying to compile it now on my other 
VPS which is 32bit and copy file to the 64bit vps but I have no idea 
if this will work
Maxim:
1-Sep-2010
remote-spec:  [scheme: 'ftp  host: "ftp.mysite.org"  user: "[user-:-mysite-:-org]" 
 pass: "xxxxxxxxxx"]
local-file: %text.txt

source-port: open/binary/direct/read local-file ; BINARY mode
print "Attempting FTP connection..."


target-port: open/binary/direct/new/write remote-spec ; BINARY mode

insert target-port copy source-port

attempt [close target-port]
attempt [close source-port]
Maxim:
10-Nov-2010
chown -R src dest 


and if you can use scp or rcp (depending on your setup) to copy your 
files over, it should be less hassle than ftp which often has many 
issues with stranger filenames and permissions.


on one server, for example, a file was created with ftp, which is 
a legal (albeit twisted) path, but it cannot be access or deleted 
from that same ftp access, because the path gets mangled when it 
goes through the url path parser of that ftp server.


also unless both source and destination ftp servers are the same, 
you can have other nasties.


its always best (and much faster) to gzip your whole directory and 
copy over one file, and then unpack it on the other server (you also 
get a free backup ;-)
Group: !Readmail ... a Rebol mail client [web-public]
Louis:
30-Oct-2006
A little success. I used a text editors to copy the contents of out.mbx.001 
and out.mbx.002 to the end of out.mbx. Then deleted the out.toc index 
file. Started Eudora, and now I can see the emails. Hopefully I'm 
now be able to send them.
Group: Web ... Everything web development related [web-public]
Louis:
3-Mar-2005
Here is the script I used to download the files.  

rebol []

page: read http://militarygetsaved.tripod.com/id23.htm

links: []

parse page [some [thru {<A HREF="} copy temp to {"} (append links 
temp)] to end]

foreach link links [
	if find link "_ibcl.htm" [

  write to-file link read to-url rejoin ["http://militarygetsaved.tripod.com/"
  link]
	]
]
Graham:
7-Oct-2005
So, to render PDF, I do this

write %/d/rebol/rebgui/www/referral.tex tmp
either zero? ret: call/wait "d:\rebol\rebgui\www\pdflatex.bat" [
            browse/only http://127.0.0.1:8001/referral.pdf
][

            alert join "Failed to print.  Batch file failed with return code 
            of " ret
]

and pdflatex.bat is just

copy referral.tex c:\texmf\
c:
cd \texmf\
pdflatex referral.tex -output-directory=d:\rebol\rebgui\www\
Group: Announce ... Announcements only - use Ann-reply to chat [web-public]
Gabriele:
10-Feb-2006
Little goodie for Windows users: http://www.colellachiara.com/soft/Misc/clips.r


It will stay in your system tray and keep track of your clipboard 
(remembers the last 5 clips). They are saved in a file so you get 
them back across reboots. You can also add notes that won't get pushed 
out from the clips. Selecting a note or a clip will copy it back 
to your clipboard so that you can paste it wherever you want.
Group: SDK ... [web-public]
[unknown: 5]:
24-Mar-2006
It was a strange problem I think.  I think I had a pro key and an 
sdk key - that is my only explaination for the problem because Cindy 
sent me a copy of my original SDK download and that key worked on 
the newer one so I think I may have been using the wrong key file.
BrianH:
27-Jun-2006
Graham, multiple data streams are how Mac files are stored on Windows 
servers. Also, some antivirus programs use the extra streams for 
storing checksum data, some viruses for storing their payload, the 
system for storing file metadata, and various applications for obscure 
reasons. Any file copy program that ignores multiple data streams 
does so at the user's peril. Since there are few such programs written 
in REBOL (Carl's recent blog post notwithstanding), the lack of data 
stream support in REBOL isn't much of a problem for now.
Anton:
6-Jul-2006
You could load each file until the one with missing bracket is found, 
then copy chunks of text and try to load them in the console repeatedly, 
eg:
	load read clipboard://
BenBran:
6-Jan-2010
Not sure where to put this so asking here:


I downloaded a web script and it has a  snippet I don't understand:
buffer: make string! 1024         ;; contains the browser request
file: "index.html"
parse buffer ["get" ["http"  |   "/ "  |  copy file to " " ]]

what does:

copy file to " "

mean or do?
tia
Rondon:
14-Jan-2012
REBOL [
Title: "ARCFOUR and CipherSaber"
Date: 17-Jan-2004
File: %arcfour.r
Author: "Cal Dixon"

Purpose: {Provides encryption and decryption using the ARCFOUR algorithm}

Note: {this implementation can decrypt data at about 40KB/s on my 
1Ghz AMD Duron system with Rebol/View 1.2.10.3.1}
Library: [
level: 'advanced
platform: 'all
type: [function module protocol]
domain: [encryption scheme]
tested-under: [view 1.2.10.3.1 on [W2K] by "Cal"]
license: 'PD
support: none
]
]


;ARCFOUR specification: http://www.mozilla.org/projects/security/pki/nss/draft-kaukonen-cipher-arcfour-03.txt

;CipherSabre specification: http://ciphersaber.gurus.com/faq.html#getrc4


arcfour-short: func [key [string! binary!] stream [binary! string!] 
/mix n /local state i j output swap addmod sz][

swap: func [a b s /local][ local: sz s a poke s a + 1 to-char sz 
s b poke s b + 1 to-char local ]
addmod: func [ a b ][ a + b // 256 ]
sz: func [ s a ][ pick s a + 1 ]

state: make binary! 256 repeat var 256 [ insert tail state to-char 
var - 1 ]

j: 0 loop any [ n 1 ] [ i: 0 loop 256 [ swap i j: addmod j add sz 
state i sz key i // length? key state i: i + 1] ]
i: j: 0 output: make binary! length? stream
repeat byte stream [
swap i: addmod i 1 j: addmod j sz state i state

insert tail output to-char xor~ byte to-char sz state addmod (sz 
state i) (sz state j)
]
clear state
return output
] 

make root-protocol [
addmod: addmod: func [ a b ][ a + b // 256 ]
sz: func [ s a ][ pick s a + 1 ]

swap: func [a b s /local][ local: sz s a poke s a + 1 to-char sz 
s b poke s b + 1 to-char local ]
ins: get in system/words 'insert
i: 0 j: 0
open: func [port][
port/state/tail: 2000
port/state/index: 0
port/state/flags: port/state/flags or port-flags

port/locals: context [ inbuffer: make binary! 40000 state: make binary! 
256]
use [key n i j] [
key: port/key
n: port/strength
repeat var 256 [ ins tail port/locals/state to-char var - 1 ]
j: 0 loop any [ n 1 ] [
i: 0 loop 256 [

swap i j: addmod j add sz port/locals/state i sz key i // length? 
key port/locals/state i: i + 1
]
]
]
i: j: 0
]
insert: func [port data][
system/words/insert tail port/locals/inbuffer data do []
]
copy: func [port /local output][
output: make binary! local: length? port/locals/inbuffer
loop local [

swap i: addmod i 1 j: addmod j sz port/locals/state i port/locals/state

ins tail output to-char sz port/locals/state addmod (sz port/locals/state 
i) (sz port/locals/state j)
]
local: xor~ output port/locals/inbuffer
clear port/locals/inbuffer
local
]

close: func [port][ clear port/locals/inbuffer clear port/locals/state 
clear port/url clear port/key]
port-flags: system/standard/port-flags/pass-thru
net-utils/net-install arcfour self 0
]

arcfour: func [key stream /mix n /local port][
port: open compose [scheme: 'arcfour key: (key) strength: (n)]
insert port stream
local: copy port
close port
return local
]


; CipherSaber is an ARCFOUR stream prepended with 10 bytes of random 
key data
ciphersaber: func [ key stream /v2 n ][

arcfour/mix join key copy/part stream 10 skip stream 10 either v2 
[ any [ n 42 ] ][ 1 ]
]
Group: !Uniserve ... Creating Uniserve processes [web-public]
Terry:
4-Feb-2006
Again, this is a service.. 

on-received: func [data][
raw-input: copy to-string data 
if raw-input = "test" [print "works"]
]


But if I put the if raw-input = "test" [print "works"] line in a 
seperate file.. ie  process.r ,and do it like this.. 

on-received: func [data][
raw-input: copy to-string data 
do %./process.r
]


It doesn't work.. In fact, it seems difficult to put global functions 
that are truly global, anywhere.
Group: Hardware ... Computer Hardware Issues [web-public]
[unknown: 9]:
23-May-2006
Are there any advantages of one over the other?  I have only used 
PGP.  What I like is:


I can create a file (x.pgp) of any size, then mount it as a drive. 
 This allows me to do things like make a file that is the size of 
a DVD disk, and if I need to burn it I just copy the folder to the 
DVD drive.  Although, since Qtask exists, I stopped burning CDs and 
DVDs, since my data is safer on Qtask.
Group: SVG Renderer ... SVG rendering in Draw AGG [web-public]
shadwolf:
23-Jun-2005
REBOL [
	Title:		"SVG Demo"
	Owner:		"Ashley G. Trüter"
	Version:	0.0.1
	Date:		21-Jun-2005
	Purpose:	"Loads and displays a resizeable SVG file."
	History: {
		0.0.1	Initial release
	}
	Notes: {
		Tested on very simple SVG icons
		Only a few basic styles / attributes / commands supported

  Does not handle sizes in units other than pixels (e.g. pt, in, cm, 
  mm, etc)

  SVG path has an optional close command, "z" ... AGG shape equivalent 
  auto-closes

  load-svg function needs to be totally refactored / optimized ... 
  *sample only*
	}
]

;	The following commands are available for path data:
;
;		M = moveto
;		L = lineto
;		H = horizontal lineto
;		V = vertical lineto
;		C = curveto
;		S = smooth curveto
;		Q = quadratic Belzier curve
;		T = smooth quadratic Belzier curveto
;		A = elliptical Arc
;		Z = closepath

;print: none	; comment out this line to enable debug messages

load-svg: function [svg-file [file! string!] size [pair!]] [

 id defs x y to-color to-byte draw-blk append-style svg-size scale-x 
 scale-y
][
	xml: either string? svg-file [parse-xml svg-file] [

  unless %.svg = suffix? svg-file [to error! "File has an invalid suffix!"]
		parse-xml read svg-file
	]

 unless xml/3/1/1 = "svg" [to error! "Could not find SVG header!"]

 ;unless find ["id" "xmlns"] xml/3/1/2/1 [to error! "Could not find 
 ID header!"]

 ;unless xml/3/1/3/1/1 = "defs" [to error! "Could not find DEFS header!"]

	id: xml/3/1/2
	defs: xml/3/1/3


	;
	;	--- Parse SVG id
	;

	svg-size: either find ["32pt" "48pt" "72pt"] select id "width" [
		switch select id "width" [
			"72pt"	[120x120]
			"48pt"	[80x80]
			"32pt"	[60x60]
		]
	][

  as-pair to integer! any [select id "width" "100"] to integer! any 
  [select id "height" "100"]
	]

	x: to integer! any [select id "x" "0"]
	y: to integer! any [select id "y" "0"]

	scale-x: size/x / svg-size/x
	scale-y: size/y / svg-size/y

	;
	;	--- Helper functions
	;


 to-color: func [s [string!]] [	; converts a string in the form "#FFFFFF" 
 to a 4-byte tuple
		to tuple! load rejoin ["#{" next s "00}"]
	]


 to-byte: func [s [string!]] [	; converts a string with a value 0-1 
 to an inverted byte
		255 - to integer! 255 * to decimal! s
	]

	;
	;	--- Parse SVG defs
	;

	draw-blk: copy []

	append-style: function [
		command [string!] blk [block!]
	][
		x xy pen-color fill-color line-width mode size radius shape
		closed? matrix transf-command
	][
		xy: 0x0
		size: 0x0
		line-width: 1
		matrice: make block! []
		radius: none
		transf-command: none
		
		
		foreach [attr val] blk [
			switch attr [
				"transform" [print "tranform have been found" 
						;probe val halt 
						val: parse val "(),"
						transf-command: first val
						probe transf-command
						switch transf-command [
							"matrix" [ 
								foreach word val [
									if not find word "matrix"
									[ 
										insert tail matrice to-decimal word
									]
								]
							
							]
						]
				]
				"style" [
					foreach [attr val] parse val ":;" [
						switch/default attr [
						
							"font-size" [ ]
							"stroke" [
								switch/default first val [
									#"#" [pen-color: to-color val]
									#"n" [pen-color: none]
								][
									print ["Unknown stroke:" val]
								]
							]
							"stroke-width" [line-width: to decimal! val]
							"fill" [
								fill-color: switch/default first val [
									#"#" [to-color val]
									#"n" [none]
								][
									print ["Unknown fill value:" val]
									none
								]
							]
							"fill-rule" [
								mode: switch/default val [
									"evenodd"	['even-odd]
								][
									print ["Unknown fill-rule value:" val]
									none
								]
							]

       "stroke-opacity" [pen-color: any [pen-color 0.0.0.0] pen-color/4: 
       to-byte val]

       "fill-opacity" [fill-color: any [fill-color 0.0.0.0] fill-color/4: 
       to-byte val]
							"stroke-linejoin" [
								insert tail draw-blk switch/default val [
									"miter"		[compose [line-join miter]]
									"round"		[compose [line-join round]]
									"bevel"		[compose [line-join bevel]]
								][
									print ["Unknown stroke-linejoin value:" val]
									none
								]
							]
							"stroke-linecap" [
								insert tail draw-blk 'line-cap
								insert tail draw-blk to word! val
							]
						][
							print ["Unknown style:" attr]
						]
					]
				]
				"x"			[xy/x: scale-x * val]
				"y"			[xy/y: scale-y * val]
				"width"		[size/x: scale-x * val]
				"height"	[size/y: scale-y * val]
				"rx"		[print "rx"]
				"ry"		[radius: to decimal! val]
				"d"	[
					shape: copy []
					x: none
					closed?: false
					foreach token load val [
						switch/default token [
							M	[insert tail shape 'move]
							C	[insert tail shape 'curve]
							L	[insert tail shape 'line]
							z	[closed?: true]
						][

       unless number? token [print ["Unknown path command:" token]]

       either x [insert tail shape as-pair x scale-y * token x: none] [x: 
       scale-x * token]
						]
					]
				]
			]
		]
		insert tail draw-blk compose [
			pen (pen-color)
			fill-pen (fill-color)
			fill-rule (mode)
			line-width (line-width * min scale-x scale-y)
		]
		switch command [
			"rect" [
				insert tail draw-blk compose [box (xy) (xy + size)]
				if radius [insert tail draw-blk radius]
			]
			"path" [
				unless closed? [print "Path closed"]
				either transf-command <> none  [
					switch transf-command [

      "matrix" [insert tail draw-blk compose/only [ (to-word transf-command) 
      (matrice) shape (shape) reset-matrix]]
					]
				][
					insert tail draw-blk compose/only [shape (shape)]
			 	]
				]

   "g" [ print "Write here how to handle G insertion to Draw block" 

    insert tail draw-blk probe compose/only [reset-matrix (to-word transf-command) 
    (matrice)]
				
				]
			]
	]	
  
	probe defs
	foreach blk defs [
		switch first blk [
			"rect"	[append-style first blk second blk]
			"path"	[append-style first blk second blk]
			"g"		[
						print "key word" probe first blk  
						print "matrix and style in G" probe second blk  
						append-style first blk second blk 
						;print "what to draw in G" probe third blk
						foreach blk2 third blk [
							probe blk2
							switch first blk2[ 
								"path" [append-style first blk2 second blk2]
							]
						]
					]
		]
	]
	
	
probe draw-blk
	draw-blk
]

view make face [
	offset:	100x100
	size:	200x200
	action:	request-file/filter/only "*.svg"
	text:	rejoin ["SVG Demo [" last split-path action "]"]
	data:	read action
	color:	white
	effect:	compose/only [draw (load-svg data size)]
	edge: font: para: none
	feel: make feel [
		detect: func [face event] [
			if event/type = 'resize [
				insert clear face/effect/draw load-svg face/data face/size
				show face
			]
			if event/type = 'close [quit]
		]
	]
	options: [resize]
]
shadwolf:
23-Jun-2005
REBOL [
	Title:		"SVG Demo"
	Owner:		"Ashley G. Trüter"
	Version:	0.0.1
	Date:		21-Jun-2005
	Purpose:	"Loads and displays a resizeable SVG file."
	History: {
		0.0.1	Initial release
	}
	Notes: {
		Tested on very simple SVG icons
		Only a few basic styles / attributes / commands supported

  Does not handle sizes in units other than pixels (e.g. pt, in, cm, 
  mm, etc)

  SVG path has an optional close command, "z" ... AGG shape equivalent 
  auto-closes

  load-svg function needs to be totally refactored / optimized ... 
  *sample only*
	}
]

;	The following commands are available for path data:
;
;		M = moveto
;		L = lineto
;		H = horizontal lineto
;		V = vertical lineto
;		C = curveto
;		S = smooth curveto
;		Q = quadratic Belzier curve
;		T = smooth quadratic Belzier curveto
;		A = elliptical Arc
;		Z = closepath

;print: none	; comment out this line to enable debug messages

load-svg: function [svg-file [file! string!] size [pair!]] [

 id defs x y to-color to-byte draw-blk append-style svg-size scale-x 
 scale-y
][
	xml: either string? svg-file [parse-xml svg-file] [

  unless %.svg = suffix? svg-file [to error! "File has an invalid suffix!"]
		parse-xml read svg-file
	]

 unless xml/3/1/1 = "svg" [to error! "Could not find SVG header!"]

 ;unless find ["id" "xmlns"] xml/3/1/2/1 [to error! "Could not find 
 ID header!"]

 ;unless xml/3/1/3/1/1 = "defs" [to error! "Could not find DEFS header!"]

	id: xml/3/1/2
	defs: xml/3/1/3


	;
	;	--- Parse SVG id
	;

	svg-size: either find ["32pt" "48pt" "72pt"] select id "width" [
		switch select id "width" [
			"72pt"	[120x120]
			"48pt"	[80x80]
			"32pt"	[60x60]
		]
	][

  as-pair to integer! any [select id "width" "100"] to integer! any 
  [select id "height" "100"]
	]

	x: to integer! any [select id "x" "0"]
	y: to integer! any [select id "y" "0"]

	scale-x: size/x / svg-size/x
	scale-y: size/y / svg-size/y

	;
	;	--- Helper functions
	;


 to-color: func [s [string!]] [	; converts a string in the form "#FFFFFF" 
 to a 4-byte tuple
		to tuple! load rejoin ["#{" next s "00}"]
	]


 to-byte: func [s [string!]] [	; converts a string with a value 0-1 
 to an inverted byte
		255 - to integer! 255 * to decimal! s
	]

	;
	;	--- Parse SVG defs
	;

	draw-blk: copy []

	append-style: function [
		command [string!] blk [block!]
	][
		x xy pen-color fill-color line-width mode size radius shape
		closed? matrix transf-command
	][
		xy: 0x0
		size: 0x0
		line-width: 1
		matrice: make block! []
		radius: none
		transf-command: none
		
		
		foreach [attr val] blk [
			switch attr [
				"transform" [print "tranform have been found" 
						;probe val halt 
						val: parse val "(),"
						transf-command: first val
						probe transf-command
						switch transf-command [
							"matrix" [ 
								foreach word val [
									if not find word "matrix"
									[ 
										insert tail matrice to-decimal word
									]
								]
							
							]
						]
				]
				"style" [
					foreach [attr val] parse val ":;" [
						switch/default attr [
						
							"font-size" [ ]
							"stroke" [
								switch/default first val [
									#"#" [pen-color: to-color val]
									#"n" [pen-color: none]
								][
									print ["Unknown stroke:" val]
								]
							]
							"stroke-width" [line-width: to decimal! val]
							"fill" [
								fill-color: switch/default first val [
									#"#" [to-color val]
									#"n" [none]
								][
									print ["Unknown fill value:" val]
									none
								]
							]
							"fill-rule" [
								mode: switch/default val [
									"evenodd"	['even-odd]
								][
									print ["Unknown fill-rule value:" val]
									none
								]
							]

       "stroke-opacity" [pen-color: any [pen-color 0.0.0.0] pen-color/4: 
       to-byte val]

       "fill-opacity" [fill-color: any [fill-color 0.0.0.0] fill-color/4: 
       to-byte val]
							"stroke-linejoin" [
								insert tail draw-blk switch/default val [
									"miter"		[compose [line-join miter]]
									"round"		[compose [line-join round]]
									"bevel"		[compose [line-join bevel]]
								][
									print ["Unknown stroke-linejoin value:" val]
									none
								]
							]
							"stroke-linecap" [
								insert tail draw-blk 'line-cap
								insert tail draw-blk to word! val
							]
						][
							print ["Unknown style:" attr]
						]
					]
				]
				"x"			[xy/x: scale-x * val]
				"y"			[xy/y: scale-y * val]
				"width"		[size/x: scale-x * val]
				"height"	[size/y: scale-y * val]
				"rx"		[print "rx"]
				"ry"		[radius: to decimal! val]
				"d"	[
					shape: copy []
					x: none
					closed?: false
					foreach token load val [
						switch/default token [
							M	[insert tail shape 'move]
							C	[insert tail shape 'curve]
							S   [insert tail shape 'curv]
							L	[insert tail shape 'line]
							Q   [insert tail shape 'qcurve]
							T   [insert tail shape 'qcurv]
							z	[closed?: true]
							H   [insert tail shape 'hline]
							V   [insert tail shape 'vline]
							A   [insert tail shape 'arc]
						][

       unless number? token [print ["Unknown path command:" token]]

       either x [insert tail shape as-pair x scale-y * token x: none] [x: 
       scale-x * token]
						]
					]
				]
			]
		]
		insert tail draw-blk compose [
			pen (pen-color)
			fill-pen (fill-color)
			fill-rule (mode)
			line-width (line-width * min scale-x scale-y)
		]
		switch command [
			"rect" [
				insert tail draw-blk compose [box (xy) (xy + size)]
				if radius [insert tail draw-blk radius]
			]
			"path" [
				unless closed? [print "Path closed"]
				either transf-command <> none  [
					switch transf-command [

      "matrix" [insert tail draw-blk compose/only [ (to-word transf-command) 
      (matrice) shape (shape) reset-matrix]]
					]
				][
					insert tail draw-blk compose/only [shape (shape)]
			 	]
				]

   "g" [ print "Write here how to handle G insertion to Draw block" 

    insert tail draw-blk probe compose/only [reset-matrix (to-word transf-command) 
    (matrice)]
				
				]
			]
	]	
  
	probe defs
	foreach blk defs [
		switch first blk [
			"rect"	[append-style first blk second blk]
			"path"	[append-style first blk second blk]
			"g"		[
						print "key word" probe first blk  
						print "matrix and style in G" probe second blk  
						append-style first blk second blk 
						;print "what to draw in G" probe third blk
						foreach blk2 third blk [
							probe blk2
							switch first blk2[ 
								"path" [append-style first blk2 second blk2]
							]
						]
					]
		]
	]
	
	
probe draw-blk
	draw-blk
]

view make face [
	offset:	100x100
	size:	200x200
	action:	request-file/filter/only "*.svg"
	text:	rejoin ["SVG Demo [" last split-path action "]"]
	data:	read action
	color:	white
	effect:	compose/only [draw (load-svg data size)]
	edge: font: para: none
	feel: make feel [
		detect: func [face event] [
			if event/type = 'resize [
				insert clear face/effect/draw load-svg face/data face/size
				show face
			]
			if event/type = 'close [quit]
		]
	]
	options: [resize]
]
shadwolf:
23-Jun-2005
REBOL [
	Title:		"SVG Demo"
	Owner:		"Ashley G. Trüter"
	Version:	0.0.1
	Date:		21-Jun-2005
	Purpose:	"Loads and displays a resizeable SVG file."
	History: {
		0.0.1	Initial release
	}
	Notes: {
		Tested on very simple SVG icons
		Only a few basic styles / attributes / commands supported

  Does not handle sizes in units other than pixels (e.g. pt, in, cm, 
  mm, etc)

  SVG path has an optional close command, "z" ... AGG shape equivalent 
  auto-closes

  load-svg function needs to be totally refactored / optimized ... 
  *sample only*
	}
]

;	The following commands are available for path data:
;
;		M = moveto
;		L = lineto
;		H = horizontal lineto
;		V = vertical lineto
;		C = curveto
;		S = smooth curveto
;		Q = quadratic Belzier curve
;		T = smooth quadratic Belzier curveto
;		A = elliptical Arc
;		Z = closepath

;print: none	; comment out this line to enable debug messages

load-svg: function [svg-file [file! string!] size [pair!]] [

 id defs x y to-color to-byte draw-blk append-style svg-size scale-x 
 scale-y
][
	xml: either string? svg-file [parse-xml svg-file] [

  unless %.svg = suffix? svg-file [to error! "File has an invalid suffix!"]
		parse-xml read svg-file
	]

 unless xml/3/1/1 = "svg" [to error! "Could not find SVG header!"]

 ;unless find ["id" "xmlns"] xml/3/1/2/1 [to error! "Could not find 
 ID header!"]

 ;unless xml/3/1/3/1/1 = "defs" [to error! "Could not find DEFS header!"]

	id: xml/3/1/2
	defs: xml/3/1/3


	;
	;	--- Parse SVG id
	;

	svg-size: either find ["32pt" "48pt" "72pt"] select id "width" [
		switch select id "width" [
			"72pt"	[120x120]
			"48pt"	[80x80]
			"32pt"	[60x60]
		]
	][

  as-pair to integer! any [select id "width" "100"] to integer! any 
  [select id "height" "100"]
	]

	x: to integer! any [select id "x" "0"]
	y: to integer! any [select id "y" "0"]

	scale-x: size/x / svg-size/x
	scale-y: size/y / svg-size/y

	;
	;	--- Helper functions
	;


 to-color: func [s [string!]] [	; converts a string in the form "#FFFFFF" 
 to a 4-byte tuple
		to tuple! load rejoin ["#{" next s "00}"]
	]


 to-byte: func [s [string!]] [	; converts a string with a value 0-1 
 to an inverted byte
		255 - to integer! 255 * to decimal! s
	]

	;
	;	--- Parse SVG defs
	;

	draw-blk: copy []

	append-style: function [
		command [string!] blk [block!]
	][
		x xy pen-color fill-color line-width mode size radius shape
		closed? matrix transf-command
	][
		xy: 0x0
		size: 0x0
		line-width: 1
		matrice: make block! []
		radius: none
		transf-command: none
		
		
		foreach [attr val] blk [
			switch attr [
				"transform" [print "tranform have been found" 
						;probe val halt 
						val: parse val "(),"
						transf-command: first val
						probe transf-command
						switch transf-command [
							"matrix" [ 
								foreach word val [
									if not find word "matrix"
									[ 
										insert tail matrice to-decimal word
									]
								]
							
							]
						]
				]
				"style" [
					foreach [attr val] parse val ":;" [
						switch/default attr [
						
							"font-size" [ ]
							"stroke" [
								switch/default first val [
									#"#" [pen-color: to-color val]
									#"n" [pen-color: none]
								][
									print ["Unknown stroke:" val]
								]
							]
							"stroke-width" [line-width: to decimal! val]
							"fill" [
								fill-color: switch/default first val [
									#"#" [to-color val]
									#"n" [none]
								][
									print ["Unknown fill value:" val]
									none
								]
							]
							"fill-rule" [
								mode: switch/default val [
									"evenodd"	['even-odd]
								][
									print ["Unknown fill-rule value:" val]
									none
								]
							]

       "stroke-opacity" [pen-color: any [pen-color 0.0.0.0] pen-color/4: 
       to-byte val]

       "fill-opacity" [fill-color: any [fill-color 0.0.0.0] fill-color/4: 
       to-byte val]
							"stroke-linejoin" [
								insert tail draw-blk switch/default val [
									"miter"		[compose [line-join miter]]
									"round"		[compose [line-join round]]
									"bevel"		[compose [line-join bevel]]
								][
									print ["Unknown stroke-linejoin value:" val]
									none
								]
							]
							"stroke-linecap" [
								insert tail draw-blk 'line-cap
								insert tail draw-blk to word! val
							]
						][
							print ["Unknown style:" attr]
						]
					]
				]
				"x"			[xy/x: scale-x * val]
				"y"			[xy/y: scale-y * val]
				"width"		[size/x: scale-x * val]
				"height"	[size/y: scale-y * val]
				"rx"		[print "rx"]
				"ry"		[radius: to decimal! val]
				"d"	[
					shape: copy []
					x: none
					closed?: false
					if all [x not number? token] [

          insert tail shape x * either token = 'V [scale-y][scale-x]
  						    x: none
					]
					foreach token load val [
						switch/default token [
							M	[insert tail shape 'move]
							C	[insert tail shape 'curve]
							S   [insert tail shape 'curv]
							L	[insert tail shape 'line]
							Q   [insert tail shape 'qcurve]
							T   [insert tail shape 'qcurv]
							z	[closed?: true]
							H   [insert tail shape 'hline]
							V   [insert tail shape 'vline]
							A   [insert tail shape 'arc]
						][

       unless number? token [print ["Unknown path command:" token]]

       either x [insert tail shape as-pair x scale-y * token x: none] [x: 
       scale-x * token]
						]
					]
				]
			]
		]
		insert tail draw-blk compose [
			pen (pen-color)
			fill-pen (fill-color)
			fill-rule (mode)
			line-width (line-width * min scale-x scale-y)
		]
		switch command [
			"rect" [
				insert tail draw-blk compose [box (xy) (xy + size)]
				if radius [insert tail draw-blk radius]
			]
			"path" [
				unless closed? [print "Path closed"]
				either transf-command <> none  [
					switch transf-command [

      "matrix" [insert tail draw-blk compose/only [ (to-word transf-command) 
      (matrice) shape (shape) reset-matrix]]
					]
				][
					insert tail draw-blk compose/only [shape (shape)]
			 	]
				]

   "g" [ print "Write here how to handle G insertion to Draw block" 

    insert tail draw-blk probe compose/only [reset-matrix (to-word transf-command) 
    (matrice)]
				
				]
			]
	]	
  
	probe defs
	foreach blk defs [
		switch first blk [
			"rect"	[append-style first blk second blk]
			"path"	[append-style first blk second blk]
			"g"		[
						print "key word" probe first blk  
						print "matrix and style in G" probe second blk  
						append-style first blk second blk 
						;print "what to draw in G" probe third blk
						foreach blk2 third blk [
							probe blk2
							switch first blk2[ 
								"path" [append-style first blk2 second blk2]
							]
						]
					]
		]
	]
	
	
probe draw-blk
	draw-blk
]

view make face [
	offset:	100x100
	size:	200x200
	action:	request-file/filter/only "*.svg"
	text:	rejoin ["SVG Demo [" last split-path action "]"]
	data:	read action
	color:	white
	effect:	compose/only [draw (load-svg data size)]
	edge: font: para: none
	feel: make feel [
		detect: func [face event] [
			if event/type = 'resize [
				insert clear face/effect/draw load-svg face/data face/size
				show face
			]
			if event/type = 'close [quit]
		]
	]
	options: [resize]
]
Group: Sound ... discussion about sound and audio implementation in REBOL [web-public]
Anton:
21-Apr-2009
Wow - first use of CP (alias of COPY) I ever saw. I override CP to 
be a unixiod file copy function.
Group: Rebol School ... Rebol School [web-public]
PatrickP61:
5-Jul-2007
Situation:	I want to read in an input file and parse it for some 
strings

Current:	My test code will do the parsing correctly IF the input 
block contains each line as a string

Problem:	When I try to run my code against the test file, It treats 
the contents of the file as a single string.

Question:	How do I have Rebol read in a file as one string per line 
instead of one string?
In-text:	[	"Line 1                        Page     1"
		"Line 2    Name      String-2"          
		"Line 4    Member    String-3 on 12/23/03"
		"Line 5    SEQNBR    abcdef               "                
		"Line 6       600    Desc 1 text         12/23/03"
		"Line 7      5400    Desc 2    Page 4    12/23/03"
		"Line 8    Number of records searched	]
 Get-page:		[thru "     Page "	copy Page-id to end]
 Get-file:		[thru "Name  "		copy Name-id to end]
 Get-member:	[thru "Member  "	copy Member-id to end]

 Page-id:	Name-id:	Member-id:	"-"

 for N 1 length? In-text 1 [
	parse In-text/:N	Get-page
	parse In-text/:N	Get-file
	parse In-text/:N	Get-member
	] 
 print	[ "Page"	Page-id		]
 print	[ "Name"	Name-id		]
 print	[ "Member"	Member-id	]
Tomc:
5-Jul-2007
if your page,name & member always exist and are in that order ...

parse/all read %file [
 some [ 
	thru "Page " copy token integer! (print ["Page" token]) 
	thru "Name " copy token to newline(print ["Name" token])
	thru "Member " copy token to newline (print ["Member" token])
	]
]
Tomc:
7-Jul-2007
Yes Patrick you have it right. The rules I gave would fail 
since you have multiple names/members

I would try to get away from the line by line mentality 
and try to break it into your conceptual record groupings
file, pages, sections, and details...

One trick I use is to replace a string delimiter for a record 
with a single char so parse returns a block of that record type. 

this is good because then when you work on each item in the block 
in turn
you know any fields you find do belong to this record and that 

you have not accidently skipped to a similar field in a later record.

something like this 


pages: read %file
replace/all/case pages "PAGE" "^L"
pages: parse/all pages "^L"

foreach page pages[
	p: first page
	page: find page newline
	replace/all/case page "NAME" "^L"
	sections: parse page "^L"
	foreach sec section [
		s: first section
		sec: find sec newline
		parse sec [
			any [thru "Member" copy detail to newline 
				newline (print [p tab s tab detail])
			]
		]
	]
]
Group: Tech News ... Interesting technology [web-public]
Volker:
17-May-2006
do[

  task 'task-server [ set[file content] copy msg  write file content 
  ]
  task [ send 'task-server %file "Hello" ]
  task[ send 'task-server %file "World" ]
]
Group: SQLite ... C library embeddable DB [web-public].
Pekr:
1-Aug-2006
I did following modifications to driver:

log-path: to-file copy ""

then replace/all "%sqlite.log" "join log-path %sqlite.log"


then in my cgi script I am able to do sqlite/log-path: %db/ to change 
location ...... maybe it would be usefull to even set db path and 
don't bother with paths, not sure ....
Pekr:
14-Dec-2006
following works:

;--- import log files
import-logs: does [

   ;--- pairs of incident No and incident file [[1 filename][2 filename] 
   atd.] ...

   log-files: [[1  06-12-06-7_50-7_59][2  06-12-12-15_46-15_47][3 
    06-12-13-15_29-15_31]]
   foreach file log-files [
     log-info: copy []
     log-file: read/lines file/2  
     ;print length? log-file
     foreach string-line log-file [
       line: parse string-line " "
       if line/7 == "GET" [ 

         append log-info reduce [line/1 line/2 line/4 line/8 line/11 to-string 
         file/1]
       ] 
     ] 

    SQL "BEGIN"

    foreach [date time ip-address url content-type incident-id] log-info 
    [

       SQL reduce ["INSERT INTO logs VALUES (?, ?, ?, ?, ?, ?)" date time 
       ip-address url content-type incident-id]
    ]
    SQL "COMMIT"

   ]
]
Robert:
3-Dec-2008
Ok, some more findings. I think the best way is to make a copy of 
the SQLite object for each database file. Than things are independent. 
The only thing to solve is to find an elegant way to select which 
SQLite object/connection to use without having to pre-fix all calls.
Pekr:
18-Apr-2010
I am not sure license is transferrable, but license is just one file 
- try to copy it to linux machine. If it is legally OK, I don't know. 
But - I would probably ask Carl ...
Group: Plugin-2 ... Browser Plugins [web-public]
BrianH:
4-May-2006
As for things like do-browser, it would be nice if the copy of REBOL 
called by the plugin could be passed some callbacks to which it would 
delegate some basic functionality like requesting a local file, proxy 
settings, do-browser, etc. This would allow the plugin to better 
integrate with the browser's existing behavior and security infrastructure.
Brock:
17-May-2006
I suppose I could use Javascript in my HTML file to check for the 
webserver and if not there try to launch the local copy from the 
sandbox.  Any thoughts?
JoshM:
6-Jun-2006
To simplify the issue, let me pose a scneario. Joe has a fresh copy 
of XP, no REBOL nothing. He clicks on a .r file. You want the plugin 
to install itself and open the .r file inside the browser window. 
Am I understanding your goal?
[unknown: 9]:
6-Jun-2006
To simplify the issue, let me pose a scneario. Joe has a fresh copy 
of XP, no REBOL nothing. He clicks on a .r file. You want the plugin 
to install itself and open the .r file inside the browser window. 
Am I understanding your goal?


No, I want it wrapped.  The ".r" is simply a reference point, since 
we don't have a word for a Rebol executable script.  Want to call 
it ".rrs" (Rebol run script) or something?  Flash calls theirs SWF, 
FLV, etc.
Group: !Liquid ... any questions about liquid dataflow core. [web-public]
Mario:
18-May-2007
A suggestion: put the working full script as a downloadable file 
(rebol.org or a link from liquid site) at the beginning of the page. 
I did the example step by step following the page and, at the endo 
of my tests I found the full script I colud copy and paste!!!
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public]
Terry:
26-Oct-2007
Ok.. this seems to work.. kinda.. 

	on-response: func [req params svc][	

  ;-- this callback is useful to mutualize the HTTP response settings.
		
		thetarget: copy req/in/target
		print join "target: " thetarget
			either found? find thetarget "." [
			mimetype: parse thetarget "."
			
			if (last mimetype) = "swf"[
			print "is a flash file"
				req/out/code: 200

    h-store req/out/headers 'Content-Type "application/x-shockwave-flash"
				]
			][
		print "is text/html" 
		req/out/code: 200
		h-store req/out/headers 'Content-Type "text/html"
		]
	]
Terry:
27-Oct-2007
Worked out the other issue.. Flash requires crossdomain.xml file 
to be delivered up by Cheyenne when running Flash that uses xml.Socket 
(like RASH).
Butt it's working well now.. and very cool. 

Works like this.. I run my local copy of Framewerks with embedded 
Cheyenne server, and park the GUI on any server (always accessible, 
single point of bug fixing etc.) for all to use.. currently it's 
here  http://kommonwealth.com/exper/gui.html


Now, it wont work for you 'cuz you're not running framewerks.. but 
if you were..  you could type into the box "codes" and it would open 
the RASH code file, on your desktop, using your favorite text editor. 
  

But wait.. there's more... 

In my local code.txt file i have the following line

PnG "testing" ][bout: {<pre>ok this works</pre>} makeXML ['DISPLAY 
'MSG "testing works here"]]


So when I open another browser, and point it to http://localhost/
testing  that line is fired (more on all this later).. 

Which does two things.. it outputs "ok this woks" to this second 
localhost page .. BUT (and this is the cool part)

it sends the "testing works here" into the panel on the first kommonwealth 
page. 

In other words, Im able to PUSH data to the remote page at ANY TIME.. 
  this will make for the ultimate in portal pages. 

And.. if that's not enough, Im able to pass messages to the DOM via 
javascript to the kommonwealth page as well. 

Allowing things like sliding in panels.. fading div elements moving 
images.. whatever.


So.. remote page can manipulate my computer.. run apps, do any Rebol, 
reboot .. whatever.. and the local desktop can manipulate a remote 
web page.

Finally.
Will:
21-May-2008
impressed! 8) I finally gave another try at php support in cheyenne 
and after patching fastcgi.c as suggested it now works like a charm.

If you are on os x and use macports, here is a way to patch and compile:

sudo port install php5 +mysql5 +fastcgi
sudo port uninstall php5
cd /opt/local/var/macports/distfiles/php5/
sudo tar -xjf php-5.2.6.tar.bz2
>> run patch below
tar -cjf php-5.2.6.tar.bz2 php-5.2.6
sudo port install php5 +mysql5 +fastcgi checksum.skip=yes

copy of Dockimbel's patch with path fixed for this example

;---- cut'n paste the following code in REBOL's console ----

patch-php: has [buffer pos][ target: %php-5.2.6/sapi/cgi/fastcgi.c 
if none? attempt [buffer: read target][ print "unable to find the 
file to patch!!" exit ] either parse buffer [ thru "int fcgi_accept_request(" 
to "if (req->fd >= 0) {" pos: to end ][ insert pos "^/^-^-^-^-break;^/^-^-^-^-" 
write target buffer print "patch applied." ][ print "failed to locate 
the line to patch!!" ] ]
patch-php ;---- end of code ----
Dockimbel:
28-Mar-2009
The uploaded file is written on disk if it's size exceed 100'000 
bytes. You can change this default threshold value by using the 'post-mem-limit 
 keyword in virtual host configuration options (in %httpd.cfg).


Cheyenne can handle file uploads up to 2GB size with no noticeable 
impact on memory usage.


The temporary file is stored in an %incoming/ folder at Cheyenne's 
root. The file is deleted once the response is sent to the client, 
so in order to keep it, you have to rename it or copy it elsewhere.


You can use the %show.rsp sample script as target of a POST action 
to test it.
Dockimbel:
20-Jun-2009
I hate Apache config file. Because I hate having to read tons of 
docs to just "switch on" some app. Cheyenne's config file has never 
been designed to copy the Apache way, nor to be used by average end 
user. It's just a placeholder waiting to be replaced by a builtin 
web GUI allowing a simple, fast and straightforward way to manage 
the server. That has been the plan since the beginning and one of 
the main motivation for building Cheyenne. Unfortunately, I never 
had the required time to complete that goal yet, so I'm stuck with 
that, and that's also why Cheyenne is still at 0.9.x.
Group: DevCon2007 ... DevCon 2007 [web-public]
Cyphre:
16-Jun-2007
foreach file [
	%01_opening1.mov
	%02_opening2.mov
	%03_carl1_1.mov
	%04_Carl1_2.mov
	%05_Francois.mov
	%06_Maxim1.mov
	%07_Carl2.mov
	%08_Ladislav.mov
	%09_Sunanda.mov
	%10_Carl3.mov
	%11_Reichart.mov
	%12_Maxim2.mov
	%13_Ron.mov
	%14_Nicolas.mov
	%15_Concluding.mov
] [
	if error? try [ 

  in: open/direct/binary join http://ead.ephe.sorbonne.fr:81/R7/ file
		out: open/new/direct/binary/write file

  len: to-integer (to-integer in/locals/headers/content-length) / 1024
		siz: 0
		chunk: 4096
		print ""
		while [data: copy/part in chunk][
			siz: siz + length? data

   print ["^(1B)[Awriting file:" file to-integer siz / 1024 "KB of" 
   len "KB..." ]
			insert tail out data
		]
		close in
		close out
		in: out: none
	][

  print ["ERROR during transfer of" join http://ead.ephe.sorbonne.fr:81/R7/ 
  file] 
	]
]
Group: !CureCode ... web-based bugtracking tool [web-public]
Dockimbel:
28-Oct-2009
After a quick code and trace.log files inspection : there's no missing 
COPY, it seems related to a complex chain of events preventing the 
RSP output buffer to be CLEARed before re-use. I found a potential 
flaw in response/include, if the included script raises an error 
in a way that's not  catchable by the RSP execution system, it can 
prevent the output buffer from being reset. In trace.log file, I've 
found an error at 00:53 AM from a rejected SMTP connection using 
SEND function (not the new builtin MTA) that could be the trigger 
for this issue.
Group: reblets ... working reblets (50-100 lines or less) [web-public]
Ammon:
1-Apr-2009
REBOL [
	File: %scramble.r
	Author: "Ammon Johnson"
	Email: [ammon-:-johnson-:-gmail-:-com]
	Version: 0.0.1
	History: [
		0.0.1 31-Mar-2009 "scrambles and descrambles code"
	]
]

scramble: context [
	words: []
	load-words: does [
		foreach word first system/words [
			add-word mold word
		]
	]
	add-word: func [
		word
		/local chars length
	][
		chars: charset word
		unless found? find words chars [repend words [chars copy []]]

  unless found? find words/:chars length: length? word [repend words/:chars 
  [length copy []]]
		length: select words/:chars length
		unless found? find length word [insert tail length word]
		word
	]
	get-word: func [
		word
		/local chars length
	][
		chars: charset word
		unless chars: select words chars [return "UNKNOWN"]
		unless length: select chars length? word [return "UNKNOWN"]
		random/only length
	]
	scramble: func [
		txt
		/local result
	][
		result: parse/all txt " "
		forall result [

   unless empty? trim copy result/1 [change result random add-word result/1]
		]
		form result
	]
	
	descramble: func [
		txt
		/local result
	][
		result: parse/all txt " "
		forall result [

   unless empty? trim copy result/1 [change result get-word result/1]
		]
		form result
	]
]
Group: !distro-bot ... [web-public] distro-bot: source & versioning + automated distribution
Maxim:
12-May-2009
I'd like to know if any of you want to be alpha testers for the up 
and comming version, which is a result of several YEARS of fine tuning, 
 and now combining, a rich set tools.

CURRENT FEATURES (partial list):
General:
-----------------------
-non intrusive, does not force any programing onto you.

    ex:  * no need to have version in header, and can still do version 
    control

           * history format is user specified, massive configurability
-encapped (windows) application, so its easy to use.

-no external dependencies (ex: zip archive is embeded, and coded 
in rebol :-)


Automated:
-----------------------
-script versioning
-file backup (versioned)
-zip archival
-file management

-creation of "packages" (create dirs, copy files, archive, prebol, 
slim-link, encap, etc)

-header manipulation (including history, date, version, and any field 
you want to enforce)
-system calls
-file parsing, replacing info tags.

Flexible setup:
-------------------------
-cascading configuration (global, user, project, + per file)

-config locking, prevents overiding configs in cascaded setups (project 
manager can create rules which no one can break)
-command-line arguments overides for many configs

-user set configs for most if not all features (ex: history format, 
date format).

and much more
1 / 194[1] 2