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

World: r3wp

[Core] Discuss core issues

Gabriele
1-Nov-2006
[5937x4]
>> s: now/precise duplicates-max blk difference now/precise s
== 0:00:02.062
>> s: now/precise duplicates blk difference now/precise s
== 0:00:00.031
>> length? blk
== 10000
duplicates: func [block /local result value] [
    result: make block! 16
    parse sort copy block [

        any [set value skip some value (append result value) | skip]
    ]
    result
]
mine does not need unique either
on a small block the speed is almost the same (mine a little bit 
faster)
Maxim
1-Nov-2006
[5941]
yes parse was the other solution, I was going to explore.
Gabriele
1-Nov-2006
[5942x2]
i wonder if counting each value would be faster, probably not. sort 
being native helps a lot :)
if blk is already sorted then it's even faster (no copy required 
either)
Maxim
1-Nov-2006
[5944]
indeed, in this situation, parse is much more flexible.
Maxim
2-Nov-2006
[5945]
Gabriele, your solution does not support words! 
duplicates [ a b c ] 
** Script Error: Invalid argument: a
** Where: duplicates
Gabriele
2-Nov-2006
[5946]
where's LITERAL when you need it?
[unknown: 5]
2-Nov-2006
[5947]
Does anyone have any information on what strength or methods that 
ENCLOAK uses?  For example, what bit strength etc, algorithm etc,?
Maxim
2-Nov-2006
[5948]
encloak is not an encryptor, its an obfuscator.
[unknown: 5]
2-Nov-2006
[5949]
you mean like an xor type thing?
Maxim
2-Nov-2006
[5950]
I don't know exactly, but I remember reading that its not a real 
encryption system.
[unknown: 5]
2-Nov-2006
[5951x2]
I had just found something via  search it looked like Carl was question 
about it and answered something along the lines of XOR.  Not sure 
if the function has evolved since then or not.
ok Thanks Maxim.
Allen
2-Nov-2006
[5953]
Encloak  -- http://www.rebol.net/cookbook/recipes/0023.html-- Carl 
says


Newer versions of REBOL include "cloaking" functions for encrypting 
and decrypting strings. These functions do not provide full strength 
encryption such as Blowfish, AES, or RSA as found in REBOL/Command, 
nevertheless they can be useful for hiding passwords and other values. 
(That's why we call it cloaking rather than encrypting.)
Maxim
2-Nov-2006
[5954]
so basically, usefull for hidding data from familly and friends, 
but not from your neighbourhood (or company) hacker  ;-)
Gabriele
3-Nov-2006
[5955]
well, the safety of XOR is the safety of the passphrase. if it is 
random and same length as data, then it's the safest possible. :)
Sunanda
3-Nov-2006
[5956]
There are things stronger than encloak in the Library

http://www.rebol.org/cgi-bin/cgiwrap/rebol/search.r?find=encryption
Louis
3-Nov-2006
[5957x2]
Am I correct is assuming that data is more apt to actually be written 
to disk using write/direct than using write with the direct refinement?
with = without
Anton
3-Nov-2006
[5959]
No, /direct just allows control of rebol's memory buffer. Rebol goes 
out to the host filesystem via host OS API calls. The host filesystem 
may still not actually write the data to disk immediately. To be 
sure of an immediate write, you would flush the disk cache, using 
a mechanism provided by the host OS and filesystem. (eg. in WinXP, 
if you disable one of the harddisks, it flushes the cache, then spins 
the disk down. There must be another way to flush the disk, but I 
never learned that.)
Gabriele
3-Nov-2006
[5960]
in principle, there should be little difference. since write always 
creates a new file, and immediately closes the file port, they should 
basically be the same. I also assume that /append implies /direct 
in some way.
sqlab
4-Nov-2006
[5961]
Since Rambo #3739 is still around, I never use write/append, but 
my own version with open/seek.
Louis
4-Nov-2006
[5962]
Anton and Gabriele, thanks.
Graham
4-Nov-2006
[5963]
>> age: 28-Dec-1923
== 28-Dec-1923
>> difference now age
** Math Error: Math or number overflow
** Near: difference now age
PeterWood
4-Nov-2006
[5964x3]
It appears to be a problem with the +-50 year window around the current 
year which Rebol uses to assign the century to two-digit years:

>> date-of-birth: 28-dec-1923
== 28-Dec-1923
>> age: func [dob [Date!] /local cutoff] [
[    cutoff: now
[    cutoff/year: cutoff/year - 50
[    either dob < cutoff [
[        return (now - cutoff) + ((cutoff - 1) - dob)][
[        return now - dob]
[    ]
>> age date-of-birth
== 30262
The calculation of the cutoff is not quite correct as on checking 
I found that Rebol sets the 50 year window at the start of the current 
year not from the current date.
>> date-of-birth: 28-dec-1923
== 28-Dec-1923
>> age: func [dob [date!] /local cutoff] [
[    cutoff: 1-1-06
[    cutoff/year: now/year - 50
[    either dob < cutoff
[    [return (now - cutoff) + ((cutoff - 1) - dob)]
[    [return now -dob]
[    ]
>> age date-of-birth
== 30262
Graham
4-Nov-2006
[5967]
should this be rambo'd ?
Anton
5-Nov-2006
[5968]
If not in Rambo already, yes.
Gabriele
5-Nov-2006
[5969x5]
graham, i think the problem there is that time! values cannot hold 
that much hours.
>> now - 28-dec-1923
== 30263
(days)
>> difference now 1-nov-1938
== 596192:12:37
there's probably not much more room than some 600k hours.
Gregg
5-Nov-2006
[5974]
When I did a date-to-epoch func, I used ATTEMPT with DIFFERENCE and, 
if that failed, used subtraction to get the number of days, then 
multiplied by 86400.0.
Maxim
5-Nov-2006
[5975]
time fot 64 bits ints.... and people asked... do we need them?
Gregg
6-Nov-2006
[5976]
I'm not sure this issue means we need 64-bit ints.
Maxim
7-Nov-2006
[5977]
by all accounts, time is expressed in seconds internally .  and guess 
what! 600000 hours is 2.16 Gs..  just above 2^31 (2.14 Gs)..   so 
if we had 64 bits, then we could hold the date and calculate it with 
other values.
Anton
7-Nov-2006
[5978]
now/precise
Maxim
7-Nov-2006
[5979]
precise add floating point sub seconds.
Anton
7-Nov-2006
[5980]
I think the minimum time unit is milliseconds - thousandths of a 
second.
Geomol
7-Nov-2006
[5981]
Is time quantisized? ;-)

Anton, that might be right under Windows. I think, under UNIX (Linux, 
OS X, etc.) the minimum time unit is less than that. Under OS X:
>> now/time/precise
== 17:28:10.349125
Anton
7-Nov-2006
[5982]
That's interesting. I don't know about OS X, but that *could* be 
just the rebol OS X beta molding of the seconds floating point number.
Ladislav
7-Nov-2006
[5983]
time really is quantized depending on the OS. XP SP 2 has got a bigger 
quantum than XP SP 1, which was 10 milliseconds IIRC
Pekr
7-Nov-2006
[5984]
Linux has much more precise timer (or it just simply returns more 
digits for now/time/precise)
Ladislav
7-Nov-2006
[5985]
not just more digits, it has got a "lower basic quantum" too
Gregg
7-Nov-2006
[5986]
Max, what I mean is that this isn't a showstopper. Adding 64-bit 
ints for this case doesn't seem worth it. There are other, more important, 
reasons to go there; I just don't think this issue is that important.