I've been working with Rebol/View for a while now and I seem to be stumped
as to how I can set up an error or debugging message which will act as a
"modular" window, i.e., it stays on top until dismissed, and program
execution does not continue until it is dismissed.
I thought I had solved this with a loop that would do a do-events (see
below), but whenever it executes do-events, it never iterates and in fact
execution of the funtion is suspended until the main window is destroyed.
Here's the code as it stands:
REBOL [
Title: "current test routine"
Author: "Ted A. Campbell"
Date: 1999-08-15
]
;---------------------
; generic handler for debug and error popup messages
;
myDebErr: func [ inString [string!] inTitle [string!] /local waitingForPanel
t ] [
t: ""
clear t
append t inTitle
append t ": "
print "Enter iDebErr..."
waitingForPanel: true
inform layout
title t with [ font: [ shadow: 1x1 ]]
text inString
button "OK" [ waitingForPanel: false hide-popup ]
] ; end of layout
while [ waitingForPanel == true ] [ print "Waiting..." do-events ] ;
wait...
; and here's the problem:
; code from this point is never executed until after the main window
; is destroyed
print "This doesn't execute until after the main (first) window is
unviewed..."
print "Now (at last) returning from iDebErr function..."
return true ; then return
]
; debug pop-up message
;
myDebug: func [ inString [string!] ] [
return myDebErr inString "DEBUG"
]
; error pop-up message
;
myError: func [ inString [string!] /local waitingForPanel t ] [
return myDebErr inString "ERROR"
]
mainWindow: layout [
backdrop effect [gradient 0.100.0 0.0.0]
title "Example"
button "Error Popup" [ myError "Hello. This is an error message from
myError." ]
button "Debug Popup" [ myDebug "Hello. This is a debug message from
myDebug." ]
button "Quit" [ unview/all ]
]
view mainWindow
print "done"
----
Can anyone help me figure out how to build a truly modular dialogue box with
Rebol/view?
Ted A. Campbell
ted@...
Outlook Express made a big change from 4.5 to 5.0, in that 5.0 stores mail
in a database, when 4.5 stored mail as separate documents in folders. In
other words, there are no files to be read. I could be wrong, as Outlook
Express doesn't come with any documentation, and I've had to guess at some
of the advanced functions. Does anyone know how to get rid of deleted mail?
I have zillions of deleted messages, and it looks like OE intends to keep
them for posterity.
--
Thomas David Kehoe Casa Futura Technologies
http://www.FriendshipCenter.com Stuttering Science & Therapy Website
The free penpals database for http://www.fluencydevices.com
individuals with disabilities. (888) FLU-ENCY
> Anyone know if there is a way to get REBOL to read email residing in
> Outlook 98?
>
> I have seen a REBOL program that can reads Eudora email:
>
> http://demo.rebol.net/cgi-bin/showfile.r?file=mbxfind.r&keywords=
> [{eudora}]
>
>
> It reads .mbx files created by Eudora.
>
> So I guess the REBOL script would have to be able to read .pst files.
>
> Thanks,
> EdGrant.com
Anyone know if there is a way to get REBOL to read email residing in
Outlook 98?
I have seen a REBOL program that can reads Eudora email:
http://demo.rebol.net/cgi-bin/showfile.r?file=mbxfind.r&keywords=
[{eudora}]
It reads .mbx files created by Eudora.
So I guess the REBOL script would have to be able to read .pst files.
Thanks,
EdGrant.com
I sort of thought that, but my version is 0.9.9.3.1 which it says is the
most current...or am I missing something bigtime?
Message: 2
Date: Mon, 14 Aug 2000 03:18:26 -0400
From: Jack Seay <jackseay@...>
Subject: Re: Messenger
Sounds like it needs a newer version of Rebol.
Gary Denrael said at Ò[Rebol_New] MessengerÓ.
[Aug/14/2000Mon 00:21]
-I am playing with REBOL, and tried to 'do' the messenger.r script.
-It
-terminates with the message 'Needs 2.1.3'. Any idea what it's
-looking
-for?
Sounds like it needs a newer version of Rebol.
Gary Denrael said at Ò[Rebol_New] MessengerÓ.
[Aug/14/2000Mon 00:21]
-I am playing with REBOL, and tried to 'do' the messenger.r script.
-It
-terminates with the message 'Needs 2.1.3'. Any idea what it's
-looking
-for?
-*-*-*-*-*-
Just because a lot of computers are sold does not mean they make any
sense. People accept what they are offered because they cannot
imagine better.
I think that the computer field has lost its way, big time. The low-
grade, tangled solutions that have been offered for most consumer
problems have come to seem god-given. "Word processing" is a geek's
notion of what you need for text; the real problem of version
management is pushed out into your lap. "Applications" are more
intended to trap you than to help you. Computer files are big
indivisible lumps in irrelevant hierarchical arrangements, absurdly
messy to deal with. ... Ted Nelson, 1998
Jack Seay jackseay@...
Lubbock Model Railroad Association - http://railserve.com/lmra
Hi folks:
I'm trying to get rebol to parse an email address from a text field.
Rebol doesn't like this..
addy: field "type the address" 200x20
or
button "Send" [send addy/text msg/txt]
I'de appreciate any help :))) Because, I stink ...
If any of you are reading the new Rebol book, please comment on it. I have it on
order. Hopefully, many of us (like myself) will be helped. The documention on
the Rebol site is mostly over my head.
>I am reading a 1,000 page book called "Dreamweaver 3 Bible". It goes
>into only some of the gory details needed to produce web pages; such
>as HTML, XML, CGI, JavaScript, Java, Shockwave, Flash, Fireworks,
>DHTML, and a whole lot more.
I was told that YAHOO always aims for a 3 second load time
on their home page. Slower and people go else ware.
In my work for Circuit Cellar Online magazine I visit a
couple of hundred new websites each month. I can count on
one hand the number of sites that use Java et.al. that have
actually worked (fast and crash free, and added useful
content).
People are seeking knowlage while drowning in a sea of
useless 'flash' of information.
If you want to do a business site, don't over whelm people
with glitz, they know it can be done you don't have to show
them with it, that you can do it too.
Time is money and Fireworks et.al. take time to load, I have
better things to do with my time...
> Thus, by learning one language, and a few simple
>dialects, someone could spend more time concentrating on
>the actual content of the pages.
I agree with you there, as long as 'content' is solid
information.
Don't lose site of your goal, what ever it may be, when
making a web page. Attract customers with cash in hand or
show off your web design talent?
>Civilization is in large part about, and around, what is written.
If Civilization was built the way web pages, and software in
general is today, the first woodpecker would cause the
collapse of civilization as we know it.
I am reading a 1,000 page book called "Dreamweaver 3 Bible". It goes
into only some of the gory details needed to produce web pages; such
as HTML, XML, CGI, JavaScript, Java, Shockwave, Flash, Fireworks,
DHTML, and a whole lot more. While Dreamweaver provides a graphical
environment to combine all these things together, I look forward to
the day when most of them can be replaced with one language, REBOL.
It would also be nice to have a graphical editor similar to
Dreamweaver for Rebol pages, and either a REBOL web browser or
browser plugin, (better yet, a combination browser/editor). Thus, by
learning one language, and a few simple dialects, someone could spend
more time concentrating on the actual content of the pages.
*#*#*#*#*#*#
To design the new structures of writing for screens is a profound
issue of literary structure. It is important to provide the best
literary structure that we can, for hypertext, as the literature of
tomorrow, determines in part the new structure of civilization.
Civilization is in large part about, and around, what is written.
This is what we call literature. Literature is an endless river,
connected, like water, in all directions. Document connections go
forward and backward in time, and sideways between documents.
Scholarship and fiction, political speeches and criticism,
advertising, journalism and technical reports-- all affect each other
and evolve in a constant flow of ideas and writings. ... Ted Nelson...
Jack Seay jackseay@...
Rebol For Dummies by Ralph Roberts : A good introduction and sample scripts
http://abooks.com/rebol/ This page has a short introduction to Rebol and some
sample scripts. The read/lines command is just what I have been looking for. Now
I can get started on a script to manipulate text to be reformatted into web
pages. This looks like it will be a much needed book. It's due out the
1-Sept-2000.
I am reading through all the definitions at the
http://rebol.org/cgi-bin/cgiwrap/rebol/wiki.r site and posting questions. If you
might have answers or more questions to post there, check it out.
Ryan wrote:
> The index.shtml file is not "including" the articles mentioned in the
include statements.
I suspect that your server is not executing the server side HTML emitted
from your REBOL CGI script. I believe your code needs to expand out these
statements by itself, as server side includes only work for files with the
.shtml extension, not CGI.
I hope that helps!
Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-
Can you help me with a server-side include problem?
I have a REBOL .cgi script which executes from an index.shtml file. The
script checks a POP account for new mail, converts the contents of the
mail strings into HTML files, then prints text/html to the browser. The
text/html it prints to the browser is a list of include statements
intending to include the contents of the five most recent files in a
directory, as such...
<!--#include virtual="/articles/20000510164353.html"-->
<!--#include virtual="/articles/20000510164352.html"-->
<!--#include virtual="/articles/20000510164351.html"-->
<!--#include virtual="/articles/20000510164350.html"-->
<!--#include virtual="/articles/20000510164349.html"-->
The index.shtml file is not "including" the articles mentioned in the
include statements. They do show up fine when I view source from the
resulting index.shtml page after the page has been rendered in the
browser. I know "include" is working because it is including other
files, albeit not from include statements generated by the .cgi script.
I think the problem lies in the fact I am returning include statements
to the browser, which somehow are not executed as includes.
Obviously, I'm doing something wrong. Can you correct me?
The script follows.
Thanks.
-Ryan
#!rebol -cs
REBOL []
reporters: [
[
"work"
email.address [ rchristiansen@... ]
full.name [ "Ryan C. Christiansen" ]
reporter.title [ "Editor-in-Chief" ]
][
"home"
email.address [ norsepower@... ]
full.name [ "Ryan C. Christiansen" ]
reporter.title [ "Editor-in-Chief" ]
][
"work extended"
email.address [ RChristiansen@... ]
full.name [ "Ryan C. Christiansen" ]
reporter.title [ "Editor-in-Chief" ]
]
]
mailbox: open pop://username:password@mail.fargonews.com ; CHANGED FOR
EXAMPLE
while [not tail? mailbox] [
msg: import-email first mailbox
foreach person reporters [
if info: find person 'email.address [
either find msg/from/1 info/2 [
new-article: make string! 10000
append new-article {<DIV class="article2">}
subject-info: msg/subject
subject-parts: []
foreach part parse/all subject-info ":" [
append subject-parts part
]
headline: first subject-parts
append new-article rejoin [{<P class="headline"><font
class="headline">} headline {</font><BR>}]
subheadline: second subject-parts
append new-article rejoin [{<font class="subhead">}
subheadline {</font>}]
temp-one: find person 'full.name
byline: temp-one/2
append new-article rejoin [{<P><font class="byline">}
byline {</font><BR>}]
temp-two: find person 'reporter.title
title: temp-two/2
append new-article rejoin [{<font class="bylinetitle">}
title {</font>}]
article-info: msg/content
end-of-paragraph: rejoin [{.} newline]
replace/all article-info end-of-paragraph {.<BR><BR>}
end-of-paragraph2: rejoin [{.} crlf]
replace/all article-info end-of-paragraph2 {.<BR><BR>}
append new-article rejoin [{<P class="news"><font class
="bodytext">} article-info {</font>}]
append new-article {</DIV>}
current-time: now/time
year: to-string now/year
month: to-string now/month
if (length? month) < 2 [insert month "0"]
day: to-string now/day
if (length? day) < 2 [insert day "0"]
hour: to-string current-time/hour
if (length? hour) < 2 [insert hour "0"]
minutes: to-string current-time/minute
if (length? minutes) < 2 [insert minutes "0"]
seconds: to-string current-time/second
if (length? seconds) < 2 [insert seconds "0"]
file-name: rejoin [year month day hour minutes seconds]
complete-file-name: rejoin [file-name {.html}]
write-file: reform ["write" rejoin [{%/absolute/path/
articles/} complete-file-name] "new-article"] ; CHANGED FOR EXAMPLE
do write-file
wait 1
][
ignore: []
clear ignore
]
]
]
remove mailbox
]
close mailbox
news-directory: read %/absolute/path/articles/
news-directory: tail news-directory
file-list: []
for file-grab 1 5 1 [
news-directory: back news-directory
file-name: first news-directory
append file-list file-name
]
list-of-includes: []
foreach file-name file-list [
include-statement: rejoin [{<!--#include virtual="/articles/} file-
name {"-->}]
append list-of-includes include-statement
]
print "Content-Type: text/html^/"
foreach statement list-of-includes [print statement]
Ronak Patel wrote:
> 1) When I try to save it doesn't work. I type in:
>
> save %files/test.r data
>
> and I get
>
> ** Script Error: data has no value.
> ** Where: save %files/test.r data
Try setting 'data to a value. For example:
data: "My data is a string"
save %files/test.r data
And make sure that the directory:
files
exists!
> 2) I D/L the redit.r and redit-macros.r, and how do I load it? Do I set it
into my user startup for REBOL?
Just enter:
do %redit.r
in the directory where %redit.r is saved. Don't do this for
%redit-macros.r as %redit.r does this.
You can also put this line in %user.r, so it's do-ne on every start of
REBOL, just after the 'set-net line.
I hope that helps!
Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-
1) When i try to save ti doesn't work. I type in
save %files/test.r data
and i get
** Script Error: data has no value.
** Where: save %files/test.r data
2) I D/L the redit.r and redit-macros.r, and how do i load it? Do i
set it into my user starup for REBOL?
james troy asked me, directly:
> Actually I am having trouble figuring it out. An explanation would be
great.
The revelent Roman Parser in REBOL script is attached.
Here's a explanation of how it works. First, the 'Roman2I or Roman to
Integer function. On reflection, I should have put a string describing the
function a little more, in the function parameters block.
Roman2I: function [Roman [string!]][Rules Total][
Total: 0
The above just declares a function and initialises a variable
Rules: [
"DM" (Total: Total - 500 + 1000) |
"CM" (Total: Total - 100 + 1000) |
"CD" (Total: Total - 100 + 500) |
"LM" (Total: Total - 50 + 1000) |
"LD" (Total: Total - 50 + 500) |
"LC" (Total: Total - 50 + 100) |
"XM" (Total: Total - 10 + 1000) |
"XD" (Total: Total - 10 + 500) |
"XC" (Total: Total - 10 + 100) |
"XL" (Total: Total - 10 + 50) |
"VM" (Total: Total - 5 + 1000) |
"VD" (Total: Total - 5 + 500) |
"VC" (Total: Total - 5 + 100) |
"VL" (Total: Total - 5 + 50) |
"VX" (Total: Total - 5 + 10) |
"IM" (Total: Total - 1 + 1000) |
"ID" (Total: Total - 1 + 500) |
"IC" (Total: Total - 1 + 100) |
"IL" (Total: Total - 1 + 50) |
"IX" (Total: Total - 1 + 10) |
"IV" (Total: Total - 1 + 5) |
#"M" (Total: Total + 1000) |
#"D" (Total: Total + 500) |
#"C" (Total: Total + 100) |
#"L" (Total: Total + 50) |
#"X" (Total: Total + 10) |
#"V" (Total: Total + 5) |
#"I" (Total: Total + 1)
]
The above is the rules for 'parse. At the bottom, I've got the standard
conversions for M, D, C, L, X, V and I, which are 1000, 500, 100, 50, 10, 5
and 1. The vertical bar "|" at the end of each line is the or operator "or".
if parse Roman [any Rules] [
return Total
]
0
]
For the above, if the 'parse works out, then the function returns the total,
otherwise it returns zero. This part:
[any Rules]
is the rules to compare to the input string. 'any means zero or more
time to apply the next thing. So, this basically means that there can 0, 1,
2, 3, or more matches of the following rule.
How does it work?
The:
(Total: Total + ... )
is the action that parse does when the string or char before the
parenthesis matches the input. So, for example, let's try:
Roman2I "MXIV"
and see how it flows through. Parse tries the rules one at a time,
looking for a match. Eventually it gets to the rule:
#"M" (Total: Total + 1000) |
The first letter of the string matches. So 'parse 'do-es this:
(Total: Total + 1000)
and so total ends up being 1000 bigger, which is the value of "M". Now
'parse has matched that rule, it advances it's pointer in the input string
past the matched part. The 'any means that another rule could match and
there's still characters in the string. Basically parse repeats, looking for
a matching sequence.
Eventually, parse gets to the "IV" in the input string. Notice that the
match for "IV in the rules is _before_ the match for "I" and the match for
"V"? Parse stops at the _first_ match in a group. It operates using
short-cut evaluation. That's why
(Total: Total - 1 + 5)
is evaluated, rather than the actions for "I" followed by "V".
If there's any questions, speak up!
Onto the next part:
I2Roman: function [Integer [integer!]][Result Arabic_Roman][
Again, just declaring a function.
if any [
Integer < 0
10000 < Integer
][
return make string! Integer
]
Here I'm checking for overflow conditions. I don't bother converting the
value if its below zero or more than ten thousand, instead, just returning
the integer converted into a string.
Result: make string! 0
Get some space for a string for the result.
For the following, look carefully at the 'reduce word and the block. Notice
that I'm putting in a formula, so that I can see that value for the roman
numeral combination is correct. I've commented out the -5... lines, as I've
discovered on testing that V before another value letter is not allowed in
Roman numerals. Notice also that I've arranged the lines in greater to
lesser order, based on the reduced value. When I did this initially, I got
the order mixed up, mistakenly thinking that a negative large number was
bigger than a negative small number.
Arabic_Roman: reduce [
1000 "M"
-1 + 1000 "IM"
; -5 + 1000 "VM"
-10 + 1000 "XM"
; -50 + 1000 "LM"
-100 + 1000 "CM"
;-500 + 1000 "DM"
500 "D"
-1 + 500 "ID"
; -5 + 500 "VD"
-10 + 500 "XD"
; -50 + 500 "LD"
-100 + 500 "CD"
100 "C"
-1 + 100 "IC"
; -5 + 100 "VC"
-10 + 100 "XC"
; -50 + 100 "LC"
50 "L"
-1 + 50 "IL"
; -5 + 50 "VL"
-10 + 50 "XL"
10 "X"
-1 + 10 "IX"
; -5 + 10 "VX"
5 "V"
-1 + 5 "IV"
1 "I"
]
We finish with the value "1" for "I".
foreach [Arabic Roman] Arabic_Roman [
while [Arabic <= Integer][
append Result Roman
Integer: Integer - Arabic
]
]
Result
]
For the above look, simple read as this: for each Arabic and Roman numeral
in the Arabic_Roman block, while the Arabic value is less than or equal to
the integer value input to this function, append onto the result string the
roman equivalent of the arabic value. Then reduced the Integer input by the
amount of the Arabic value.
When the above is done, simply return the result, which is the arabic
conversion of the roman numeral.
If there's any questions, speak up!
You can copy the above as much as you want.
Andrew Martin
Revealing imperfections...
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-
----------
[
REBOL [
Title: "Roman"
File: %Roman.r
Date: 6/February/2000
]
Roman2I: function [Roman [string!]][Rules Total][
Total: 0
Rules: [
"DM" (Total: Total - 500 + 1000) |
"CM" (Total: Total - 100 + 1000) |
"CD" (Total: Total - 100 + 500) |
"LM" (Total: Total - 50 + 1000) |
"LD" (Total: Total - 50 + 500) |
"LC" (Total: Total - 50 + 100) |
"XM" (Total: Total - 10 + 1000) |
"XD" (Total: Total - 10 + 500) |
"XC" (Total: Total - 10 + 100) |
"XL" (Total: Total - 10 + 50) |
"VM" (Total: Total - 5 + 1000) |
"VD" (Total: Total - 5 + 500) |
"VC" (Total: Total - 5 + 100) |
"VL" (Total: Total - 5 + 50) |
"VX" (Total: Total - 5 + 10) |
"IM" (Total: Total - 1 + 1000) |
"ID" (Total: Total - 1 + 500) |
"IC" (Total: Total - 1 + 100) |
"IL" (Total: Total - 1 + 50) |
"IX" (Total: Total - 1 + 10) |
"IV" (Total: Total - 1 + 5) |
#"M" (Total: Total + 1000) |
#"D" (Total: Total + 500) |
#"C" (Total: Total + 100) |
#"L" (Total: Total + 50) |
#"X" (Total: Total + 10) |
#"V" (Total: Total + 5) |
#"I" (Total: Total + 1)
]
if parse Roman [any Rules] [
return Total
]
0
]
I2Roman: function [Integer [integer!]][Result Arabic_Roman][
if any [
Integer < 0
10000 < Integer
][
return make string! Integer
]
Result: make string! 0
Arabic_Roman: reduce [
1000 "M"
-1 + 1000 "IM"
; -5 + 1000 "VM"
-10 + 1000 "XM"
; -50 + 1000 "LM"
-100 + 1000 "CM"
;-500 + 1000 "DM"
500 "D"
-1 + 500 "ID"
; -5 + 500 "VD"
-10 + 500 "XD"
; -50 + 500 "LD"
-100 + 500 "CD"
100 "C"
-1 + 100 "IC"
; -5 + 100 "VC"
-10 + 100 "XC"
; -50 + 100 "LC"
50 "L"
-1 + 50 "IL"
; -5 + 50 "VL"
-10 + 50 "XL"
10 "X"
-1 + 10 "IX"
; -5 + 10 "VX"
5 "V"
-1 + 5 "IV"
1 "I"
]
foreach [Arabic Roman] Arabic_Roman [
while [Arabic <= Integer][
append Result Roman
Integer: Integer - Arabic
]
]
Result
]
print ["Roman:" Roman2I probe "MCMLXII"]
print ["I2Roman:" I2Roman probe 1962]
]
[Non-text portions of this message have been removed]
>Can you remind us what the various symbols in Roman Numerals mean? I'll
>plunk together a quick parser for roman numerals, and show you how I would
>do it.
You can find some "C" code fragments (don't yell at me :-)
that do this.
NAME=Bob Stout's SNIPPETS
URL=http://www.brokersys.com/snippets/
Lots of code there that would be interesting to see in
Rebol.
--
For information on any of the following check out my WEB site at:
http://www.biogate.com/bpaddock/
Chemical Free Air Conditioning/No CFC's, Chronic Pain Relief, Echofone,
Electromedicine, Electronics, Explore!, Free Energy, Full Disclosure,
KeelyNet, Matric Limited, Neurophone, Oil City PA, Philadelphia Experiment.
http://www.uCOS-II.com
jetroy@... wrote:
> I'd like to learn how to do symbolic differentiation and parse roman
numerals to get Arabic numbers. I've read the docs, but nothing sinks in. I
believe I need to use the dialog method. Does anybody know how to do these?
Can you remind us what the various symbols in Roman Numerals mean? I'll
plunk together a quick parser for roman numerals, and show you how I would
do it.
You wrote:
> I believe I need to use the dialog method.
What's that method? :-/
Oh, and by the way, hi!
Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-
I'd like to learn how to do symbolic differentiation and parse
roman numerals to get arabic numbers. I've read the docs, but nothing
sinks in. I believe I need to use the dialog method. Does anybody know how
to do these?
Those are some good tips, Timmy, especially writing down what you want
a program to do before you write it.
Writing a program can be a lot like writing a research paper. In the
old days, we were taught to write our research notes on cards, and then
organize the cards. To finish the paper, we just needed to fill in the
blanks between the cards.
When writing a script, a good place to start is with the comments.
Write a comment for each thing the script needs to do, then start
putting in code between the comments.
A nice thing about REBOL is that you can also test things as you go
along. Write the first line and try it out, if it works, write the next
line, and then the next.
Programmers call this successive refinement. It's an important idea in
developing a good program. First think of the simplest script that
could do something like what you want. Write that script first. When
it's working, think of the next simplest thing that would make the
script better, and add that. An important idea here is to always have a
working script, starting with the simplest version and moving step by
step to a more sophisticated version. But keep it working each step of
the way.
The step-by-step approach also works well when learning REBOL. As you
go through the docs, keep a REBOL session open. Cut and paste the
sample code into your REBOL session, and watch it work for yourself.
Then change it a little bit, and make it YOUR example. Change it some
more, and see if you can break it. After you break it, fix it again.
This is called debugging.
Programmers do a lot of debugging. We spend as much time fixing
programs as we do writing them. A famous saying is that "All
programmers are optimists -- otherwise they could not be programmers".
But the most important thing is that programmers program. The best time
to start using REBOL is when you are reading the documents for the
first time. Open that REBOL session, and follow along. The best time to
join the REBOLution is now!
-Ted.
Hi :) A thought for beginners. Don't try to learn rebol
from studying the examples or user contributions.
Rebol was developed over years, so it's going to take
a little time to learn. Sit back and take it one page at a time
slowly. EVERY word in each sentence is important. The
creator of rebol seems to think we all have photographic
memories!
Remember: Rebol is the only thing that can take
control of the internet. I gave up learning it twice and
had to come back because nothing else
can do what it does unless you want to learn
c++ and learning c++ means learning all the protocals
for the internet on top of learning to create windows, controls,
and learning to handle and minipulate data, sockets, etc.
I think the best way to learn Rebol is write down
everything you want to accomplish on the internet and
then while you're resting from reading the users.html you
can daydream about all the great things you'll be doing in a few weeks.
:)
...timmy
The attached text file is a script I wrote
to send base64 attachments in my emails.
The main purpose for this tutor/script is to
show new users how to attach files to
their emails without them ending up as just
a bunch of characters on their friends computer
screen. remember that I'm just a beginner too.
You can email me with questions.
..timmy :)
----------
REBOL [
Title:"Timmy"
comment {
Read the notes at the end of this page.
By examining this script you can learn
how to add binary files to your emails
without them ending up as a bunch of
characters on your friends email client.
You can email me with questions if you're
stuck along the way. tim781@...
}
]
;---- This line-break func(below) will put the necessary
;---- newline into an enbased binary file.
line-break: func [data] [
while [not tail? data] [
data: insert skip data 72 "^/"
]
data: head data
]
;--end
;---- this(below) will open a jpg named picture.jpg that's
;---- in the directory that you started rebol from.
picture1: read/binary %picture.jpg
;--end
;---- this(below) will enbase the picture.jpg into base64(default)
;---- and call the line-break function to put in
;---- the necessary newline
picture2: line-break enbase picture1
;--end
;---- this(below) adds additions to the standard header
header: make system/standard/email [
From: "tim781@..."
MIME-Version: "1.0"
Subject: "Testing auto-enbase"
Content-Type: join {multipart/mixed; boundary=} {"------------4F9F64BEEE5"}
]
;--end
;---- This(below) is the body of the email. Binary
;---- attachments in emails are included in the
;---- body of the message.
message:{
This is a multi-part message in MIME format.
--------------4F9F64BEEE5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi timmy this is a 64 picture
--------------4F9F64BEEE5
Content-Type: image/jpeg; name="picture.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="picture.jpg"
}
; this is the end of the body of the message
;--end
;---- This(below) is added at the end of the
;---- base64 encoding to let the email client
;---- know that it is the end of the attachment.
;---- NOTICE that its different than the ones above.
last: "--------------4F9F64BEEE5--"
;--end
enb: join message picture2
enb2: join enb last
send/header tim781@... enb2 header
;------This is the end of the script ----- read below ---
comment {
what this script does is enbases a jpg (picture.jpg)
and then puts the encoding into the body of the message.
Nothing happens until REBOL reaches the last line
that says "send/header tim781@... enb2 header".
When "enb2" is called, it in turn calls "enb"
which calls "picture2" and picture2 calls "picture1"
and then it's complete.
Note you can use the same locator "--------------4F9F64BEEE5"
for all your emails. You don't have to create a new
one for each email. By adding -- to the end of
--------------4F9F64BEEE5 you're telling an email
client that that is the end of all attachments.
Don't forget!!! This was written by a Dummy!!! :)
}
[Non-text portions of this message have been removed]
I uploaded 3 versions of the same file to the file area today. As a result, 3
messages went out. I think this "feature" is now turned off, since I will be
making frequent revisions to the tutorial. I wouldn't want everyone to be
getting a message every time I made a minor change.
Beginner's Rebol Tutorial - Here's my light-hearted/headed version of how to
start learning a computer language. - Jack Seay.
What does Rebol mean?
"Relative Expression-Based Object Language". I know I shouldn't frighten you
right away with something I can't explain yet, but you were thinking "Why
Rebol?", am I right? What this means will be explaned later, after some simpler
stuff.
What is a computer?
An information handling machine, a universal one.
Like one of those infomercial gadgets that slices, dices, makes curly-fries, and
walks the dog. Unlike most "normal" machines, a computer (chameleon-like), can
change instantly to do almost any job the user wants that involves information.
This information can be expressed as text, pictures, animation, music, speech,
or a combination of these, such as an episode of Twin Peaks or a Miami Vice
music video. The senses of smell and taste will soon be added. This could be
very good or very bad for users.
If the computer is connected to a tool, (such as a lathe, drill press, welder,
or vertical milling machine), it can make that tool more flexible, but can't
turn it into a completely different machine (until we get nanotechnology).
What is a computer language?
A computer works by constantly, millions of times a second, turning millions of
switches on and off. To humans, this may not sound like a very good way of
writing poetry or painting a picture. But when it comes to making lots of very
small, fast changes in a machine, this works very well, (it's hard to build a
knob about the size of a flu virus that has 256 different positions). These
switches turning on and off are usually referred to as the numbers 0 and 1. 0 is
off and 1 is on. Believe it or not, some people can actually write computer
programs using nothing but 0's and 1's. How would you like to send your friend
an email by typing 0011000011111010011000111000111100011100001111110000111...,
page after page? Not very intuitive, huh? Fortunately, someone came up with the
brilliant idea of making it easier. Thus, we have Rebol (I skipped a few steps
for brevity). Now you can type - send jack/jill@... "Hi, how is your
programming going?". A lot easier, right? I won't go into much more detail here,
but between the machine language and Rebol, we have: assembly, C, Java, Pascal,
Smalltalk, Lisp, and about 2 million others. Maybe, soon, you will write a
program by telling your computer what you want to do like, "Write me a
hypertext, paint, music program that will morph this song linked to that
painting into a smell", and walah!, it's done. But until then, here's Rebol.
What is an operating system?
An operating system is made up of a bunch of programs that do the repetitive
stuff that almost all the other programs do over and over. Things like save a
file, put a button on the screen, pop up a file list, make a tinny squeak that
is supposed to tell the user something. This lets the programmer write things
like "Pop up a button, that when clicked on, squeeks and shows a list of cryptic
file names". This saves the programmer several years of mind-numbing complexity
trying to figure out how to do this.
What are the advantages and disadvantages
of various languages?
The closer you get to speaking the computer's language of
0's and 1's, the more direct control you have. Like being able to tell your car
to close the choke 12%, and open this venturi valve 5% more and push that 90
degree lever 5 millimeters to the right. What you gain in control, you lose in
ease of driving/programming. These computer level languages, such as Assembly,
write very efficient and fast programs for those that can learn them. They are
often used for video games and operating system programs that will be repeated
millions of times. Higher up on the scale of ease of use are languages like C
and C++. Most professional programmers use these languages. They also write very
fast and small programs when used by skilled programmers. But once again, they
are not easy to learn and have very complex rules, especially when it comes to
where you put and don't put semicolons. Leave one out, and your program might
just crash the computer. I once saw a $13 million dollar rocket explode because
a programmer left out a comma. It was carrying a color TV satellite for the
Olympics. Aren't you glad your English teacher wasn't so strict. You would be
dead.
Closer to people language are ones like BASIC and Rebol. They can almost
be understood by someone who doesn't even know what a computer is. But, still,
they do require some study to learn the precise definitions of the words and the
rules of the game. Rebol is a much more modern language than BASIC, and was made
for the Internet, so does things such as sending and receiving emails, web
pages, and files to the other side of the planet a matter of writing 3 or 4
words. Not bad for a newbie. Rebol also has what are called dialects (Cajun,
Northeastern Welsh, see that Rex Harrison - Audrie Hepburn movie). I am
imagining Ross Perot saying "The rain in Spain falls mainly on the plain". You
get the idea. I won't go any further along this line, you are glad to hear. Now
you can make specialized vocabularies if you are into racing jet-powered
tricycles or playing paintball while bungee jumping. You can add the words you
normally use in those subjects and write them in a program. Just state that you
are now using the PaintBungeeBall dialect.