World: r3wp
[Core] Discuss core issues
older newer | first last |
Graham 26-Mar-2010 [16176] | I won't be able to grab the PID without some Windows API I guess |
Steeve 26-Mar-2010 [16177x4] | you don't necessarly need of the PID. On which OS are you running your apps ? |
oh windows ! | |
if it's to kill the processes, then you got this command http://www.tech-recipes.com/rx/446/xp_kill_windows_process_command_line_taskkill/ | |
very versatil | |
Graham 26-Mar-2010 [16181] | Windows 2003 and 2008 |
Steeve 26-Mar-2010 [16182x2] | you should have the same, no ? |
I mean, to be able to kill a process just with its name | |
Graham 26-Mar-2010 [16184x2] | except I am running multiple processes with the same name |
I really only need to remove a process if it has died ... and is sitting at the rebol error message | |
Steeve 26-Mar-2010 [16186] | just rename the exe |
BrianH 27-Mar-2010 [16187] | Sysinternals has better ps utilities, which can do a better job of killing process if need be. |
Rebolek 31-Mar-2010 [16188] | I need to do something like this: >> a: context [b: context [c:1]] >> get in a 'b/c == 1 Is there some way to do this? |
Pekr 31-Mar-2010 [16189] | the only chanined solution which comes to my mind is: get in get in a 'b 'c |
Steeve 31-Mar-2010 [16190x2] | having, >> to-path [a b c] == a/b/c you can get it with: >> do to-path append [a] 'b/c == 1 |
>> do head clear change change '_/_ 'a 'b/c == 1 | |
Rebolek 31-Mar-2010 [16192] | Pekr: that's what I need to avoid. |
Ladislav 31-Mar-2010 [16193x2] | >> a: context [b: context [c: 1]] >> do bind [b/c] a == 1 |
is that more like what you want? | |
Steeve 31-Mar-2010 [16195] | haha, you won |
Rebolek 31-Mar-2010 [16196] | Ladislav, exactly! Thanks |
Pekr 31-Mar-2010 [16197] | my line of thoughts was .... hmm, I would somehow have to bind b/c into 'a's context, but .... then I never know, how to use bind :-) Cool solutions, both from Ladislav and Steeve .... |
Ladislav 31-Mar-2010 [16198] | Actually, Pekr, your solution has to be used in some cases in R2, since the support for get-paths is missing |
Pekr 31-Mar-2010 [16199] | I don't know much about it, I just remember that path evaluation has changed with some R2 version - from more to less "aggressive" ... does it for e.g. mean, that with earlier versions of R2, it was possible? |
Rebolek 31-Mar-2010 [16200] | Ok, so now let's make it bit more complicated :) I have the a object and for example >> p: make path! [b c] and I need something like >> do bind [p] a == 1 |
Pekr 31-Mar-2010 [16201] | do bind reduce [p] a |
Steeve 31-Mar-2010 [16202] | or, >> do head insert p 'a |
Pekr 31-Mar-2010 [16203] | :-) ... amazing :-) |
Rebolek 31-Mar-2010 [16204] | (i'm sorry for such a newbie questions, but I'm ill and my brain refuses to work :-) |
Ladislav 31-Mar-2010 [16205x2] | ...does it for e.g. mean, that with earlier versions of R2, it was possible?... - no, it is possible in R3 |
jdishun (and other fans of named functions) - check http://www.rebol.org/view-script.r?script=named-func.r | |
ChristianE 1-Apr-2010 [16207] | That's nice, finally something to point to when that question comes up again. |
Andreas 1-Apr-2010 [16208x4] | ah, those named functions are brilliant |
maybe we should add special handling to bind so that each function is automatically passed a handle to refer to itself | |
we could call it ..... self! | |
/apr1 | |
Ladislav 2-Apr-2010 [16212] | :-D |
BrianH 2-Apr-2010 [16213] | :) |
Gregg 2-Apr-2010 [16214] | NAMED-FUNC is excellent though. A great REBOL example. Thanks for doing that Ladislav. |
Paul 2-Apr-2010 [16215] | Rebolek couldn't you have done this in your first example: >> a/b/c == 1 |
Steeve 2-Apr-2010 [16216] | No no no. It's again the rules. You have to find the weirdest way. |
Paul 2-Apr-2010 [16217] | Ahhh... |
Ashley 3-Apr-2010 [16218] | Is there is better way to code the following idiom: foreach [from to] [ "&" "&" "<" "<" ">" ">" "^/" "<br>" ][ replace/all string from to ] I'm using this much too frequently for my own liking ;) |
Maxim 3-Apr-2010 [16219x3] | there are faster algorythms, if you are managing very large files, but they require a bit more code and/or use of parse. |
still, replace is pretty fast... I don't know if the parse approach will be faster with only 4 items to replace. | |
then again, if your source string has many of the origin ("from") strings the parse could still be faster... I guess it largely depends on the size and shape of the data you are manipulating. | |
Rebolek 3-Apr-2010 [16222] | Steeve :)) Paul - no. The object is anonymous and I know only the b/c part. |
Gregg 3-Apr-2010 [16223] | Ashley, I've done parse-based REPLACE funcs, and a simple TRANSLATE func, but I haven't generalized and dialected them the way I want to either. This week is busy for me, but if you want to collaborate on something, let me know. I think it would have a lot of value. |
Chris 3-Apr-2010 [16224x2] | I use a variant of this: sanitize: use [chars encode][ chars: complement charset {&<>"} encode: func [txt chr][change/part txt chr 1] func [text [any-string!]][ parse/all copy text [ copy text any [ text: some chars | #"&" (text: encode text "&") :text | #"<" (text: encode text "<") :text | #">" (text: encode text ">") :text | #"^"" (text: encode text """) :text ] ] any [text ""] ] ] Provides a bit of scope for expansion... |
Though it's admittedly bigger... | |
older newer | first last |