r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Gabriele
22-Oct-2006
[5826]
>> enbase/base to binary! 255.0.0 16
== "FF0000"
Anton
22-Oct-2006
[5827x4]
Ashley, works for me. What do you get when you probe system/scirpt/args 
?
By the way I usually do this in the script to ensure the args are 
always a block:
	args: compose [(system/script/args)]
Ah, I see do-thru. Probably the first version you cached didn't handle 
the args properly. Ensure you have the latest version from the website 
by using /update
do-thru/update/args url args
Ashley
22-Oct-2006
[5831]
Got it working. Deleted everything and started from scratch with 
the do/args version and it now works as expected. Thanks for the 
lead.
Graham
22-Oct-2006
[5832]
Gabriele .. that is interesting!!
Henrik
22-Oct-2006
[5833]
yet another "that's it?! no more code than that?" experience :-)
Anton
22-Oct-2006
[5834]
Cool. To the next problem !
Maxim
23-Oct-2006
[5835x2]
what is the easiest/most direct way to convert an integer value into 
a 4 byte binary (equivalent to to a 4 byte unsigned LONG) ?


for some reason, this kind of thing is not 'simple in REBOL I expected 
this to work. but didn't even get a one byte binary.

>> to-binary 100
== #{313030}


100 is a numerical value, not a string, I would have expected (in 
base 16 which is default) :
#{64}
some might be tempted to suggest converting to char!  first, but 
for any value larger than 255 This obviously does not work.
Sunanda
23-Oct-2006
[5837]
to-hex 100
== #00000064
Maxim
23-Oct-2006
[5838x2]
but that's an issue!    ;-)
>> to-binary to-hex 100
== #{3030303030303634}
Gregg
23-Oct-2006
[5840]
>> ss: make struct! [val [integer!]] [100]
>> third ss
== #{64000000}
Maxim
23-Oct-2006
[5841]
thanks Gregg we are getting close now! but that's byteswapped no? 
(I am no expert in this kind of byte manipulation...btw)
what about getting this result directly?
#{00000064}
Gregg
23-Oct-2006
[5842x2]
>> reverse third ss
== #{00000064}
You need to do that to use to-integer on the binary, as you may have 
guessed.
Maxim
23-Oct-2006
[5844x3]
<sigh!>  binary data handing really is an oversight in rebol!
does REBOL always return the data as print it out here (using the 
struct!) or will that change based on OS/HW ?
what I mean is that there seems to be everything there... its just 
not REBOLish.  (not simple)
Janeks
23-Oct-2006
[5847]
Why this function runs well on some web servers (f.ex. KFWS) but 
hangs (getting cgi script time out) for MS IIS and how to solve them? 
I found that problem is in line where read-io is.

read-post-data: func [
    {Reads the HTTP entity body}
    /safe "Disables evaluation of content-length header."
    /local len data tmp
] [

    len: load any [ all [safe "65536"] system/options/cgi/content-length 
    "0" ]

    data: make string! len
    tmp: make string! len
    while [ 0 < read-io system/ports/input tmp len ] [
        insert tail data tmp
        clear tmp
    ]

    data
]
Gregg
23-Oct-2006
[5848]
REBOL, being targeted at higher level use, hasn't made bit twiddling 
terribly easy in the past, to be sure, but if you're doing a lot 
of it, write a dialect. :-)
Anton
23-Oct-2006
[5849x2]
Maxim, yes the byte order is dependent on the platform.
Janeks, try 
	set-modes system/ports/input [binary: true]
before the WHILE. Maybe it works ?
Janeks
24-Oct-2006
[5851x2]
Anton, it did not help!
How the MS IIS is putting  those cgi data into system/ports/input?
Jerry
26-Oct-2006
[5853]
I got two REBOL functions, say, f1 and f2, which are both time-consuming.

How can I make them run simultaneous in the same process? Thank you.
Jerry
27-Oct-2006
[5854]
Got the answer as "NO", form the REBOL mail archive in REBOL.org.
Anton
27-Oct-2006
[5855x2]
Janeks, I don't know, I'm sorry. I've never used MS IIS.
Jerry, yes, you will have to divide the work up into manageable chunks.
Henrik
27-Oct-2006
[5857]
ladislav, I'm becoming comfortable with BUILD. it is indeed very 
nice to do evaluations "on the spot" inside large blocks.
Pekr
27-Oct-2006
[5858]
guys, please, just introduce syntax, which will be in-build in R3. 
Because we are relatively close (well, who knows :-) to R3 alpha, 
and once we become familiar with some technique, I would not like 
to learn new habits for R3 eventually .... :-)
BrianH
27-Oct-2006
[5859]
Jerry, can't you launch them in seperate processes?
Jerry
27-Oct-2006
[5860x2]
BrianH, launching them in different processes is my second choice, 
How do i do that? By using the LAUNCH native function, right? I've 
never used it before. I will give it a try.
I have noticed some REBOL experts designing their own protocols, 
which, by the way, are very cool. By "protocol," I mean the protocol 
part of an url, it doesn't have to have anything to do with networking. 
I would like to design my own protocol, too. So I can write:

>> print read DICT://English/English/Cheyenne
Cheyenne
-noun, plural -ennes, (especially collectively) -enne for 1. 

1. a member of a North American Indian people of the western plains, 
formerly in central Minnesota and North and South Dakota, and now 
divided between Montana and Oklahoma.  

2. an Algonquian language, the language of the Cheyenne Indians. 
 
3. a city in and the capital of Wyoming, in the S part. 47,283.  
>>


Is there any document I can read about this. Thank you for your help.
Rebolek
27-Oct-2006
[5862]
your definition is missing the REBOL web server from DocKimbel ;o)
Jerry
27-Oct-2006
[5863]
My mistake. Sorry, DocKimbel. And thank you for bringing us the wonderful 
Cheyenne web server
Anton
27-Oct-2006
[5864]
Jerry, go to 
http://knowngood.com/rebol/
and search "rebol scheme handler"

The first link for me is "Rebol Forces — Writing your own Protocol 
Handler" which as I remember is written very well by Jeff Kreis.
Pekr
27-Oct-2006
[5865]
ah, Jeff Kreis, Holger Kruse, those were the times :-)
Anton
27-Oct-2006
[5866x2]
and be prepared to get your hands pretty dirty writing scheme handlers. 
You will need to understand how words are bound to different contexts. 
However, your scheme looks pretty easy to write.
(I mean, looks pretty simple, so *easier* to write.)
Jerry
27-Oct-2006
[5868]
Thanks, Anton.
Anton
27-Oct-2006
[5869x2]
I have used   data: read/binary url   and saved data to disk. Now 
I want, without accessing the disk again, to translate the line terminators 
as if I had just READ the file at the beginning.
Any ideas ?
(I think I hit this problem already a long time ago..)
Sunanda
27-Oct-2006
[5871]
Is it as simple as this?
 data: read/binary http://www.rebol.com
to-string data
Maxim
27-Oct-2006
[5872x2]
if you want to strip the CRLF form (which is what I guess you are 
trying to do:

data: replace/all to-string data "^M" ""
this will remove any CR chars hanging around after the to-string...
Anton
27-Oct-2006
[5874]
Hmm.. can't be a simple as that. I think READ determines the file's 
host platform somehow and translates accordingly.
Maxim
27-Oct-2006
[5875]
rebol only strores newlines using the LF char internally (like unix)