r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Henrik
4-Jan-2009
[11982]
layout compose/deep [button "Hello" with [(load at mold :things 14)]]

Dumb solution, but it works.
Ammon
4-Jan-2009
[11983]
>> third things
== [item-type: something]
>> type? second third things
== word!
>> things/item-type
== something
>> type? things/item-type
== word!
>> type? things/item-type: to lit-word! things/item-type
== lit-word!
>> third things
== [item-type: 'something]
>> type? things/item-type
== lit-word!
Henrik
4-Jan-2009
[11984]
yes
Ammon
4-Jan-2009
[11985]
I vaguely remember some sort of hack I worked with Compose to come 
out with the correct result on item creation but I may very well 
be mistaken.
Gregg
4-Jan-2009
[11986]
I've done the mold+load trick as well Henrik. I've also taken the 
block from THIRD and changed each word type to lit-word.

  change-each w third things [either word? w [to-lit-word w] [w]]
Henrik
4-Jan-2009
[11987]
thanks, Gregg. I'm assuming now there is no truly quick way to do 
this.
Maxim
4-Jan-2009
[11988]
henrik, the trick is to keep them as lit words:

make object! [
    item-type: to-lit-word 'something
]
Graham
5-Jan-2009
[11989]
Have there been any efforts to standardize on IPC methods?
Gregg
5-Jan-2009
[11990]
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).
Pekr
5-Jan-2009
[11991x2]
Graham - what do you mean by IPC? Rebol task to rebol task?
IIRC r3 architecture counts on it, and there should be ipc:// scheme, 
or I think I saw something like that proposed :-)
Graham
5-Jan-2009
[11993]
Yes, rebol process to rebol process
Nicolas
7-Jan-2009
[11994]
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
[11995]
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
Henrik
7-Jan-2009
[11996]
Can anyone explain exactly what random/secure does?
btiffin
7-Jan-2009
[11997]
Does this help?  http://www.rebol.net/cookbook/recipes/0019.html
[unknown: 5]
7-Jan-2009
[11998]
My belief is that  /secure is like /seed except much the algorithm 
is far stronger.than the /seed algorithm.
Henrik
7-Jan-2009
[11999]
what does strength mean here? the number of times between two identical 
outcomes?
[unknown: 5]
7-Jan-2009
[12000]
dunno.
Sunanda
7-Jan-2009
[12001]
/secure provides its own seed. Theoretically, that seed is less guessable 
than the sort of things we are likely to think of in mezzanine code 
-- like time/precise.

But we don't know for sure. All we do know is that with /seed we 
can provide the same seed and get the same series of random values; 
while with /secure if is not so easy.
Graham
7-Jan-2009
[12002]
So, /seed is used for replicating issues ...
Sunanda
7-Jan-2009
[12003]
That's what I use it for, anyway. Try this and see the effect:

loop 5 [random/seed 100 print "start of new series" loop 5 [print 
random 100]]
btiffin
7-Jan-2009
[12004]
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
[12005x2]
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]]
Compared with:

   loop 5 [print "start of new series" loop 5 [print random/secure 100]]
Graham
7-Jan-2009
[12007]
change the seed!
Sunanda
7-Jan-2009
[12008]
Or do not have one when using /secure, and expecting /secure to work!
Graham
7-Jan-2009
[12009x2]
I usually seed with a precise time value
so, random/seed now looks okay to me
Henrik
7-Jan-2009
[12011]
Graham, if you ever (ever) need to do that under win98, you must 
be careful, because time precision is much lower there.
Graham
7-Jan-2009
[12012]
Umm... not sure if my stuff runs under win98!
Henrik
7-Jan-2009
[12013x2]
hence, you can get the same value, if you do it again after 1/10th 
or 1/100th of a second.
just so you know. :-)
Graham
7-Jan-2009
[12015x2]
what do people do to create a UUID?
This is what I am doing .. hope it's okay!


make-uuid: func [ pid ][

    form checksum/secure rejoin [ "" random/secure 10000000 form now/precise 
    pid ]
]

where pid is the id for the customer in the crm
Henrik
7-Jan-2009
[12017]
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
[12018]
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
[12019]
sunanda and when there is a million values?
Graham
7-Jan-2009
[12020]
Hmm... mine is already time based.  I doubt my hard drive IO is faster 
than that!
Henrik
7-Jan-2009
[12021]
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.
Sunanda
7-Jan-2009
[12022]
The question to ask is not:

-- how would I ever get duplicates (you'll easily find that out when 
something goes wrong -- it's called debugging).
Instead ask:
-- how damaging would duplicates be?

If very damaging, then make sure your system is robust -- not simply 
that it looks so.
Graham
7-Jan-2009
[12023]
the only problem arises if the pc clock is set back.
Sunanda
7-Jan-2009
[12024]
Or if the clock gets stuck!
Graham
7-Jan-2009
[12025]
but then I synchronize the user's clock to NIST time at the start 
of the session.
Henrik
7-Jan-2009
[12026]
The only way is to generate a stupid long ID to reduce the likelihood 
of a duplicate by a factor of... astronomical.
Graham
7-Jan-2009
[12027x2]
I know lots of people use UUIDs for database records .. wonder what 
their algorithm is.
I don't .... I use an autoincrementing field ... but think in retrospect 
I should have used UUIDs instead so I can merge databases
Gregg
7-Jan-2009
[12029]
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
[12030x2]
Noticing that many people use two words to time things, I made a 
little timer function.
time: func [s] [
    t: now/time/precise
    if do s [now/time/precise - t]
]