[REBOL] none Re:(3)

2000-05-06 Thread rryost

I tried to upload a revised version of julian.r to www.rebol.org, but don't
know if I was successful.  Meanwhile, the revised version is attached
hereto.

Russell [EMAIL PROTECTED]
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 06, 2000 2:32 AM
Subject: [REBOL] none Re:(2)


> > Can you repost the original script?
>
> It's on http://www.rebol.org/utility/julian.r too.
>
> > A few months ago Russel posted a very nice script computing the Julian
> > day with Rebol.
> >
> > I just used it and noticed, that there's a problem with the 1st of March
> > of leap years after 2000.
>
> > TIA
> >
> AR
>
>
> --
> Sent through GMX FreeMail - http://www.gmx.net
>
>


REBOL
[ Title: {Julian Calendar Stuff}
date: 6-5-2000
file: %julian.r
Comment: { Run this from console by typing "do %path/julian1.r " 
where "path" starts with "/" followed by absolute
path, eg, I would type "do %/c/dpart/rebol22stuff/julian1.r"
I'm sorry; drag-drop to REBOL/view 3 results in the console 
closing before you can use the script.
}
version: 0.0.1
Comment: { This version fixes a bug in j2d function by replacing
(to-integer (yr * daysinyear)) with
(dye yr).  This was crucial in the da: statement.
}
author: {Russ Yost}
Email: [EMAIL PROTECTED]
Purpose: { To provide conversions to/from julian day numbers/dates }
Category: 'utility
Comment: {I'm not sure where these algorithms originated, but I used
them in a JForth program in 1992.  The epoch date seems to be   
that set by Joseph Scaliger in 1582, i.e., Jan 1 4713 BC, (that 
would be Julian day number 1), but as this algorithm takes the  
average length of the solar year as 365.2425, it works over the 
range 0001 through 3000. Beyond then, the discrepancy with the
true length, 365.242199, should lead to errors.
(The year 2000, being divisible by 400,  will be a leap year, 
although in general, years that are multiples of 100 are not 
leap years. It *does* yield the correct Julian Day number given 
in the 1999 World Almanac (World Almanac Books, Mahwah NJ) pg 
322, for 31 Dec 1998, 2,451,179.)
}

]
usergreeting: {
Two functions are defined herein, date-to-jul, with argument a
date in format dd-mm- in  year range 0001 through 3000, and 
jul-to-date, with  argument a julian  day number (JD) based on 1 Jan
4713 BC, with 31 Dec 1998's JD = 2451179 (as given in the 1999
Almanac) and corresponding to the above mentioned range.
This latter function also provides the day of the week for
the given JD.

Some other useful functions:
diy, arg , yields the number of days in a given year.
febdays, arg , yields the number of days in February.
testj-d, arg , prints a   calendar, 1 line per month.   
}


jul0: 1720997 ; use with jul day based in 365.2425 days in year.

comment {There are 365.242199 solar days in a year, so the preceding
assumption will lead to trouble after year 3000, I think.}

comment { 'jul0 also compensates for extra days added in the calculation 
of the number of days per month, and adjusts the result to agree 
with 1999 Almanac's statement that JD of 31 Dec 1998 is 
2,451,179.
}

daysinyear: 365.2425
daysinmo: 30.6001 ; a synthesized number that is used to calc
; days in each month.
weekdays: ["Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat"]



idiv: func [x y][to-integer ( divide x y) ]

comment {REBOL ought to include an integer divide function! }


comment { Th func 'dye calcs a Julian day no based on 1-1-0001, taking  
into account years that are multiples of 4 are leap years 
(Feb has 29 days instead of 28) unless they're multiples of
100 years, but those *are* leap years if they're multiples of
400.
}

comment {dye is day number of last day of year y }

dye: func[y][  (y * 365) + (((idiv y 4) - (idiv y 100)) + (idiv y 400))] 


date-to-jul: func [date /local jul mo mox yr][
jul:  date/day   + jul0
 yr: date/year 
 mo: date/month
 either mo > 2 [mox: mo + 1  ] [
mox: mo + 13 yr: yr - 1 ]
 jul: jul + (dye yr) + (to-integer mox * daysinmo) 
]

jul-to-date: func [jl /local date da  mo yr dano][
dano: jl - jul0
dow: remainder (dano + 6) 7 ; Sunday = 0
date: j2d jl
da: date/day mo: date/month yr: date/year
print [{date is  } to-date reduce[da mo yr]]
print [{ day of week is }first skip weekdays dow]
]

j2d: func [ jl /local  dano yr mo da dow mox][
dano: jl - jul0   
  

[REBOL] none Re:(2)

2000-05-06 Thread sqlab

> Can you repost the original script?

It's on http://www.rebol.org/utility/julian.r too.

> A few months ago Russel posted a very nice script computing the Julian
> day with Rebol.
> 
> I just used it and noticed, that there's a problem with the 1st of March
> of leap years after 2000.
 
> TIA
> 
AR
 

-- 
Sent through GMX FreeMail - http://www.gmx.net




[REBOL] none Re:

2000-05-05 Thread rrm

Can you repost the original script?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 03, 2000 5:03 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] none


Hello

A few months ago Russel posted a very nice script computing the Julian day
with Rebol.

I just used it and noticed, that there's a problem with the 1st of March
of leap years after 2000.
It assumes that e.g. 2-Mar-2004 is following 29-Feb-2004.

Anyone more familiar with this subject and able to help ?


TIA

AR

-- 
Sent through GMX FreeMail - http://www.gmx.net




[REBOL] none Re:

2000-04-17 Thread kevin


> Can you Ping a server from Rebol.

Ping, no.  To access the ICMP socket, the REBOL interpreter would 
need to be installed suid root, which could be a Bad Thing (tm).

> Is it possible to detect if a http server
> is not responding.

How about:

> if error? try [read http://www.rebol.com/]
[print "Server not available]

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




[REBOL] none Re:

2000-04-17 Thread kracik

Hi,

No and yes, and you can set the timeout in seconds when the server
should respond:

>> system/schemes/http/timeout: 1
== 1
>> if error? try [ read http://www.itv.cz/ ] [ print "server is not responding" ]
connecting to: www.itv.cz
server is not responding

-- 
Michal Kracik

[EMAIL PROTECTED] wrote:
> 
> Hi
> 
> Can you Ping a server from Rebol. Is it possible to detect if a http server
> is not responding.
> 
> Many thanks
> 
> Aneesha




[REBOL] none Re:

2000-02-28 Thread lmecir

Hi,

Your observation was reported to feedback by me before and it has
been assigned ticket #2409.

OTOH, if you check the code more thoroughly, URL! never changes to
File!.

Regards,
Ladislav

>
> Hi folks,
>
> I was just playing around with Ladislav's fix of SPLIT-PATH. I
was
> wondering why he converted the argument values to strings, since
this
> has the disadvantage that if the argument is a URL the result
will
> eventually get changed to a file.
>
> Then I noticed something really weird:
>
> >> path: file: %dir/file.ext
> == %dir/file.ext
> >> parse path [any [#"/" file: | skip]]
> == true
> >> file
> == "file.ext"
> >> insert path "parent/"
> == %dir/file.ext
> >> path
> == %parent/dir/file.ext
> >> head file
> == "parent/dir/file.ext"
>
> Even though we're parsing a file! , any pointer set within the
parse
> rule becomes a string! , and yet it's still pointing to the same
> underlying data. It can't, however, be used as an index with
COPY/PARSE:
>
> >> parse path [any [#"/" file: | skip]]
> == true
> >> copy/part path file
> ** Script Error: Invalid /part count: file.ext.
> ** Where: copy/part path file
>
> I never realized that you could view the same data with two
different
> datatypes. Is this intended? I think it would be much better to
have
> get-words in parse rules use the type of the data being parsed.
>
>
> BTW, I agree with Andrew that this behavior of SPLIT-PATH is
better
> than Ladislav's fix (unless READ is also fixed to read the
current
> directory for %""):
>
> >> split-path %file.ext
> == [%./ "file.ext"]
> >> read first split-path %file.ext
> == [%USER.R %TALK.R %rebol.r %REBOL.exe ...
>
> >> sp %file.ext; Ladislav's version
> == [% %file.ext]
> >> read first sp %file.ext
> ** Access Error: Cannot open /C/prog/rebol/.
> ** Where: read first sp %file.ext
>
> See you,
> Eric
>
>
>



[REBOL] none Re:(2)

2000-01-14 Thread kowalskM

I wasn't getting anything from the mailing list for about day
and 1/2. Didn't know if it was my mailer or everyone was taking
a breather.--myron

On Thu, 13 Jan 2000 [EMAIL PROTECTED] wrote:

> [EMAIL PROTECTED] wrote:
> > help
> 
> With what?
> 
> Andrew Martin
> Ever helpful...
> ICQ: 26227169
> [EMAIL PROTECTED]
> http://members.xoom.com/AndrewMartin/
> -><-
> 
> 
> 



[REBOL] none Re:

2000-01-13 Thread Al . Bri

[EMAIL PROTECTED] wrote:
> help

With what?

Andrew Martin
Ever helpful...
ICQ: 26227169
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
-><-




[REBOL] NONE Re:

1999-12-29 Thread Andrew . M . Grossman

--- You wrote:
 The
 manual suggests that a block be used for a simple database. i.e. url 
addr book. However, how would I access an SQL database? i.e. Access.
--- end of quote ---
Right now there is no way to do this, although ODBC is promised for the forthcoming 
rebol/command.
I've used rebol, though, to generate thousands of line of sql code, which it does 
pretty well.  

--
Andrew Grossman
http://web.dartmouth.edu/~grossman/pgp.html



[REBOL] NONE Re:

1999-12-29 Thread Petr . Krenzelok



[EMAIL PROTECTED] wrote:

> It is amazin' what one learns when one RTFM!!  Now I have a few more
> questions perhaps not altogether the most intelligent.  1.  Am I correct
>  in thinking that if I wanted to create a form or template I would use
> either html or .txt document format with embedded rebol script?

Whatever you like, Petra. As html and txt are both plain text, you can
decide about the aproach. Or you can store your template in XML format. With
REBOL, you can parse it

>2.  The manual suggests that a block be used for a simple database. i.e.
url

> addr book. However, how would I access an SQL database? i.e. Access.

That's the problem right now. As for the Access, I think upcoming
REBOL/Command should fulfill your requirements. It should support ODBC, and
AFAIK, ODBC driver for Access is available.  There are also some versions
with various database systems direct support planned. We will see ...

-pekr-



[REBOL] none Re:

1999-12-07 Thread Al . Bri

Feng lei wrote:
> I am a beginner of rebol, who know how debug the rebol script?

We are all students of REBOL on this list. Present your script on this
list and discover enlightment.

Andrew Martin
Practising REBOL Zen...
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
Online @ 33,600 Baud!
-><-



[REBOL] none Re:(3)

1999-11-12 Thread DGreene

Cheers for that


Donal

> -Original Message-
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, November 12, 1999 1:24 PM
> To:   [EMAIL PROTECTED]
> Subject:      [REBOL] none Re:(2)
> 
> Donal,
> 
> Sorry, I had a cut/paste error in part of what I said in my earlier
> reply...
> near the bottom I show extraneous contents of 'page from an earlier read
> of
> another URL.  Some of what I said near the end is therefore erroneous, but
> I
> think you get the jist of using 'exists? ok ?  hope so... sorry.
> 
> Russ
> 
> -- erroneously cut/pasted part and remarks pertaining to it ---
> >>> print page
> >Date: Fri, 12 Nov 1999 12:59:05 GMT
> >Server: Apache/1.2.4
> >Location: http://www.PortONE.com/portone/error.html
> >Connection: close
> >Content-Type: text/html
> >
> >Again, a test on "either page" doesn't do what you desire; but 'exists?
> does.
> >
> >>> either page [print "true"] [print "false"]
> >true
> --



[REBOL] none Re:(2)

1999-11-12 Thread Russ

Donal,

Sorry, I had a cut/paste error in part of what I said in my earlier reply...
near the bottom I show extraneous contents of 'page from an earlier read of
another URL.  Some of what I said near the end is therefore erroneous, but I
think you get the jist of using 'exists? ok ?  hope so... sorry.

Russ

-- erroneously cut/pasted part and remarks pertaining to it ---
>>> print page
>Date: Fri, 12 Nov 1999 12:59:05 GMT
>Server: Apache/1.2.4
>Location: http://www.PortONE.com/portone/error.html
>Connection: close
>Content-Type: text/html
>
>Again, a test on "either page" doesn't do what you desire; but 'exists? does.
>
>>> either page [print "true"] [print "false"]
>true
--



[REBOL] none Re:

1999-11-12 Thread Russ

Hi Donal,

This has come up before, even in my own early use of REBOL.  Check the use
of 'either and a simple test case, and you can see better what's happening
in your script:

>> ? either
If condition is TRUE, evaluates the first block, else evaluates the second.
Arguments:
condition --
true-block --  (block)
false-block --  (block)

ok, so what is the condition?  In your case, you're doing 'either on a
string returned as a result of reading the URL.  ANYTHING that is returned
by that URL (even a "page does not exist" message from the server when it
detects attempt to read non-existent page) will get put in that string 'page.

Let's see how 'either behaves with two types of strings:

>> a: none
== none
>> either a [print "true"] [print "false"]
false
>> a: "test"
== "test"
>> either a [print "true"] [print "false"]
true

So, unless the string read ('page in your case) is 'none, then 'either will
see a TRUE condition.

The same will happen if you try to use 'exists? on a non-existent page with
a web server that intercepts such failed attempts.  However, if  the server
truly returns a "404 error" then things work as exected:

>> exists? http://www.theskillstore.com/nonexistentpage.txt
== false

This is probably what you'd like to use (with an either ahead of it).

To see what actually got return, look at this:

>> page: read http://www.theskillstore.com/nonexistentpage.txt
** User Error: Error.  Target url:
http://www.theskillstore.com/nonexistentpage.t
xt could not be retrieved.  Server response: HTTP/1.1 404 Object Not Found.
** Where: page: read http://www.theskillstore.com/nonexistentpage.txt

>> print page
Date: Fri, 12 Nov 1999 12:59:05 GMT
Server: Apache/1.2.4
Location: http://www.PortONE.com/portone/error.html
Connection: close
Content-Type: text/html

Again, a test on "either page" doesn't do what you desire; but 'exists? does.

>> either page [print "true"] [print "false"]
true

>> either exists? http://www.theskillstore.com/nonexistentpage.txt [print
"true"] [print "false"]
false

Hope this helps.

To answer the second question, add this to the beginning of your script:

secure none


Russ

-
At 12:26 PM 11/12/99 +, you wrote:
>Hi all,
>
>maybe a silly question, but I've written a small
>script to try and detect if my webpage is up and
>running every hour.
>
>page: read http://www.theskillstore.com
>either page[send [EMAIL PROTECTED] "http://www.theskillstore.com is up"]
>[send [EMAIL PROTECTED] "http://www.theskillstore.com is down"]
>
>I'm running it on NT and if it fails to read the page
>the script exits with
>
>** Access Error: Cannot connect to http://www.theskillstore.com
>
>is there a way around this ???
>
>also is there a way to set secure to none, and not get the 
>dialogue box asking to lower permissions ??
>
>Anyway good luck with REBOL it's a great tool.
>
>Donal
>
>"it's all fun and games until someone uses an ie browser"
>
>Donal Greene,
>Webmaster,
>Educational Multimedia Corporation (Ireland)
>EMG House
>Deansgrange
>Co. Dublin
>Tel:  +353 1 289 9000 extension 302
>Fax: +353 1 289 9150
>
>
>
>



[REBOL] [REBOL] none Re:

1999-11-12 Thread Micael . Gullmes

Hi Donal,

you can do it by using error? and try

either error? try [
read http://www.theskillstore.com
][
send [EMAIL PROTECTED] "http://www.theskillstore.com is down"
][
send [EMAIL PROTECTED] "http://www.theskillstore.com is up"
]

Brgds /Micael
-Ursprungligt meddelande-
Fran: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Skickat: den 12 november 1999 13:27
Till: [EMAIL PROTECTED]
Amne: [REBOL] none


Hi all,

maybe a silly question, but I've written a small
script to try and detect if my webpage is up and
running every hour.

page: read http://www.theskillstore.com
either page[send [EMAIL PROTECTED] "http://www.theskillstore.com is up"]
[send [EMAIL PROTECTED] "http://www.theskillstore.com is down"]

I'm running it on NT and if it fails to read the page
the script exits with

** Access Error: Cannot connect to http://www.theskillstore.com

is there a way around this ???

also is there a way to set secure to none, and not get the 
dialogue box asking to lower permissions ??

Anyway good luck with REBOL it's a great tool.

Donal

"it's all fun and games until someone uses an ie browser"

Donal Greene,
Webmaster,
Educational Multimedia Corporation (Ireland)
EMG House
Deansgrange
Co. Dublin
Tel:  +353 1 289 9000 extension 302
Fax: +353 1 289 9150



[REBOL] none Re:

1999-11-12 Thread petr . krenzelok



[EMAIL PROTECTED] wrote:

> Hi all,
>
> maybe a silly question, but I've written a small
> script to try and detect if my webpage is up and
> running every hour.
>
> page: read http://www.theskillstore.com
> either page[send [EMAIL PROTECTED] "http://www.theskillstore.com is up"]
> [send [EMAIL PROTECTED] "http://www.theskillstore.com is down"]
>
> I'm running it on NT and if it fails to read the page
> the script exits with
>
> ** Access Error: Cannot connect to http://www.theskillstore.com
>
> is there a way around this ???
>

either not error? try [page: read http://www.theskillstore.com] [
  send [EMAIL PROTECTED]
"http://www.theskillstore.com is up"
 ][
  send [EMAIL PROTECTED]
"http://www.theskillstore.com is down"
 ]

>
> also is there a way to set secure to none, and not get the
> dialogue box asking to lower permissions ??

1) secure none
2) run rebol with -s option
3) type "usage" in console
4) read notes.html coming with Rebol distribution 


> Anyway good luck with REBOL it's a great tool.
>

We know ;-)

Cheers,

-pekr-

> Donal
>
> "it's all fun and games until someone uses an ie browser"
>
> Donal Greene,
> Webmaster,
> Educational Multimedia Corporation (Ireland)
> EMG House
> Deansgrange
> Co. Dublin
> Tel:  +353 1 289 9000 extension 302
> Fax: +353 1 289 9150



[REBOL] none Re:

1999-09-27 Thread Al . Bri

Send it to [EMAIL PROTECTED] so they know about it.
Andrew Martin
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
Online @ 33,600 Baud!
-><-


--
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [REBOL] none
> Date: Tuesday, 28 September 1999 11:07 AM
> 
> I believe that I have found a typo on the data base how to:
> 
> 
> 
> in the section titled "Saving, Loading, and Sending Data" It is
stated:
> 
> >foreach [city state zip] [
> >print [city state zip]
> >]
> 
> should not the first line read:
> 
>   foreach [city state zip] my-cities [
>^
>