[REBOL] Script = Rebol Tag

2000-02-23 Thread mprice
Title: Script = Rebol Tag





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] format.r update on rebol.org

2000-02-23 Thread KGD03011


Hi,

I've just posted version 1.0.2 of format.r to rebol.org.

http://www.rebol.org/utility/format.r

It includes one bug fix and a couple of added features:

1. Option to insert commas in long numbers.

 format 1e9 #..8
== "1,000,000,000"

2. Money values now formatted to various precisions:

 format $20 / 3 #.4
== "$6.6667"

3. No longer chokes on values like set-word! and path! .

Have fun,
Eric



[REBOL] news (no info??)

2000-02-23 Thread tim781

Hi   does anyone know how to post to newsgroups.
Rebol's new user guide does'nt say. The old user guide did.
The new one does'nt tell how to just download the headers
either. Does anyone know how to just download the first
100 lines of newsgroup messages? thanks..

timmy



[REBOL] [REBOL] Multipart emails

2000-02-23 Thread bregolin

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?

Thanks

Mauro




[REBOL] Any help or direction of how to proceed on this message UPS for freight calculation Re:

2000-02-23 Thread brian . hawley

Gobiraj wrote:
We are using say UPS for freight calculation. I want to give the to and from
zip code, weight and dimension to the UPS site. Then I would like to 
download the freight charges in to some local table/ascii file.
My url will be https://www.ups.com/ups.app/iss.class. Is it possible to 
invoke this and enter the information directly into the URL.And get back the
information needed

REBOL doesn't currently have https support. I think that
they are working on it (Holger?) but the task is not an
easy one, and the patent license fees are expensive for
/Core, as are the lawyers.

Try using an external program to do the https transaction
and then using REBOL on the data retrieved. Works for me.

Good luck!
Brian



[REBOL] WOW a rebol HTML calendar, please do % and criticize Re:

2000-02-23 Thread mjelinek

I think you intended a prompt to verify that the correct date was entered
(you can use the "ask" word) but other than that it's nice. :)

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 21, 2000 7:00 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] WOW a rebol HTML calendar, please do % and criticize


; please run this and comment as you will :-)
 
 
REBOL [
   Title:  "HTML Monthly Calendar"
   Date:   19-Feb-2000
   Version: 0.0.1
   Name:   "Monthly Calendar"
   File:   %rebMonth.r
   Author: "John Braman"
   Email:   mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
   Rights: { "Copyright (C) John Braman" Permission to use and improve
granted,
 with the understanding you include my footer on calendar. 
  And if improvements are made please email improvements to
mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 }
   Purpose: {
   Prelude to AN INTERACTIVE HTML MONTHLY CALENDAR. 
  Currently, using the Rebol Console, you enter the
  month and year you are interested in.
  This code prints the html version of that month 
  to a file called rebolcal.htm "
  }
 
   Comment: { Thanks to  bpaddock, olivier doleman, Donald Dalley, karin,
rryost
especially Olivier doleman for the slick date coding, and Donald
Dalley
 and others on list who replied to my initial 'prelude to HTML post'.
 
The next version will be more interactive and completely cgi-enabled
with a 
database or series in flat files.  However...
 
 I need HELP HERE:  The simplist of code that is intuitively obvious for 
 veteran Rebols, is new to me.
 For example.  I've seen several html related scripts using an "EMIT"
function,
 yet I don't know how it works.
 
 The ideal is to retrieve values from a database or at least from a file,
much
 like one using coldFusion, PERL, PHP, ASP etc. However I've not 
 found clear examples of dbase connection.  Or even less sophisticated 
 examples of getting data from a flat file.  There are too few good examples
of
 using REBOL words in the dictionary.  HELP !
 For example: What if I had a file with 365+ records many of which will
conatin
 the values of holidays and the like. The unique key being the date.
 How do I get data from that file via http?  How would I write to that file
for updates?
 How do I write to that file to update the specific record only using cgi? 
 }
 
   History: [version 0.0.1 created 19-2-2000]
   Example: {Show how to use it.}
]
 BODY OF CODE FOLLOWS ;
 
; initialize
 
weekdays: [Monday Tuesday Wednesday Thursday Friday Saturday Sunday]
; weeks in this calandar start with Monday, if you want them to start with
any other day then use the series or offset to the appropriate day of week.
Or change this block to start with the day of the week that you want it to.
 
months: [January February March April May June July August September October
November December]
 
; get month and year from user
userDate: PARSE ASK " Enter Month as MM , or q to exit : " NONE
 
IF (first userDate) = "q" [ PRINT "HTMLCalendar.r" HALT ]
; use appropriate datatype
month:   MAKE INTEGER! FIRST userDate
year: MAKE INTEGER! SECOND userDate
 
; join the input and make it to be the first day of the month
inputDate: JOIN 1 [ "-" month "-" year ]
firstOfMonth: MAKE DATE! inputDate
 
PRINT ["Do I have it right, the month you are intrested in is " PICK
months(firstOfMonth/month) year"?"]
 
; find first of next month and first of previous month
; this will help us to find the number of days in month to make calendar
firstOfNextMonth: firstOfMonth/month: firstOfMonth/month + 1
 
PRINT ["check again is this the month?" PICK months(firstOfMonth/month)]
 
; find days in month and days in previous month
 
daysInMonth: firstOfNextMonth - firstOfMonth
 
; firstOfPrevMonth: firstOfMonth/month: firstOfMonth/month - 1
; there is a bug in the above date function which doesn't work for the first
month in the year. 
; so do a work around.
 
Either (month = 1) [
 prevMonthName: "December"
 daysInPrevMonth: 31
 ] 
 [
 firstOfPrevMonth: firstOfMonth/month: firstOfMonth/month - 1
 daysInPrevMonth: firstOfMonth - firstOfPrevMonth
 ; convert previos month to words and save it.
 prevMonthName: PICK months (firstOfPrevMonth/month)
 ]; end first month bug correction
 
; convert the month to words, save it.
monthName: PICK months (month)
nextMonthName: PICK months (firstOfNextMonth/month)
 
; print the values just to check them
PRINT ["There are " daysInPrevMonth " days in " prevMonthName ] ; adjust for
first month bug
PRINT ["There are " daysInMonth " days in " monthName firstOfMonth/year ]
 
; is it possible to echo to a port easily for cgi purposes, what is the best
way if this were running on a server to get the follwing back to the client,
after evaluation of course?
 
ECHO  %rebolcal.htm ; write output to a file
 

; how do I surpress the printing to the console?
 
; HTML header of the calendar page include title and a heading 

[REBOL] Re: constructor destructor Re:(2)

2000-02-23 Thread rebol

Hello Elan,

I agree that in a garbage-collection world, destructors are mostly unneeded,
but then garbage collection must cover everything (ie. every resource).
Consider the following REBOL session - the port is not freed by the GC.
Quite anoying when experimenting.

Perhaps the GC is simply faulty, but othervice it'd be nice to be able to
encapsulate resource (de-)allocation in an object with a destructor...


## rebol/version
== 2.2.0.1.1
## recycle/on
## my-port: open tcp://:80
## my-port: none
== none
## my-port: open tcp://:80
** Access Error: Error opening socket listen port.
** Where: my-port: open tcp://:80
## recycle/torture
## my-port: open tcp://:80
** Access Error: Error opening socket listen port.
** Where: my-port: open tcp://:80


Best regards
Thomas Jensen


On 22-Feb-00, [EMAIL PROTECTED] wrote:

 Hi Martin,
 
 re: destructors:
 
 Note that REBOL has automatic garbage collection. 
 
 This means that the memory that was allocated by an object programmatically
 during its creation processor or subsequently will be automatically
 released when the object is destroyed. 
 
 In contrast, programming languages like C++ that do not have automatic
 garbage collection require a destructor function, so that you will be able
 to clean up, i.e. release programmatically allocated memory, when your
 object is destroyed. 
 
 With automatic garbage collection, i.e. memory getting automatically
 reclaimed, I think the motivation behind a destructor function no longer
 exists and a destructor function is no longer critical.
 
 
 ;- Elan  [: - )]
 
 



[REBOL] System... and the other objects! Re:

2000-02-23 Thread icimjs

Hi Matos,

How can I know wich objects, variables and other things exist under an
object?!

use and look at Bo's system browser (browse-system.r) which should be on
rebol.org. If you can't find it let me know off-list and I'll mail it to you.

In short, as Jan pointed out, you can access a block containing all the
words defined in an object using first object-name:

 object: make object! [word-1: "this is word-1" word-2: "this is word-2"]
 print mold first object
[self word-1 word-2]

Note that the first word in every object is self, which evaluates to the
object itself. When you inspect the object word by word you will want to
skip the first word, since you are interested in the words defined in the
object and not the complete object. You can use a loop like this:

foreach word next first object [
  print [
   mold word
   mold get in object word
  ]
]

to print each word and its value. In our example this will result in:
 foreach word next first object [
[  print [
[   mold word
[   mold get in object word
[  ]
[]
word-1 "this is word-1"
word-2 "this is word-2"




;- Elan  [: - )]



[REBOL] example of switch...

2000-02-23 Thread bemerson


Can some one please give me an example of how to use /default in a switch 
construction?

TIA

Brad

P.S. The dictionary *really* falls down in advanced examples...



[REBOL] doleman html Calendar follow up.

2000-02-23 Thread business



Here is something more efficient 
: firstOfNextMonth: firstOfMonth/month: 
firstOfMonth/month + 1== 1-Mar-2000 daysInMonth: 
firstOfNextMonth - firstOfMonth== 29print [" 
There are " daysInMonth " days in " currentMonth 
now/year]Olivier
Thanks for theelegantcode above... run the 
following...an oddity occurs...

REBOL [ Title: "What's the proper way to 
do the datefunction to avoid firstmonth of year - last month of 
previous year oddity?" Date: 
19-Feb-2000 Version: 0.0.1 Author: "John 
Braman" Email: [EMAIL PROTECTED]
]

weekdays: [Monday Tuesday Wednesday Thursday Friday Saturday 
Sunday]; weeks in this calendar start with Monday, if you want them to start 
with any other day then use the series or offset to the appropriate day of week. 
Or change this block to start with the day of the week that you want it 
to.

months: [January February March April May June July August 
September October November December]

; get month and year from user
PRINT "To expose bug type 1st month of any year, like1 
2000, or 1 1999, etc."userDate: PARSE ASK " Enter Month as MM , or q to 
exit : " NONE

IF (first userDate) = "q" [ PRINT "HTMLCalendar.r" HALT ]; 
use appropriate datatypemonth: MAKE INTEGER! FIRST 
userDateyear: MAKE INTEGER! SECOND userDate

; join the input and make it to be the first day of the 
month

inputDate: JOIN 1 [ "-" month "-" year ]firstOfMonth: MAKE 
DATE! inputDate

PRINT ["Soyou are intrested in is " PICK months 
(firstOfMonth/month) year]

; find first of next month and first of previous month; 
this will help us to find the number of days in month to make calendar and 
should automatically account for leap years.
; note this works for all months except the first month of any 
year.
firstOfNextMonth: firstOfMonth/month: firstOfMonth/month + 
1firstOfPrevMonth: firstOfMonth/month: firstOfMonth/month - 1

; find days in month and days in previous 
monthdaysInMonth: firstOfNextMonth - firstOfMonthdaysInPrevMonth: 
firstOfMonth - firstOfPrevMonth

; convert the month to words, save it.monthName: PICK 
months (month)prevMonthName: PICK months (firstOfPrevMonth/month) ; use date 
value incase month-1=0nextMonthName: PICK months 
(firstOfNextMonth/month)

; print the values just to check themPRINT ["There are " 
daysInPrevMonth " days in the previous month of  " prevMonthName 
firstOfPrevMonth/year]PRINT ["There are " daysInMonth " days in " monthName 
firstOfMonth/year ]


[REBOL] news (no info??) Re:

2000-02-23 Thread Petr . Krenzelok



[EMAIL PROTECTED] wrote:

 Hi   does anyone know how to post to newsgroups.
 Rebol's new user guide does'nt say. The old user guide did.
 The new one does'nt tell how to just download the headers
 either. Does anyone know how to just download the first
 100 lines of newsgroup messages? thanks..

 timmy

http://www.rebol.com/howto.html#news.html

-pekr-



[REBOL] cgi and post Re:

2000-02-23 Thread deadzaphod

You are reading the data correctly, but you need to check 
system/options/cgi/request-method to make sure that this was a POST request 
before you use the content-length - if the page was requested with GET you 
don't want to try to read from STDIN.  And if there is a POST request with 
no data it is an error, so and error responce is correct and does not need 
to be fixed, at most just checkk for it with "if error? try [ ... ]" and 
generate an error page.

As for the ugly problem, you could always build a wrapper function adn 
either include it in your programs, or in your %user.r

Cal Dixon  ([EMAIL PROTECTED])
--


From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [REBOL] cgi and post
Date: Sun, 20 Feb 2000 22:25:03 +0100


  Hi.

I wanna ask what's the latest recomended way to read data submitted
from some www page with form by POST method.

I use:

   tmp: load system/options/cgi/content-length
   buffer: make string! (tmp + 10)
   read-io system/ports/input buffer tmp

   ...
   decode-cgi buffer



but IMHO it's quite ugly.
And when calling the cgi "manually" without any data submission,
it throw an error (as excepted).
Of course I can check if found? system/options/cgi/content-length
but it is quaranteed that content-length will be send everytime
by each browser (or another user-agent)? (question for Holger?)

what about reading stdin by this way:

instr: make string! 5 * 1024
while [found? tmp: pick system/ports/input 1][append instr tmp]

What are using You?

Thanks.
Jan

--
Jan Strejcek
[EMAIL PROTECTED]


__
Get Your Private, Free Email at http://www.hotmail.com



[REBOL] .r to html monthly calendar prelude Re:(2)

2000-02-23 Thread business


Here is something more efficient :

 firstOfNextMonth: firstOfMonth/month: firstOfMonth/month + 1
== 1-Mar-2000
 daysInMonth: firstOfNextMonth - firstOfMonth
== 29


print [" There are " daysInMonth " days in " currentMonth now/year]

Olivier

Thanks for the elegant code above... run the following... an oddity
occurs...

REBOL [
   Title:  "What's the proper way to do the date function to avoid first
month of year - last month of previous year oddity?"
   Date:   19-Feb-2000
   Version: 0.0.1
   Author: "John Braman"
   Email:  [EMAIL PROTECTED]
]

weekdays: [Monday Tuesday Wednesday Thursday Friday Saturday Sunday]
; weeks in this calendar start with Monday, if you want them to start with
any other day then use the series or offset to the appropriate day of week.
Or change this block to start with the day of the week that you want it to.

months: [January February March April May June July August September October
November December]

; get month and year from user
PRINT "To expose bug type 1st month of any year, like 1 2000, or 1 1999,
etc."
userDate: PARSE ASK " Enter Month as MM , or q to exit : " NONE

IF (first userDate) = "q" [ PRINT "HTMLCalendar.r" HALT ]
; use appropriate datatype
month:   MAKE INTEGER! FIRST userDate
year: MAKE INTEGER! SECOND userDate

; join the input and make it to be the first day of the month

inputDate: JOIN 1 [ "-" month "-" year ]
firstOfMonth: MAKE DATE! inputDate

PRINT ["So you are intrested in is "  PICK months (firstOfMonth/month) year]

; find first of next month and first of previous month
; this will help us to find the number of days in month to make calendar and
should automatically account for leap years.
; note this works for all months except the first month of any year.

firstOfNextMonth: firstOfMonth/month: firstOfMonth/month + 1
firstOfPrevMonth: firstOfMonth/month: firstOfMonth/month - 1

; find days in month and days in previous month
daysInMonth: firstOfNextMonth - firstOfMonth
daysInPrevMonth: firstOfMonth - firstOfPrevMonth

; convert the month to words, save it.
monthName: PICK months (month)
prevMonthName: PICK months (firstOfPrevMonth/month) ; use date value incase
month-1=0
nextMonthName: PICK months (firstOfNextMonth/month)

; print the values just to check them
PRINT ["There are " daysInPrevMonth " days in the previous month of "
prevMonthName  firstOfPrevMonth/year]
PRINT ["There are " daysInMonth " days in " monthName firstOfMonth/year ]



[REBOL] [REBOL] Multipart emails Re:

2000-02-23 Thread Petr . Krenzelok



[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?


do http://www.rebol.org/email/detach.r ; just
do the script
  mb: open pop://your-name:[EMAIL PROTECTED];  open your mailbox:
msg: import-email first mb
; import the entire message
  blk: detach
msg   ; create
block of pairs: name-of-attachement, content

foreach [name content] blk [write/binary name to-string content]  ; write the
stuff to your hd 


see ya,

-pekr-


 Thanks

 Mauro



[REBOL] Re: WOW a rebol HTML calendar, please do % and criticize

2000-02-23 Thread alanwall

Hello Rebol,this had a few errors and fixed:
REBOL [
   Title:  "HTML Monthly Calendar"
   Date:   19-Feb-2000
   Version: 0.0.1
   Name:   "Monthly Calendar"
   File:   %rebMonth.r
   Author: "John Braman"
   Email:  [EMAIL PROTECTED]
   Rights: { "Copyright (C) John Braman" Permission to use and improve
granted,
 with the understanding you include my footer on calendar.
  And if improvements are made please email improvements to
[EMAIL PROTECTED]
 }
   Purpose: {Prelude to AN INTERACTIVE HTML MONTHLY CALENDAR.
  Currently, using the Rebol Console, you enter the
  month and year you are interested in.
  This code prints the html version of that month
  to a file called rebolcal.htm }
]
; initialize

weekdays: [Monday Tuesday Wednesday Thursday Friday Saturday Sunday]
; weeks in this calandar start with Monday, if you want them to start with
any other day then use the series or offset to the appropriate day of
week. Or change this block to start with the day of the week that you want
it to.

months: [January February March April May June July August September
October November December]

; get month and year from user
userDate: PARSE ASK " Enter Month as MM , or q to exit : " NONE

IF (first userDate) = "q" [ PRINT "HTMLCalendar.r" HALT ]
; use appropriate datatype
month:   MAKE INTEGER! FIRST userDate
year: MAKE INTEGER! SECOND userDate

; join the input and make it to be the first day of the month
inputDate: JOIN 1 [ "-" month "-" year ]
firstOfMonth: MAKE DATE! inputDate

PRINT ["Do I have it right, the month you are intrested in is " PICK
months(firstOfMonth/month) year"?"]

; find first of next month and first of previous month
; this will help us to find the number of days in month to make calendar
firstOfNextMonth: firstOfMonth/month: firstOfMonth/month + 1

PRINT ["check again is this the month?" PICK months(firstOfMonth/month)]

; find days in month and days in previous month

daysInMonth: firstOfNextMonth - firstOfMonth

; firstOfPrevMonth: firstOfMonth/month: firstOfMonth/month - 1
; there is a bug in the above date function which doesn't work for the
first month in the year.
; so do a work around.

Either (month = 1) [
 prevMonthName: "December"
 daysInPrevMonth: 31
 ]
 [
 firstOfPrevMonth: firstOfMonth/month: firstOfMonth/month - 1
 daysInPrevMonth: firstOfMonth - firstOfPrevMonth
 ; convert previos month to words and save it.
 prevMonthName: PICK months (firstOfPrevMonth/month)
 ]; end first month bug correction

; convert the month to words, save it.
monthName: PICK months (month)
nextMonthName: PICK months (firstOfNextMonth/month)

; print the values just to check them
PRINT ["There are " daysInPrevMonth " days in " prevMonthName ] ; adjust
for first month bug
PRINT ["There are " daysInMonth " days in " monthName firstOfMonth/year ]

; is it possible to echo to a port easily for cgi purposes, what is the
best way if this were running on a server to get the follwing back to the
client, after evaluation of course?

ECHO  %rebolcal.htm ; write output to a file


; how do I surpress the printing to the console?

; HTML header of the calendar page include title and a heading with name of
month.
print "html"
print "head"
print "title REBOL MADE CALENDAR by John Braman's rebolcal.htm /title"
print "/head"
print "body"
print "centerh1font face='Arial' color='BLUE'"
print [monthName firstOfMonth/year] ; we get month from the input
print "/font/h1/center"

; Print table, heading days of week, start with Monday
print "table border='1' bordercolor='yellow' cellpadding='5'
cellspacing='5' width='100%'tr"
i: 1
while [i = 7] [
 print ["thbfont face='Arial color='blue'" PICK weekdays(i)
"/font/b/th"]
 i: i + 1
] ; end while for headings
print "/tr"

; Put the data into the table to form a calendar.
; Don't exceed the total number of daysInMonth.

; Initialize
day: 1 ; for the days of the month
i: 1  ; for figuring out where to start printing the first day of month
"fdom"
off: 0 ; used to keep track of where in the week we are.
fdom: firstOfMonth/weekday ; set where to print first day of week.

PRINT "tr" ; start the first weeks row

WHILE [day  daysInMonth] [

off: off + 1 ; marks where in week we are so we can start new row after 7
days.

  IF (off  7) [PRINT "tr" off: 1] ; used to start the each week after
the first

  ; at the very start of the month we might need to fill in table cells.
  IF day = 1 [
 ; print preceeding cells for the first week, fill with dates from prev
month
 WHILE [i  fdom][
  PRINT ["td valign='top' halign='left' height='100' width='100'font
face='Arial' color='black'"]
  PRINT [(daysInPrevMonth - fdom + i +
1)"smallsmall"prevMonthName"/small/small/font/td" NEWLINE]
  ; ?
 i: 1 + i ;  isn't there a short cut for incrementing
values +=i?
  ; ?
  off: off + 1 ; advance where we are in the week
  ] ; end while, preceed cells are filled with end dates from previous
month.

  ; print the first day of the month
  PRINT 

[REBOL] [REBOL] Multipart emails Re:

2000-02-23 Thread Tiana . Zhang

Hi, Mauro,

In the http://www.rebol.org/email/index.html, you'll find sample scripts to
handle how to compose an email with attachments.

Hope that helps.

Tiana

Reply Separator
Subject:[REBOL] [REBOL] Multipart emails 
Author: [EMAIL PROTECTED]
Date:   2/22/00 6:12 PM

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?

Thanks

Mauro






[REBOL] news (no info??) Re:

2000-02-23 Thread kevin


 Hi   does anyone know how to post to newsgroups.
 Rebol's new user guide does'nt say. The old user guide did.
 The new one does'nt tell how to just download the headers
 either. Does anyone know how to just download the first
 100 lines of newsgroup messages? thanks..

Check out: http://www.rebol.com/howto.html#news.html
This describes how to use the nntp.r protocol.  The built-in protocol 
can do simple posting to a server, but won't do the more advanced 
stuff like downloading parts of headers.

If you want, I'll send you a copy of my %newsgate.r script which acts 
as a mail-to-news gateway... Incoming e-mail messages are posted to a 
newsgroup.  Hasn't been updated in a bit, but works pretty well.

Cheers,
Kev


Kevin McKinnon, Network Engineer [EMAIL PROTECTED]
Sunshine Communications http://www.sunshinecable.com

PGP Public Key: http://www.dockmaster.net/pgp.html   PGP 6.0 www.pgp.com

If the box says Windows 95 or better, it should run under Linux, right??



[REBOL] RIP - REBOL Self Extracting Binary Archives

2000-02-23 Thread carl

RIP - REBOL Self Extracting Binary Archives

1. OVERVIEW

Here is a script for creating REBOL self-extracting file
archives that are BINARY rather than textual.  The binary
format of the archive provides extra speed when downloading
applications from websites or ftp.

Each archive begins with a valid REBOL header followed by its
extraction code.  Because the extraction code never gets
separated from the data, the archive is time-enduring (it
"rests in peace" because it contains the algorithm to revive
itself).

2. STANDARD

This archive format will become a standard for distributing
REBOL applications that require multiple files, such as image
files.  The current standard will be posted on WWW.REBOL.COM.
Improvements to the standard can be contributed, see below.

3. OPERATION

Provide a directory name at the prompt or just press enter to
archive the current directory.  Only REBOL related text and
image files will be archived (see the file-types block in the
code).  The output file will be given the suffix .rip if you
do not provide a suffix.

To extract an archive, you can simply "do" it.  This can be
executed from your OS shell by typing:

REBOL archive.rip

(where archive.zip is the name of your file) or from the
REBOL shell with:

do %archive.rip

or directly extract from a web site with:

do http://www.rebol.com/archives/demo.rip

In addition you can add a .RIP association to your OS to make
this action automatic.

4. IMPROVEMENTS

The benefit of the archive containing its own extraction code
is that it is consistent with its data format.  An archive
can always extract its data, regardless of what changes are
made to the RIP standard later.  This is the primary rule for
any future enhancements.

This script will be posted as the official archive standard
on our web site.  However, it is open to your improvements.
If you want to improve it, here's how:

  1. Make your changes to the script.
  2. Review, optimize, and clean your changes.
  3. Test your changes.
  4. Document precisely what you did and why.
  5. Send your new script to [EMAIL PROTECTED]

I'll accept or reject your changes.  If accepted, I'll update
the header history to include your name, date, version, and a
summary of the change.  The new script will be posted to our
REBOL.com web site. If your changes are rejected, I'll let
you know why. It could be that your changes don't meet the
primary objectives of the script or that they make it overly
complex and difficult to understand.

The REBOL,

-Carl

PS: Script below has only been tested with REBOL/View.


REBOL [
Title: "RIP - REBOL Binary Archiver"
Date: 22-Feb-2000
File: %rip.r
Author: "Carl Sassenrath"
Email: [EMAIL PROTECTED]
Version: 1.0.0
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.}
]
]

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 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]
]
]

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]
data: decompress copy/part archive len
archive: skip archive len
either any [
not exists? path/:file
confirm reform [file "already exists - overwrite? "]
][write/binary 

[REBOL] select help

2000-02-23 Thread bemerson


This is probably a repeat, but I don't see my original posting.

How do you search a key-value sort of series when the key can appear more 
then once?  i.e.  [ a 200 b 22200 a 22323 ]  Select returns 200.  If 200 
isn't what I'm searching for I want to look for the next.

Brad Emerson



[REBOL] example of switch... Re:

2000-02-23 Thread mjelinek

f: func [][
c: ask "Please type a primary color? "
example: switch/default c [
"red"   ["Roses are red."]
"blue"  ["Violets are blue."]
"yellow"["Daisies are yellow."]
][
rejoin ["'"c "' is not a primary color."]
]
print example
]

(Sorry about the earlier multiple posts, the MS Exchange server sent it
multiple times, not me!)
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 22, 2000 5:19 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] example of switch...



Can some one please give me an example of how to use /default in a switch 
construction?

TIA

Brad

P.S. The dictionary *really* falls down in advanced examples...



[REBOL] select question

2000-02-23 Thread bemerson


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



[REBOL] rebol-powered web sites

2000-02-23 Thread syndrome


Greetings and Salutations! :)

Apart from rebol.com (and rebol.org(?)), I was wondering if anyone here
uses rebol in some way for generating websites (or could point me
towards some sites that do).  

I've already completed an incredibly rudimentary system that puts brings
together separate "stories" from different files, and am wondering what
else people have used rebol for.

And yes, I've checked out the partners page on rebol.com, but those
companies aren't exactly talking about or sharing how and what they're
doing.

Thanks,
chris


ps. I apologise if this has been discussed on the list recently, as I've
been off it for a while.



[REBOL] Parsing and Recursion ...

2000-02-23 Thread mdb

Hello,

I'm having a problem with understanding Parsing using recursion. The code
below consists of 4 tests. 

Tests 1 and 4 produce the correct results, both in terms of the values in
the block and that they returns TRUE. The [none] in the rule makes this
happen.

Test 2 produces the correct values in the block but returns FALSE,
presumably because [none] is missing from the rule.

However why does Test 3 return TRUE but process the last input value
twice??

Mike.





REBOL []


check: func [
] [clear inps
probe parse "123+" col
print inps
clear inps
probe parse "123+456-" col
print inps
]

inps: []
digits: charset "0123456789"


num: [copy value [some digits] (value: to-decimal value)]
term: [num ["+" (insert tail inps value)|"-" (insert tail inps negate
value)]]

;Test 1
print "Test 1"
col: [term col | [none]]
check
;Test 2
print "Test 2"
col: [term col]
check
;Test 3
print "Test 3"
col: [term col | term]
check
;Test 4
print "Test 4"
col: [term col | term | [none]]
check




[REBOL] [REBOL] Multipart emails Re:

2000-02-23 Thread sterling


Check out www.rebol.org.
Lots of cool scripts there including scripts to attach and detach
files in email.

Sterling

 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?
 
 Thanks
 
 Mauro
 



[REBOL] rebol-powered web sites Re:

2000-02-23 Thread s_woodrum

I think http://www.openip.org is REBOL generated. It really is a nice 
looking site

Scott


From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [REBOL] rebol-"powered" web sites
Date: Thu, 24 Feb 2000 10:53:27 +1000


Greetings and Salutations! :)

Apart from rebol.com (and rebol.org(?)), I was wondering if anyone here
uses rebol in some way for generating websites (or could point me
towards some sites that do).

I've already completed an incredibly rudimentary system that puts brings
together separate "stories" from different files, and am wondering what
else people have used rebol for.

And yes, I've checked out the partners page on rebol.com, but those
companies aren't exactly talking about or sharing how and what they're
doing.

Thanks,
chris


ps. I apologise if this has been discussed on the list recently, as I've
been off it for a while.


__
Get Your Private, Free Email at http://www.hotmail.com



[REBOL] CGI interpreter on win95 apache

2000-02-23 Thread kenss . lo

 
 How can I make rebol a cgi interpreter on win95 apache ?
 
 I can easily make perl work.  Just copy the perl script to cgi-bin and 
 make sure a #!C:/PERL/BIN/PERL at the top.  I don't even need to touch 
 the apache .conf files.
 
 I did the same to rebol.  First it popup a rebol window and show all 
 my stuff there instead of the browser.  Searched rebol.org and got the 
 -c or -cgi solution.  It did suppress the rebol window but nothing 
 went to the browser.
 
 I guess apache captures stdout and sends to the browser.  rebol does 
 not print to stdout and that's the problem.



[REBOL] REMOVE

2000-02-23 Thread CStajda

 



[REBOL] CGI interpreter on win95 apache Re:

2000-02-23 Thread business

Your post was fascinating because when I used clicked to open it with my MS
Outlook express it pops open a blank ie window about 500x600 with no
controls and the following error message... Internet Explorer cannot open up
the file C//:\web\iejit.htm

How did you do that?

braman




- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 23, 2000 7:40 PM
Subject: [REBOL] CGI interpreter on win95 apache



  How can I make rebol a cgi interpreter on win95 apache ?

  I can easily make perl work.  Just copy the perl script to cgi-bin
and
  make sure a #!C:/PERL/BIN/PERL at the top.  I don't even need to
touch
  the apache .conf files.

  I did the same to rebol.  First it popup a rebol window and show all
  my stuff there instead of the browser.  Searched rebol.org and got
the
  -c or -cgi solution.  It did suppress the rebol window but nothing
  went to the browser.

  I guess apache captures stdout and sends to the browser.  rebol does
  not print to stdout and that's the problem.



[REBOL] limiting number of lines read

2000-02-23 Thread tim781

Hi, Does anyone know how I can just download 100 lines
or less of each news post. Some news posts are gigaintic.

thanks   timmy



[REBOL] CGI interpreter on win95 apache Re:

2000-02-23 Thread icimjs

Hi kenss,

At 11:40 AM 2/24/00 +0800, you wrote:
 
 How can I make rebol a cgi interpreter on win95 apache ?
 
 I can easily make perl work.  Just copy the perl script to cgi-bin and 
 make sure a #!C:/PERL/BIN/PERL at the top.  I don't even need to touch 
 the apache .conf files.

You may "not even need to touch ...". That may mean that Apache was already
configured to support perl. Or MS Windows is configured to support Perl and
perhaps therefore Apache does not need to be configured. 

I'm using Apache on a Win95 system and it works just fine. Here are my
settings.

The only file that needs to be modified is httpd.conf

1. ServerName must be configured to something sensible. If you are using
Apache locally then simply removing the comment character, #, will be
sufficient. Otherwise you must use the domain name of your si2. te or its
IP Number:

#ServerName new.host.name

2. You must add ExecCGI to the Options line:

Options Indexes FollowSymLinks ExecCGI

3. Are you using the default CGI directory cgi-bin for your scripts? 
C:\Program Files\Apache Group\Apache\cgi-bin

4. Check the first line of your CGI script. If rebol is in the directory
c:\rebol, your first line in the script should read:

#!C:/REBOL/REBOL.EXE --cgi --script

5. Verify that your script begins its output by printing:
print "Content-Type: text/html^/^/"

followed by a proper html page. A simple example:

print "Content-Type: text/html^/^/"
print {
HTML
HEAD
TITLETesting/TITLE
/HEAD
BODY
H1 This is a test. /H1
/BODY
/HTML
}

;- Elan  [: - )]



[REBOL] if condition vs. while condition Re:

2000-02-23 Thread tim781

They're not treated differently. A condition
is a condition. "While" gives more options
such as including more commands in the conditional block
( as long as the last is conditional ). It's the last condition
in the block that determines if the loop continues. "while"
and "until" are very useful. If you tried to accomplish the
same just using "if"s then you'd be doing alot of unneccessary
typing. Rebol is designed to let you write scripts quickly.
If you wrote a c+ program to do the same as a simple
rebol script, you'd be writting for hours or days.
Note: The Rebol guides are getting more and more
easy to understand. Rebol recently helped me understand
part of the guide and decided to add the help in the next site
update.:)

timmy

[EMAIL PROTECTED] wrote:

 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)

 Thanks.

 --
 Piroz Mohseni
 [EMAIL PROTECTED]

 __
 Do You Yahoo!?
 Talk to your friends online with Yahoo! Messenger.
 http://im.yahoo.com