[REBOL] Re: imanXwin kludge
iamanXwin kluge: This came about because for some reason, under X windows, the font layout engine in REBOL View needed to go through once or else the text came out confined to a narrow strip running top to bottom. We haven't tracked down the cause yet, but it turns out that by doing a throwaway layout ( ie.: layout [text iamanXwin kludge] ) the problem was solved. Apparently evidence of this little throwaway kludge has been discovered. :-) -jeff -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with unsubscribe in the subject, without the quotes.
[REBOL] REBOL and the unix shell
Say folks: I put up an article I wrote this weekend on using REBOL with the unix shell. It's a part of some other domain specific REBOL materials I've been assembling. Have a look and please feel free to send me any feedback you have. http://www.cs.unm.edu/~whip/rebol-unix-shell.html -jeff If your mailer is configured to be able to DO emails, then hopefully this will take you there: REBOL [] browse http://www.cs.unm.edu/~whip/rebol-unix-shell.html
[REBOL] Dangerous (use of) Secure Re:(5)
Wow, that mail must have gotten delayed along the way. That arrived a day late. Once, I actually received an email from a friend that was over a month late! Strange but true.. -jeff Howdy, Ladislav: There is an equally simple effective defense to such an attack:
[REBOL] Dangerous (use of) Secure Re:(8)
Hi, it's much worse. If Untrusted doesn't have Do, it can use If, Else, Use, While,...lots of other possibilities. Instead of load Untrusted can use: ld: get to word! "load" Moreover, Replace is not enough to clear Untrusted. The moved System is a higher obstacle. foreach nope ["load" "bind" "do"][ replace/all script nope "none" ] Well, after the replace/all the untrusted script would be doing this: ld: get to word! "none" But granted, you could always do: ld: get to word! trim/all "l o a d" So, moving away the system object is probably the thing to do if you're worried about tracking the impact of executing an untrusted script :-) Of course, there's also load/next and do/next which will let you incrementally determine when a script is going to modify the environment, which can be combined with query of the system/words. There is a good deal of fine grained control options for dealing with a random script. Modules are definitely the eventual real answer here though.. -jeff
[REBOL] Dangerous (use of) Secure Re:(4)
Howdy, Ladislav: There is an equally simple effective defense to such an attack: ;- dump-it disposes the untrusted script check-object: :query unset 'query if error? try [do %untrusted.r][dumpit] if not ok-changes? check-object/clear system/words [dump-it] As long as the untrusted script doesn't know where query has been moved it'll have a much harder time clearing the modified status of the system words. There are some other more sneaky methods for hiding QUERY from an untrusted script.. Beyond that, untrusted scripts can be analyzed initially using LOAD/next to look for mischief. -jeff For additional security, point another word at QUERY first, ie: check-object: :query There is a simple effective attack against this: 1) somewhere in %untrusted.r use the statement: query/clear system/words Regards Ladislav
[REBOL] rebol for dummies Re:(2)
Well, it looks like REBOL is finally going to hit the big time. There is going to be a "Dummies" book out in September. 8-) There is? Well, since the cat is out of the house so to speak, yes there is going to be one.g I just finished it literally today and emailed the final parts to my editor. --Ralph Roberts Hats off to Ralph! Congratulations! -jeff
[REBOL] Dangerous (use of) Secure Re:(4)
Howdy, Ladislav: Woops, an even simpler defense: if error? try [ do func [/query/system/rebol] compose/deep [ do [(load %untrusted.r)] ] ][dump-it] if not ok-mods? query/clear system/words [dump-it] There is a simple effective attack against this: 1) somewhere in %untrusted.r use the statement: query/clear system/words Regards Ladislav
[REBOL] Dangerous (use of) Secure Re:(2)
Howdy, Gabriele: ... it's better to quit REBOL just after running an untrusted script, because you can't know if it has changed every word in the global context to do evil things. Using the new ability to QUERY objects, you can do the following: protect 'query query/clear system/words do %some-script.r new-or-modified-words: query/clear system/words Then you can tell if something's messed with any of the system words. For additional security, point another word at QUERY first, ie: check-object: :query Note: New words may show up in the return that are not necessarily new global words, but were defined in another context. To determine which are new globals you can iterate over the contents of the returned block and test them with VALUE? If you find the word SECURE in the block you can assume the script's up to no good. -jeff
[REBOL] set in object 'variable string Re:(8)
Gee whiz my message sounded negative, wasn't meant to, was meant to be constructive. Sorry. Brett. REBOL's the funnest language on the planet as are the REBOL programmers and this is one of the funnest lists I've ever been a part of.. :-) (there's that silly smilee again (-: and again... ) -jeff - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 08, 2000 10:14 AM Subject: [REBOL] set in object 'variable "string" Re:(6) Where did you derive that definition from? ...
[REBOL] parsing by period and newline Re:(3)
Howdy, Allen: You can always filter away empty strings from your body block: obj/body: difference [""] obj/body BIG BIG Caution with this method. If any strings have duplicates you will lose them too! d: difference/only ["^/" "P" "Tea for two, please." "P" "But you're alone now" "" "Tea for two, please." ][""] == ["^/" "P" "Tea for two." "But you're alone now"] ... See the second "P" is lost!! and looks likes it just tea for one now... Cheers, Allen K (*Slaps*) Jeff for the time lost when using his tip ;-) OK Jeff I know the chances of duplicates across paragraphs is slim, but there is still a chance and it is a hard thing to find when your code goes wrong.. Ahhh ... touche' mon frare' or however it is said-- my pardons to the French in the audience, and my pardons to Ryan and Allan and anyone else I led astray. That's good-- keep me honest :-) but hey-- no one caught my error a while back when I told Petr that there were commercial SSH modules for apache... uh that would be SSL modules.. how are you going to SSH into apache, jeff?? Haha. Oh whatever.. I'm babbling now. (-: That doesn't address your question about parse, but I'm running out of time.. :) -jeff Serves me right for mailing off a tip when I'm running out of time. "Complexity is immediate, simplicity takes time" (quoted from a sign that Dan has on his wall at REBOL. One of the earliest and best articulations of the REBOL philosophy that struck me when I first got there..) -jeff
[REBOL] FTP Problem Re:
Howdy, fellow allumn: Sometimes FTP has problems if it's not in passive mode. Set it my doing the following: system/schemes/ftp/passive: on Then try your upload. If that doesn't clear it up, do the following: trace/net on echo %ftp.log write ftp://user:[EMAIL PROTECTED]/test.txt "test" echo off trace/net off That will produce a bunch of raw transaction output helpful for debugging. After it's done, mail the resulting ftp.log to [EMAIL PROTECTED] with a subject indicating a problem with the messiest protocol known to the web: FTP. Good luck! -jeff Hello, folks. I'm having a major FTP problem. write ftp://user:[EMAIL PROTECTED]/test.txt "test" works fine, but write ftp://user:[EMAIL PROTECTED]/test.txt "test" bails with this message: ** Script Error: pick expected series argument of type: series pair event money date time object port tuple any-function. ** Where: pick server-said 4 Anyone know what the problem could be? It's something with the azorius.com server, but is there anything in particular that I could talk to the server manager about? Thanks, Justin Smith
[REBOL] hash! Re:
Howdy Brett: Hash's are good for scripts which have a bunch of block data in memory that they want to do many searches on. For instance, if you had something like this: associations: [ jeffrey giraffe snoopy dog garfield cat ... and on and on ] with say more than a few hundred of such pairs and you was doing a bunch of things like: select associations 'garfield then you'd want to HASH your block, and your script would then be a lot faster. h-assoc: make hash! associations You'd still do select on the new hash: select h-assoc 'snoopy ..the selection with a block ends up being a linear search for 'snoopy, but with the hash it's a constant time search. Creating the hash takes some amount of time for large block data, so it's only worth it if the hash will be sticking around in memory for some time (ie. not as useful for things like CGI.) Of course, you can insert and remove items into a hash! in the same way you work with blocks. -jeff From the user guide: "Hash is a storage method that makes finding data in large files faster. The hash datatype is useful for converting data into a binary table format that is readily searchable. " Cool. and: "Hash values are identical in operation to block values. See blocks values for detail on the format of block values. " Excellent. Umm.., but the examplesthere seem counter-intuitive to me (probably because I have waytoo much experience in relation databases). So can someone show me how and when hash! is most optimally used please? Brett
[REBOL] Self is mysterious Re:(4)
Howdy, Ladislav: If I understood correctly, the work of make "could" (with a big simplification, of course) be described in Rebol like this: make-object-sim: func [ initializer [block!] /local words ] [ words: copy [self] foreach item :initializer [ if set-word? :item [ append :words to word! :item ] ] words: union :words [] use words [ bind words 'self self: compose/deep [[(:words)]] do bind/copy initializer 'self :self ] ] Hey, that's neato. I always think describing REBOL in REBOL has a high coolness factor. For this rendering, also there are the parent object's words (or more appropriately called the template object's) that have to be included in the word block. Additionally, values from the template object have to be carried over into the new object. And, my question is as follows: wouldn't it be better (for the sake of preventing some strange effects and to simplify things) to change that to: make-object-sim: func [ [ . . . snip ] result: self: compose/deep [[(:words)]] do bind/copy initializer 'self :result ] ] ,which is more in a direction of representing any context (with any Self value) That could be argued. (-: The cases where the "strange effects" show up are pretty oddball cases though. SELF is supposed to refer to the self same object. If you decide to make self be something else besides an object while making an object, then the result probably shouldn't be an object. It's a little messy there and probably needs to stay simple. Interesting stuff, though.. :-) -jeff
[REBOL] hidden variables in objects? Re:(13)
Howdy, Larry: Everything is peachy about all this, but object words shouldn't ever be END. They should be UNSET in these conditions-- A minor little bug. ;) So what is END? Larry A non-datatype, like unset! but it shouldn't normally be encountered while using REBOL. If you do encounter one, report it to the authorities ([EMAIL PROTECTED], that is (-:). Not that it's at all dangerous, it's just one of those odd things floating at the fringe of the REBOL universe. -jeff
[REBOL] hidden variables in objects? Re:(13)
[EMAIL PROTECTED] wrote: The trick here is what does SELF evaluate to when you set 'x to it? SELF at that time is an object, containing the words C and D, but those words haven't yet been assigned anything at the time you assign the word X to SELF. I would assume they're unset in that stage (even if perhaps setting them to NONE could make more sense for an object, like it is for function contexts). Which makes me consider what are the real distinctions between NONE and UNSET? I tend to think that NONE, in REBOL, is closer to a logical state, where as UNSET is more of an existential state. For a function, local variables defaulting to NONE eases a common question function writers will ask in their code: if local-variable [do-something-with local-variable] I tend to think that words in the global context or in an object context are more in an existential state. Once they are mentioned in a given context the word exists but with no value. They either are filled in by the person mentioning that word in that context or not. A word at the global context or in an object context isn't like a word in a function context which may be changing all the time, being passed in or not. Those non function context variables seem more existential. At least, that's how it all strikes me. But. of course, that's just my own formulation, and not necessarily the most in keeping with REBOL's philosophy. I wonder what Carl's thinking is about why words default to NONE in functions, and UNSET at the global and object contexts. What's the deeper meaning? There always is a deeper purpose with most things in REBOL. (-: Cheers-- -jeff
[REBOL] Self is mysterious Re:(2)
That's essentially the way it works, Gabriele. :-) Yours is a better, simpler explanation than my was. One extra note, just to state the obvious: the set-word SELF is first bound into the newly created object context making it refer to THE SELF of the object before evaluating its assignment. The stages of an objects creation are sometimes important. (-: -jeff Hello [EMAIL PROTECTED]! On 27-Mag-00, you wrote: d x: make object! [a: 1 b: 2 self: 3] d == 3 d type? x d == integer! d Mystery abounds, Actually, obj: make object! [a: 1 b: 2] obj/self: 3 == 3 probe obj make object! [ a: 1 b: 2 ] I think it's just that MAKE OBJECT! returns the value of SELF, so if you modify it, you get the modified value as a result. Regards, Gabriele. -- Gabriele Santilli
[REBOL] hidden variables in objects? Re:(11)
Howdy, Gabriele: make object! [ set 'x make self [ a: 1 b: 2 ] c: 3 d: 4 ] Being C and D duplicated in the "inner" object, using them as hidden variables may be tricky; surely that would make someone who's PROBEing the object to see how it works go crazy. :-) There will only wind up one C and one D in either object. The trick here is what does SELF evaluate to when you set 'x to it? SELF at that time is an object, containing the words C and D, but those words haven't yet been assigned anything at the time you assign the word X to SELF. An object begins its creation by first collecting all the words within the block that makes up its body, and adding them into the new object context. The determination of what words are included in an object's context precedes the evaluation of an object's body. What's really happening above is we're taking a snapshot of an incomplete object. So, moving the SET X later: make object! [c: 3 d: 4 set 'x make self [a: 1 b: 2]] ..all the assignments happen before self is evaluated and no words wind up being UNSET or END. Everything is peachy about all this, but object words shouldn't ever be END. They should be UNSET in these conditions-- A minor little bug. ;) Fun chatting with you about esoteric object stuff-- (-: -jeff
[REBOL] multithreaded cmd, ports Re:
Howdy, Pawel: Dear list, I'm new to Rebol, and I'm sorry if I'm asking about anything that has been already discussed. Here are two scripts (attached) which allow me to run a Rebol script via cgi. Neat stuff. 1. I need to check if there is any data to read from non-listen port without waiting for it (functions: 'check-cgi? and 'read-cgi). I wonder if there is any simplier, WORKING method, than changing the default timeout. By not waiting for it you mean not using something like the following?: if port? wait reduce [cmd-port .5] [fetch-stuff from port] The wait will return after half a second with either NONE or your port if there's data in it. Also, once you have a talk port connected (not a listen port), you should also be able to use query to determine when there's data within the port. 2. If the scripts are worth uploading them to rebol.org, what should be their category? Probably: [advanced web] -jeff
[REBOL] hidden variables in objects? Re:(9)
Not a follow up, but for those that are interested in little REBOL "hacks", hidden object variables, etc, try playing around with this: x: make object! [a: 1 b: 2] x/self: make object! [a: 11 b: 22] And now there's some hidden vars in X. x/a x/self/a Nothing truly mysterious here. Self is a word, that by default refers to the self same object. The word can be used to point to another object as well. If self instead points somewhere else, that's okay, but self won't be copied if you clone that object. Now for some mysterious stuff: x: make object! [self: make self [a: 1 b: 2] c: 3 d: 4] What do you suppose is happening here? :-) It's a little mystery. (-: -jeff
[REBOL] Self is mysterious Re:
Howdy, Don: SELF is a word in every object which by default refers to the object itself. By setting, in the process of making an object, the word SELF in the object's context to something other than that object, in effect, whatever you are assigning that object to will instead be assigned to what you set SELF to. The same is not true after you've made the object. -jeff Perhaps "self" can NOT be used as a regular? Rebol word: x: make object! [a: 1 b: 2 ] type? x == object! x: make object! [a: 1 b: 2 sel: 3] type? x == object! x: make object! [a: 1 b: 2 self: 3] == 3 type? x == integer! Mystery abounds, Don
[REBOL] Will REBOL Lead or Mislead? Re:(2)
Howdy Petr: /Apache, REBOL/Serve ... can be licenced, no problem here, although all other Apache modules are free IIRC There are commercial pay for SSH modules for apache, for instance. Multitasking, threading, async messaging, shell access should become part of /Core imho ... -pekr- Shell can't be in /Core without destabilizing the cross platform nature of most REBOL scripts. For instance, most PERL scripts I've ever seen that send mail typically shell out and use the unix mail command. Ugg. :-) -jeff
[REBOL] CGI problems... Re:
Howdy Malte: Perhaps you might know: How does macintosh deal with cgi request data? Where does it put the data from a GET or POST request? -jeff Fellow rebels! Im writing a cgi-script over here, to be run from a AppleShare IP server (MacOS). Now, when I try to run these cgi's.. all I get is an error like: 500 Internal Server Error The server encountered an internal error: Host header is missing from an HTTP 1.1 request. So, I tried adding a "Host: the-ip-number" to the http header, without success. I don't know if anyone out there has experienced a similar problems, but any comments are welcome. :) Cheers Malte
[REBOL] Text to CW !!! Re:(2)
If brevity is what you're going for, you can use issues for all strings that don't contain spaces: ask # prin # I guess I forgot the ultra-ultra short version which doesn't handle space= s or strange chars: REBOL[]foreach cask{}[l: index? find{%etinamsdrgukwohblzfcp=F6vx=E4q=FCy= j=E756%7=E9%%8%/ 94%=E5%3%%=F12%10}c until[prin pick{-=B7}odd? l(l: l / 2) 2]prin= { }] (152-153 bytes, may require deletion of the / at the end of first line on= some systems) Or ifwe skip numbers: REBOL[]foreach c ask{}[l: index? find{%etinamsdrgukwohblzfcp=F6vx=E4q=FCy=j}c until[ prin pick{-=B7}odd? l(l: l / 2) 2]prin{ }] (120-121 bytes) --=20 /Johan R=F6nnblom, Team Amiga
[REBOL] Text to CW !!! Re:(6)
Howdy Johan: I stand corrected. :-) In each possible case the length is longer or the same, eg: [ask{}] [ask #] (same length!) [ask{bla}] [ask #bla] (same length!) [prin{bla}] [prin #bla] (again, same length!) [prin #] (useless, this is a no-op!) [print #] [print{}] (same length) --=20 /Johan R=F6nnblom, Team Amiga
[REBOL] what's Carl's autograph worth? Re:
Cool Ralph! We're just going to have to run off a million copies of Carl's picture and get a pen in his hand! Oh, and to see what Carl's autograph is worth (and this will be in the next book), search for Sassenrath, Carl. Best to all, --Ralph Roberts
[REBOL] open/allow Re:(2)
Howdy Brian: There is no way to _set_ unix permissions from within REBOL whatsoever. That functionality will probably be accessable from REBOL/Command, when it comes out. Not true. Try WRITE/allow %test.dat "test" [read write execute] No, I don't know when REBOL/Command will come out :( It'll be at least a day sooner ever day! :-) -jeff
[REBOL] newnews Re:(2)
Ryan said: I would like to use the NNTP client command "newnews" with the REBOL nntp protocol to retrieve new messages since a specified date. Hi Ryan, 'newnews' is not currently implemented in the NNTP dialect. I don't know Jeff's exact reason for not implementing it, but it could be due to the high number of servers that have newnews administatively disabled. Howdy Kevin: Pretty much. NNTP only supports what could be determined as commonly found features. The exception is xhdr which though not standard seemed to be too useful not to include. Ryan, if your server supports it, you could use nntp.r's xhdr feature to get the date headers from a newsgroup, determine which articles are new (greater than your start date) and download those. Of course, adding newnews to the nntp dialect shouldn't be too hard either. Check out how nntp does xhdr for instance. Hopefully when the next version of core comes out with block parsing abilities, nntp's dialecting engine can be upgraded to use that much cleaner approach instead of its present mini interpreter. That would also make it easier to extend nntp's capabilities. Maybe I can steal some time somewhere along the way to get that one done.. :-) The list never ends... (-: -jeff
[REBOL] getting Rebol OK Re:(2)
The only problem I have had is with a bad script. It spawned a copy of rebol.exe and it never went away until I stopped and restarted the web server. If I knew of a way to stop this happening I would happily host REBOL for everyone. Melvin Mudgett-Price Director ofDevelopment Howdy Melvin: If REBOL is invoked with -c or -qw command line switches then any error that occurs in the script should cause REBOL to fully exit (after printing out the error). If you've found otherwise, please send in a feedback with information about your set up and we'll try to figure out why. Thankya kindly. :-) -jeff
[REBOL] newnews Re:(4)
Howdy Ryan: I have been working on a script which will retrieve newsgroup news and then output only a single day (the previous day) to an HTML file so that I can post the messages on a web page. If I grab more than one day's worth of messages, the web page becomes too large (as much as 1MB.) Unfortunately, REBOL does not understand the date formats. There are at least three date formats used by newsgroups, as follows: Date: Tue, 22 Feb 2000 15:33:09 GMT Date: Tue, 22 Feb 2000 16:49:03 +0100 Date: 22 Feb 2000 16:00:52 GMT REBOL can understand those dates, if fed in after the comma: get-news-date: func [ date-str [string!] "One of the above date strings" ][ date-str: any [find/tail date-str ", " date-str] to-date date-str ] -jeff
[REBOL] nntp limited by date Re:
I would like to use the nntp.r protocol to retrieve messages from a newsgroup limited by date. Is there any way to do this with nntp.r? -Ryan Sure. Read up on using nntp.r's xhdr functionality. You can retrieve just the date headers of a given news group and then determine which range of messages you want before downloading them. -jeff
[REBOL] Mail Re:
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: some-number (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] REBOL/View Re:(9)
View, View it's new, it's new! View, View, it's good for you!! - jim I think the pressure's gettin Jim a little sock eyed.. :) ignore the little dancing leprechans around your computer. They're just a sign of shipping madness... (: -jeff
[REBOL] UDP Re:(7)
Whomever you ask, I hope they'll reply here on the list so we all can benefit from the info! This is something I've wanted to know more about (as well as UDP with REBOL) for some time. Thanks, /Russ - At 02:22 PM 1/9/2000 +0200, you wrote: snip BTW, I have spent some time over the last holidays studying how protocol handlers work, because I need to write one. I still need some clarifications on the port flags, and the meaning of the fields in port/state... this could save me some time. :-) Can I ask to you, Jeff, or should I ask to Sterling? Regards, Gabriele. Well, lessee.. generally, the state object relates to presenting the data a port contains or fetches as a serialized set of values. state/tail is the end of the data, what should be reported when you do LENGTH? on a port. Similarly, state/index is like a series index. This value gets bumped when you call NEXT on the port. When the state/index = state/tail then the port is at the tail, and TAIL? port will return true. The state/flags there correspond to the capabilities of the port. At some point the doc team will cover ports and clarify the other fields. The time I've written handlers I never really needed to touch most of the values in the state object. (Sometimes you can't set these field when with some protocols you can't know what the tail of the data is...) To look at a protocol that messes with the tail and index members of the state object check out pop. Typically, the open sequence will set the state variables. Now the port flags change the functional properties of the ports. With network ports it generally comes down to either pass-thru ports or direct-ports (all the built in protocol port handlers are one or the other). To see the differences in behavior try playing with the script listed below. I know that's hand waiving, but I didn't implement the port mechanism so I don't want to say anything incorrect about them. Give this a play, though. Hope I've been helpful. (-: -jeff REBOL [ Title: "Port Tester" Purpose: { Illustrates the different port mechanisms of "direct ports", vs. "pass-thru" ports. Discover the differences by playing with two dummy ports. } ] tst-port: make root-protocol [ init: func [port spec][print "Init" 1] open: func [port][ print "open" port/state/flags: port/state/flags or port-flags 2 ] close: func [port][print "close"3] write: func [port][print "write"4] read: func [port][print "read" 5] copy: func [port][print "copy" 6] insert: func [port][print "insert" 7] pick: func [port][print "pick" 8] ] foreach [flags name] reduce [ system/standard/port-flags/direct'dport system/standard/port-flags/pass-thru 'pport ][ make tst-port compose [ port-flags: (flags) scheme: (to-lit-word name) ;-arbitrary port number assigned below net-utils/net-install (name) self (2000 + random 1000) ] ] print #DP dp: open dport:// print #PP pp: open pport:// ;- Now notice the different results of ; using COPY, INSERT, PICK, and CLOSE on ; the above ports. ; ;- also, try: read dport:// ; vs: read pport:// ; ;- and: write dport:// # ; vs: write pport:// # ; ; Pass-thru ports return results from different ; phases. Pass-thru goes directly to named function ; with out buffering...
[REBOL] REBOL puzzle/challenge
Here's a couple small REBOL puzzles for those of you who enjoy that kind of thing: 1. Can you simulate a static local variable in REBOL? The variable should be local to a function, but each time the function is called, the variable has the same value it had at the end of the last function call. The variable should be modified in some way in the function (incremented for instance) and it should have the modified value on subsequent calls. I have one solution, but I think there could be others. 2. Can you create a line of REBOL code, including two or more functions of arity one or more (that take one or more parameters), that results in the same result forwards or backwards? To verify, put the code in a block, and try: (do block) = do reverse block And it's no fair padding either side of the block! ie: [1 1 print 1 print 1 1] (Okay that one's convoluted...) 3. Can you make a function which takes one argument, unless called with a refinement in which case the function takes no arguments? 4. Can you create a parse rule that recognizes whether a string of numbers is from the Fibonacci sequence? 5. Can you think up more puzzles? :-) -jeff
[REBOL] UDP Re:(4)
[EMAIL PROTECTED] wrote: Aha, so I missunderstood you, is it possible to udp talk with current version of port implementation? Yep: close insert open udp://somewhere:9090 "something" and "something" will, infact, be sent via udp to somewhere's 9090 udp port (which I verified earlier today). For some reason it doesn't seem possible to create a udp listen port, though. I don't think, or at least never heard that anyone had ever really verified the udp stuff before (due to udp's lack of popularity I suppose) so I thought I'd take a peek it at. I think the problem with the udp listen ports is in the port interface. Perhaps they can be fixed before the next release. As for refinements, I've never tried to use /custom /mode refinements. Do they actually work? Not sure about /custom... I'll add that to my ever growing poke list.. but /mode works like this: file: open/mode %test.txt [binary new] That's the same as: open/binary/new %test.txt -jeff
[REBOL] RFF: empty? for blocks Re:(5)
Wow. You may never know just how right on the money the above statement is! It is a very good analogy.In fact, in the same sense, all of REBOL is a movie, and all variables are frames of the big REBOL movie. :-) There isone painful exception that doesnot fit in this metaphor. That is the reported case: list: [1 2 3 4] list2: next list clear list list2 == [2 3 4] Looks like a bug to me. [ . . . ] I believe that the "cheapest" way for handling it correctly is to have every word that references a series negotiate the legality of its offset before it attempts to access the series at that offset and it should report some indication that its offset into the series is illegal whenever that is the case. Maybe so. It's sad an extra layer of logic has to be added across the board to deal with outlying cases. -jeff
[REBOL] Linux different? Re:(3)
Howdy Fleet: Assuming you are trying to be helpful; it didn't work. Now I don't know what the heck *you* are talking about. I thought I *had* specified the file (readme.txt) on the command line. file: to-file system/options/args ;name of file to send In the code you sent the list the above line read: file: %mailer.r followed by the function to send FILE to you. Sterling above takes the file from the command line arguments. What's more surprising is that that script is sending you readme.txt under windows. The code you sent should ONLY ever send you %mailer.r. ? -jeff
[REBOL] Test message and benchmark Re:
Howdy John C: I submitted this benchmark to rebol.org, but it must have gotten lost in the mail. On my machine, this runs at 6.8 seconds per iteration. REBOL [ Title: "Count Change Benchmark" Date: 11-11-1999 File: It's in there. It was choking on your hotmail signature that was being appended to the mail. -jeff
[REBOL] Removing obsolete scripts from REBOL.ORG Re:
How does one go about removinga obsolete scriptfrom http://www.rebol.org ? I would like to remove my %Append.r script, as the 'append word in REBOL 2.2 now comes with the needed enhancement that this script provided. AndrewMartin [EMAIL PROTECTED] No automated way right now, but I'll remove it later on today. -jeff
[REBOL] [REBOL] Removing obsolete scripts from REBOL.ORG Re:
How does one go about removinga obsolete scriptfrom http://www.rebol.org ? I would like to remove my %Append.r script, as the 'append word in REBOL 2.2 now comes with the needed enhancement that this script provided. AndrewMartin [EMAIL PROTECTED] No automated way right now, but I'll remove it later on today. -jeff
[REBOL] Using REBOL With Microsoft Personal Web Server Re:
Howdy Paul: I'm trying to use Microsoft Personal Web Server to run my REBOL/CGI scripts; but I can't get them to run. Instead I keep getting the download dialog box. Could someone please help me setup PWS to use REBOL/CGI scripts? Here's a recent post from sterling on setting up PWS/IIS. Apparently this rigamorole is necessary for most scripts: --- We will be adding this info to the CGI How-to soon: Please let me know if you find you had to do something else to get it to work, what that was, and why. Here's the basic Win**, PWS/IIS setup info... thanks to the folks working on PHP who took the time to figure this all out. :) Windows NT and IIS 4: 1. open Internat Service Manager (MMC) and choose the website or starting directory of an application 2. Open the directories property sheet (right click - Properties) and choose the Home Directory, Virtual Directory, or Directory tab 3. Click Configuration and choose the App Mappings tab 4. Click Add and i nthe Executable box type the path to REBOL.exe like c:\REBOL\rebol.exe %s %s (the two %s are important and must be there) 5. In the Extension box, type the extension you want associated with REBOL like .r Repeat the last two steps for each extension you want. 6. Set the security (done in Internet Service Manager) 7. If you use the NTFS filesystem, add execute rights for I_USR_ to the directory that has the REBOL executable. Done. Windows 95/98/NT PWS/IIS 3: 1. Run Regedit 2. Find HKEY_LOCAL_MACHINE /System /CurrentControlSet /Services /W3Svc /Parameters /ScriptMap 3. Menu: Edit - New - String Value 4. Type the extension you want to use for your REBOL scripts: .r 5. Double click the new string value and select the path to REBOL.exe like this: c:\REBOL\rebol.exe %s %s The two %s are important and must be there. 6. Repeat for any other extensions you want. 7. find HKEY_CLASSES_ROOT 8. Menu: Edit - New - Key 9. Name the extension from the earlier step 10. Highlight the new key and in the right pane double click the "default value" and enter rebolscript 11. Repeat last step for each extension created earlier 12. Create another New - Key under HKEY_CLASSES_ROOT and call it rebolscript 13. Highlight the new key and i nthe right pane double click the "default value" and enter "REBOL script" 14. Right click on the rebolscript key and select New - Key and call it Shell 15. Right click on Shell and select New - Key and call it open 16. Right click on open and and select New - Key and call it command 17. Highlight the new key command and i nthe right pane double click the "default value" and enter the path to REBOL.exe like c:\REBOL\rebol.exe -cs %1 (the %1 (numeral one, not L) is important and required) 18. Exit Regedit Hope it all works and you never have to do this again. ;) Sterling ---
[REBOL] Colors Re:(6)
X-REBOL: 2.1.90.1.1 "TheInternet Messaging Language(TM) WWW.REBOL.COM" Precedence: bulk X-SELMA: [REBOL] 41741 Jeff, Myresponse was only intended with the pinnacle of lightheartedness. No grievous feelings, ol' chap! As were mine, you old dog! My comments were intended to be as light as the thinnest wisp of a feather floating on the sweetest shimmering winds of frivolity! Ho ho! Don't take it rough, ol' boy, my chumaroo!! Be not dismayed! It was all in good fun! No harm done! Do bring your light pinnacles to work with you on Monday and we'll have a great uproarious laugh! -jeff
[REBOL] Colors Re:(2)
Howdy johnkenyon: Bo said: How 'bout this: color-text: func [intensity text][ rejoin [ {FONT color="#} copy/part tail form to-hex to-integer intensity * 2.55 -2 {8000"} text /FONT] ] Here's another approach, a little less string-concatenatey: ;- You get back a block with two tag!s surrounding whatever 'text is color-text: func [intensity text][ compose [ (build-tag [FONT COLOR (mold join # [enbase/base form to-char intensity * 2.55 16 8000])]) (text) /FONT ] ] ENBASE is a pretty cool function. It lets the above code use less conversions which lends it some efficiency. (An implicit integer round off occurs with to-char by the way.) The real efficency win, however, comes from doing less copying. Lets see: The first example does a decimal to integer to hex to string to a copy of part of that string joined to copies of other strings, including the passed in text. The second example does a decimal to a char to a string, joined (which copies) with an empty issue made into a tag, which is dropped into a block with the text and another tag, with out copying the original passed in text. Generally speaking the second example will do less copying especially if the text passed in grows large. Also, the second example treats numeric data in a more numeric way. Finally, the result of the second example maintains its distinct datatypes, which could be useful if you want distinguish tags from text in the result later on without having to parse it. The second takes a more symbolic approach. Not to cast any hint of aspersion on Bo's solution! (-: It certainly suffices for your purposes just fine, and it may be more intuitive to some. I only mean to suggest that in REBOL, as in all languages, there is always room for optimization. REBOL is a symbolic language, so symbolic approaches to problem solving will generally be more efficient in REBOL than approaches based largely on string manipulation. But of course I don't imagine that my approach is the most optimal either!! :-) Just trying to be helpful -jeff
[REBOL] [REBOL] Need a Script Re:(5)
-original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Subject: [REBOL] Need a Script Re:(2) Russ thanks for the help. I am trying to make a script to check a site every xx:xx minutes and see if a specific word on a page exists. if not send me email... and do this forever... Regards, Philip M. McDonnell --- ---snip REBOL [ Title: "WebSiteCheck" File: %webchk.r Date: 22-Oct-1999 Purpose: {Check a set of sites every 5 minutes mail an error response only once} Author: "Andre Venter" ] secure none sites: [ "Site 1" http//www.site1.com "1" "Site 2" http//www.site2.com "1" "Page2" http//www.site1.com/page2.htm "1" ] while [ true ][ foreach [name url status] sites [ start: fourth now either error? try [read url][ if status = "1" [ message: reform ["Rebol Alert:" name "is down!"] send [EMAIL PROTECTED] message change status "0"] ] [change status "1"] stop: fourth now if stop - start = 0:00:45 [ if status = "1" [ message: reform ["Rebol Alert:" name "timed out!"] send [EMAIL PROTECTED] message ; ] ] ] print reform [fourth now "Pausing for 5 min"] wait 0:05:00 ; //change to suite your needs ] Another approach: sites: [ http://www.worldrps.com http://www.theonion.com http://www.rebol.org http://www.doesnotexist.com http://www.neitherdoesthis.com ] total-no-go: copy [] forever [ no-go: copy [] foreach site sites [ all [not exists? site append no-go site] ] if not empty? no-go: difference no-go total-no-go [ send [EMAIL PROTECTED] reform ["These sites down:" no-go] ] total-no-go: union total-no-go no-go wait 00:05:00 ] EXISTS? works for urls. The UNION and DIFERENCE functions let you see pretty quickly when something new has entered a set of items, in this case the set of missing sites. Like Andre's code, the above will only send mail the first time a site goes down (but the above code doesn't deal with time out errors, as Andre's does (-:). Using DIFFERENCE you can also then restrict further checking of urls to only those sites you haven't found to be down previously. (ie: sites: difference sites total-no-go). There's so many ways to do things in REBOL. It's just t00 k00l! :) -jeff
[REBOL] Use of - in prefix notation. Re:(7)
Howdy Martin: also with parenthesis + 3 ( 4 + 5 ) == 13 + 2 ( 3 + 4 ) == 10 This is no wierd Pentium bug, isn't it? ;-) That's a pre 2.2 beta bug. BTW: Not in the upcoming 2.2 release, but soon afterwards we're eliminating the prefix behavior of + and -. There'll still be ADD and SUBTRACT as prefix, but as some of you have experienced, having + and - be both infix and prefix causes some ambiguity, and inconsistency when you throw in - unary. Just a heads up. :) -jeff
[REBOL] Colors Re:(4)
I knew Jeff would jump all over my example grumble grumble ;-) Hey-- You told me I'm the script cop. Just doing my job. Ha ha just kidding. But no reason to grumble there, Bo. It wasn't my intention to "jump all over" your example. Just trying to point out a different way to do it and to rant about efficiency. But there's no "right" answer. I also toyed with enbase, but it wasn't as straightforward from a user's standpoint in my opinion as the method I chose. ENBASE was put there to be used! (-; But mine still uses less bytes to store the function so there! You got me there. Leaner and slower. ;-) Cheers-- -jeff
[REBOL] New bot at rebol.org
Howdy ladies and gentlemen, New to the chat room at rebol.org: Pundit. Pundit likes to talk politics. Sometimes he's evasive, sometimes he's redundant, but he's often moderately coherent and on topic. Here's a short transcript ("pundit:" is how you address pundit, ie. those are the questions I'm asking him): pundit: What do you think about congress? jeff: Life is unfair. pundit: No really, what is your opinion of congress? jeff: He makes no value judgments. pundit: Do you like congress? jeff: I don't miss being in politics. Pundit: Aren't you still in politics? jeff: I wasn't obsessed with politics, dance! pundit: Would you like to be a senator? jeff: Senator from New York, this august body and all of us who...deserve the title of Senator, my God! pundit: so you would like to be a senator? jeff: It is perhaps accurate for Senator Gramm and myself to describe the Daschle proposal as being Sex, little boy as individuals rather than Senator So-and-So from Minnesota or Senator So-and-So from Alabama. Pundit: That was weird. jeff: George didn't go for that. Pundit: You're crazy. I'll talk to you later. Bye! jeff: You have to stop kidding about this. He really is a typical politician. You gotta grill him to get anywhere. It's fun writing these bots. If anybody else wants their bot added to the room (Allen?) , give me a holler and I'll hook it up when I can. Try to make the bot pretty well self contained, a single script with maybe with one additional datafile, and not tons of globals sticking out. Also provide a calling function which takes a string of something someone said, and returns the response in a string. Also provide a response string that is said if the bot has an error. Lastly provide it a name that it is addressable by in the chat room. Holler at me about your bot at this account or [EMAIL PROTECTED] Aloha-- -jeff
[REBOL] Command Sneak Preview Re:(4)
Howdy Robert: Hi, yes, I have written a Rebol LRWP protocol function, so no need for CGI ;-)) just let your Rebol instance running. However, what I would like to do is use Reblets inside my HTML pages (this even won't be HTML pages, as I would use Andrew's and mine HTML dialect). To do this, Rebol should be directly coupled into the process of the web-server. Well, since Carl and Dan have sprilled the beans... :-) ...we're talking Apache embeded interpreter, REBOL custom phase handlers, support for stacked content handlers, cgi emulation, and SSI. Sorry, no plans for Xitami right now. :( -jeff
[REBOL] send-selma
[REBOL] New listing at rebol.org
Howdy folks, Today I added a link from the script archive to a comprehensive list of the scripts in the archive in no particular order. This list will be updated on the fly like the rest of the site per submission. Currently we have 67 scripts. Everything should be operating fine now with the submission engine as well. If you notice any problems send me some mail and I'll see what I can see when possible. More features coming soon to rebol.org. Stay tuned. -jeff
[REBOL] Mac Core 2.2? Re:
Howdy Ron: When are the Mac versions of Core 2.2 going to be available? Very soon, like as soon as today. You lucky mac kids. You guys get a brand new console, courtesy of code wizard extraordinaire Jim Goodnow. :) -jeff
[REBOL] Dates Re:(3)
Maybe in a pre-emptive strike, you could add it to the faq ? from-idate: func [i-date [string!]][to-date skip i-date 5] Cheers, Allen K Howdy Allen: The faq certainly needs another revision. There's a good many FAQs (including above) that should be added to the faq. Hopefully next week some time I can get to it. No rest for the wicked.. :) -jeff
[REBOL] CGI-Hit Counter Re:
Does anyone know how I could use REBOL to return a gif hit counter. I did see and example of how to return a text number but I really need it to be in an img tag. I've faked it using a script let but that only works with IE browsers. Any help is apprecitated. Jim Howdy Jim: Check out Allen Kamp's script that shows how a cgi-bin program can return an image called from an IMG tag: http://rebol.org/web/spacer.r or colorized html version: http://rebol.org/web/spacer.html Now, that method can only return a single image each time, so for a counter you have to do some image compositing. Can this be done? Sure it can, by directly modifying an image file. I made some code to suck in .bmp files available at: rebol.org/utility/bitmap.r Never have had the time to get to adding some function to composite, but it shouldn't be too tough.. you got a bunch of same sized image files of numbers, you choose a color for an alpha channel, you run through a background image sticking painting on the right numbers (skipping the alpha of course). Of course, some ambitious person might want to build gif or jpeg handling routines. Weren't you going to do jpeg Bo? -jeff