[REBOL] Antwort: Switch!

2000-11-19 Thread Sharriff . Aina



I´m almost there Brett. Michael, Andrew

although I´ve solved the problem using some extensive code, I wonder if
there is a cleaner or shorter way to do this (see code below)


; creates subindexes from the first characters
foreach [title file] titles [
switch first title [
  #"a" [clear sub-list
; temp-html: copy sub-toc-html-template
append sub-list rejoin [{
}title {}]
append temp-html newline
 append temp-html sub-list
 append temp-html sub-toc-html-stub
 write/append %aa.html temp-html]
  #"b" [clear sub-list
; temp-html: copy sub-toc-html-template
append sub-list rejoin [{
}title {}]
append temp-html newline
 append temp-html sub-list
 append temp-html sub-toc-html-stub
 write/append %bb.html temp-html]


and so on and so forth.to character Z

the links to the files and buttons are added correctly, but the tags of the
HTML template are added also too, so the files (%aa.html, %bb.html e.t.c)
end up having multiple ,   e.tc. tags. How do code a
method to execute only once in this situation?

The way I´ve solved it atthe moment is to define alphabet blocks at the
moment with the top of the HTML template in them and upon an occuring
switch, the links get added to the respective alphabet blocks. The alphabet
blocks are then written one by one to disk.

I´m not sure if the script is economical with memory,( i´ve defined more
than 20 blocks!) I would like than one of you should look it over, but it
so large and I think it might be impolite to post it here.

Thanks in advance


Sharriff Aina


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Antwort: Re: Switch!

2000-11-19 Thread Sharriff . Aina


On the spot Brett, Andrew also hinted at this, I´ve corrected the code to
cater for this situation

Thanks!

Sharriff Aina



   
  
"Brett Handley"
  
  
  
cious.com> Kopie:  
  
Gesendet von:  Thema:  [REBOL] Re: Switch! 
  
rebol-bounce@re
  
bol.com
  
   
  
   
  
20.11.00 00:26 
  
Bitte antworten
  
an rebol-list  
  
   
  
   
  




Hi Sharriff,

Maybe one of your titles is only one character is length or is empty?

Brett.

>> second "ab"
== #"b"
>> second "a"
** Script Error: Out of range or past end.
** Where: second "a"

Brett.

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 19, 2000 4:07 PM
Subject: [REBOL] Switch!


>
> Hi REBOL-List!
>
> given this code snippet::
>
>
> titles: ["Akne" %basis14.htm " Alkoholischer Leberschaden" %basis15.htm "
> Alzheimer" %basis16.htm ]
>
>
> foreach [x y] titles [ switch second :x [
> #"a" [either exists? %a.html [save %a.txt
> "test"][print "a.html exists!"]]
>  #"b" [ print "do that"]
>  #"c" []
>  #"d" [print "hoo" ]
>  #"e" [print "gotcha"]
>  #"f" []
>  #"g" []
>  #"h" []
>  #"i" []
>  #"j" []
>  #"k" []
>  #"l" []
>  #"m" []
>  #"n" [print "bogey"]
>  #"o" [print "stark"]
>  #"p" [Print "balloo"]
>  #"q" []
>  #"r" []
>  #"s" []
>  #"t" []
>  #"v" []
>  #"v" []
>  #"w" []
>  #"x" []
>  #"y" []
>  #"z" []]]
>
>
> If the block "titles" is not too big (30-40 entries) the snippet runs
fine,
> but the actual list generates more than 180 enties, the script runs but I
> get this error:
>
> ** Script Error: Out of range or past end.
> ** Where: switch second :x [
>
> Can someone tell me what is wrong?
>
> Sharriff Aina
> med.iq information & quality in healthcare AG
>
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.





-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Antwort: Re: Switch!

2000-11-19 Thread Sharriff . Aina


Thanks Andrew!



Sharriff Aina
med.iq information & quality in healthcare AG



   

"Andrew

Martin"  An: <[EMAIL PROTECTED]>

   Thema:  [REBOL] Re: Switch!   

Gesendet von:  

rebol-bounce@  

rebol.com  

   

   

19.11.00   

20:21  

Bitte  

antworten an   

rebol-list 

   

   





For why this:
> foreach [x y]
is bad, check out:
http://c2.com/cgi/wiki?MeaningfulNames

Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
-><-


--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.





-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Free SMS messaging from Rebol

2000-11-19 Thread Philip Bevan

Hi Graham,

This is just what I need  I would like to be able to send SMS messages
from Rebol  who do I have to register with to use this??
Does it work for all networks??

Do I just need the 2 scripts
mycellphone.r
cookies-client.r

Cheers Phil (Bevan)

- Original Message -
From: "Graham Chiu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 19, 2000 1:53 PM
Subject: [REBOL] Re: Free SMS messaging from Rebol


> On Sun, 19 Nov 2000 17:39:11 +1300
>  "Graham Chiu" <[EMAIL PROTECTED]> wrote:
> >
> > I finally got around to fixing mycellphone.r which allows
> > you to send free sms messages.  I've changed from
> > mtnsms.com
> > to freesms.net as the latter does not require you to
> > register to send messages.
>
> Oops!  There seems to be a daily 10 sms message limit with
> freesms.net.
>
> Oh well, back to mtnsms.com
>
> --
> Graham Chiu
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: CGI POST input

2000-11-19 Thread Joel Neely

Hello, Gabriele,

I wasn't able to get this to work.

[EMAIL PROTECTED] wrote:
> 
> Hello Joel!
> 
> On 19-Nov-00, you wrote:
> 
>  JN> OTOH, if I try repeatedly calling for input, concatenating
>  JN> the results into a single string until the total length
>  JN> equals the content-length, I get a script that never
>  JN> terminates.
> 
>  JN> Does anyone know of an officially-sanctioned, reliable
>  JN> approach to reading data from large forms (via POST, of
>  JN> course)?
> 
> Did you try opening console:// and reading from there? Like:
> 
>   port: open/binary/no-wait console://
>   while [need-more-chars] [
> wait port
> insert tail form-input copy port
>   ]
>   close port
> 

I used   wait [port 5]   hoping to get a timeout, but what I get
instead is the script (apparently) terminating with no code
following that point getting executed.  It's late now, but I'll
post a copy of the code tomorrow.

>
> (I didn't try if /NO-WAIT works with CONSOLE://, tough)
> 

It doesn't.

-jn-
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: CGI POST input

2000-11-19 Thread Joel Neely

Hello, Allen,

I tested it and it didn't work.  |-(

Details below.

[EMAIL PROTECTED] wrote:
> 
> From: "Joel Neely" <[EMAIL PROTECTED]>
> >
> > I get failure if the form uses POST and the combined length of all
> > name/value pairs exceeds 4104 bytes, which is apparently the max
> > length returned by a single call to input (this is consistent).
> > I.e., the rest of the data are lost.
>
> Hi Joel,
> 
> This a new entry in the Official FAQ which may be of use here.
> 
> http://www.rebol.com/faq.html#14982631
> 
> I haven't tested it on anything large yet.
> 

Here's the form I created for the test.


Test CGI with form

Test CGI with form

Text area:
Hello
Text field:








... and here's the first script ...

#!/usr/local/bin/rebol -cs

REBOL []

read-post-input: func [/local cs] [
;cs: copy system/ports/input
cs: input
return cs
]

clen: to-integer system/options/cgi/content-length
reqm: system/options/cgi/request-method
cont: any [
if reqm = "get"  [ system/options/cgi/query-string ]
if reqm = "post" [ input ]
]

print [
{Content-type: text/plain^/^/}
{^/request-method: } system/options/cgi/request-method
{^/content-length: } clen
{^/content: }cont
{^/length?: }length? cont 
newline
]

When I put large quantities of text into the textarea, the script
produces the following output ...

request-method:  POST 
content-length:  6771 
content: 
area=12345678901234567890123456789012345678901234567890%0D%0A1...
length?:  4094

Note the "magic number" of 4094 bytes in the actual length retrieved,
even though the form sent over 6.5K.

The second attempt just swapped the source of data in the
Read-Post-Input function...

#!/usr/local/bin/rebol -cs

REBOL []

read-post-input: func [/local cs] [
cs: copy system/ports/input
;cs: input
return cs
]

clen: to-integer system/options/cgi/content-length
reqm: system/options/cgi/request-method
cont: any [
if reqm = "get"  [ system/options/cgi/query-string ]
if reqm = "post" [ read-post-input ]
]

print [
{Content-type: text/plain^/^/}
{^/request-method: } system/options/cgi/request-method
{^/content-length: } clen
{^/content: }cont
{^/length?: }length? cont 
newline
]

...which produced...

request-method:  POST 
content-length:  53 
content:  area=Hello&field=Goodbye&submit=Submit&secret=whisper 
length?:  1

...using the default form content.  Notice the peculiar fact that the
length is being reported as 1 (???)  However, this one also hits the
proverbial wall when the input exceeds 4094 bytes in length.

So...

I'm still open for suggestions, but it's not looking too good for
the home team at this point.

-jn-
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Antwort: CGI POST input

2000-11-19 Thread Eric King

On Sun, Nov 19, 2000, Joel Neely <[EMAIL PROTECTED]> wrote:

>My problem was a REBOL problem, not a browser nor a GET-vs-POST
>problem.  I was already using POST.  The problem was that I still
>wasn't getting all of the data into REBOL.  When I rewrote the
>script using Perl, all of the data showed up.
>
>I'm going to test the idea from the REBOL FAQ (URL in Allen's reply)
>and report back on whether that solved the problem.

I was having the *exact* same problem in my Rebol webserver.   
 The only
thing that worked reliably for me was looping on read-io, and my server
does regularly handles submissions from large ( >20k ) forms. One of my
tests was a text version of my Bachelor's thesis, and that was 216k. 
Since my webserver has to handle multiple connections 
I use a couple
of queues, one for writing, and one for reading. Both send little chunks
of data with write-io or read-io, and keep track of how much was sent or
received so they know when to stop. I don't do keep-alives. 
Incidentally, during my testing, I also noticed that 
Netscape and IE
have very different patterns of I/O. It is quite possible (I know because
I inadvertently did it...) to write some code that reads a POST reliably
from IE, but not Netscape. There also seems to be a maximum amount of
data that the browsers can send from a text area. Each browser has a
different max. Figure somewhere around 30k. I don't remember exactly. But
any more gets truncated by the browser, not Rebol. Also, IE will let you
use the PUT method with a form, whereas Netscape won't. My server handles
PUTs exactly like POSTs. 
I know I should probably recode my read and write 
queue code to use
copy or insert, but it's been working really well since August, and I
have too much other code external to my core webserver code to fix. Plus,
I'd like to get it running on Mac OS X, but that's stuck with Rebol 2.2,
and I think I need 2.3+ for the new networking stuff to work. 
My server's gotten too chubby (800+ lines, excluding 
handlers) to
post to the list, but it's pretty well commented, so I could send email
it to you if you like. When I've cleaned out some of the esoteric cruft I
need for the applications I'm using it for, I'll post it up on one of my
websites, so others can play with it.

.:Eric



-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Antwort: CGI POST input

2000-11-19 Thread Tom De Grave

Hi Joel,

isn't this problem something caused by a little inconsistency with 'read
and the method of using 'read-io mentioned in the "How To" the (so far)
appropriate way to handle it?! I have to admit, I haven't much experimented
with the POST method myself so far, but 'read-io seems to work for me
even for somwhat larger files (at least larger than 4k) as you also can
see in the CGI test script I posted on thursday.

Tom



Joel Neely wrote:
> 
> Hello, Sharriff,
> 
> Thanks for the reply...
> 
> [EMAIL PROTECTED] wrote:
> >
> > Hi Joel!
> >
> > I think you meant the problems that posted to the list concerning
> > the out of the text and content using TEXTAREAS. This is what I
> > discovered:
> >
> > 1. I think it depends on the Browser, IE5 REFUSES to send more
> > than 1600 bytes with GET, Netscape on the other hand, sends
> > everything over with get, I have sent over approximately 2 pages
> > of text sucessfully.
> > 2. According to the documentation on www.blooberry.com, its
> > advisable to use the POST method, since the data that post can
> > handle is not limited, I´ll have to try that out.
> >
> 
> My problem was a REBOL problem, not a browser nor a GET-vs-POST
> problem.  I was already using POST.  The problem was that I still
> wasn't getting all of the data into REBOL.  When I rewrote the
> script using Perl, all of the data showed up.
> 
> I'm going to test the idea from the REBOL FAQ (URL in Allen's reply)
> and report back on whether that solved the problem.
> 
> -jn-
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Switch!

2000-11-19 Thread Brett Handley

Hi Sharriff,

Maybe one of your titles is only one character is length or is empty?

Brett.

>> second "ab"
== #"b"
>> second "a"
** Script Error: Out of range or past end.
** Where: second "a"

Brett.

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 19, 2000 4:07 PM
Subject: [REBOL] Switch!


>
> Hi REBOL-List!
>
> given this code snippet::
>
>
> titles: ["Akne" %basis14.htm " Alkoholischer Leberschaden" %basis15.htm "
> Alzheimer" %basis16.htm ]
>
>
> foreach [x y] titles [ switch second :x [
> #"a" [either exists? %a.html [save %a.txt
> "test"][print "a.html exists!"]]
>  #"b" [ print "do that"]
>  #"c" []
>  #"d" [print "hoo" ]
>  #"e" [print "gotcha"]
>  #"f" []
>  #"g" []
>  #"h" []
>  #"i" []
>  #"j" []
>  #"k" []
>  #"l" []
>  #"m" []
>  #"n" [print "bogey"]
>  #"o" [print "stark"]
>  #"p" [Print "balloo"]
>  #"q" []
>  #"r" []
>  #"s" []
>  #"t" []
>  #"v" []
>  #"v" []
>  #"w" []
>  #"x" []
>  #"y" []
>  #"z" []]]
>
>
> If the block "titles" is not too big (30-40 entries) the snippet runs
fine,
> but the actual list generates more than 180 enties, the script runs but I
> get this error:
>
> ** Script Error: Out of range or past end.
> ** Where: switch second :x [
>
> Can someone tell me what is wrong?
>
> Sharriff Aina
> med.iq information & quality in healthcare AG
>
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Dialects and XML

2000-11-19 Thread Petr Krenzelok

Hi Andrew,

In my opinion - ability to generate/read various file formats is very
essential. Imagine some kind of e-commerce bot, putting your data into
MSWord file, .pdf file, etc.
I think the functionality is so essential, ti has to be also fast enough.
That's the right place for REBOL components. Once we will get dynamic
components, I have no problem buying /pdf /msoffice set of components for
native generating, reading various file formats ...

As for your XML<->Java<->pdf converter - it's good as instant solution, but
hardly good enough ... We even don't have "professional" XML parser and I am
not sure /Command will have one, although it was planned earlier by RT.


-pekr-


- Original Message -
From: Andrew Martin <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, November 19, 2000 10:07 AM
Subject: [REBOL] Dialects and XML


> Here's a XML to PDF converter written in Java:
> http://xml.apache.org/fop/index.html
> There's obvious applications here for generation of high quality
> documents from Rebol. By writing a XML dialect for Rebol, script output
from
> Rebol could be semi-automatically "poured" into a .PDF file. By converting
> the FOP's Java code into Rebol script, and adding a Rebol .pdf launch
> command, automatic high quality print files are available for display or
> printing. Carrying on from this, writing a Rebol script that reads a form
> letter and a database, generating a .pdf file then launching the file with
a
> print command. This could then eliminate at least one application of MS
Word
> in many offices.
>
> Andrew Martin
> ICQ: 26227169
> http://members.nbci.com/AndrewMartin/
> -><-
>
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Antwort: CGI POST input

2000-11-19 Thread Joel Neely

Hello, Sharriff,

Thanks for the reply...

[EMAIL PROTECTED] wrote:
> 
> Hi Joel!
> 
> I think you meant the problems that posted to the list concerning
> the out of the text and content using TEXTAREAS. This is what I
> discovered:
> 
> 1. I think it depends on the Browser, IE5 REFUSES to send more
> than 1600 bytes with GET, Netscape on the other hand, sends
> everything over with get, I have sent over approximately 2 pages
> of text sucessfully.
> 2. According to the documentation on www.blooberry.com, its
> advisable to use the POST method, since the data that post can
> handle is not limited, I´ll have to try that out.
> 

My problem was a REBOL problem, not a browser nor a GET-vs-POST
problem.  I was already using POST.  The problem was that I still
wasn't getting all of the data into REBOL.  When I rewrote the
script using Perl, all of the data showed up.

I'm going to test the idea from the REBOL FAQ (URL in Allen's reply)
and report back on whether that solved the problem.

-jn-
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Launch query

2000-11-19 Thread Philip Bevan

Hi guys,

When I run the following script from explorer

rebol []
help launch
print system/version
halt

I get the output :
0.10.38.3.1
USAGE:
LAUNCH

DESCRIPTION:
(undocumented)


Running the rebol.exe from explorer going to the console and typying help
launch I get the output (and I cant get launch to work)

REBOL/View 0.10.38.3.1 31-Oct-2000
Copyright 2000 REBOL Technologies.  All rights reserved.
>> help launch
USAGE:
LAUNCH value /reboot

DESCRIPTION:
 Launches a new REBOL interpreter process.
 LAUNCH is a native value.

ARGUMENTS:
 value -- The command-line arguments (Type: any-string)

REFINEMENTS:
 /reboot


So if I am running the same version of rebol why do I get different
results???
I thought I might have an old version of Rebol hanging around, but I cant
find any other versions.

Cheers Phil

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: CGI POST input

2000-11-19 Thread Gabriele Santilli

Hello Joel!

On 19-Nov-00, you wrote:

 JN> OTOH, if I try repeatedly calling for input, concatenating
 JN> the results into a single string until the total length
 JN> equals the content-length, I get a script that never
 JN> terminates.

 JN> Does anyone know of an officially-sanctioned, reliable
 JN> approach to reading data from large forms (via POST, of
 JN> course)?

Did you try opening console:// and reading from there? Like:

  port: open/binary/no-wait console://
  while [need-more-chars] [
wait port
insert tail form-input copy port
  ]
  close port

(I didn't try if /NO-WAIT works with CONSOLE://, tough)

Regards,
Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Help required for a little parsing problem

2000-11-19 Thread Gabriele Santilli

Hello Nigel!

On 18-Nov-00, you wrote:

 NB> Whilst I could probably write a (long) solution I'm sure
 NB> there must be an elegant couple of line Rebol solution - one
 NB> problem is that there may be any number of links in the post.

 NB> Any suggestions?

Just an idea:

  post-rule: [some [link | text]]
  link: ["[url]" copy url to "[/url]" 6 skip (emit-link url)]
  text: [copy chars [to "[url]" | skip to end] (emit chars)]
  emit-link: func [url] [
emit build-tag [A HREF (url) TARGET "_blank"]
emit url
emit 
  ]
  emit: func [text] [
insert tail output text
  ]
  output: ""
  parse-post: func [post] [
clear output
if parse/all post post-rule [copy output]
  ]

>> print parse-post "This is a post - Perl is good [url]http://www.perl.com[/url], 
>Rebol is better [url]http://www.rebol.com[/url]"
This is a post - Perl is good http://www.perl.com" 
TARGET="_blank">http://www.perl.com, Rebol is better http://www.rebol.com" TARGET="_blank">http://www.rebol.com

(Perhaps it's a bit long...)

Regards,
Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Help required for a little parsing problem

2000-11-19 Thread chaz

parse post [
any [ to "[url]" url_start: 
 thru "[url]" copy href to "[/url]" 
 thru "[/url]" url_end:

   (change/part url_start 
compose [("") (href)
("")]
url_end)
]
]

Go through the post.
Move to the beginning of the '[url] tag and save that position into the
word 'url_start
copy the value of the url into 'href
move to the end of the '[/url] tag and save that position in 'url_end

Replace everything between 'url_start and 'url_end
with a new string composed of three strings and two instances of the value
of the word 'href 
('compose concatenates and evaluates)

Please email me off-list with the Perl equivalent.

chaz

P.S. Thanks to Gabriele for his Expression Evaluator.


At 04:41 PM 11/18/00 -, you wrote:
>Hi
>
>I'm writing an add-on for a bulletin board and need a bit of help in writing
>some elegant code to do the following:
>
>a variable has the content of a post -eg:
>post: "This is a post - Perl is good [url]http://www.perl.com[/url], Rebol
>is better [url]http://www.rebol.com[/url]"
>
>when this is posted to the board the text between the [url] and [/url] ends
>up as a link.
>
>So what I need to do is change the above text to:
>"This is a post - Perl is good http://www.perl.com^" target =
>^"_blank^">http://www.perl.com, Rebol is better href=^"http://www.rebol.com^" target=^"_blank^">http://www.rebol.com"
>
>Whilst I could probably write a (long) solution I'm sure there must be an
>elegant couple of line Rebol solution - one problem is that there may be any
>number of links in the post.
>
>Any suggestions?
>
>Thanks in advance
>
>Nigel
>
>-- 
>To unsubscribe from this list, please send an email to
>[EMAIL PROTECTED] with "unsubscribe" in the 
>subject, without the quotes.
>
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Dialects and XML

2000-11-19 Thread Andrew Martin

Here's a XML to PDF converter written in Java:
http://xml.apache.org/fop/index.html
There's obvious applications here for generation of high quality
documents from Rebol. By writing a XML dialect for Rebol, script output from
Rebol could be semi-automatically "poured" into a .PDF file. By converting
the FOP's Java code into Rebol script, and adding a Rebol .pdf launch
command, automatic high quality print files are available for display or
printing. Carrying on from this, writing a Rebol script that reads a form
letter and a database, generating a .pdf file then launching the file with a
print command. This could then eliminate at least one application of MS Word
in many offices.

Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
-><-


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Multiple Word Conditional?

2000-11-19 Thread Andrew Martin

Chaz wrote:
> factorial: func [num][
>  fact: func [n a][
>  any [
>  all [lesser? n 0 print "I don't know"]
>  all [switch n [0 1 a]]
>  all [fact subtract n 1 multiply n a]
>  ]
>  ]
>  fact num 1
> ]

This can be better written as:

Factorial!: make object! [
Fact: func [n a] [
any [
all [lesser? n 0 print "I don't know"]
all [switch n [0 1 a]]
all [fact subtract n 1 multiply n a]
]
]
set 'Factorial func [num][
Fact Num 1
]
]

Note that Fact is only defined once, in the 'Factorial! object, rather than
every time 'Factorial is executed.

I hope that helps!

Andrew Martin
Objective Rebol...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
-><-


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Help required for a little parsing problem

2000-11-19 Thread Andrew Martin

Nigel wrote:
> I'll try them later - I'm sure it will save me a big headache

To save yourself from more headaches, why not drop the "[url]" notation, and
directly generate the HTML link by recognising the http:// url? So your
example becomes:
post: {
This is a post - Perl is good http://www.perl.com,
Rebol is better http://www.rebol.com.
}
result: {
This is a post - Perl is good http://www.perl.com">http://www.perl.com,
Rebol is better http://www.rebol.com">http://www.rebol.com.
}

Then you could go one step further yet again:
post: {
This is a post - Perl is good: http://www.perl.com,
Rebol is better: http://www.rebol.com.
}
result: {
This is a post - http://www.perl.com">Perl is good,
http://www.rebol.com">Rebol is better.
}
Want an asprin? :-)
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
-><-


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Multiple Word Conditional?

2000-11-19 Thread chaz

"any" is pretty cool! That does help!

factorial: func [num][
 fact: func [n a][
 any [
 all [lesser? n 0 print "I don't know"]
 all [switch n [0 1 a]]
 all [fact subtract n 1 multiply n a]   
 ]
 ] 
 fact num 1
]

chaz

At 09:59 AM 11/16/00 -0800, you wrote:
>Hi Rodney
>
>One nice way to do this is:
>
>>> one: false
>== false
>>> two: false
>== false
>>> three: true
>== true
>>>
>>> any [all [one print "1"] all [two print "2"] all [three print "3"]]
>3
>
>Notice that ANY and ALL can return the values of any expression as well as
>just true and false. BTW, the construct above has the same functionality as
>a COND in Scheme or Lisp.
>
>HTH
>-Larry
>
>- Original Message -
>From: Rodney Snell <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, November 16, 2000 9:33 AM
>Subject: [REBOL] Multiple Word Conditional?
>
>
>> Given three mutually exclusive refinements in a function
>> (or just three words in a script), what is the best way
>> to perform the conditional?
>>
>> one: false
>> two: false
>> three: true
>>
>> Of course we can do:
>>
>> either one [print "1"] [either two [print "2"][print "3"]]
>>
>> but this gets ugly for more than three words and I thought
>> that someone recently posted a trick using 'any
>> that made this simpler and more readable.  Can't find it
>> though.  Any suggestions?
>>
>> Thanks,
>>
>> Rodney
>> --
>> To unsubscribe from this list, please send an email to
>> [EMAIL PROTECTED] with "unsubscribe" in the
>> subject, without the quotes.
>
>-- 
>To unsubscribe from this list, please send an email to
>[EMAIL PROTECTED] with "unsubscribe" in the 
>subject, without the quotes.
>
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: Help required for a little parsing problem

2000-11-19 Thread Nigel Booker

Thanks Andrew & Christian for the replies to the parsing problem.

I'll try them later - I'm sure it will save me a big headache

Thanks

Nigel


- Original Message -
From: "Christian Ensel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 18, 2000 7:59 PM
Subject: [REBOL] Re: Help required for a little parsing problem


> Hallo Nigel,
>
> Andrew's version is even shorter than mine, doing it by just
> 'change -ing instead of 'remove -ing and 'insert -ing.
>
> Nevertheless, here's my version with additinal comments:
>
> parse post [
> any; apply the following rule 0 or more times
> [
> to "[url]" ; jumps to the first occurence of "[url]"
>; we're right ahead of it now
>
> tag:   ; remember the position in the string
>
> 5 skip ; skip 5 characters ("[url]")
>
> copy url to "[/url]"   ; copy everthing till we encounter a
>; string "[/url]"
>; 'url now holds the url, but not the
brackets
>
>; all the above is the 'parse dialect
>
> (  ; start of code (non-dialect) section
>
> remove/part tag add length? url 11
>
>; remove length? url plus additional 11
>; chars ("[url]" = 5 + "[/url]" = 6)
>; from the input string,
>; counting from the position we told
>; 'parse to remember in 'tag
>
> insert tag rejoin [
> {} url {}
> ]
>; composes the html-tag and inserts
>; it at the position 'tag
>
>; voila!
>
> )  ; end of code section
> ]
> to end
> ]
>
> If you want to learn about 'parse see the new user guide on rebol.com,
> chapter 14. Have fun!
>
>
>Christian
>[EMAIL PROTECTED]
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.