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

2000-02-21 Thread business



; 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:  [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 "  }
 
   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 useruserDate: 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 
monthinputDate: 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 
calendarfirstOfNextMonth: 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 themPRINT ["There are " 
daysInPrevMonth " days in " prevMonthName ] ; adjust for first month 
bugPRINT ["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 ""print ""print 
" REBOL MADE CALENDAR by John Braman's rebolcal.htm 
"print ""print ""print 
""print 
[monthName firstOfMonth/year] ; we get month from the inputprint 
""
 
; Print table, heading days of week, start with 
Mondayprint ""i: 1while [i <= 7] 
[ print ["" 
PICK weekdays(i) ""] i: i + 1] ; 
end while for headingsprint ""
 
; Put the data into the tabl

[REBOL] constructor & destructor Re:(2)

2000-02-21 Thread icimjs

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] using environment variables Re:(2)

2000-02-21 Thread t_degrav

Hi Robert,

Danke! I must have missed your answer before...
Well, setting environment variables would have been what I really need.
Does anybody else know if it's possible?

Tom

P.S.: If Rebol can't do this, any suggestions for another language that
  provides an easy way to set environment variables?



[EMAIL PROTECTED] wrote:
> > does anyone know if or how it's possible to use (get and SET)
> > OS environment variables from within Rebol?
> 
> Hi, I think if you start Rebol in CGI mode, you will get the environment...
> setting variables isn't possible AFAIK.



[REBOL] constructor & destructor Re:

2000-02-21 Thread ingo

Hi Martin,

constructors are easily done. 

>> a: [
[print "hey, I'm new here ..."
[b: 3
[]
>> b: make object! a
hey, I'm new here ...
>>

I have no idea on destructors, though ...


regards,

Ingo


Those were the words of [EMAIL PROTECTED]:
> Since I've programmed sometime i C++ with classes (almost like objects in REBOL), 
>I've missed some features in the objects in REBOL.
> 
> What about constructors (a member function that is executed at object creation) and 
>destructors (a member function that is executed at object deletion)?
> 
> 1. Will it be added to REBOL?
> 
> 2. How can it be made with current implementation of REBOL?
> 
> Yours faithfully
> ---
> Martin Ancher Holm
> Work <[EMAIL PROTECTED]>, Home <[EMAIL PROTECTED]>
> ,Cell <[EMAIL PROTECTED]>
> 
> 

--  _ ._
ingo@)|_ /|  _| _   ingo@| |(_|o(_)| (_| 
http://www.2b1.de/Rebol/ ._|  ._|



[REBOL] Mail Re:

2000-02-21 Thread whip


  Howdy Matos:

You can specify a proxy for each individual protocol.  I
believe the following should work for you:

(In your user.r, or at the top of your script:)

   set-net [[EMAIL PROTECTED] mail.host.dom]
   system/schemes/http/proxy/host: "your.proxy.host"
   system/schemes/http/proxy/port-id: 

  (Of course, substituting in all your information..)

  You probably want ftp and others too.  I believe you can also just
set a by-pass for individual protocols as well -- which might be a
cleaner way to do what you want...

-jeff

>  Hello all...
>  I'm having this  problem: I can  access my e-mail server without  a
> proxy  se= rver, but if  i try to  access it with  the  "help" of my
> proxy server then i can't reach it (it is not the objective = of the
> proxy server). But if I want to access web pages, the only way to do
> that is using the proxy server.
>  My problem is that when  we configure the proxy  server in REBOL he
> assumes=  that the  proxy should be  used  also to   access the mail
> server. Is there a way to correct this excluding the hipo= thesis of
> doing a set-net every time i want to access the web or the mail?!



[REBOL] Re: cgi and post

2000-02-21 Thread giesse

Hello [EMAIL PROTECTED]!

On 20-Feb-00, you wrote:

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

AFAIK this could not read all the data. I think it's better to use
something like:

while [tmp > 0] [tmp: tmp - read-io system/ports/input buffer tmp]

 s> system/options/cgi/content-length but it is quaranteed that
 s> content-length will be send everytime by each browser (or
 s> another user-agent)? (question for Holger?)

The browser MUST include the Content-Length header if it is
sending data. If it doesn't, the server cannot tell how much data
to wait for.

 s> what about reading stdin by this way:

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

Rather slow IMHO... and it will not work in case of binary data
(well, that shouldn't be your case anyway).

Regards,
Gabriele.
-- 
o) .-^-. (--o
| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
| GIESSE on IRC \ \-\_/-/ /  http://www.amyresource.it/AGI/ |
o) `-v-' (--o




[REBOL] Re: in 'return

2000-02-21 Thread giesse

Hello [EMAIL PROTECTED]!

On 20-Feb-00, you wrote:

 s> So It's a bug IMHO.

You can fix it by yourself. Just add the THROW attribute:

>> forall: func [
["Evaluates a block for every value in a series." [throw] 
['word [word!] {Word set to each position in series and changed as a result} 
[body [block!] "Block to evaluate each time"
[][
[while [not tail? get word] [
[do body 
[set word next get word
[]
[]
>> test [ 1 2 3 "a" 5 6]   
== "Not integer!"

Regards,
Gabriele.
-- 
o) .-^-. (--o
| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
| GIESSE on IRC \ \-\_/-/ /  http://www.amyresource.it/AGI/ |
o) `-v-' (--o



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

2000-02-21 Thread gvadivelrajan

Hello ,



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


Regards
Gobiraj



 winmail.dat


[REBOL] constructor & destructor Re:

2000-02-21 Thread mjelinek

I create a "wrapper" function around the make object! declaration to create
an instance of the "class", then call this wrapper function explicitly when
I want a new instance. This wrapper function does the initialization and
such of a constructor. If you cared, you could also write a function for the
destructor, and call it explicitly. Alas, these are not "true oo"
constructors and destructors as they are not elements of the object, but
they work.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 21, 2000 4:17 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] constructor & destructor


Since I've programmed sometime i C++ with classes (almost like objects in
REBOL), I've missed some features in the objects in REBOL.

What about constructors (a member function that is executed at object
creation) and destructors (a member function that is executed at object
deletion)?

1. Will it be added to REBOL?

2. How can it be made with current implementation of REBOL?

Yours faithfully
---
Martin Ancher Holm
Work <[EMAIL PROTECTED]>, Home <[EMAIL PROTECTED]>
,Cell <[EMAIL PROTECTED]>



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

2000-02-21 Thread mjelinek

I've loaded well over 100,000 records (about 100 char in length) via
read/lines - probably more like 350,000. The biggest thing to watch out for
is that REBOL will use about twice as much memory as the disk file size to
store it in a block.

- Michael Jelinek

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 20, 2000 8:01 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] .r to html monthly calendar prelude Re:(3)


>REBOL is perfect for storing a wide range of data values, so can be used
for
>creating databases up to and beyond several thousand records. This is
useful

Does any one know what the true limit is?  I've got a data
base of 23,000 records right now, growing at a rate of about
100 entries per week.



[REBOL] unix timestamp conversion? Re:

2000-02-21 Thread ralph


> Anyone written a script to convert unix timestamps (is 950618412) to
> a usable rebol date and time format.
>
> Cheers
>
> Francois
>
>
>

And to do it the other way around, i.e. generate an Epoch date:


REBOL[
 ]

date: now

seconds: ((date - 1-1-1970) * 86400) + (date/time/hour * 3600) +
(date/time/minute * 60) + date/time/second

zone: now/zone

zone: zone/hour

zone: zone * 3600

seconds: seconds - zone ; minus a minus gives plus

print seconds  ; Epoch date



[REBOL] unix timestamp conversion? Re:

2000-02-21 Thread ralph


> Anyone written a script to convert unix timestamps (is 950618412) to
> a usable rebol date and time format. 
> 
> Cheers
> 
> Francois
> 
> 

Hi Francois:

Try this.


REBOL [
Title: "Convert Epoch Time to Date"
Author: "Ralph Roberts"
File: %epoch-to-date.r
Date: 21-Feb-2000
Purpose: {converts UNIX Epoch time (seconds after 1-1-1970
to current date and time }
Example: {outputs "Epoch date 951142987 is 21-Feb-2000
14:38:52 GMT or 9:38:52 Local" }
]

epoch: 951142987

days: divide epoch 86400

days2: make integer! days

time: (days - days2) * 24
hours: make integer! time
minutes: (time - hours) * 100
minutes2: make integer! minutes
seconds: make integer! (minutes - minutes2) * 100
time2: make time! hours * 60) + minutes2) * 60) + seconds)

prin ["Epoch date" epoch "is" 1-Jan-1970 + days2 time2]
print [" GMT or" time2 + now/zone "Local"]



[REBOL] Mail

2000-02-21 Thread jamatos

Hello all...

I'm having this problem: I can access my e-mail server without a proxy server, but if 
i try to access it with the
"help" of my proxy server then i can't reach it (it is not the objective of the proxy 
server). But if I want to
access web pages, the only way to do that is using the proxy server.

My problem is that when we configure the proxy server in REBOL he assumes that the 
proxy should be used also to
access the mail server. Is there a way to correct this excluding the hipothesis of 
doing a set-net every time i
want to access the web or the mail?!

--
Signout: Zé Matos

--
A frase imediatamente abaixo desta é verdadeira!
A frase imediatamente acima desta é falsa!
--




[REBOL] unix timestamp conversion?

2000-02-21 Thread prowsef

Anyone written a script to convert unix timestamps (is 950618412) to
a usable rebol date and time format. 

Cheers

Francois




[REBOL] Fw: [REBOL] Ok, how to print to STDOUT Re:(4)

2000-02-21 Thread fuchs

The pipe "trick" may only work under NT and 2000. It also works under Win98
using ksh (part of Uwin).

Ira

> From: [EMAIL PROTECTED]
> Reply-To: [EMAIL PROTECTED]
> Date: Mon, 21 Feb 2000 1:36:08 -0600
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Fw: [REBOL] Ok, how to print to STDOUT Re:(3)
> 
> Warped minds think alike tried it but I get a windows write error!!?
> (trying to write to a windows temp file)
> --
> Erik Jorgensen
> Programmer/Analyst - Principle
> Customer Service and Support
> Information & Access Technology Services
> University of Missouri - Columbia
> (573) 882-5974
> www.missouri.edu/~ccjorgie
> [EMAIL PROTECTED]
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 19, 2000 2:23 PM
> Subject: [REBOL] Fw: [REBOL] Ok, how to print to STDOUT Re:(2)
> 
> 
>> try
>> rebol -c drives.r | more
>> and see if that works.
>> 
>> Ira
>> - Original Message -
>> From: <[EMAIL PROTECTED]>
>> To: <[EMAIL PROTECTED]>
>> Sent: Friday, February 18, 2000 10:06 PM
>> Subject: [REBOL] Fw: [REBOL] Ok, how to print to STDOUT Re:
>> 
>> 
>>> Still looking for help on this... (want output at the command line
> without
>>> showing a window
>>> --
>>> Erik Jorgensen
>>> Programmer/Analyst - Principle
>>> Customer Service and Support
>>> Information & Access Technology Services
>>> University of Missouri - Columbia
>>> (573) 882-5974
>>> www.missouri.edu/~ccjorgie
>>> [EMAIL PROTECTED]
>>> - Original Message -
>>> From: <[EMAIL PROTECTED]>
>>> To: <[EMAIL PROTECTED]>
>>> Sent: Thursday, February 17, 2000 9:45 AM
>>> Subject: [ALLY] Ok, how to print to STDOUT Re:
>>> 
>>> 
 Thanks to everyone who responded... But...
 
 How do I get rebol to print something at the dos prompt? I used the -c
 specifically to suppress the window and the init info during
> execution,
>>> but
 I expected the same data that can be redirected using > to show up in
> my
>>> dos
 window.
 
 Erik
 
 Notice I made the suggested change...
 
 --
 Erik Jorgensen
 Programmer/Analyst - Principle
 Customer Service and Support
 Information & Access Technology Services
 University of Missouri - Columbia
 (573) 882-5974
 www.missouri.edu/~ccjorgie
 [EMAIL PROTECTED]
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 16, 2000 7:22 PM
 To: [EMAIL PROTECTED]
 Subject: [ALLY] Ok, how to print to STDOUT
 
 
 I wrote the following script:
 
 ;---snip---
 REBOL [
 File: %drives.r
 ]
 
 list: make string! 1
 
 list-drives: func [drives] [
 foreach letter drives [
 if not error? try [read to-file join "/" [letter "/."]]
 [append list to-string letter]
 ]
 print list
 ]
 
 list-drives "cdefghijklmnopqrstuvwxyz"
 ;---snip---
 
 But when I run it with:
 
 rebol.exe -c drives.r
 
 I do not see the output. (Win98)
 
 But:
 
 rebol.exe -c drives.r > t
 
 Does write the expected output to the file %t
 
 Help!
 
 Erik
 --
 Erik Jorgensen
 Programmer/Analyst - Principle
 Customer Service and Support
 Information & Access Technology Services
 University of Missouri - Columbia
 (573) 882-5974
 www.missouri.edu/~ccjorgie
 [EMAIL PROTECTED]
 
>>> 
>>> 
>> 
> 
> 



[REBOL] constructor & destructor

2000-02-21 Thread mah

Since I've programmed sometime i C++ with classes (almost like objects in REBOL), I've 
missed some features in the objects in REBOL.

What about constructors (a member function that is executed at object creation) and 
destructors (a member function that is executed at object deletion)?

1. Will it be added to REBOL?

2. How can it be made with current implementation of REBOL?

Yours faithfully
---
Martin Ancher Holm
Work <[EMAIL PROTECTED]>, Home <[EMAIL PROTECTED]>
,Cell <[EMAIL PROTECTED]>




[REBOL] [BUG] in 'return Re:(3)

2000-02-21 Thread lmecir

Ahoj,

change Forall like this:

>> source forall
forall: func [ [throw] ; <- inserted
"Evaluates a block for every value in a series."
'word [word!] {Word set to each position in series and changed
as a result}
body [block!] "Block to evaluate each time"
][
while [not tail? get word] [
do body
set word next get word
]
]

Ladislav

>
>   Well, I should add that I use rebol/core version 2.2.0.4.2
>
>   Regards,
>   Jan
>
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > Here's my console session:
> >
> > >> test: func [blk][
> > [  forall blk [
> > [if not integer? first blk [return "Not integer!"]
> > [  ]
> > [  none
> > []
> > >> test ["a" 1]
> > == "Not integer!"
> > >> test [1 "a" 1]
> > == "Not integer!"
> > >> test [2 3 1 "a" 1]
> > == "Not integer!"
> > >>
> > >> test [1 2 3 "a" 5 6]
> > == "Not integer!"
> > >>
> > Looks ok to me!
> > Russell [EMAIL PROTECTED]
> > - Original Message -
> > From: <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Sunday, February 20, 2000 2:10 PM
> > Subject: [REBOL] [BUG] in 'return
> >
> >
> > >
> > >  Hi.
> > >
> > > Next one problem:
> > >
> > > do you ever try return from forall in function?
> > >
> > > test: func [blk][
> > >   forall blk [
> > > if not integer? first blk [return "Not integer!"]
> > >   ]
> > >   none
> > > ]
> > >
> > > >> test [ 1 2 3 "a" 5 6]
> > > == none
> > >
> > > Dictionary says:
> > >
> > > Exits the current function immediately, returning a value as
the result of
> > > the function.
> > >
> > > So It's a bug IMHO.
> > >
> > > To exit only 'forall should be used break (with refinement
/return to
> > return
> > > some value)
> > >
> > > Another $0.02 :-)
> > >
> > > Regards.
> > > Jan
> > >
> > >
> > > --
> > > Jan Strejcek
> > > [EMAIL PROTECTED]
> > >
> > >
> >
>
> --
> Jan Strejcek
> [EMAIL PROTECTED]
>
>
>