World: r3wp
[Core] Discuss core issues
older newer | first last |
Gordon 6-May-2005 [1019] | Beauty! Thanks DideC |
DideC 6-May-2005 [1020] | no problem |
Micha 7-May-2005 [1021x4] | REBOL [Title: "proxy multiple" ] print "start-multiple" list: [] proxy: make object! [ host: 24.186.191.254 port-id: 29992 ] ph: func [port][ switch port/locals/events [ connect [insert tail list port ping: to-integer (now/time - port/date ) * 1000 port/date: now/time print [ "open ping: " ping ] ] close [ remove find list port init ping: (now/time - port/date ) * 1000 print ["close ping: " ping ] close port ] ] false ] stop: func [] [ clear system/ports/wait-list forall list [close first list ]] init: func [ /local port ][ port: make port! [ scheme: 'atcp host: proxy/host port-id: proxy/port-id awake: :ph date: now/time ] open/no-wait/binary port insert tail system/ports/wait-list port ] set: func [ h p ] [ proxy/host: h proxy/port-id: p ] send: func [ port ][ port/date: now/time insert port join #{0401} [debase/base skip to-hex 80 4 16 to-binary 193.238.73.117 #{00}] ] |
plis help ? | |
init error ! | |
>> init ** User Error: No network server for atcp is specified ** Near: port: make port! [scheme: 'atcp host: proxy/host port-id: proxy/port-id awake: :ph date: now/time] open/no-wait/binary >> | |
Sunanda 7-May-2005 [1025] | Any easy way of doing this? (I got a loop, but it feels there ought to be a more elegant way) a: "123123123" b: "12312345678" print skip-common a b "45678" ;; string after common part of both strings |
Gordon 7-May-2005 [1026] | Hello; How do you convert a letter (ASCII) to it's hex equivalent? I've tried to-hex but it wants an integer!? You would think it would be easier than: print to-integer to-string to-hex to-integer to-decimal to-char "a" which works but there has got to be an easier way. |
Tomc 7-May-2005 [1027] | >> to-hex to integer! #"A" == #00000041 |
Sunanda 7-May-2005 [1028] | Gordon, your method only works for chars than happen to map to decimals. Try this for an error: print to-integer to-string to-hex to-integer to-decimal to-char "M" Variant on Tom's to produce the same result as yours (may not work with 64-bit REBOL) form skip to-hex to-integer first "a" 6 |
Gordon 7-May-2005 [1029] | Thanks Tomc and Sunanda |
Tomc 7-May-2005 [1030x2] | >> copy/part tail to-hex to integer! to char! "Z" -2 == #5A |
unfortinatly for me we dont have a 64 bit rebol | |
Gordon 7-May-2005 [1032] | Does anyone? |
Tomc 7-May-2005 [1033x2] | or unicode |
not that I know of | |
Gordon 7-May-2005 [1035] | Thanks again for your help |
Sunanda 7-May-2005 [1036x2] | Quick work there Gordon: http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=char-to-hex.r Thanks for the name check :-) |
And I see you've solved the potental 64-bit / variable hex problem | |
Gordon 7-May-2005 [1038x5] | Well actually Tomc made the suggestion. |
Sorry for the slow reply but if I leave Altme open it keeps stealing focus from my coding program . I have to shut Altme down so I can work. | |
Here's another odd one that has be puzzled (Notice that appending something to the Writefile variable, also appends it to the DateStr variable! Very Strange!) >> WriteFile: "WriteFileName_2005-05-07" == "WriteFileName_2005-05-07" >> DateStr: skip tail WriteFile -10 == "2005-05-07" >> Success: append WriteFile "_Parsed.txt" == "WriteFileName_2005-05-07_Parsed.txt" >> probe DateStr 2005-05-07_Parsed.txt == "2005-05-07_Parsed.txt" | |
Nevermind. I think I should have used a copy of Writefile. DateStr must be a subset of WriteFile variable because of the reference to it's tail. | |
Yep, it just needed a copy as in: >> DateStr: skip tail copy WriteFile -10 == "2005-04-11" | |
Tomc 8-May-2005 [1043] | gordon: home-icon - settings - options -unset "activate window on new message" |
Gordon 8-May-2005 [1044] | Thanks Tomc; that should do it. |
Micha 9-May-2005 [1045x3] | how to decode this url ? |
input: uggc%2Fjungvfzlvc.pbz | |
output: http://whatismyip.com | |
Anton 9-May-2005 [1048] | rot13: func [s [string!] /local result top][ result: copy s repeat n length? s [ top: either s/:n >= #"a" [97][65] ; determine upper or lowercase if (i: s/:n - top) < 26 [ ; only 26 letters in alphabet affected i: i + 13 // 26 ; perform rot13 poke result n to-char top + i ; insert new letter ] ] result ] |
Gabriele 9-May-2005 [1049x5] | sunanda: i can only think of: |
>> index? find (as-binary a) xor as-binary b complement charset "^(00)" == 7 | |
though, i'm not sure it's an easy way, and it is probably overkillif a and b are "big". | |
another option would be to try with parse, though it's gonna boil down to some kind of loop anyway. | |
>> parse a [any [(char: b/1) char (b: next b)]] == false >> b == "45678" | |
Janeks 9-May-2005 [1054] | How to set correctly progress function for read-net? Or what causes following error and : >> myProgr: func [ tot bt ] [ print bt / tot ] >> read-net/progress to-url "http://maps.dnr.state.mn.us/cgi-bin/mapserv36?map=/usr/loca l/www/docs/mapserver_demos/tests36/expressions/test.map&map_counties_class_expression=(% 5bAREA%5d %3e 7577272785.15339)&layer=title&map_title_class_text=Counties+Larger+Tha n+Itasca+County&mode=map" :myProgr 0.425625 ** Script Error: not is missing its value argument ** Where: read-net ** Near: all [:callback size not callback size length? buffer data: true break] not data >> source read-net read-net: func [ {Read a file from the net (web). Update progress bar. Allow abort.} url [url!] /progress callback {Call func [total bytes] during transfer. Return true.} /local port buffer data size ][ vbug ['read-net url] if error? try [port: open/direct url] [return none] size: to-integer any [port/locals/headers/content-length 8000] buffer: make binary! size set-modes port/sub-port [lines: false binary: true no-wait: true] until [ if not data: wait [60 port/sub-port] [data: true break] if data: copy port/sub-port [append buffer data] all [:callback size not callback size length? buffer data: true break] not data ] close port if not data [buffer] ] >> |
Gabriele 9-May-2005 [1055] | is your callback function returning a value? i think it should return true normally, or false if you want to cancel the download. |
Allen 9-May-2005 [1056] | Use request-download as a guide. It has everything you need to know. you should be able to substitute read-thru with read-net if you wish. |
Janeks 10-May-2005 [1057x3] | O'k. My mistake are offen do not tell what is my target. So it is to get working status bar in a layout. As I understood it is possible by read-thru. |
Thanks Gabriele. It was the reason. But to continue regarding status bar functions fired by read-thru. Than it is a problem just to kBox/image: read-thru/progress myUrl :myProgr . It is possible just by using local file i.e. kBox/image: read-thru/to/progress myUrl %tmpImg.png :myProgr | |
BTW: How to insert newline in a post? | |
DideC 10-May-2005 [1060] | Click the "pen" icon just up to the input area (near color/ no color one) |
Janeks 10-May-2005 [1061] | Thanks! I am getting following parameters of myProgr: 3650 8000 7430 8000 9950 8000 13730 8000 15335 8000 19115 8000 22975 8000 26755 8000 30695 8000 34475 8000 38255 8000 42195 8000 46055 8000 49835 8000 53695 8000 55197 8000 55197 8000 How then to calculate data for progress bar ( decimal from 0 to 1 )? Or how to get total bytes? |
Allen 10-May-2005 [1062] | Janek. request-download has the example callback you need. View its source. here is a snippet. Where prog is the progressbar and stat is a label in your layout and stop is a value that controls that should be be set false outside of this func to start with, and can set to true via a cancel button to force a download to stop before completion. func [total bytes] [ prog/data: bytes / (max 1 total) stat/text: reform [bytes "bytes"] show [prog stat] not stop ] |
Janeks 11-May-2005 [1063] | Thanks Allen! The problem was so obvious that I did not think about it ;-) just it is impossible to know what size of image will be that is coming from a cgi process with many parameters. |
Allen 11-May-2005 [1064] | A easy job for REBOL... http://www.eyon.com/. I can't believe this tool needs to be 4mb zipped. |
Volker 12-May-2005 [1065] | i like this little function and cant find a good name. your: func [offset value] [ if value [value/:offset] ] usage: your 'facet get-style 'field its sometimes more readable IMHO than putting the interesting word far at the end of line. but i find no good name.. any suggestions? |
RebolJohn 12-May-2005 [1066] | Help peoples.. I have the following.. x: [a b c d] foreach y x [ set y make string! {} ] ;make them all empty strings. then I process/append info into the different groups a,b,c,d. Now, I want to write each string/list to a file of the same name. i.e. foreach y x [write to-file join y ".txt" ??GETVALUE?? y] Can someone clue me in on what I do at the ??GETVALUE?? position? Thanks peoples. |
Sunanda 12-May-2005 [1067x2] | foreach y x [print [y get y]] |
... so the missing ??getvalue?? is just get | |
older newer | first last |