World: r3wp
[Core] Discuss core issues
older newer | first last |
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) |
Anton 27-Oct-2006 [5876] | Yes...... |
Maxim 27-Oct-2006 [5877x2] | so the above will read DOS and UNIX newlines. |
I'm using it myself for http operations on a server. and it works flawlessly. | |
Anton 27-Oct-2006 [5879] | Mac uses just CR. |
Maxim 27-Oct-2006 [5880] | yes, but then how to determine the input itself. |
Anton 27-Oct-2006 [5881] | Let me just see what to-string does... |
Maxim 27-Oct-2006 [5882x4] | if you have a potential for receiving Mac Files... (I was just about to give you this when you posted about mac ;-) |
if converts byte for byte each char in the binary string;... | |
I have been handling binary data now for the last 2 weeks in many different operations. | |
for a more unified conversion you could do this: data: replace/all replace/all to-string data "^M^/" "^/" "^M" "^/" this way if its CRLF it will strip them and if its only CR it will convert them. | |
Anton 27-Oct-2006 [5886] | That looks better. |
older newer | first last |