World: r3wp
[Core] Discuss core issues
older newer | first last |
ChristianE 1-Jun-2005 [1169] | Oh, sorry, typo here: should have read DO GET IN OBJECT 'WORD - it's LIT-WORD!, actually. Of course, there *are* differences, e.g. OBJECT/WORD doesn't throw an error if WORD is unset. But I'm uncertain on the exact reason why that idiom is used. |
JaimeVargas 1-Jun-2005 [1170] | Dynamic dispatch of code, if the slot exist. |
ChristianE 1-Jun-2005 [1171] | Still don't get it. Both do-face: func [face value][do get in face 'action face either value [value] [face/data]] do-face: func [face value][face/action face either value [value] [face/data]] seem to work. |
JaimeVargas 1-Jun-2005 [1172x3] | o1: context [ init: [print "Init code for o1"] eval: [print "Eval code for o1"] end: [print "End code for o1"] ] o2: context [ init: [print "Init code for o2"] eval: [print "Eval code for o2"] ] eval-obj: func [obj][ do get in obj 'init do get in obj 'eval do get in obj 'end ] eval-obj o1 eval-obj o2 |
In your example the face may not have an action slot. | |
Therefor throwing an error instead of graceful fail. | |
ChristianE 1-Jun-2005 [1175x2] | Oh, thanks, now it's all clear. I tried with setting WORD to any value I could image, but not with object without WORD. As always, so simple, so obvious! Thanks again. |
Kind of obvious after someone makes it obvious to me, though ;-) | |
JaimeVargas 1-Jun-2005 [1177] | That seems to be the norm with Rebol. But we are so trained to look for complex explanations that we skip the path of less surprise. |
BrianH 1-Jun-2005 [1178] | Plus, the behavior of object/word depends upon what datatype the word is set to and (for some datatypes) which version of REBOL you are running. If WORD is set to a block, OBJECT/WORD is the same as GET IN OBJECT 'WORD, while if WORD is set to a function, or sometimes a path or paren, it means DO GET IN OBJECT 'WORD. By spelling out what you want to do, you won't be as tied to variances in REBOL path evaluation and your code can be more general. |
Gabriele 2-Jun-2005 [1179] | The real reason, most of the times, is what Brian says above: if you want to get a function value instead of evaluating it. |
ChristianE 2-Jun-2005 [1180] | Yes, Gabriele, that's what I supposed it's all about, but since in the places I've seen it, the function weren't used as first class values, but rather evalutated. Jaime pointed me to another reason: the GET IN variant doesn't break if an object doesn't feature the wanted "slot". That really makes sense where code can't be too sure about the objects it handles. Actually, though the guru code I mentioned was some of your changes to the view event- and modal system (I'm still working my way thru it, trying to understand it's pickier details) and other view related code snippets from cyphre, I'd really thought I'd better ask in core group, since it may come down to a more broader misconception of path evalutation I had. I'm happy to see that it's "only" the point Jamie made which I overlooked. |
Gabriele 2-Jun-2005 [1181x4] | yes, the main point is that you are safer, whatever value is in the object. note that if the word is not available just using get in will break anyway in "older" versions. |
>> system/version == 1.2.8.3.1 >> obj: context [a: 1 b: 2] >> get in obj 'c ** Script Error: get expected word argument of type: any-word ** Near: get in obj 'c | |
recent versions will not complain in this case (GET accepts NONE too) | |
i think in the VID case, the code is written that way so that it works correclty not only if face/action is a function, but also if it is a block (as it was in earlier versions of VID) | |
Guest 5-Jun-2005 [1185] | http: -> Circular forwarding is there any stable solution yet to avoid endless loops ? have tried to set different flaggs within the schemes object but can't stop den endless loop. even read the messages-boards and found some hints but these doesn't work either. is there no flagg to set to prevend forwarding ? any hint are welcome... thanks |
Gabriele 5-Jun-2005 [1186] | can you check port/locals/list? what do you get there? |
Guest 5-Jun-2005 [1187] | hi gabriele, thx for reply. if I open the port, the loop instant apears. the only way to stop is to press escape... after this the port has no value. |
Micha 5-Jun-2005 [1188x8] | rebol [ title: "SOCKS SERWER" ] conn: make port! tcp://:800 proxy: make object! [ host: 208.59.117.69 port: 2988 ] black-lista: [ 69.64.51.223 194.69.207.145 80.252.0.145 194.69.207.165 217.73.17.115] adns: open/no-wait make port! dns:///async adns/awake: func [port /local data][ data: copy port print data false ] insert tail system/ports/wait-list adns heandler: func [ port /local data dns serwer client] [ serwer: first port wait serwer data: copy serwer ;data: make string! 10000 ;read-io serwer data 10000 print ["data1" to-binary data] dns: to-tuple copy/part skip to-binary data 4 4 insert adns dns ;print dns name either find black-lista dns [ close serwer print "firtled" print read join dns:// dns ] [ print "new connetion" insert serwer join #{005A} [debase/base skip to-hex serwer/port-id 4 16 to-binary dns ] client: make port! [ scheme: 'tcp host: system/words/proxy/host port-id: system/words/proxy/port ] ;insert tail system/ports/timeout-list client open/no-wait/binary/async/direct client :response client/sub-port: serwer insert tail system/ports/wait-list client client/date: data serwer/sub-port: client serwer/awake: :request ] false ] request: func [ port /local data f ] [ data: make string! 10000 read-io port data 10000 if f: find data "GET /favicon.ico" [ insert port "HTTP/1.1 404 Not Found" print "favicon.ico"] either (data <> {}) and not f [ print [ "data3" data ] if error? try [ write-io port/sub-port data length? data ][ print "error: close serwer"] ; insert port/sub-port data ] [ close port remove find system/ports/wait-list port port close port/sub-port remove find system/ports/wait-list port/sub-port port/sub-port print "close connetion client" print length? system/ports/wait-list ] false] response: func [ port e a /local data f ] [ switch e [ open [ insert port port/date ] read [ data: copy/part port a either ( a <> 8 ) [write-io port/sub-port data length? data] [ insert tail system/ports/wait-list port/sub-port ] ] close [ close port remove find system/ports/wait-list port port close port/sub-port remove find system/ports/wait-list port/sub-port port/sub-port print "close connetion serwer" print length? system/ports/wait-list] ] ] start: func [] [ conn: make port! tcp://:800 conn/awake: :heandler set-modes conn [no-wait: false] insert tail system/ports/wait-list conn open/no-wait/direct/binary conn ] stop: func [][ close conn remove find system/ports/wait-list conn] set-proxy: func [ h p ] [ proxy/host: h proxy/port: p ] print "proxy" lay: layout [ backdrop blue across h3 red "PROXY" f: field 145 return button green "start" [ p: parse f/text ":" remove find p "" set-proxy to-tuple p/1 to-integer p/2 source p start] button green "stop" [f/text: "" stop ] ] view/offset lay 4x29 halt |
I ask about help . | |
to improve someone this programme maybe ? | |
in order to he was better . | |
jak napisaæ serwer tunel : client - socks - http proxy - serwer ? | |
how to write server tunnel : client - socks - http proxy - server ? | |
1. firefox connet socks serwer . 2. socks serwer connett proxy serwer . 3. proxy serwer connet internet | |
to pass someone code of such application maybe ? | |
Gabriele 6-Jun-2005 [1196x2] | Guest: you can try: port: make port! http://yoururlopen port (after pressing esc you can access port/locals/list) |
otherwise, just try with trace/net on. you'll get a lot of output but surely the answer will be there somehow. | |
Ammon 6-Jun-2005 [1198] | Does anyone else find the fact that encloak/decloak CHANGES the 'data value passed to them confusing? It sure has caused me quite a bit of headache! |
Vincent 6-Jun-2005 [1199] | encloak/decloak : I think it's a good thing for security. You don't want having both encrypted and unencrypted data in memory. Modifying the data assure that the unencrypted string isn't available anymore (if you don't explicitly copy it.) |
Ammon 6-Jun-2005 [1200] | Ah, I see. That makes sense. |
Sunanda 6-Jun-2005 [1201] | And it works the same way as replace or uppercase -- directly on the data. |
Guest 6-Jun-2005 [1202] | rebol newby needs pop script to delete 1000 bounces from mailer daemon (was spam attacked) need to be able to delete emails based on subject or from to pattern. Thanks for any pointers or direction to sample script |
Graham 6-Jun-2005 [1203x3] | the problem with the standard rebol pop protocol is that it doesn't allow you to download the headers only. |
DideC has a script somewhere that allows you to examine your mail box and delete selected email. I do too, but mine is part of a larger anti-spam package. | |
http://membres.lycos.fr/didec/rebsite/delete-emails/delete-emails3.0.0.html | |
Guest 7-Jun-2005 [1206] | thanks Graham. this looks pretty neat . i may be able to use some of this code. i just need a simple script that connects to pop, loops through emails and checks each one for pattern in subject and deletes it if it matches. thanks again. |
Graham 7-Jun-2005 [1207x2] | your're welcome guest |
In most cases, where some spam has been bounced back to you as the account does not exist, the first line of the email says something like Return-Path: <> The <> is a special null email address to stop mail loops. So, if you check all your email for this first line, then you should be able to delete all the automated bounces. | |
yeksoon 10-Jun-2005 [1209] | what is the correct way to handle vector arithmeitc? Or rather, is there an easy way to show vector arithmetic eg. 2 * [2, 3, 4] .... results should be [6, 8, 10] |
MikeL 10-Jun-2005 [1210] | You could use Andrew Martin's map function to achieve this do http://www.rebol.org/library/scripts-download/arguments.r; Needs do http://www.rebol.org/library/scripts-download/map.r; Instantiate map func [a][2 * a] [1 2 3 4 5 6] ; supply the function to map >>[2 4 6 8 10 12] |
Gregg 10-Jun-2005 [1211] | You might also check out Ladislav's matrix functions: http://www.fm.vslib.cz/~ladislav/rebol/#section-6 |
MichaelAppelmans 11-Jun-2005 [1212x4] | trying to open a pop mailbox with nonstandard password with the following code: |
REBOL [] mailbox: open [ scheme: 'pop user: "myname" pass: "%$100k" host: "mydomain.com" ] foreach message mailbox [ print message ask "Next? " ] close mail | |
I get the following error when I do this: ** Script Error: foreach expected data argument of type: series ** Near: foreach message mailbox [ print message ask "Next? " ] close | |
this is from a simple example in the script library with the only modification being an open block instead of a single line open. Thanks for any insight. | |
Graham 11-Jun-2005 [1216x2] | that would happen if mailbox = none |
try print type? mailbox before you use the foreach | |
MichaelAppelmans 11-Jun-2005 [1218] | thanks Graham, I get " type has no value" does this mean that rebol is unable to open this pop account? I know my domain, user and pwd are correct |
older newer | first last |