[REBOL] e-mail with attachement Re:
Hi I modified your script and added the mail function from %attach.r (on rebol site) I added some notes to help you. NOTE: you don't change the To: in my_header ( Just change your from address and the subject you'd like for the emails.) Since I'm a stranger :P you should erase the pasting of the mail function and copy/paste it from %attach.r yourself. the function is really complex for beginners. timmy :) form_attach.r
[REBOL] Weird stuff with time
Whilst testing to find the upper limits of time/hour (for an up-time monitoring script) I came across these anomalies in time! Can anyone explain what is happening here? How come some large numbers for hours give an error and others return bizare numbers? x: 2000:10:12 == 2000:10:12 x: 20:10:12 == 20:10:12 x: 200:10:12 ** Syntax Error: Invalid time -- 200:10:12. ** Where: (line 1) x: 200:10:12 x: 200:10:12 ** Syntax Error: Invalid time -- 200:10:12. ** Where: (line 1) x: 200:10:12 x: 2000:10:12 ** Syntax Error: Invalid time -- 2000:10:12. ** Where: (line 1) x: 2000:10:12 x: 2:10:12 ** Syntax Error: Invalid time -- 2:10:12. ** Where: (line 1) x: 2:10:12 x: 20:10:12 ** Syntax Error: Invalid time -- 20:10:12. ** Where: (line 1) x: 20:10:12 x: 200:10:12 == -231041:32:12 x: 2000:10:12 == 75676:02:44 x: 2:10:12 == -436287:32:44 x: 20:10:12 == 409308:53:56 Cheers, Allen K
[REBOL] Run commands in NT's REBOL
Hi ... Everyone know somethig about run commands in NT inside a REBOL script ... I need make a "at" command in the DOS's consola and i don't know ... Is it posible??? Please, Regards David Guitian
[REBOL] Run commands in NT's REBOL Re:
HI I don't know how to do that. :( timmy [EMAIL PROTECTED] wrote: Hi ... Everyone know somethig about run commands in NT inside a REBOL script ... I need make a "at" command in the DOS's consola and i don't know ... Is it posible??? Please, Regards David Guitian
[REBOL] Some niggley things Re:(5)
Hi Donald, you wrote: What I really wanted to know was how to use a set-word!. The reason is that, if the program has an error and stops, the console is still set for a changed directory path. This is very annoying, since, to re-run the program, I have to change-dir again and again: list-path: %/drive/folder/folder/ list: READ path with "list" containing the dir-list block. I didn't get this working yet. I must be missing something! This wouldn't work for you, right? set 'path %/d/temp/ == %/d/temp/ list: read path == [%save_NewFrames/ %funky/ %tcl-v7/ %snapshots/ %lynx_w32_2_8_2rel_1.zip %yikes131.zip... BTW, here you see how my temp file has changed since the last test ;-) If you're using words that referece the directory names: drive: 'd == d folder-1: 'temp == temp folder-2: 'funky == funky set 'path to file! reduce ["/" drive folder-1 folder-2] == %/d/temp/funky append :path #"/" == %/d/temp/funky/ read path == [%schema.DAT %LATEST.LOG %DECISION_TAB.LOG] Hope this REALLY helps, ;- Elan [: - )]
[REBOL] Run commands in NT's REBOL Re:
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Thursday, March 09, 2000 2:12 PM To: [EMAIL PROTECTED] Subject: [REBOL] Run commands in NT's REBOL Everyone know somethig about run commands in NT inside a REBOL script ... I need make a "at" command in the DOS's consola and i don't know ... Is it posible??? Hi, at the moment Rebol can't spawn external programs. Robert
[REBOL] Some niggley things Re:(2)
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] getting rebol OK
I am searching for a new web hosting service and I figure it is a good business practice to ask the hosting service if it is "OK" to use scripting languages other than perl for CGI. The response is usually, "what scripting languages are you thinking about?" When I tell them REBOL and point them to the REBOL web page, they tell me (all of them so far) that REBOL is not a language that can be used on their servers. What does a person do besides installing and using the binary first and asking for forgiveness later? -Ryan
[REBOL] Run commands in NT's REBOL Re:(2)
On Thu, 9 Mar 2000 [EMAIL PROTECTED] wrote: command in the DOS's consola and i don't know ... Is it posible??? Hi, at the moment Rebol can't spawn external programs. Robert That would be need trick considering different operating systems Rebol is covering. For Amiga/MAC/Linux/PC there are different ways to tell the path for secondary storage. TOJA:file.arg (placekeeper for mac) \usr\TOJA\file.arg D:\file.arg And I'm sure there is fifth and sixth ways of designing file hierarchy. Put I'm missing the point the question was about NT version 4? That I have not installed for personal use, too daunting task. I failed to install NT :) Tomi Jaskari Mobile:+358 50 330 3784 http://www.iki.fi/tmjj Helsinki Business Polytechnic
[REBOL] Weird stuff with time Re:(2)
Hi Tim Allen all! Last Date I can set with Microsoft Calendar Control (ActiveX) is 31.12.2100 - I consider it enough for all but astrological purposes. Have you those? On Thu, 9 Mar 2000 [EMAIL PROTECTED] wrote: We're all earthlings here :P Maybe someone past the orion nebula uses programs for intergalactic journeys. I heard the aliens who crashed in Roswel, NM had watches that registered billions of years. :P [EMAIL PROTECTED] wrote: Whilst testing to find the upper limits of time/hour (for an up-time monitoring script) I came across these anomalies in time! Can anyone explain what is happening here? How come some large numbers for hours give an error and others return bizare numbers? x: 2000:10:12 == 2000:10:12 x: 20:10:12 == 20:10:12 x: 200:10:12 ** Syntax Error: Invalid time -- 200:10:12. ** Where: (line 1) x: 200:10:12 x: 200:10:12 ** Syntax Error: Invalid time -- 200:10:12. ** Where: (line 1) x: 200:10:12 x: 2000:10:12 ** Syntax Error: Invalid time -- 2000:10:12. ** Where: (line 1) x: 2000:10:12 x: 2:10:12 ** Syntax Error: Invalid time -- 2:10:12. ** Where: (line 1) x: 2:10:12 x: 20:10:12 ** Syntax Error: Invalid time -- 20:10:12. ** Where: (line 1) x: 20:10:12 x: 200:10:12 == -231041:32:12 x: 2000:10:12 == 75676:02:44 x: 2:10:12 == -436287:32:44 x: 20:10:12 == 409308:53:56 Best regards: Tomi Jaskari Mobile:+358 50 330 3784 http://www.iki.fi/tmjj Helsinki Business Polytechnic
[REBOL] getting Rebol OK Re:
Title: RE: [REBOL] getting Rebol OK Our server allows Rebol scripts to be run straight out of the cgi-bin. You can see an example of this at http://www.whadup.com click on search, the whole search engine is REBOL based. You can tell the ISP that all they have to do is put the Rebol.exe in a folder and tell their web server to pass .r files to it rebol.exe. I can send you screen shots of how to do this for IIS5. I managed to get our server running in 10 minutes. 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 of Development http://www.acmex.com/bio/mmp (Bio) (216) 391-7400 X207 ICQ - 15588809 acmeX.com - Acme Express, Inc. Web-enabled software / e-commerce / Web Marketing http://www.acmeX.com (216) 391-0707 (FAX) (216) 276-5487 (Cell)
[REBOL] getting rebol OK Re:
On Thu, Mar 9, 2000, [EMAIL PROTECTED] wrote: I am searching for a new web hosting service and I figure it is a good business practice to ask the hosting service if it is "OK" to use scripting languages other than perl for CGI. The response is usually, "what scripting languages are you thinking about?" When I tell them REBOL and point them to the REBOL web page, they tell me (all of them so far) that REBOL is not a language that can be used on their servers. What does a person do besides installing and using the binary first and asking for forgiveness later? I don't know, because I did that exact thing. ;) I did mention that I was using Rebol during an email to their tech. support, and they (http://www.dreamhost.com) didn't seem to care. I think most services won't care as long as you don't do evil things with Rebol and as long as you don't need to involve their tech. support crew. Also, any hosting service that gives you access to C compilers as part of their plan should be pretty permissive, since you could do far more evil with that than Rebol/Core. .:Eric
[REBOL] Some niggley things Re:(3)
On 09-Mar-00, [EMAIL PROTECTED] wrote: In einer eMail vom 09.03.00 06:33:20 (MEZ) Mitteleuropäische Zeit schreibt [EMAIL PROTECTED]: 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" A good point, but "none" is handled by the server. -- ---===///||| Donald Dalley |||\\\===--- The World of AmiBroker Support http://webhome.idirect.com/~ddalley UIN/ICQ#: 65203020
[REBOL] Weird stuff with time Re:
Hi Allen Interesting. I think the largest time value for year which works in the expected way is: 596522:10:12;this is ok (and far beyond any reasonable year value) == 596522:10:12 596523:10:12 ** Syntax Error: Invalid time -- 596523:10:12. ** Where: (line 1) 596523:10:12 REBOL allows integers to be entered for the year which are larger than allowed by the REBOL integer! datatype. This is probably not what was intended. Also there are further anomalies. to-time probe rejoin [2 ** 32 ":10:12"] ;multiples of 2 ** 32 produce 0 for the year "4294967296:10:12" == 0:10:12 to-time probe rejoin [2 ** 32 + 1 ":10:12"] ;we can add 1 and the year increments "4294967297:10:12" == 1:10:12 to-time probe rejoin [2 ** 32 - 1 ":10:12"] ;but if we subtract, big surprise! "4294967295:10:12" == -0:49:48 The largest value for year which does not lead to an error for the 'rejoin block is: to-time probe rejoin [999 ":10:12"] "999:10:12" == 183645:36:20 This limitation is due to the way 'form works, if we enter a larger value directly, we get 1000:10:12 == 183646:36:20 The weird numbers are due to some sort of wrapping of the integer values. The behavior is complex, so the explanation you requested will likely have to come from someone at Rebol Tech with access to the underlying C-code. One simple fix would be to return the "Invalid time" error for values of year greater than 596522. I am copying this to feedback as a bug. You, of course, deserve full credit for the discovery. Good catch! Cheers Larry - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 09, 2000 4:44 AM Subject: [REBOL] Weird stuff with time Whilst testing to find the upper limits of time/hour (for an up-time monitoring script) I came across these anomalies in time! Can anyone explain what is happening here? How come some large numbers for hours give an error and others return bizare numbers? x: 2000:10:12 == 2000:10:12 x: 20:10:12 == 20:10:12 x: 200:10:12 ** Syntax Error: Invalid time -- 200:10:12. ** Where: (line 1) x: 200:10:12 x: 200:10:12 ** Syntax Error: Invalid time -- 200:10:12. ** Where: (line 1) x: 200:10:12 x: 2000:10:12 ** Syntax Error: Invalid time -- 2000:10:12. ** Where: (line 1) x: 2000:10:12 x: 2:10:12 ** Syntax Error: Invalid time -- 2:10:12. ** Where: (line 1) x: 2:10:12 x: 20:10:12 ** Syntax Error: Invalid time -- 20:10:12. ** Where: (line 1) x: 20:10:12 x: 200:10:12 == -231041:32:12 x: 2000:10:12 == 75676:02:44 x: 2:10:12 == -436287:32:44 x: 20:10:12 == 409308:53:56 Cheers, Allen K
[REBOL] Lowing SECURITY LEVEL within a script Re:
Title: RE: [REBOL] Lowing SECURITY LEVEL within a script If you look in the users guide at: /users-guide/users/operunning.html#SecuritySettings It is all explained
[REBOL] Lowing SECURITY LEVEL within a script Re:
Hi Carlos, If you are running the script under a copy of REBOL that you control, you can use rebol -s (or rebol.exe -s) to disable security at startup. If REBOL is running on someone else's remote computer, and you have not control over that REBOL instance, you are NOT SUPPOSED to be able to disable security programmatically, without that person OKing it. At 04:56 PM 3/9/00 -0300, you wrote: Hi REBOLS, Is there any way of lowing security level of REBOL within a script without having to click that warning every time? In other words how can I avoid that warning dialog everytime? Carlos ;- Elan [: - )]
[REBOL] Weird stuff with time Re:(2)
- Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 10, 2000 12:26 AM Subject: [REBOL] Weird stuff with time Re: We're all earthlings here :P Maybe someone past the orion nebula uses programs for intergalactic journeys. I heard the aliens who crashed in Roswel, NM had watches that registered billions of years. :P LOL! But imagine you are calculating man hours (work-time) for a ten year project involving a workforce of 10 000 or more. These hour numbers don't seem so rediculous, for project management apps. I expected time! to error when hour values were greater than integers, not give me predictions of how many hours before the world would end ;-) Its prediction of -231041:32:12 makes me think we've over lived our welcome on this planet... I better find my hitchhiker guide to the galaxy, I'm gonna need it. Buzz, click, buzz Allen K
[REBOL] Some niggley things Re:(2)
Hello, Elan: On 09-Mar-00, [EMAIL PROTECTED] wrote: 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" Hope this helps, 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? -- ---===///||| Donald Dalley |||\\\===--- The World of AmiBroker Support http://webhome.idirect.com/~ddalley UIN/ICQ#: 65203020
[REBOL] Smart Client
I'm an innovation-minded freelance Writer-Photographer, but I don't write code, so I'm looking for someone who does. I'd like my writing samples and photos to be coded and hosted using REBOL's smart client, as part of my initial website or as an alternative to a website. (My only current web presence is a placeholder page in a community site, ErisX, where room for expansion may not be available.) In addition to providing an alternative to HTML and to web browsers entirely, I hope that REBOL is also capable of accommodating alternative graphics codecs or of serving as one itself. However, I may not need the smart client's e-commerce capability. I want the smart client nevertheless, so that my 'net site can be compactly coded both by the REBOL language and in the REBOL language. Please reply, with prices, directly to Dave Kanter, at [EMAIL PROTECTED] or [EMAIL PROTECTED] Thanks.
[REBOL] How do I save and restore an array of objects Re:
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 /BODY/HTML | 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]
[REBOL] Some niggley things Re:(3)
At 06:15 PM 3/9/00 +, you wrote: Hello, Elan: On 09-Mar-00, [EMAIL PROTECTED] wrote: 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" Hope this helps, 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, Which error? A REBOL error? and the page is returned which page returned where? minus the first and last (f-1 f-5) entries. If it causes an error, how is anything returned? Oh, it's not a REBOL error? 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 ] note that I used the "print mold " expression only for demonstration purposes: so that you can see exactly what is being returned, namely a string "..." containing the file values %x and plus signs. If you want to use the stuff somehow (I don't know what the URL you are returning has to look like, you will need to join the stuff with the url, and the final result should be one value, including all information, of type url!. As in read join http://www.some-site.com/ [""]. See, I don't know whether you plan to read the files and report the contents of those files to the URL you are addressing, or whether you want to send a list of file names to the url, in which case you possibly do not want to include the leading percent sign, if the server side program does not know that % is REBOL's way of saying literal file! type. Hmm, this is the *same line* used elswhere in the program, which worked last night. Am I missing something? I guess it is. In what form can I get the above "string" without quotes, so that I can build the URL properly? join http://www.some-site.com/ ["a+b+c+d+e"] == http://www.some-site.com/a+b+c+d+e type? join http://www.some-site.com/ ["a+b+c+d+e"] == url! Hope this helps, ;- Elan [: - )]
[REBOL] How do I save and restore an array of objects Re:(2)
Hi Bob, if I'm not mistaken, it is here where you are loading the file containing objects: if exists? %articles/stor [ stories: load %articles/stor ] try the following instead: if exists? %articles/stor [ stories: reduce load %articles/stor ] At 06:57 PM 3/9/00 +, you wrote: 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 /BODY/HTML | 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] ;- Elan [: - )]
[REBOL] Some niggley things Re:(3)
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] Run commands in NT's REBOL Re:(2)
Quoting [EMAIL PROTECTED] ([EMAIL PROTECTED]): Everyone know somethig about run commands in NT inside a REBOL script ... I need make a "at" command in the DOS's consola and i don't know ... Is it posible??? Hi, at the moment Rebol can't spawn external programs. Robert True, but with help of TCP/IP and i.e. perl it can be achieved. I did a little perl script for this purpose. I just needed to do some 'netscape -remote' :) -Jussi -- Jussi Hagman CS in Åbo Akademi University Studentbyn 4 D 33[EMAIL PROTECTED] 20540 Åbo[EMAIL PROTECTED] Finland
[REBOL] Some niggley things Re:(6)
On 09-Mar-00, [EMAIL PROTECTED] wrote: list-path: %/drive/folder/folder/ list: READ list-path with "list" containing the dir-list block. I didn't get this working yet. Elan: I had left the "/" off the tail, and REBOL chewed it up. I believe that was what fixed it; regardless, it is working. Hope this REALLY helps, I'd be still lost, without people like you, Jan, Bo and many others on the list. =8^{) -- ---===///||| Donald Dalley |||\\\===--- The World of AmiBroker Support http://webhome.idirect.com/~ddalley UIN/ICQ#: 65203020
[REBOL] Command Line Args Re:
Can some one please send me a example of how to deal with command lind arguments please? And can someone tell me how I do command line arguments with the Macintosh version? Bruce.
[REBOL] Command Line Args Re:
I tested it on my machine (running Win95) and it worked as advertised, i.e. the arguments were available under system/script/args as a string. What did you expect would happen? Perhaps the problem is with trim.r? At 09:04 PM 3/9/00 -0500, you wrote: Can some one please send me a example of how to deal with command lind arguments please? I want to do some thing like this from the command line: rebol -swq trim.r file.in file.out Manual says I should see "file.in and file.out" at system/script/args but I don't. What am I doing wrong? ;- Elan [: - )]
[REBOL] Command Line Args Re:(2)
Hi Bo, system/script/args is only for arguments passed with DO/ARGS. system/options/args is for arguments passed from the command line. Interesting enough, under Win95 system/script/args did contain the command line args! Actually, they both worked! ;- Elan [: - )]
[REBOL] Command Line Args Re:(2)
Hi Bo, system/script/args is only for arguments passed with DO/ARGS. system/options/args is for arguments passed from the command line. Interesting enough, under Win95 system/script/args did contain the command line args! Actually, they both worked! They both contained the same arguments. ;- Elan [: - )]
[REBOL] Associative Arrays in Rebol? Re:
I think select and paths should come close to what you're asking: for instance: select [ a "this is a" b "this is b" ] 'a == "this is a" select [ a "this is a" b "this is b" ] 'b == "this is b" block: [ a "this is a" b "this is b" ] == [a "this is a" b "this is b"] block/a == "this is a" block/b == "this is b" At 09:06 PM 3/9/00 -0500, you wrote: Is there any way to simulate Associative Arrays in Rebol? The type where the index could be a list of random words like in the language Awk? ;- Elan [: - )]
[REBOL] Command Line Args Re:(3)
Bo wrote: system/script/args is only for arguments passed with DO/ARGS. system/options/args is for arguments passed from the command line. Elan wrote: Interesting enough, under Win95 system/script/args did contain the command line args! Actually, they both worked! Bug in Windows version? Or problem in documentation? Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ --
[REBOL] Command Line Args Re:(2)
It may help to write a little test program, like this: write %trim.r { {[ {rebol [] {write %text.txt mold system/script/args {] {} and view the contents of %test.txt. Given the example of: rebol -swq trim.r file1.in file2.out I get: "file1.in file2.out" in %test.txt. Try it out for your self and see. Then your problem should be obvious. If not, let's know about it. Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ -- - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, 10 March 2000 6:26 PM Subject: [REBOL] Command Line Args Re: I tested it on my machine (running Win95) and it worked as advertised, i.e. the arguments were available under system/script/args as a string. What did you expect would happen? Perhaps the problem is with trim.r? At 09:04 PM 3/9/00 -0500, you wrote: Can some one please send me a example of how to deal with command lind arguments please? I want to do some thing like this from the command line: rebol -swq trim.r file.in file.out Manual says I should see "file.in and file.out" at system/script/args but I don't. What am I doing wrong? ;- Elan [: - )]
[REBOL] How do I save and restore an array of objects Re:(4)
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. B) you wrote: is there a situation where reduce should not be used? There are two I can think of right now. 1. When the object contains a literal word, as in: o: make object! [word: 'something] here 'something is lit-word! probe o reveals that the lit-word! becomes a word! when we create the object: probe o make object! [ word: something ] We store it and then load it. We now have the following block: o: load %bob-store.dat == [ make object! [ word: something ]] Note that this block contains three elements: the word make, the word object!, and the block containing the set-word! word and the word something. So when we reduce this block, we have the same situation as: o: make object! [word: something] which generates an error as it would with reduce, because the word something is not defined in this context: o: make object! [word: something] ** Script Error: something has no value. ** Where: word: something This whole scenario is due to the fact that the original lit-word! something (i.e. 'something) was reduced to a word when the original object - the one that we saved - was created. Accordingly, when we saved the object the word something, originally a lit-word! is saved as a word! and is no longer usable to create the object. I don't see how this situation could be avoided, since you can't as a matter of principle change all words that are assigned to a set-word! into lit-words when you load the stuff, because it is possible that some of these words are indeed intended as words. This is only a problem if it is possible that your object will include values that started out as lit-words, before the object was created. Two work-arounds: a) Never use literal words in objects you want to save, instead always assign literal word in blocks: o: make object! [word: [something] ] save %bob-store.dat o o: reduce load %bob-store.dat == [ make object! [ word: [something] ]] type? first o == object! b) Or If you are certain that - when you load objects from a file - you will not be using words that should be dereferenced during the act of object creation, i.e. something can never be intended as anything but 'something, then you could edit each respective block used in the object creation before you reduce the stuff, like in this case: o: make object! [word: 'something] save %bob-store.dat o loaded-o: load %bob-store.dat == [ make object! [ word: something ]] change back tail third loaded-o ['something] == [ ] print mold loaded-o [ make object! [ word: 'something ]] o: reduce loaded-o == [ make object! [ word: something ]] type? first o == object! probe first o make object! [ word: something ] 2. When you have objects that contain references to objects: p: make object! [q: o] save %bob-store.dat p r: first reduce load %bob-store.dat probe r make object! [ q: [ make object! [ word: something ]] ] probe p make object! [ q: [ make object! [ word: something ]] ] Looks as though everything is ok. NOT! Here's the problem: p, which is the object the word q as a reference to o, does not have its own copy of o. If you modify o, you automatically modify p's embedded object: Let's grab the object contained in the block o (remember we loaded it from the file): o: first o probe o make object! [ word: something ] Ok, now let's change what word is pointing at: o/word: 'something-else == something-else and p was changed as well: probe p make object! [ q: [ make object! [ word: something-else ]] ] in contrast there is no equivalent of p in the loaded scenario r, such that this equivalent points at the object referenced by q in r. In other words, as soon as you save the objects o and p, the relationship between o and p, namely that p/q is only reference to the object o, and not a second object, this relationship is lost. Can't think of anything else right now. Hope this helps. ;- Elan [: - )]