[REBOL] if condition vs. while condition Re:
Hi Pihoz, it doesn't even help, to have a look at until ... help until Evaluates a block until it is TRUE. Arguments: block -- (block) where the loop-condition is the return value of the loop-block itself. Ideally they all had the same parameters, I think. regards, Ingo Those were the words of [EMAIL PROTECTED]: Hello, For both a decision-making construct like "if" and a loop construct like "while" we need to specify a condition. Based on the evaluation of that condition, we would proceed with the loop or the body of the conditional. In REBOL, the condition for a while loop is specified as a "block" but the condition for an if statement is specified as a "condition." In this context, what is the definition of a "condition" and why does REBOL treat the two conditions differently? Why not use a block for an "if" statement as we do for loops? help if If condition is TRUE, evaluates the block. Arguments: condition -- block -- (block) help while While a condition block is TRUE, evaluates another block. Arguments: cond-block -- (block) body-block -- (block) ... -- _ ._ ingo@)|_ /| _| _ We ARE all ONE www._|_o _ _ ._ _ www./_|_) |o(_|(/_ We ARE all FREE ingo@| |(_|o(_)| (_| http://www.2b1.de/Rebol/ ._| ._|
[REBOL] Script = Rebol Tag Re:(4)
[EMAIL PROTECTED] escribió: Hi Keith, you wrote: For now, if you want to use REBOL to get form input from an HTML page, you'll have to do it with REBOL running as a CGI script. :) Well, how else would collect data from a form? Even using JavaScript, you will have to eventually report the data to the server and you will need some server side application to collect the data. So, server side you must have some program that will accept the data and do something sensible with it. When the own JavaScript script can not do it. I use a web page for sending short messages to cell phones. The limit is 160 characters. The service of the telephone company allows me to send those messages as e-mails (using a mail address like [EMAIL PROTECTED]) I could use my mail program to do it, but I use a web page where I write the phone number and the body of the message. I use it because it takes care of the characters you are typing and you know when you reach the 160 characters limit. When you press an OK button you send this input to the servers which send the mail. This needs a server program, because as far as I know JavaScript doesn´t have the ability to send mails by itself, but the character counting is done enterely from the client side. Using Rebol I think all this could be done from the local computer and I wouldn´t depend on the stability of the remote service (which is very poor). I´d like to write a local page which just do it. I "double-click" my page icon, write the message and send it through Rebol. I could enhace the page, allowing it to write messages longer than 160 chars and then spliting it automatically in 'less than 160 long' chunks and sending those chunks. ;- Elan [: - )] Thanks
[REBOL] Script return code Re:(2)
In einer eMail vom 24.02.00 12:24:36 (MEZ) Mitteleuropäische Zeit schreibt [EMAIL PROTECTED]: Maybe I wasn't clear enough, my posting was referring to situations in which one has to "glue" together the execution of multiple scripts, not necessarily all of them written in Rebol. A motivation could be legacy applications (if we call "legacy" whatever is already there and we won't/can't modify/rewrite). To give a real example, I need to integrate a number of Perl scripts with Rebol scripts; I'm doing that via a main shell script - though this detail is not relevant. In my case it's not a question of legacy software - I had to write some pieces in Perl because I need to access a RDBMS, something I can't do today in Rebol. So the "driver" script (the high-level shell script in my case) needs to know what's going on with the execution of the Perl and Rebol scripts. Perl poses non problem, but with Rebol I can't use the same mechanism. Of course I can have it worked out - I was wondering if anybody else felt my same need. I think the matter may be considered on the level of "design principles" or, in some sense, on the "philosophycal" side of what one expects from a programming language... Ciao Mauro Why not using perl for the main-script, it can start external programs, so also rebol. i think rebol can write to stdout, so simply pipe the result to perl? i don't know mutch perl, if it can make bidirectional pipes when starting, both can even communicate over it. i searched for perl with bidirectional pipes once a bit, but did not find them. So if you know, please tell :) Gruss Volker
[REBOL] Script = Rebol Tag Re:(4)
If you *really* want to use your REBOL scripts with an html interface in Windows, you can set up the Personal Web Server to serve REBOL CGI scripts from your own machine. There's been some discussion on the list about doing that before, and it seemed like people ran into a lot of pitfalls. Can't help you much further with the configuration of it because I've never done it, although I'll try to help if I can. Good luck! Keith - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 24, 2000 1:30 PM Subject: [REBOL] Script = "Rebol" Tag Re:(3) Thanks Sorry for my ignorance but, how can I do it in Windows95? I am not going to develop app for web servers but I´d like to give my rebol scripts an html interface for local use. Rather than giving command-line parameters or getting input from the rebol prompt I would use html forms and buttons for getting input and use hyperlinks for creating menus and navigate over my scripts. [EMAIL PROTECTED] escribió: It can't be done. Browsers don't have built in REBOL interpreters like they do JavaScript interpreters. However, there's been something called REBOL/Browse planned for awhile as far as I know, which is possibly a browser plugin that will let you do this. Also, REBOL/Apache is supposed to let you have REBOL code embedded in HTML pages in the style of PHP or ASP or JSP (curse JSP!!!). For now, if you want to use REBOL to get form input from an HTML page, you'll have to do it with REBOL running as a CGI script. :) Keith - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 24, 2000 10:58 AM Subject: [REBOL] Script = "Rebol" Tag Re: I don´t know also how to use scripts form HTML pages, using from rebol the input fields from HTML forms. Does anyone know if is itpossible? How would it be done? [EMAIL PROTECTED] escribió: How do I get the embedded Script tags in a HTML page to work. I have tried saving as both myPage.r and myPage.html, neither work. I have managed to set up the web server to correctly run Rebol as CGI scripts. This is the only example I cannot get to work. If the browser doesn't know about Rebol as it does script language = "JavaScript", how will this ever work. Thank you in advance Melvin Mudgett-Price Director of Development http://www.acmex.com/bio/mmp (Bio) (216) 391-7400 X207 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] Script = Rebol Tag Re:(5)
I´d like to write a local page which just do it. I "double-click" my page icon, write the message and send it through Rebol. I could enhace the page, allowing it to write messages longer than 160 chars and then spliting it automatically in 'less than 160 long' chunks and sending those chunks. Again, you can't run REBOL in a browser in any way. The only way you could use REBOL in this situation in conjunction with a browser is to have the browser talk to a REBOL cgi script running locally on a web server such as PWS. All the logic you're talking about with splitting the message up and everything could be done with REBOL, but it'd have to be done on the server side. Keith
[REBOL] Script = Rebol Tag Re:(5)
Hi, better use a local Apache server. I described the configuration in a previous email (from yesterday). You can download Apache for Win95 at http://www.apache.org (I think it was .org. Otherwise try .com or .net). Then you can put your form handling REBOL script in the Apache cgi-bin and continue to use JavaScript + HTML for input. Better yet, wait til REBOL/View becomes available (or join the beta testing now), and you can do it all with a nice GUI interface using nothing but REBOL/View (no web browser, no web server, no HTML, no JavaScript, and probably in no more than ten or twenty lines of code ...) ;- Elan [: - )]
[REBOL] WAP (protocol) and REBOL Re:(2)
Any pointers to URL's with specifications, tutorials ... ;- Elan [: - )]
[REBOL] text in face Re:
Hi Gerry, rebol/view related topics should be sent to the [EMAIL PROTECTED] list, not here. cheers Allen K - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 24, 2000 10:35 PM Subject: [REBOL] text in face Hello,every one, In beta view,I found: In CID layout text is easier than "make face",for example: layout 640x480 [ at 200x200 text "hello" 10x100 ] location of text can be defined using word 'at but : make face [ size: 120x120 text: "hello" font: make font [ size: 10x10 valign: 'center ;a few words not apply to me,'at not works here offset: 100x100 ;? another meaning rather than 'offset in others ] ] how to locate text in face? especially in big face,I think this is important in some cases. BTW, should all facets in face such 'text be designed as object! which could be customed in programming just like [feel font body]? of course,'font should be sub-object of text. maybe i'm missing something. ---gerry
[REBOL] html4 generator script Re:
Hi Scott, I briefly glanced at your html4.r script. (Briefly means that I may have few more ideas when I take a close look). Some observations: You use print throughout in your functions. That will significantly slow down your output to the webserver. Instead, have each function return a string that contains the stuff you would have usually printed out. I.e in this example: Begin: func ["The HTML tag."][ print [HTML] ] use: begin: func [] [ return "HTML" ] In this example: _head: make object! [ http-equiv: none author: none keywords: none description: none title: none style: none out: func [][ print [HEADnewline] if (not none? http-equiv) [print build-tag [meta http-equiv (http-equiv)]] if (not none? author) [print build-tag [meta name "AUTHOR" content (author)]] if (not none? keywords) [print build-tag [meta name "KEYWORDS" content (keywords)]] if (not none? description) [print build-tag [meta name "DESCRIPTION" content (description)]] if (not none? style) [ print build-tag [style type "text/css"] print [style newline /STYLE]] if (not none? title) [print [{TITLE}title{/TITLE}newline{/HEAD}]] ] end: func [] [print [/HEAD]] ] ; end of _head object TRY INSTEAD: _head: make object! [ tags: make object! [ http-equiv: none author: none keywords: none description: none title: none style: none ] out: func [/local result meta-block][ result: make string! 1000 foreach tag next first tags [ if get in tags tag [ append result either meta-block: select [ http-equiv [http-equiv] author [name "AUTHOR"] keywords [name "KEYWORDS"] description [name "DESCRIPTION"] ] tag [ build-tag compose/deep [meta (meta-block) content (get in tags tag)] ][ switch tag [ style [ rejoin [ build-tag [tags/style type "text/css"] tags/style newline "/STYLE" ] ] title [ rejoin ["TITLE" tags/title " /TITLE /HEAD"] ] ] ] append result newline ] ] return head insert result HEAD ] ] To have a complete (albeit trivial) web page let me add the following strings: content-type: "Content-Type: text/ ^/^/" end-html: /HTML body: "BODY/BODY" In your CGI script you the say: _head/tags/http-equiv: "Whatever" _head/tags/author: "Elan" _head/tags/keywords: {REBOL programming consult web page design software programs} _head/tags/description: {Programmer and consultant web page} _head/tags/title: {Think First Consulting} _head/tags/style: none print [ content-type _head/out body end-html ] If I print mold _head/out I get: {HEADmeta http-equiv content="Whatever" meta name="AUTHOR" content="Elan" meta name="KEYWORDS" content="REBOL programming consult web page design software programs" meta name="DESCRIPTION" content="Programmer and consultant web page" TITLEThink First Consulting /TITLE /HEAD } Perhaps it would be a better idea to use html-head instead of _head? It's more user friendly and even a novice will immediately understand what you are talking about. ;- Elan [: - )]
[REBOL] Folders on Mac
Hi All, Sorry if that question has been asked before but I'm new to the list. I can't seem to be able to open up folders on a Macintosh iMac but can do it without any problem on W98, anything special I need to do? Thanks, Stephane __ Get Your Private, Free Email at http://www.hotmail.com
[REBOL] RIP
The version of RIP I posted last night was missing a closing quote in the history section of the header, so if you want to use it - add the quote (big OOPS here... sorry). For whoever it was who was having problems using RIP: RIP saves the archive's file name in the extraction code, and needs this to open the archive in binary mode - as a result you cannot rename the file... perhaps a solution to this should be the next enhancement? Anyway in the mean time just don't change the name of the archive after you create it. - Cal Dixon ([EMAIL PROTECTED]) -- __ Get Your Private, Free Email at http://www.hotmail.com
[REBOL] select question Re:
- Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 24, 2000 6:36 AM Subject: [REBOL] select question I have a series with multiple identical entries, but different values: [ "book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "MM" ] I want to search the series for each occurrence of say "book" and then evaluate it for a match. How can I do this? Or, is select perhaps not the right hammer to beat this puzzle with? Brad Emerson Hi Brad, A couple of ideas... db: [ "book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "MM" ] foreach [category item] db [ if category = "book" [print item] ] Or you could look at rearanging the way you store your data, so that items are stored under their categories. db: [ book ["The Hobbit" "The Stand"] candy ["Mars Bar" "MM"] ] foreach item db/book [print item] foreach item db/candy [print item] or category: 'book foreach item db/:category [print item] Cheers Allen K
[REBOL] if condition vs. while condition Re:
Hi Piroz, In this context, what is the definition of a "condition" A condition is an expression that evaluates either to a logical false (including none, off) or something else. Like in C, everything that is not a logical false is considered true, i.e. if 1 [print {will be evaluated because 1 is not logical false}] will be evaluated because 1 is not logical false if [] [print {will be evaluated because an empty block, [], is not logical false}] will be evaluated because an empty block, [], is not logical false and why does REBOL treat the two conditions differently? The condition expression for if needs to be evaluated exactly once. First, we evaluate the condition expression and then - depending on what this expression evaluates to - we either do or do not evaluate if's body. What happens in that body cannot affect the result of having evaluated the condition expression. There is therefore no reason to pass the condition expression on to if for evaluation. The condition expression will be evaluated in the context in which if is called, and the resulting value will be passed to if. In contrast, while's condition has to be evaluated repeatedly, once on entering while and repeatedly after while's body has been evaluated. Therefore, "while" itself must evaluate its condition expression. It cannot simply receive the result of a single evaluation of the condition epxression. To protect while's condition expression from being evaluated in the context in which while is being called (i.e. the global context of the REBOL shell, or the context of a function in which while is being called), the condition expression is embedded in a block. The condition expression block can contain as many expressions as required. The condition expression itself - not the result of having evaluated it - is passed to while in a block and and while will evaluate the condition expression as often as it needs to. We expect that some expression evaluated in while's body will eventually affect the condition expression and that expression will return false. The condition expression must therefore be able to reflect modifications that occurred as a result of evaluating while's body. Why not use a block for an "if" statement as we do for loops? There are two factors that determine that we must pass the condition expression unmodified - i.e. embedded in a block - to while: the condition expression must be evaluated repeatedly, and during its repeated evaluation changes that occured within while's body must be able to affect values that are processed in the condition expression. Neither of these factors apply to if. There is no reason to complicate if's implementation by forcing it to evaluate its condition expression, when that expression can be safely evaluated before the result of that evaluation is passed to if. ;- Elan [: - )]
[REBOL] Script return code
First of all, thanks to everybody who promptly answered my former question on email attachments. My question of the day is: what mechanism can be used to (programmatically) test whether the execution of a Rebol script has been successful or not? If I'm right, a script has no way to return an "exit code" which would provide the usual mechanism found on Unix. While it is true that the script might output the equivalent of a return code, this works fine provided that the script doesn't do any other kind of output. In other words, it'd be suitable for batch-oriented scripts which don't write anything else on stdout/stderr. In my opinion, the formalized notion of a return code is essential, especially when one has to "glue" together scripts and/or applications and drive their execution by means of a higher-level program (e.g., a shell script), taking into account failures etc. The presence of the return code should also be transparent to the user, i.e. it shouldn't interfere with the execution of the script (like altering its output). Any idea of why such a feature hasn't been incorporated in the language? Concerning cross-platform portability, a solution a la exit() is as portable as C. Thanks for your help, Mauro
[REBOL] RIP
__ Get Your Private, Free Email at http://www.hotmail.com
[REBOL] RIP
Well, RIP didn't have the ability to archive sub-directories, so I added 8 lines and changed one slightly so it could.. I've tested it a bit and it seems to work well... So here it is (attached) Cal Dixon -- __ Get Your Private, Free Email at http://www.hotmail.com REBOL [ Title: "RIP - REBOL Binary Archiver" Date: 22-Feb-2000 File: %rip.r Author: "Carl Sassenrath" Email: [EMAIL PROTECTED] Version: 1.0.1 Purpose: { Gathers and compresses files into a self extracting archive file that has a REBOL header. Note that resulting archive is BINARY for minimal size. } History: [ 1.0.0 22-Feb-2000 "Carl Sassenrath" {Original code.} 1.0.1 24-Feb-2000 "Cal Dixon {Added subdirectoy support} ] ] file-types: [%.r %.txt %.html %.htm %.bmp %.jpg %.jpeg %.gif] path: to-file ask { Enter the directory path. Press RETURN key for current directory, or type a path in the form: dir/dir/dir Directory? } if empty? trim path [path: %./] if (last path) #"/" [append path #"/"] if not exists? path [print [path "does not exist"] halt] file-list: [] archive: make binary! 32000 print "Archiving:" foreach file (files: read path) [ if find file-types find/last file "." [ prin [tab file " "] data: read/binary path/:file prin [length? data " - "] data: compress data print [length? data] append archive data append file-list reduce [file length? data] ] if dir? path/:file [ append file-list reduce [file 'DIR ] foreach newfile read path/:file [ append files file/:newfile ] ] ] print [newline "Total size:" length? archive "Checksum:" checksum archive newline] filename: to-file ask "Output file name? " if empty? trim filename [filename: %archive.rip] if not find filename "." [append filename ".rip"] if all [exists? filename not confirm reform ["Overwrite file" filename "? "]] [ print "stopped" halt ] header: mold compose/deep [ REBOL [ Title: "REBOL Self-extracting Binary Archive (RIP)" Date: (now) File: (filename) Note: (reform [{To extract, type REBOL} filename {or run REBOL and type: do} filename]) ] file: (filename) size: (length? archive) path: (path) files: (reduce [file-list]) check: (checksum archive) secure none if not exists? path [make-dir path] archive: read/binary file archive: next find/case/tail archive to-binary probe join "!DATA" ":" if check checksum archive [print ["Checksum failed" check checksum archive] halt] print "Reviving:" foreach [file len] files [ print [tab file] either len = 'DIR [ if not exists? path/:file [ make-dir path/:file ] ][ data: decompress copy/part archive len archive: skip archive len either any [ not exists? path/:file confirm reform [file "already exists - overwrite? "] ][write/binary path/:file data][print "skipped"] ] ] ] insert archive reduce [header newline "!DATA:" newline] write/binary filename archive quit
[REBOL] Reading a file line by line
Hello! I need to read a BIG text file line by line but I don't know exactly how to do. As I understand the following will read the entire file to a list of lines and that is not what I want. lines: read/lines %textfile I want to read one line, process it before reading the next line and so on. Best regards, Peter Carlsson Peter CarlssonTel: +46 31 735 45 26 Saab Ericsson Space ABFax: +46 31 735 40 00 S-405 15 Göteborg Email: [EMAIL PROTECTED] SWEDENURL: http://www.space.se
[REBOL] if condition vs. while condition Re:
[EMAIL PROTECTED] wrote: In this context, what is the definition of a "condition" and why does REBOL treat the two conditions differently? Why not use a block for an "if" statement as we do for loops? Because WHILE needs to evaluate the condition several times, so it needs the code of the condition, not the result of its execution; IF, on the other hand, just needs the result. If you really want an IF which uses a block, then use the following: my-if: func [ "My strange if" [throw "To make RETURN work as expected"] cond-block [block!] "Condition block" code-block [block!] "Code block" ] [ if do cond-block code-block ] Ciao, /Gabriele./ o) .-^-. (--o | Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila | | GIESSE on IRC \ \-\_/-/ / http://www.amyresource.it/AGI/ | o) `-v-' (--o
[REBOL] Reading a file line by line Re:
Peter wrote: I need to read a BIG text file line by line but I don't know exactly how to do. Use a port, Peter. Look in "Ports Access to Files", from the REBOL manual, here: users-guide\users\filports.html Of course, your directories may vary, but there's a copy at the REBOL site. Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ --
[REBOL] Script return code Re:
Maybe I wasn't clear enough, my posting was referring to situations in which one has to "glue" together the execution of multiple scripts, not necessarily all of them written in Rebol. A motivation could be legacy applications (if we call "legacy" whatever is already there and we won't/can't modify/rewrite). To give a real example, I need to integrate a number of Perl scripts with Rebol scripts; I'm doing that via a main shell script - though this detail is not relevant. In my case it's not a question of legacy software - I had to write some pieces in Perl because I need to access a RDBMS, something I can't do today in Rebol. So the "driver" script (the high-level shell script in my case) needs to know what's going on with the execution of the Perl and Rebol scripts. Perl poses non problem, but with Rebol I can't use the same mechanism. Of course I can have it worked out - I was wondering if anybody else felt my same need. I think the matter may be considered on the level of "design principles" or, in some sense, on the "philosophycal" side of what one expects from a programming language... Ciao Mauro [EMAIL PROTECTED] wrote: Mauro wrote: My question of the day is: what mechanism can be used to (programmatically) test whether the execution of a Rebol script has been successful or not? S1: [print "This is S1" true] == [print "This is S1" true] do s1 This is S1 == true S2: [print "This is S2" false] == [print "This is S2" false] do s2 This is S2 == false SE: [print a string that is not in double quotes true] == [print a string that is not in double quotes true] either error? Result: try [do SE][print "There was an error?"][print "All OK!"] There was an error? either error? Result: try [do S2][print "There was an error?"][print "All OK!"] This is S2 All OK! either error? Result: try [do S1][print "There was an error?"][print "All OK!"] This is S1 All OK! I hope that helps! :-D Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ -- - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, 24 February 2000 10:31 PM Subject: [REBOL] Script return code First of all, thanks to everybody who promptly answered my former question on email attachments. My question of the day is: what mechanism can be used to (programmatically) test whether the execution of a Rebol script has been successful or not? If I'm right, a script has no way to return an "exit code" which would provide the usual mechanism found on Unix. While it is true that the script might output the equivalent of a return code, this works fine provided that the script doesn't do any other kind of output. In other words, it'd be suitable for batch-oriented scripts which don't write anything else on stdout/stderr. In my opinion, the formalized notion of a return code is essential, especially when one has to "glue" together scripts and/or applications and drive their execution by means of a higher-level program (e.g., a shell script), taking into account failures etc. The presence of the return code should also be transparent to the user, i.e. it shouldn't interfere with the execution of the script (like altering its output). Any idea of why such a feature hasn't been incorporated in the language? Concerning cross-platform portability, a solution a la exit() is as portable as C. Thanks for your help, Mauro begin:vcard n:Bregolin;Mauro tel;fax:+39 049 8073066 tel;work:+39 049 8073066 x-mozilla-html:TRUE adr:;; version:2.1 email;internet:[EMAIL PROTECTED] end:vcard
[REBOL] REMOVE Re:
You need to send the word: unsubscribe in the subject line in an email to this list. Here's a helpful link: [EMAIL PROTECTED]?subject=unsubscribe or in REBOL: send [EMAIL PROTECTED] {unsubscribe} Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ -- - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, 24 February 2000 11:46 AM Subject: [REBOL] REMOVE
[REBOL] What's with Ally beta list? Re:
[EMAIL PROTECTED] wrote: am I the only one having problems with posting to REBOL Ally mailing list? I assume there are some problems with SELMA, since I am receiving tons of duplicates here... :-/ Ciao, /Gabriele./ o) .-^-. (--o | Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila | | GIESSE on IRC \ \-\_/-/ / http://www.amyresource.it/AGI/ | o) `-v-' (--o
[REBOL] un subscribe Re:
You need to send the word: unsubscribe in the subject line in an email to this list. Here's a helpful link: [EMAIL PROTECTED]?subject=unsubscribe or in REBOL: send [EMAIL PROTECTED] {unsubscribe} Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ -- - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, 24 February 2000 12:06 PM Subject: [REBOL] un subscribe
[REBOL] [REBOL] Multipart emails Re:
[EMAIL PROTECTED] wrote: Does anybody know how (or has written something) to handle multipart email messages? I mean things like listing, extracting attachments from a message when reading it, or composing an email message consisting of a number of attachments? I did some work for a multipart/form-data decoder; it needs some work for more generic MIME handling, but if you are interested... Ciao, /Gabriele./ o) .-^-. (--o | Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila | | GIESSE on IRC \ \-\_/-/ / http://www.amyresource.it/AGI/ | o) `-v-' (--o
[REBOL] Script return code Re:
Mauro wrote: My question of the day is: what mechanism can be used to (programmatically) test whether the execution of a Rebol script has been successful or not? S1: [print "This is S1" true] == [print "This is S1" true] do s1 This is S1 == true S2: [print "This is S2" false] == [print "This is S2" false] do s2 This is S2 == false SE: [print a string that is not in double quotes true] == [print a string that is not in double quotes true] either error? Result: try [do SE][print "There was an error?"][print "All OK!"] There was an error? either error? Result: try [do S2][print "There was an error?"][print "All OK!"] This is S2 All OK! either error? Result: try [do S1][print "There was an error?"][print "All OK!"] This is S1 All OK! I hope that helps! :-D Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ -- - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, 24 February 2000 10:31 PM Subject: [REBOL] Script return code First of all, thanks to everybody who promptly answered my former question on email attachments. My question of the day is: what mechanism can be used to (programmatically) test whether the execution of a Rebol script has been successful or not? If I'm right, a script has no way to return an "exit code" which would provide the usual mechanism found on Unix. While it is true that the script might output the equivalent of a return code, this works fine provided that the script doesn't do any other kind of output. In other words, it'd be suitable for batch-oriented scripts which don't write anything else on stdout/stderr. In my opinion, the formalized notion of a return code is essential, especially when one has to "glue" together scripts and/or applications and drive their execution by means of a higher-level program (e.g., a shell script), taking into account failures etc. The presence of the return code should also be transparent to the user, i.e. it shouldn't interfere with the execution of the script (like altering its output). Any idea of why such a feature hasn't been incorporated in the language? Concerning cross-platform portability, a solution a la exit() is as portable as C. Thanks for your help, Mauro
[REBOL] Reading a file line by line Re:
I need to read a BIG text file line by line but I don't know exactly how to do. As I understand the following will read the entire file to a list of lines and that is not what I want. lines: read/lines %textfile I want to read one line, process it before reading the next line and so on. Hi Peter: It's relatively easy to act on files larger than memory, one line at a time. I believe BO at REBOL came up with the technique originally. I've adapted it and use it for manipulating large log files on my internet servers. Here it is, enjoy: hugefile: open/direct/read/lines %huge_file while [ ( line: pick hugefile 1 ) none ] [ ;;do stuff to each line;; ] close hugefile --Ralph Roberts
[REBOL] 'send and the subject-line
Hello REBOLS! I just walked into a problem with 'send. If I e.g. send [EMAIL PROTECTED] "The Subject^/The Body" I always get an email looking like this ... subject: The Subject The Subject The Body Why does REBOL repeat the subject line in the message's body? Does anyone know? Do I necessarily have to supply my own custom header with 'send/header ? Or is this the result of simple misconfiguration? Thanks in advance, Christian Ensel [EMAIL PROTECTED]
[REBOL] Reading a file line by line Re:(2)
I have been reading really large files using this setup; file: read/lines %filename foreach line file [do stuff] This seems to work well, however what is the limitation. What are the limitations on such a read, does the entire file get read into memory when issuing the read/lines command? Seems to work for me anyhow Francois On Thu, 24 Feb 2000 [EMAIL PROTECTED] wrote: I need to read a BIG text file line by line but I don't know exactly how to do. As I understand the following will read the entire file to a list of lines and that is not what I want. lines: read/lines %textfile I want to read one line, process it before reading the next line and so on. Hi Peter: It's relatively easy to act on files larger than memory, one line at a time. I believe BO at REBOL came up with the technique originally. I've adapted it and use it for manipulating large log files on my internet servers. Here it is, enjoy: hugefile: open/direct/read/lines %huge_file while [ ( line: pick hugefile 1 ) none ] [ ;;do stuff to each line;; ] close hugefile --Ralph Roberts
[REBOL] Reading a file line by line Re:(3)
Just read/lines %filename will cause REBOL to crash and burn on large files, as I found out the hard way (the way I usually do find out stuffg). I wrote some beautiful scripts to monitor various logs on my server using read/lines on files. Was very proud of meself, as they worked very slickly. Then, one day, they broke. And it was because of memory problems. But the technique below zips through 10 megabyte logs very nicely. I'm putting together a script now to delete my logs after they get so hugeg, but am mining some great info in the meantime. --Ralph Roberts I have been reading really large files using this setup; file: read/lines %filename foreach line file [do stuff] This seems to work well, however what is the limitation. What are the limitations on such a read, does the entire file get read into memory when issuing the read/lines command? Seems to work for me anyhow Francois On Thu, 24 Feb 2000 [EMAIL PROTECTED] wrote: I need to read a BIG text file line by line but I don't know exactly how to do. As I understand the following will read the entire file to a list of lines and that is not what I want. lines: read/lines %textfile I want to read one line, process it before reading the next line and so on. Hi Peter: It's relatively easy to act on files larger than memory, one line at a time. I believe BO at REBOL came up with the technique originally. I've adapted it and use it for manipulating large log files on my internet servers. Here it is, enjoy: hugefile: open/direct/read/lines %huge_file while [ ( line: pick hugefile 1 ) none ] [ ;;do stuff to each line;; ] close hugefile --Ralph Roberts
[REBOL] 'send and the subject-line Re:
Hello REBOLS! I just walked into a problem with 'send. If I e.g. send [EMAIL PROTECTED] "The Subject^/The Body" I always get an email looking like this ... subject: The Subject The Subject The Body Why does REBOL repeat the subject line in the message's body? Does anyone know? Do I necessarily have to supply my own custom header with 'send/header ? Yes. Or is this the result of simple misconfiguration? No. ;-) To be more verbose: I vote for adding next function for sending a mail: sendmail email where email is like system/standard/email email: make object! [ To: none CC: none BCC: none From: none Reply-To: none Date: none Subject: none Return-Path: none Organization: none Message-Id: none Comment: none X-REBOL: {2.2.0.4.2 "The Internet Messaging Language (TM) WWW.REBOL.COM"} MIME-Version: none Content-Type: none Content: none ] this function should send mail as it is, i.e. get the addressees automatically from To, CC and BCC fields. and make from Content field the body of the mail. I don't know how to send mail from REBOL now with two email addresses in To field. Regards, jan -- Jan Strejcek [EMAIL PROTECTED]
[REBOL] Script = Rebol Tag Re:
I don´t know also how to use scripts form HTML pages, using from rebol the input fields from HTML forms. Does anyone know if is itpossible? How would it be done? [EMAIL PROTECTED] escribió: How do I get the embedded Script tags in a HTML page to work. I have tried saving as both myPage.r and myPage.html, neither work. I have managed to set up the web server to correctly run Rebol as CGI scripts. This is the only example I cannot get to work. If the browser doesn't know about Rebol as it does script language = "JavaScript", how will this ever work. Thank you in advance Melvin Mudgett-Price Director of Development http://www.acmex.com/bio/mmp (Bio) (216) 391-7400 X207 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] select question Re:
In einer eMail vom 24.02.00 03:25:34 (MEZ) Mitteleuropäische Zeit schreibt [EMAIL PROTECTED]: I have a series with multiple identical entries, but different values: [ "book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "MM" ] I want to search the series for each occurrence of say "book" and then evaluate it for a match. How can I do this? Or, is select perhaps not the right hammer to beat this puzzle with? i: a s: "book" == "book" while[i: find i s][ probe i i: next i ] ["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "MM"] ["book" "The Stand" "candy" "Mars Bar" "candy" "MM"] Trick: find itself returns position in a series, you can simple continue from here. Good Design :) Attention! This does not work with hash! stepwise beyond: s: "book" == "book" a: [ "book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "MM" ] == ["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "MM"] b: find a s == ["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "MM"] c: next b == ["The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "MM"] d: find c s == ["book" "The Stand" "candy" "Mars Bar" "candy" "MM"] ;... ;so i: a s: "book" == "book" while[i: find i s][ probe i i: next i ] ["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "MM"] ["book" "The Stand" "candy" "Mars Bar" "candy" "MM"] == none i: a s: "MM" ; make shure it works on end.. == "MM" while[i: find i s][ probe i i: next i ] ["MM"] == none Gruss Volker
[REBOL] WAP (protocol) and REBOL
Any body working on a WAP scheme? This is a discussion starter What follows is a quote from a recent email message I received. QUOTE 1. WAP and WML What are WAP and WML? If you are not yet involved with this technology you can be excused for not being familiar with it. If you are an HTML author or make your living on the Internet, then now is the time to learn something about WML and WAP. It will not be long before they are as familiar to many people as the Internet. WML stands for Wireless Markup Language and is used to create the equivalent of a web page on a Wireless Device such as a Digital Cell Phone. Where WML is basically equivalent to HTML, WAP, which stands for Wireless Application Protocol, is roughly equivalent to HTTP or Hypertext Transfer Protocol. So what makes this technology so special? I have seen quite a few references to WAP becoming as big or bigger than the Internet. I see that as something of an oxymoron. For me, WAP is a natural extension of the Internet that will make the World Wide Web available for applications and technologies in places that it is difficult or impossible to access using existing Internet technology. The key to WAP is its portable nature. You don't need a Keyboard, monitor or cable connection. Simply open your cell phone and dial into the service you want. A miniature web page will be displayed on the LCD of your Wireless Device. Even laptops do not provide this level of convenience. The highly portable nature of a WAP device is also its biggest limitation. Unlike a large computer monitor with a fast Internet connect, a WAP device has a tiny monochrome screen with a relative slow digital connection. Those big interactive animated web pages will be impossible to display on a WAP device. What will WAP devices be used for? Well that is were your imagination could make you very rich if you have the business savvy to put it together. There are many WAP startup companies raising a lot of capital right now on little more than their ideas. Applications for WAP range from Online banking and Investing, Stock tracking, GPS navigation (where are you and how do you get home?), shopping, email etc. Maybe someone will actually use them for making phone calls. /QUOTE Douglas Vos - e-Mail: mailto:[EMAIL PROTECTED] AlphaPager: mailto:[EMAIL PROTECTED]
[REBOL] Script = Rebol Tag Re:(2)
It can't be done. Browsers don't have built in REBOL interpreters like they do JavaScript interpreters. However, there's been something called REBOL/Browse planned for awhile as far as I know, which is possibly a browser plugin that will let you do this. Also, REBOL/Apache is supposed to let you have REBOL code embedded in HTML pages in the style of PHP or ASP or JSP (curse JSP!!!). For now, if you want to use REBOL to get form input from an HTML page, you'll have to do it with REBOL running as a CGI script. :) Keith - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 24, 2000 10:58 AM Subject: [REBOL] Script = "Rebol" Tag Re: I don´t know also how to use scripts form HTML pages, using from rebol the input fields from HTML forms. Does anyone know if is itpossible? How would it be done? [EMAIL PROTECTED] escribió: How do I get the embedded Script tags in a HTML page to work. I have tried saving as both myPage.r and myPage.html, neither work. I have managed to set up the web server to correctly run Rebol as CGI scripts. This is the only example I cannot get to work. If the browser doesn't know about Rebol as it does script language = "JavaScript", how will this ever work. Thank you in advance Melvin Mudgett-Price Director of Development http://www.acmex.com/bio/mmp (Bio) (216) 391-7400 X207 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] Reading a file line by line Re:(3)
You can read a larger file with a bare READ than with READ/LINES. I've just tested reading a 50 meg file with READ, where with READ/LINES REBOL just seemed to hang. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 24, 2000 6:41 AM To: [EMAIL PROTECTED] Subject: [REBOL] Reading a file line by line Re:(2) I have been reading really large files using this setup; file: read/lines %filename foreach line file [do stuff] This seems to work well, however what is the limitation. What are the limitations on such a read, does the entire file get read into memory when issuing the read/lines command? Seems to work for me anyhow Francois On Thu, 24 Feb 2000 [EMAIL PROTECTED] wrote: I need to read a BIG text file line by line but I don't know exactly how to do. As I understand the following will read the entire file to a list of lines and that is not what I want. lines: read/lines %textfile I want to read one line, process it before reading the next line and so on. Hi Peter: It's relatively easy to act on files larger than memory, one line at a time. I believe BO at REBOL came up with the technique originally. I've adapted it and use it for manipulating large log files on my internet servers. Here it is, enjoy: hugefile: open/direct/read/lines %huge_file while [ ( line: pick hugefile 1 ) none ] [ ;;do stuff to each line;; ] close hugefile --Ralph Roberts
[REBOL] Script = Rebol Tag Re:(3)
Thanks Sorry for my ignorance but, how can I do it in Windows95? I am not going to develop app for web servers but I´d like to give my rebol scripts an html interface for local use. Rather than giving command-line parameters or getting input from the rebol prompt I would use html forms and buttons for getting input and use hyperlinks for creating menus and navigate over my scripts. [EMAIL PROTECTED] escribió: It can't be done. Browsers don't have built in REBOL interpreters like they do JavaScript interpreters. However, there's been something called REBOL/Browse planned for awhile as far as I know, which is possibly a browser plugin that will let you do this. Also, REBOL/Apache is supposed to let you have REBOL code embedded in HTML pages in the style of PHP or ASP or JSP (curse JSP!!!). For now, if you want to use REBOL to get form input from an HTML page, you'll have to do it with REBOL running as a CGI script. :) Keith - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 24, 2000 10:58 AM Subject: [REBOL] Script = "Rebol" Tag Re: I don´t know also how to use scripts form HTML pages, using from rebol the input fields from HTML forms. Does anyone know if is itpossible? How would it be done? [EMAIL PROTECTED] escribió: How do I get the embedded Script tags in a HTML page to work. I have tried saving as both myPage.r and myPage.html, neither work. I have managed to set up the web server to correctly run Rebol as CGI scripts. This is the only example I cannot get to work. If the browser doesn't know about Rebol as it does script language = "JavaScript", how will this ever work. Thank you in advance Melvin Mudgett-Price Director of Development http://www.acmex.com/bio/mmp (Bio) (216) 391-7400 X207 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] Script = Rebol Tag Re:(3)
Hi Keith, you wrote: For now, if you want to use REBOL to get form input from an HTML page, you'll have to do it with REBOL running as a CGI script. :) Well, how else would collect data from a form? Even using JavaScript, you will have to eventually report the data to the server and you will need some server side application to collect the data. So, server side you must have some program that will accept the data and do something sensible with it. ;- Elan [: - )]
[REBOL] html4 generator script
I've been working on a script to automagically generate html 4.0 tags. It's kinda big, probably ugly. With it you can do things like: h1/text: "Hello World" h1/style: "background:white" h1/out The 'out function spits out a formatted tag like h1 style="background:white"Hello World/h1. Basically I took all the html4 tags and turned them into objects, with all the attributes as properties or fields of the object. You can make your own tags and customize them, then use them throughout a page. You can use a 'reset function, h1/reset, to set the tags back to a default, like h1. I'd appreciate any comments. Please be gentle, I'm a newbie..:-)I'm attaching a test script I used to test everything, which should be modified to work on your system. Thanks for suggestions, comments, etc. Scott __ Get Your Private, Free Email at http://www.hotmail.com REBOL [ Title: "HTML 4 Generator" Date: 24-Feb-00 Name: 'HTML4 Version: 1.0 File: %HTML4.r Author: "Scott Woodrum" Email: [EMAIL PROTECTED] Category: [web] Tabs: 4 Purpose: {Build properly formatted html4 tags for dynamic web page creation(cgi) } Comment: { Every html tag has a corresponding object. Some object names have been changed to prevent name clashes with REBOL or for simplicity, i.e., HEAD = _head | OBJECT = obj | SELECT = sel | _form=FORM. Every object has an 'out function (prints out the constructed tag) and a 'reset function (resets the tags attributes to some default value). Some tag objects have an 'end function to print out a closing tag. Make sure for cgi stuff you call the 'header function at the start of your script. Not everything here is as clean or efficient as I would like, i.e., the cut and pasty reset function. Further note: most of this stuff really only works with IE4 or IE5. I did some testing with Mozilla alpha releases (http://www.mozilla.org) and everything seemed to work OK. Current versions of Netscape are iffy. Some things work, some things don't. I included an ugly test page I used during development to exercize tags/objects. I didn't include any tags that are DEPRECATED by w3c.} ] gentag: func [obj [object!]][ tag: [] clear tag words: next first obj foreach word words [ either function? get in obj word [][ if (not none? get in obj word) [ either equal? (mold word) "text" [] [ append tag to-lit-word word append tag get in obj word ] ] ] ] return tag ] Begin: func ["The HTML tag."][ print [HTML] ] End: func ["The /HTML tag."][ print [/HTML] ] header: func ["Must have this at the beginning of your script, if using for cgi stuff."][ print ["Content-Type: text/html^/"] ] _head: make object! [ http-equiv: none author: none keywords: none description: none title: none style: none out: func [][ print [HEADnewline] if (not none? http-equiv) [print build-tag [meta http-equiv (http-equiv)]] if (not none? author) [print build-tag [meta name "AUTHOR" content (author)]] if (not none? keywords) [print build-tag [meta name "KEYWORDS" content (keywords)]] if (not none? description) [print build-tag [meta name "DESCRIPTION" content (description)]] if (not none? style) [ print build-tag [style type "text/css"] print [style newline /STYLE]] if (not none? title) [print [{TITLE}title{/TITLE}newline{/HEAD}]] ] end: func [] [print [/HEAD]] ] ; end of _head object body: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [body (tag)]] ] end: func [] [print [/BODY]] ] h1: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" ;the text between H1/H1 out: func [] [ tag: gentag self print [build-tag [h1 (tag)]] print text print [/h1] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none