[REBOL] two-digit return of now switches Re:(3)
Hi RChristiansen, you wrote: This doesn't work... month: to-string now/month if (length? month 2) [insert month "0"] ** Script Error: Expected one of: string! - not: integer!. ** Where: if (length? month 2) [insert month "0"] Try: if (length? month) 2 [insert month "0"] == "5" How come? Since you ask: 1. is polymorph: String comparison: "1" "2" == true When the left argument to is of type string, expects the right argument to be of type string as well. 2. Precedence: The is evaluated first, then the length? operator. Example: "123" "1234" == true length? "123" "1234" ** Script Error: length? expected series argument of type: series port tuple. ** Where: length? "123" "1234" What's the complaint? First "123" "1234" is evaluated and returns true. Then length? is applied to true. We are applying length? here to a boolean value. Accordingly, this does not work: length? "123" 10 ** Script Error: Expected one of: string! - not: integer!. ** Where: length? "123" 10 Precedence, is applied before length? Polymorphism, detects that its left argument is a string, and therefore expects the right argument to be a string as well. But this does work, because we force length? to be applied first and detects an integer left and expects an integer as its right argument: (length? "123") 10 == true ;- Elan [: - )]
[REBOL] two-digit return of now switches Re:(4)
If you hate parentheses, you can use the prefix property of length? "123" 10 == true but it must be the first op on a line, or otherwise be preceded by a ( {and a corresponding closing ) must follow somewhere} Russell [EMAIL PROTECTED] - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 08, 2000 10:06 PM Subject: [REBOL] two-digit return of now switches Re:(3) Hi RChristiansen, you wrote: This doesn't work... month: to-string now/month if (length? month 2) [insert month "0"] ** Script Error: Expected one of: string! - not: integer!. ** Where: if (length? month 2) [insert month "0"] Try: if (length? month) 2 [insert month "0"] == "5" How come? Since you ask: 1. is polymorph: String comparison: "1" "2" == true When the left argument to is of type string, expects the right argument to be of type string as well. 2. Precedence: The is evaluated first, then the length? operator. Example: "123" "1234" == true length? "123" "1234" ** Script Error: length? expected series argument of type: series port tuple. ** Where: length? "123" "1234" What's the complaint? First "123" "1234" is evaluated and returns true. Then length? is applied to true. We are applying length? here to a boolean value. Accordingly, this does not work: length? "123" 10 ** Script Error: Expected one of: string! - not: integer!. ** Where: length? "123" 10 Precedence, is applied before length? Polymorphism, detects that its left argument is a string, and therefore expects the right argument to be a string as well. But this does work, because we force length? to be applied first and detects an integer left and expects an integer as its right argument: (length? "123") 10 == true ;- Elan [: - )]
[REBOL] Endless looping processes. Re:(4)
Le lun, 08 mai 2000, vous avez écrit : Fredrik Bergstrom wrote: I will, when I get the chance, I cannot do this right now because, we may need to reboot the server to get rid of the Rebol process, will do this later. Is it possible to kill a rebol process? PKtc That's not question related to rebol, right? If you can't kill NT process, PKtc then how to stop infinite loop? Start Task Manager. Go to the Processes page. Sort by name. End every rebol.exe process. No reboot necessary. Brian Hawley Openning the Rebol console, and hit the escape key will normaly stop the process ...
[REBOL] rebol books Re:
Le sam, 06 mai 2000, vous avez écrit : hi all i am new to the language and i am searching for rebol reference books...(to complement the online reference material) i noticed one at amazon and fatbrain that said it was being published in jan 2000 but fatbrain says not published yet.. does any know what is happening or an impending date? many thanks jason Jason Savidge IT Manager One Stop Entertainment Brisbane Australia www.onestopent.com.au I went on the Rebol site, and printed the whole Rebol manual (about 300 pages). I read it, and it's a very good manual ...
[REBOL] Shouldn't 'to-hex return binary instead of issue?
Hi, While working with hexadecimal values I found two aproaches - first one - using issues, and second one - using binary values: - to-integer #{FF} == 255 - to-integer #FF == 255 - to-integer #00FF == 255 - to-integer #{00FF} == 255 - help enbase USAGE: ENBASE value /base base-value DESCRIPTION: Converts a string to a different base representation. ENBASE is a native value. ARGUMENTS: value -- The string to encode (Type: any-string) REFINEMENTS: /base -- Allow a selection of a different base for conversion base-value -- The base to convert to: 64, 16, or 2 (Type: any) - enbase/base #FF 2 == "0100011001000110" What's that? Bug or what? I would assume obtaining "", as in following example: - enbase/base #{FF}2 == "" - x: (to-integer #{A1}) + (to-integer #{10}) == 177 - to-hex x == #00B1 - enbase/base to-hex x 2 == {001100110011001100110011011000110001} - enbase/base #{00B1} 2 == "10110001" Which in turn really represents 177: to-integer debase/base "10110001" 2 == 177 Even 'debase returned binary datatype, so why to-hex returns an issue? Thanks, -pekr-
[REBOL] Endless looping processes. Re:(4)
Hello brian, Monday, May 08, 2000, 9:41:35 PM, you wrote: PKtc That's not question related to rebol, right? If you can't kill NT process, PKtc then how to stop infinite loop? bhbc Start Task Manager. Go to the Processes page. Sort by name. bhbc End every rebol.exe process. No reboot necessary. Yes, but there where some problem with the rights for that process, but we are going to test some more later on. Regards, Fredrik Bergstrom -- PowerWebs AB Wåxnäsgatan 10 S-653 40 Karlstad Sweden Tel: +46-(0)54-103377 Fax: +46-(0)54-103376 ICQ# 7654213
[REBOL] RE: Re: load/next - bug?!
Hello Gabriele Hello [EMAIL PROTECTED]! On 06-Mag-00, you wrote: a the "REBOL-header" is skipt even if it is somewhere in the a code, even in nested blocks?! a when at start of line! a this means i have to check for occasional REBOL everywhere in a my save - databases?! a Bug, yes? No, I think this is intended behaviour. (rip works thanks to this, too.) If the string contains a REBOL header, it is assumed to be a script... but perhaps this should happen for files only, and not for strings? Well, rebol talks about simple databases and "better xml". how can i use it if a occasianal "rebol" can crash the data? . REBOL can be part of the data on save and after that load will crash, in an otherwise correct programm. maybe a new refinement LOAD/DATA which ignores headers? Or an explicit option at start for skipping before REBOL, perl does it this way. i think this header-trap is as random as dangling pointers, if one does not know about it. This stuff should be avoided in a beginners language. Or there should be a warning: "currently not for saving serious data!" for me i was expecting i can load/next parts of rebol-source. i loaded the header-block by hand to get only defined fields, after moving behind the first rebol i used load/next . works very well, except with the parser itself. load moaned, and i could not figure out why. only occasinally i discovered the header-way of load/next, and the parser contains a REBOL somewhere.. BTW i also dislike the [a: ""] trapp. i programm the usual way, "write, test run, change, test .." without restarting rebol. and if the test works fine, i'm shot in the back if a second complete run gives "random" errors. sourcecode should try to show what will happen, without this "oh yes, learn the magic rule #44b23, says [a: copy""]! stupid boy!" especially in rebol, which seems so clear i ride with lowered shield.. I suggest inline-strings and blocks should be read-only, copy [] can be written. this should fix surprises. and COPY/PROTECTED could be a feature? I heard this [a: ""] was discussed some time ago, is there a collection of arguments somewhere? Then there must be a timeout if rebol runs serious remote (cgi..). And a warning about contexts/bind while this crashes so reliable. What else? Is there a public-readable bug-list somewhere? Because, avoiding some stuff, rebol is very stable, and the real trapps could be mentioned on a single page? There should be one. I would not trust guys shooting me in the back once a long time, (except i like them so mutch :) A longer time than not to try because i read helpfull warnings about it, maybe.. Regards, Gabriele. -- Gabriele Santilli [EMAIL PROTECTED] - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/ Volker
[REBOL] Re: two-digit return of now switches Re:
[EMAIL PROTECTED] wrote: I think you may wish to check this further. current-time: now/time file-name: rejoin [ now/year now/month now/day current-time/hour current-time/minute current-time/second ] complete-file-name: rejoin [{%} file-name {.html}] When I was looking at something similar, I hit a problem because the integer returned is of course not 0-padded on the left. So, is it (2000116) November 6th or is it January 16th?? Statistically it may be unlikely to cause a problem, but if it could happen even once and that would mess you up bad, then you better pre-pad the month and day with 0 when necessary. Try this: twodig: func [digit digstr/local][ digstr: to-string digit either (length? digstr) = 1 [return join "0" digstr] [return digstr] ] n: now complete-file-name: rejoin [ n/year twodig n/month twodig n/day twodig n/time/hour twodig n/time/minute twodig n/time/second ] I'd recommend using only one "now" statement, since theoretically it's possible that we call the first "now" at say 23:59:59.99 at 31 of December 2000. Then maybe the first statement takes some fraction of a second, so the second "now" gets the date-time of 00:00:00 at 1 Jannuary 2001. Then it rejoins this to.. 210100 when it should have been 20001231235959 or 2001010100 - one year wrong. Oops. -- /Johan Rönnblom, Team Amiga In a recent survey, it was found that only 16% of people are normal.
[REBOL] two-digit return of now switches Re:(3)
Note precedence in rebol works funny :) if 2 length? month [insert month "0"] you need a single argument on the left, ut on the right can be a whole call. 2 1 + 3 ;works not, 2 add 1 3 ;works 2 + 1 3 ; works too Volker This doesn't work... month: to-string now/month if (length? month 2) [insert month "0"] ** Script Error: Expected one of: string! - not: integer!. ** Where: if (length? month 2) [insert month "0"] How come? if (length? tmp: to-string now/day) 2 [insert tmp "0"]
[REBOL] web proxy Re:
rebol.org/web/proxy.r Title: "REBOL HTTP Proxy" Author: "Sterling Newton" View: %proxy.html Download: %proxy.r Purpose: { This script serves many purposes. 1. Act as an HTTP proxy 2. See what your broswer sends out as an HTTP request 3. Add data filters to remove Javascript pop-up windows, remove banner ads, and more... } Volker Basically, I wanted to know if it was possible, and how, to write an http proxy server, using Rebol of course. I want to be able to have the proxy filter page content, e.g. translate to uppercase, to another font, to another language, or other kinds of transformations on the text, and have it be more or less invisible and automatic to the person browsing. I know that I could write an app that would put up a form and you would fill out the url and submit it and the rebol app could fetch the page, filter it, and return it, but it gets tedious, and it really fails on urls with frames, and other stuff. I dont know if the http proxy server idea would be too complex to make it worth it or if rebol has stuff built in already that makes it very easy, or ... And if somebody knows where to get docs on http proxy info, that would be kind and helpful. Galt Barber
[REBOL] two-digit return of now switches Re:(4)
[EMAIL PROTECTED] wrote: Note precedence in rebol works funny :) if 2 length? month [insert month "0"] you need a single argument on the left, ut on the right can be a whole call. 2 1 + 3 ;works not, 2 add 1 3 ;works 2 + 1 3 ; works too I see no problem in using expressions enclosed in parenthesis :-) -pekr- Volker This doesn't work... month: to-string now/month if (length? month 2) [insert month "0"] ** Script Error: Expected one of: string! - not: integer!. ** Where: if (length? month 2) [insert month "0"] How come? if (length? tmp: to-string now/day) 2 [insert tmp "0"]
[REBOL] two-digit return of now switches Re:(3)
Ah, yes, thanks for the recommendation. I am also including a wait statement in my foreach statement since I may be naming more than one file in a session. No sense naming two files within the same span of a second thus using the same name. 8-) I'd recommend using only one "now" statement, since theoretically it's possible that we call the first "now" at say 23:59:59.99 at 31 of December 2000. Then maybe the first statement takes some fraction of a second, so the second "now" gets the date-time of 00:00:00 at 1 Jannuary 2001. Then it rejoins this to.. 210100 when it should have been 20001231235959 or 2001010100 - one year wrong. Oops.
[REBOL] Endless looping processes. Re:(5)
I had a similar problem with IIS 4.0 and 5.0, where I could not kill a rebol cgi process that was having problems. I would open task manager, try to end the process, and get an "access denied" error. I found that if I stopped the web server, through the management console, or through the Services applet in Control Panel, I could then go back and end the rebol process successfully in task manager. I didn't have to reboot the server. From: [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [REBOL] Endless looping processes. Re:(4) Date: Tue, 9 May 2000 12:28:18 +0200 Hello brian, Monday, May 08, 2000, 9:41:35 PM, you wrote: PKtc That's not question related to rebol, right? If you can't kill NT process, PKtc then how to stop infinite loop? bhbc Start Task Manager. Go to the Processes page. Sort by name. bhbc End every rebol.exe process. No reboot necessary. Yes, but there where some problem with the rights for that process, but we are going to test some more later on. Regards, Fredrik Bergstrom -- PowerWebs AB Wåxnäsgatan 10 S-653 40 Karlstad Sweden Tel: +46-(0)54-103377 Fax: +46-(0)54-103376 ICQ# 7654213 Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
[REBOL] load/next - bug?! (repost) Re:(2)
References: [EMAIL PROTECTED] Howdy Gabriele, agem: Load/next will only skip past a REBOL header when it sees something like this: { something something ^/REBOL []} If you have a block like this: [something something rebol []] and you SAVE it, you won't wind up with "REBOL []" preceded by a newline, so it will LOAD/next back in as you like, an element at a time. Also, you can always TRIM/lines other strings that you want to LOAD/next if you suspect there may be REBOL headers within the string. -jeff Hello [EMAIL PROTECTED]! On 06-Mag-00, you wrote: a the "REBOL-header" is skipt even if it is somewhere in a the code, even in nested blocks?! when at start of a line! this means i have to check for occasional REBOL a everywhere in my save - databases?! Bug, yes? No, I think this is intended behaviour. (rip works thanks to this, too.) If the string contains a REBOL header, it is assumed to be a script... but perhaps this should happen for files only, and not for strings? Regards, Gabriele. -- Gabriele Santilli [EMAIL PROTECTED] - Amigan - REBOL programmer AmigaGroupItalia sez. L'Aquila -- http://www.amyresource.it/AGI/
[REBOL] Question on Wait
Hello, The following is taken from the Rebol Dictionary, describing WAIT. If the value is a TIME, delay for that period. If the value is a DATE/TIME, wait until that DATE/TIME. If the value is an INTEGER or DECIMAL, wait that number of seconds. Testing with TIME and INTEGER works fine. forever [print now/time wait 60 print now/time break ] 10:18:33 10:19:33 forever [print now/time wait 00:01:30 print now/time break ] 10:20:12 10:21:43 However when i try to specify a DATE/TIME, i get the following forever [print now/time wait 9-May-2000/10:30:00 print now/time break ] 10:24:08 ** Script Error: wait expected value argument of type: number time port block. The error seems to suggest that WAIT only expects a TIME and not a DATE? Am i missing something? Thanks. Mike.
[REBOL] Question on Wait Re:
Help wait agrees with your observation. It reports help wait ARGUMENTS: value -- (Type: number time port block) No mention of date. At 10:46 AM 5/9/00 -0800, you wrote: Hello, The following is taken from the Rebol Dictionary, describing WAIT. If the value is a TIME, delay for that period. If the value is a DATE/TIME, wait until that DATE/TIME. If the value is an INTEGER or DECIMAL, wait that number of seconds. Testing with TIME and INTEGER works fine. forever [print now/time wait 60 print now/time break ] 10:18:33 10:19:33 forever [print now/time wait 00:01:30 print now/time break ] 10:20:12 10:21:43 However when i try to specify a DATE/TIME, i get the following forever [print now/time wait 9-May-2000/10:30:00 print now/time break ] 10:24:08 ** Script Error: wait expected value argument of type: number time port block. The error seems to suggest that WAIT only expects a TIME and not a DATE? Am i missing something? Thanks. Mike. ;- Elan [: - )]
[REBOL] Question on Wait Re:(2)
Thanks Elan. ::Help wait agrees with your observation. It reports :: help wait ::ARGUMENTS: :: value -- (Type: number time port block) ::No mention of date. Your response begs the questions: Is the Rebol Dictionary incorrect ? How do you fire off an event at a certain time of the day (say at 10:30, do something?) If you specify a time, it will wait for that time, not till that time? Mike.
[REBOL] Question on Wait Re:(3)
How do you fire off an event at a certain time of the day? What I am doing is computing the difference between launch time and 'now, and waiting for that period of time. - Michael Jelinek -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 09, 2000 12:41 PM To: [EMAIL PROTECTED] Subject: [REBOL] Question on Wait Re:(2) Thanks Elan. ::Help wait agrees with your observation. It reports :: help wait ::ARGUMENTS: :: value -- (Type: number time port block) ::No mention of date. Your response begs the questions: Is the Rebol Dictionary incorrect ? How do you fire off an event at a certain time of the day (say at 10:30, do something?) If you specify a time, it will wait for that time, not till that time? Mike.
[REBOL] Question on Wait Re:(3)
There's a bug in the documentation or the implementation of 'wait. I believe it was reported some time ago, but I can't yet recall when. Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ -- - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, 10 May 2000 7:40 AM Subject: [REBOL] Question on Wait Re:(2) Thanks Elan. ::Help wait agrees with your observation. It reports :: help wait ::ARGUMENTS: :: value -- (Type: number time port block) ::No mention of date. Your response begs the questions: Is the Rebol Dictionary incorrect ? How do you fire off an event at a certain time of the day (say at 10:30, do something?) If you specify a time, it will wait for that time, not till that time? Mike.
[REBOL] listen ports
How do I know if I have a message to read in my listen port or not? port: open tcp://:8000 either ???-what goes here?-??? [ io-port: first port print copy io-port close io-port ][ print "Nothing to see here..." ] close port Thanks for any help, Max