• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp5907
r3wp58701
total:64608

results window for this page: [start: 39201 end: 39300]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
Sunanda:
3-Jan-2009
It would be useful.....Here's a previous discussion that looks at 
various related issues:
http://www.rebol.org/ml-display-thread.r?m=rmlDMBC
[unknown: 5]:
3-Jan-2009
That is somewhat simliar but that sounds like you were interested 
in executing any script code in a sandbox.  What I'm doing is allowing 
all other values to be reduced except allowed functions and natives.
btiffin:
3-Jan-2009
I think Maxim mentioned that he had done a lot of work when he sandboxed 
Elixir.  I didn't study enough of the magic Elixir to know how he 
pulled it off, but if it's Max, it's good and ahead of it's time.
[unknown: 5]:
3-Jan-2009
For example, my function will take a series and if anything in it 
is a function or native then it will change that word to a literal 
so that it is then seen as a value.
[unknown: 5]:
3-Jan-2009
Yeah Brian, that is what would be nice to have.  But not just an 
exclusion but also a type!  such as Reduce/exclude [delete %somefile] 
[function!]
Chris:
3-Jan-2009
Sounds like you need a 'map function.  Psuedo-example:

	map my-block func [val][
		either word? val [
			either any-function? get val [val][get val]
		][
			val
		]
	]
BrianH:
3-Jan-2009
A whitelist is easier to implement in R2. You create an object that 
has all of the legit functions assigned to fields, then load the 
block unbound (to-block of its string representation), then bind 
the block to the legit object. All other function references will 
be unbound in the block. Be really careful when choosing your legit 
functions - you might need to make safe equivalents for some.
BrianH:
3-Jan-2009
Chris, you missed that being able to screen for "bad" functions is 
what Paul is trying to do. It is much easier to maintain a whitelist 
than a blacklist, and easier to implement in R2 as well.
Henrik:
4-Jan-2009
I want to use the body of an object in a VID layout block, but words 
are not lit:

things: make object! [item-type: 'something]

layout compose/deep [button "Hello" with [(things)]]

When words are not lit, the layout process goes wrong, because:

>> probe things
make object! [
    item-type: 'something ; yes
]
>> third things
== [item-type: something] ; no!

How do I get lit words there?
Gregg:
5-Jan-2009
Not that I'm aware of, other than me bugging Carl about it. I've 
used a number of different methods myself (files, local TCP ports, 
tuplespace).
Nicolas:
7-Jan-2009
are rebol's words stored as a linked list? also, where are rebol's 
datatypes stored? is there a value in front of every value that is 
the datatype? is the datastructure stored in a separate place to 
the values themselves? how does it work?
Sunanda:
7-Jan-2009
No one is really saying, Nick. It's a part of the implementation 
that may change at any time.

Some clues have surfaced over the years in discussions about "slots" 
(search for [REBOL slots] for more links:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlKVVC
btiffin:
7-Jan-2009
Well, wait, the cookbook example from Carl starts with a   random/seed 
now   before calling the random/secure code.  So I'm confused.
Sunanda:
7-Jan-2009
I think that may be so he can later _remove_ the /seed and have secure 
numbers once testing is complete.   Look at the *bad* effect of starting 
with a seed in my example:

loop 5 [random/seed 100 print "start of new series" loop 5 [print 
random/secure 100]]
Graham:
7-Jan-2009
I usually seed with a precise time value
Henrik:
7-Jan-2009
hence, you can get the same value, if you do it again after 1/10th 
or 1/100th of a second.
Graham:
7-Jan-2009
what do people do to create a UUID?
Henrik:
7-Jan-2009
I think it's OK. I use:

checksum/secure random to-string now/precise


Never had a duplicate with that, but I would want a fast one for 
performance built into REBOL.
Sunanda:
7-Jan-2009
But, just in case of duplicates, you need to write that to a file.

If the value already exists on that file, try again. Repeat until 
a unique number emerges.
Henrik:
7-Jan-2009
sunanda and when there is a million values?
Henrik:
7-Jan-2009
As an experiment I tried a plain 'checksum on now/precise, because 
I wanted a shorter numeric ID that a user could type in. On 5000 
users there were 3 collisions, so.. no good.
Henrik:
7-Jan-2009
The only way is to generate a stupid long ID to reduce the likelihood 
of a duplicate by a factor of... astronomical.
Gregg:
7-Jan-2009
There are a lot of ways to do it. Some people use the GUID API on 
Windows. Some use a high-low model, kind of like you are by including 
the PID. Combining clock (with setback checking), counter, machine 
info, and a key (like PID), is plenty good.
Nicolas:
7-Jan-2009
Noticing that many people use two words to time things, I made a 
little timer function.
Steeve:
7-Jan-2009
pffff, i give you a medal
btiffin:
7-Jan-2009
Historical?   start (set) and then end (report).    R3 has a dt (delta-time) 
function built in and some other nice profiling words.
Gabriele:
8-Jan-2009
Re: Random: there is some confusion here! /SECURE is *not* an alternative 
to /SEED. You still need a seed as well for both algorithms.
Gabriele:
8-Jan-2009
is a dice "random"?
Henrik:
8-Jan-2009
I would say it is, but I may be asking the wrong thing of randomness, 
namely a minimal risk of collisions.
Gabriele:
8-Jan-2009
what is the probability of getting the same number twice in a row? 
or twice in a sequence of 3 rolls? or twice in a sequence of 100 
rolls?
Gabriele:
8-Jan-2009
the risk of collision depends only on the number of possible outcomes, 
assuming a uniform distribution
Gabriele:
8-Jan-2009
for example, if you had a clock with a precision of 10^-5 seconds, 
and you knew it was impossible to have more than 10000 requests per 
seconds, then you would be fine to just use your clock as your UUID.
Henrik:
8-Jan-2009
I suppose then also if you want a short (6-8 digits) user input ID, 
one you must type in your browser, it's best to use a sequential 
ID accompanied by a passcode.
Henrik:
8-Jan-2009
so there is a sequential part and a random part.
Sunanda:
8-Jan-2009
Generate a random id, then check if is not already issued. If it 
is, try again.
That works for me!

(Though there is the remote risk that my code starts getting slower 
aftre many thousand years of continuous operation, when clashes start 
becoming likely :-)
Maxim:
8-Jan-2009
to generate IDs, I do a nasty infalable trick on mysql.  i insert 
directly, in a uid table.
Geomol:
8-Jan-2009
It's a very cool piece of code, Rebolek! :-)
Steeve:
8-Jan-2009
i noticed that op! functions can't be reduced, is it a bug ? (in 
R2 and even in the R3).
>> do reduce [:add 1 1]
==2
>> do reduce [1 :+ 1]
** Script error: cannot use add on none! value
** Where: applier do
** Near: op! 1
BenBran:
16-Jan-2009
The past few weeks I've had more time to devote to Rebol.  I'm working 
on some typical examples and routines to get aquainted with it.  
So I appreciate all the help I'm getting from this forum.  Currently 
just playing with the delete-dir function.

I'm not able to get this to work....is this even possible.....

in the environment: myPath = C:\myTemp

	myPath: probe get-env "myTemp"

 ....(tried several iterations of code here to fix the path perfectly)
	delete-dir myTemp

also tried reduce 

the path has been refomed to //%/myTemp/, %C/myTemp/,  and several 
others forms.

it says that it expects a dir argument of type: file url
Chris:
19-Jan-2009
There was a script for Rebol->Arexx once called Pipebridge.  Wonder 
if it's applicable to Linux?
btiffin:
19-Jan-2009
Janko; I'm pretty sure a mkfifo named pipe will work; BUT as usual, 
either end borks, the other end hangs.
Janko:
19-Jan-2009
btiffin: I am newbie at linux... you mean I can make a named pipe 
in command line with mkfifo and then rebol uses that as a normal 
filename to write/read from it? Similarly the other language has 
Unix package and can make named pipes by it's own... can rebol create 
pipe too? (sorry if I got it all wrong)
Janko:
19-Jan-2009
about hanging, yes I read that write does not happen untill there 
is a read at the other side and vice versa so I was thinking if there 
is some king of timeout possible..
btiffin:
19-Jan-2009
Well normally fifo files are created in blocking mode, so yeah a 
write won't complete until a read occurs and a read will wait for 
a writer (by default).  I'll be honest, I've not done this from REBOL, 
but with 2.7.6 and LOAD/LIBRARY freed, we can do any libc6 calls 
that we want, so you should be able to set a non blocking mode and 
get true multiple writes and reads that will return empty if no data 
is queued.


For OpenCOBOL I implemented POSIX Message Queues; as MQ_NOTIFY will 
make a callback when the queue goes from empty to non-empty and you 
don't have to worry about spinning on a read.


If you don't mind playing with  make routine!  take a look at mq_open 
and friends (man mq_overview) it might offer more control for IPC.
Janko:
20-Jan-2009
thanks btiffin for such great explanation, yes I was looking at message 
queues too at first but then someone proposed pipes and they do seem 
more accessible/simple to start in a way.
Janko:
20-Jan-2009
Is there any article or blog post about 2.7.6 being able to load 
native libraries? I searched and couldn't find any info on this.. 
I found docs for REBOL/Command/SDK version so this would be a place 
to start experimenting probably
btiffin:
20-Jan-2009
Janko; yep.  It's weird, docs wise, but  make routine!  is a new 
bonus layer that hasn't made it's way to the main documentation. 
 Our good Gregg is a goto guy when it comes to knowing some of the 
foibles invovled.  If you like learning by example http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=capture-screen.r
or http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=capture-screen.r
  There are other examples.
Janko:
20-Jan-2009
oh, great just what I need... I was fixing/modding a sqlite binding 
in factor already
Janko:
20-Jan-2009
so I can compare a little , and I will probably need it also
[unknown: 5]:
21-Jan-2009
>> a: copy []
== []
>> b: 'test
== test
>> append a :b
== [test]
>> type? first a
== word!
>> find a 'test
== [test]
>> c: ['test]
== ['test]
>> find a first c
== none
[unknown: 5]:
21-Jan-2009
Why can I do a find using a lit-word but not get results when using 
the lit word from a block?
[unknown: 5]:
21-Jan-2009
find a 'test works but find a first c doesnt.
[unknown: 5]:
21-Jan-2009
I would have to use find a to-word first c to get a match.
Pekr:
21-Jan-2009
I think it is a bug. But we will probably see gurus trying to find 
an excuse, why sometimes you can't code in REBOL different way than 
to simply try some stuff in console ...
Pekr:
21-Jan-2009
insert as an operation does not preserve datatype. It reduces litword 
to word. Not sure there is a reason to do so ...
[unknown: 5]:
21-Jan-2009
Yeah, that to me would be a bug.
Henrik:
21-Jan-2009
>> append [] to-lit-word 'a
== ['a]
[unknown: 5]:
21-Jan-2009
Yeah Henrik but that is a workaround really.
[unknown: 5]:
21-Jan-2009
the 'a was already a lit-word to begin with.
Henrik:
21-Jan-2009
I'm not defending it, just trying to come up with a theory.
Pekr:
21-Jan-2009
... but yes, REBOL is dynamic, so it might be a problem, to have 
all cases working as expected ...
[unknown: 5]:
21-Jan-2009
But to me Henrik the append or insert should be able to look at the 
argument and see it is already a lit-word and append it as such.
Henrik:
21-Jan-2009
I was going to write something clever about that, but I think trying 
to fit such a change in has some pretty big ramifications for how 
words are used in REBOL. :-)
BrianH:
21-Jan-2009
It's not the insert that changes the litword to a word, it is the 
initial evaluation of the litword. By the time insert sees it it's 
already a word.
[unknown: 5]:
21-Jan-2009
But couldn't insert be modified to see that it is appending a lit 
word to a block and make the appropriate modification?
BrianH:
21-Jan-2009
INSERT wasn't appending a lit-word, it was appending a word. DO converted 
the lit-word to a word, not INSERT.
[unknown: 5]:
21-Jan-2009
In the example, I gave I showed that b was a lit-word being appended 
to a.
[unknown: 5]:
21-Jan-2009
But I already get the idea.  That the idea is that it it is now a 
word and  not a lit-word!
BrianH:
21-Jan-2009
No, it was an expression of the words append and a and a lit-word 
'b. DO evaluated the expression, and while doing so evaluated the 
'b to create b. Then it passed the b to the function referenced by 
the word append.
[unknown: 5]:
21-Jan-2009
Back to this issue, I checked replace and it doesn't support replacing 
word! in a block with lit-words.
BrianH:
21-Jan-2009
Code? A lit-word is an active value, like a function. You need to 
use get-word references if they are assigned to variables, or to-lit-word 
if they are literal in a place where they will be evaluated.
[unknown: 5]:
21-Jan-2009
Not an issue really.  Good think about REBOL is you can usually find 
a workaround.
[unknown: 5]:
21-Jan-2009
I just noticed this group is web-public.  Shouldn't this be a bit 
more closed as often bugs and such are discussed here.
Sunanda:
21-Jan-2009
Given RAMBO, the R2 bug database, is web available it should not 
be too much of a problem:
http://www.rebol.net/cgi-bin/rambo.r
[unknown: 5]:
21-Jan-2009
I think what Brian is saying is that it isn't a bug issue.  Just 
a gotcha.
BrianH:
21-Jan-2009
I make it a point to not discuss bugs with security implications 
in web-public groups. Otherwise it is better to let people know.
BrianH:
21-Jan-2009
BACKPORTS! Hot off the presses! Get your new R3 functions, now here 
for R2! Available now, before the next release!

funct: make function! [
    [catch]
    "Defines a user function assuming all set-words are locals."

    spec [block!] "Help string (opt) followed by arg words (and opt type 
    and string)"
    body [block!] "The body block of the function"
    /local r ws wb a
][
    spec: copy/deep spec
    body: copy/deep body
    ws: make block! length? spec
    parse spec [any [

        set a [word! | refinement!] (insert tail ws to-word a) | skip
    ]]
    wb: copy ws
    parse body r: [any [
        set a set-word! (
            unless find wb a: to-word a [insert tail wb a]
        ) |
        hash! | into r | skip
    ]]
    unless empty? wb: difference ws wb [
        remove find wb 'local
        unless find spec /local [insert tail spec /local]
        insert tail spec wb
    ]
    throw-on-error [make function! spec body]
]

functor: make function! [
    [catch]

    "Defines a user function with all set-words collected into a persistent 
    object (self)."

    spec [block!] "Help string (opt) followed by arg words (and opt type 
    and string)"
    body [block!] "The body block of the function"
    /local r wb a

][ ; Note: Words in the spec override the bindings of the object 
words.
    wb: copy []
    parse body r: [any [
        set a set-word! (unless find wb a [insert tail wb a]) |
        hash! | into r | skip
    ]]
    remove find wb [self:]

    throw-on-error [make function! copy/deep spec  bind/copy body construct 
    wb]
]
BrianH:
21-Jan-2009
*TARD indeed, because such a function wouldn't be able to call external 
functions, not even DO :)
BrianH:
21-Jan-2009
They are declared as code blocks in R3, not functions, and then turned 
into functions using a fixed spec and FUNCT. Safer that way.
Janko:
22-Jan-2009
>> b: 'test   ;; line gets evaluated , b already holds a word!
== test
>> append a :b  ;; word get's added to serries
== [test]
>> type? first a
== word!

>> find a 'test  ;; 'test get's evaluated into a word again so find 
finds it in block
== [test]

>> c: ['test]      ;; 'test is in a block and of course doesn't get 
evaluated as any other thing in a block wouldn't so it stays lit-word!
== ['test]
Janko:
22-Jan-2009
if you want a block to get evalueated you should reduce it, then 
it will also find it
Janko:
22-Jan-2009
BrianH and others : you made such great word (and ported it to mezzaine 
- I still have no idea what that is :) ) of the word map (as in functional 
programming ) ... did you maybe or is there any chance that its sister 
function reduce or fold or fold-left could be made in such a way.. 
I use your map a lot now but I have to use my poor fold word for 
folds :)
Will:
24-Jan-2009
on OS X and Linux, for every instance of rebol , 2 processes are 
launched, the second for dns, right? is there any known bug? I have 
an difficult to debug situation , when quitting cheyenne after some 
load, some handler process goes 100% cpu, but the dns process is 
no more there, this make me think it may be a problem with rebol, 
otherwise also if one process would go 100% CPU, the dns one would 
still be present, help!! 8)
Will:
25-Jan-2009
got a partial answer from here http://www.rebol.net/cgi-bin/rambo.r?id=4113
is that window specific?
Will:
25-Jan-2009
both bugs have window as platform but I'm investigating a similar 
issue to 4153 on os x
Will:
25-Jan-2009
-qs, the problem is when doing a ctrl-c on running cheyenne (not 
always, mostly after some load) traying hard to have a 100% repoducible 
code but nothing yet, hard
Will:
25-Jan-2009
sorry I may have been more clear, the code is in uni-engine.r, this 
line:

call/show join form to-local-file system/options/boot [" -qs " cmd]
not in a RSP, and not sure at all the problem is with call... 8/
Oldes:
25-Jan-2009
the above is not in RSP either.. it's as a cgi script. Cheyenne is 
not only RSP:)
Will:
25-Jan-2009
ok, thank you, now I need a guru with some tips on how to track down 
the issue.
BrianH:
25-Jan-2009
More backports: AJOIN

ajoin: func [
    "Joins a block of values into a new string."
    block [block!]
] [
    head insert copy "" reduce block
]


AJOIN is native in R3 and doesn't generate an intermediate block 
(it reduces in place), but even in R2 it has advantages:

- It always returns a string, no matter what the type of the first 
value in the block is.
- It is faster than REJOIN.
[unknown: 5]:
25-Jan-2009
Might change the description a bit to say that is reduces the block. 
 "Reduces a block of values and joins them into a new string."  Reducing 
is a security concern so we might want to ensure whoever uses the 
function is aware of this.
BrianH:
25-Jan-2009
Since that is the doc comment of the R3 version I will submit that 
concern as a trouble ticket in CureCode.
Dockimbel:
25-Jan-2009
Brian, in AJOIN, why not prefer the use of [make string! 0] instead 
of [copy ""] so that REBOL don't need to allocate a literal string 
to be used only as a prototype? That would reduce memory usage by 
one string buffer allocation.
Dockimbel:
25-Jan-2009
I guess that memory usage is a high concern in mezzanines.
BrianH:
25-Jan-2009
COPY "" is faster than MAKE STRING! 0 (amazingly enough), and you 
don't have to allocate a literal "" every time, just once at LOAD 
time
BrianH:
25-Jan-2009
Speed is a bigger concern for mezzanines, but there has to be a balance. 
We are doing more advanced tricks in R3 to increase speed and reduce 
memory overhead, but R2 is in bugfix and backport only mode right 
now.
DideC:
26-Jan-2009
In R3  (R2 is a very small bit faster, but I guess its related to 
the console) :

>> t: now/time/precise loop 1000000 [copy ""] print [t - now/time/precise]
-0:00:00.203

>> t: now/time/precise loop 1000000 [make string! 0] print [t - now/time/precise]
-0:00:00.25
DideC:
26-Jan-2009
Not a big difference if you consider 1'000'000 loop !
Oldes:
26-Jan-2009
I'm using this version:
ajoin: func [

    {Faster way how to create string from a block (in R3 it's native!)}
    block [block!]
][to string! reduce block]
[unknown: 5]:
26-Jan-2009
There might be a reason why Brian didn't go that route.
39201 / 6460812345...391392[393] 394395...643644645646647