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

World: r3wp

[Core] Discuss core issues

Dockimbel
24-May-2008
[10558]
>> if*: func [cond body][either cond body [[ ]]]
>> a: compose [ (if* 0 > 1 ["b"]) ]
== [ ]
Henrik
24-May-2008
[10559]
>> a: compose [(either 0 > 1 ["b"][])]
== []
[unknown: 5]
24-May-2008
[10560x2]
Does protect work inside an object's context?  For example if i have 
a: context [b: 0]  can I then protect 'b from being changed?
I might be able to figure this out if I take a look at the protect-system.
ChristianE
24-May-2008
[10562]
In cases like this, Robert, I usually use somthing like

>> pass: func [value] [any [value []]]

which makes code somewhat readable

>> a: compose [ (pass if 0 > 1 ["b"]) ]
Dockimbel
24-May-2008
[10563]
Clean and simple solution.
[unknown: 5]
24-May-2008
[10564]
a: compose [(pick [["b"][]] 0 > 1)]
Graham
1-Jun-2008
[10565x2]
If I wish to compute a checksum on an image file, I can do this

checksum read/binary %image.png


but how do I get the same result when I have the image as image data 
?

eg. i: load %image.png

and to compute the checksm on i ?
guess I can't
Henrik
1-Jun-2008
[10567x2]
convert it to binary first
or if you want to avoid loading the image twice:

i: read/binary %image.png
checksum i
i: load i
Graham
1-Jun-2008
[10569]
Since I might be grabbing the image as jpg and then saving it to 
png, I guess I should save it to memory as binary and do the calculation 
that way.
Will
1-Jun-2008
[10570x2]
I use these quite often:

ifs: func [c b][either c [do b][""]] ;like if but return empty string

ifb: func [c b][either c [do b][[]]] ;like if but return empty block
my bad, thanks Dock, I can refactor to
ifs: func [c b][either c b [""]] ;like if but return empty string
ifb: func [c b][either c b [[]]] ;like if but return empty block
so ifs is like your if* 8)
Josh
12-Jun-2008
[10572x2]
Which version of rebol allows for evaluation in paths?  (i.e. block/(1+i): 
"hello" )  Or am I not remembering this correctly?
Nevermind, I think I just had a typo in my code. :)
[unknown: 5]
14-Jun-2008
[10574x4]
What is the limitation on file size that REBOL 7.6 can handle?
I'm assuming there must be a iimit that open/direct can't just mount 
any file size.  I'm assuming that the limitation is roughly 2 Gigs.
I'm also assuming since a port/size is integer! that the file size 
can be no greater than 2099999999 bytes.
Since integers greater than that number cause errors.
[unknown: 5]
16-Jun-2008
[10578]
Ok, I checked for a file size limitation in REBOL but haven't found 
one.  I noticed the documentation for open/direct for example says 
that /direct can be used for files of any size.  I don't see how 
that can be if it is calculating the size as an integer and integer 
has a limitations.
Geomol
16-Jun-2008
[10579]
Largest 32-bit signed int is 2 ** 31 - 1 = 2'147'483'647

If REBOL internally use 32-bit unsigned, it's 2 ** 32 - 1 = 4'294'967'295

If REBOL internally use 64-bit unsigned, it's 2 ** 64 - 1 ca. = 
1.845E+19
[unknown: 5]
16-Jun-2008
[10580]
I'm actually running an experiment now.  I'm going to write a file 
that will attempt to exceed those sizes.
Geomol
16-Jun-2008
[10581x2]
:-) Be sure, you have enough HD space!
The file system might have max-size for files. I remember something 
about 2 or 4GB for some file systems.
Henrik
16-Jun-2008
[10583]
FAT32 is the one with that limit.
Anton
16-Jun-2008
[10584]
Yep, hit it today on FAT32 - 4GB file was produced.
[unknown: 5]
16-Jun-2008
[10585x3]
I'm on NTFS.  I'll post what I find out.
currently still writing a file which is only at 668 Megs at the moment.
Anton, you created a 4GB file using REBOL or was reading one when 
you got the error?
Anton
16-Jun-2008
[10588]
Sorry, not using Rebol, but in Linux, creating a file in a FAT32 
partition.
[unknown: 5]
16-Jun-2008
[10589x3]
ahhh ok.
I was curious because I'm interested in what happens when I hit 2099999999 
size.
Actually a bit larger than that.
Anton
16-Jun-2008
[10592]
I don't know where you got that number from; If I remember correctly 
the first time you can get a problem with rebol file size is at 2 
^ 31 - 1
[unknown: 5]
16-Jun-2008
[10593]
Oh it was a generic range number based on a algorithm I was running. 
 I expect the number to be the 32 bit signed number that John posted.
Anton
16-Jun-2008
[10594]
Maybe it was 2 ^ 31 - your buffer size ?
[unknown: 5]
16-Jun-2008
[10595]
That number I posted is the highest in my algorithm I could hit.
Anton
16-Jun-2008
[10596]
Ok, that makes sense.
Oldes
16-Jun-2008
[10597x2]
p: open/direct/write/new %/k/test.bin

b: make binary! 1000000 insert/dup b #{00} 1000000 i: 0 while [not 
error? try [insert tail p b]][i: i + 1]
created file ower 5GB here... than I stoped it.
[unknown: 5]
16-Jun-2008
[10599]
what OS?
Oldes
16-Jun-2008
[10600]
WIN/ ntfs
[unknown: 5]
16-Jun-2008
[10601x3]
ok cool.
I want to be able to do some probes on the file once I get it to 
size.
on the port rather.
Oldes
16-Jun-2008
[10604]
The problem is with reading anyway
[unknown: 5]
16-Jun-2008
[10605]
You having problem reading that file now?
Oldes
16-Jun-2008
[10606]
But not impossible I guess. Using such a big files is not practical 
imho.
Anton
16-Jun-2008
[10607]
I think it's when you want to seek to a position greater than 2 ^ 
31 - 1