World: r3wp
[Core] Discuss core issues
older newer | first last |
PeterWood 20-Oct-2006 [5811] | Second question: >> fp: open/direct %testdata >> write %testdata2 copy/part fp 10 >> read %testdata2 == "123456789B" |
Graham 20-Oct-2006 [5812] | Peter, the second answer would not work well with large files. I think Carl gives an example of how to copy large files and one should use that method. |
PeterWood 20-Oct-2006 [5813x2] | Thanks Graham |
Was it this example? http://www.rebol.net/article/0281.html | |
Graham 20-Oct-2006 [5815x2] | Yes. |
T'was | |
Jerry 21-Oct-2006 [5817] | Thanks. The #0281 Article in the "Vivi la REBOLution" Blog is very helpful. Maybe I should read these articals all over again. BTW, I really hope that the web page in http://www.rebol.com/docs/changes.html would be updated to reflect the changes after 2.5.6. |
Gregg 21-Oct-2006 [5818] | OK, so it's not just the volume of raw registry data we're dealing with, but loading it into blocks as well. Do you have any idea how many keys there are that you're dealing with (i.e. how many block entries)? (Your English is very good BTW :-) |
Jerry 21-Oct-2006 [5819x2] | Gregg. There are 166,659 keys in my registry system. |
And loading the registry into a REBOL block is not a problem so far. I simply READ the registry-dump file as a string, then PARSE the long string into block: parse-reg: func [ file /local str blk ] [ str: read file blk: copy [] parse str [ to "[HKEY_" some [ copy txt thru "]" (append blk txt) skip copy txt [ to "[HKEY_" | to end ] (append blk trim txt) ] ] str: none blk ] | |
Graham 22-Oct-2006 [5821x3] | anyone got a function that converts rebol colours to html colour codes ? |
sint-to-hex: func [ smallint [integer!]][ copy/part skip tail form to-hex smallint -2 2 ] rgb-to-hex: func [ c [tuple!] /local ][ rejoin [ "#" sint-to-hex c/1 sint-to-hex c/2 sint-to-hex c/3 ] ] | |
something like that I guess | |
Ashley 22-Oct-2006 [5824] | Quick question. Assuming I have a script with the following in it: ... either system/script/args [ ... and the following in another script: do/args %my-script.r 42 what do I need to get it working remote. Tried the following without success: do/args http://www.my-site.com/my-script.r42 do-thru/args http://www.my-site.com/my-script.r42 Any ideas? |
Gabriele 22-Oct-2006 [5825x2] | Graham: |
>> 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 [5860] | 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. |
older newer | first last |