World: r3wp
[Core] Discuss core issues
older newer | first last |
Oldes 27-Oct-2007 [8819x3] | which is not correct as well. As it would throw an error if the martker 192 is not found... I should rather use open/seek instead of /direct |
here is correct version using the /seek method... sorry for so many posts: | |
get-JPG-size: func[ "Returns size of JPG image or none on invalid files" jpgfile [file! url!] "File to examine" /local stream bytes height width ][ stream: open/read/binary/seek jpgfile ;seek to jpg image start while [#{FFD8} <> copy/part stream 2][ if tail? stream: skip stream 2 [ ;no Start Of Image marker found close stream return none ] ] stream: skip stream 2 while[not tail? stream][ bytes: copy/part stream 2 stream: skip stream 2 if 255 = bytes/1 [ either 192 = bytes/2 [ stream: skip stream 3 height: to-integer copy/part stream 2 width: to-integer copy/part skip stream 2 2 close stream return as-pair width height ][ stream: skip stream ((to integer! copy/part stream 2) - 2) ] ] ] close stream none ] | |
Gregg 28-Oct-2007 [8822] | A few extra posts is no problem when you end up with a nice, useful, working func. :-) |
Will 28-Oct-2007 [8823] | that is fast! thank you Oldes 8) |
Terry 30-Oct-2007 [8824] | How do you get Rebol from popping up 'public' folders everywhere (windows)? |
Oldes 30-Oct-2007 [8825] | I don't understand this question... byt maybe try to look at 'secure |
Henrik 30-Oct-2007 [8826] | terry, I posted a bug report on this once. I don't think you can stop it. |
Ingo 30-Oct-2007 [8827x3] | I'm not sure wether it works as advertised (esp. in all versions), but theoretically there's an option: --noinstall (-i) Do not install (Link, View) (to know about options: use 'usage) |
On thnking about it, I think if you use --noinstall, that's when 'public folders are created everywhere. If you install it, you can define the place where the public folder is to be created, and that's used then. | |
At least that's how it worked the last time for me. | |
Gregg 30-Oct-2007 [8830] | I thought the newer releases stopped doing that. There were a number of builds that did it though. Very annoying. |
Gabriele 30-Oct-2007 [8831] | it has never done it for me, but it has always done it for others. so, it's not clear yet how/when that happens. afaik the code does a make-dir view-root/public so in theory it should always be in view-root not in the cd. |
Graham 30-Oct-2007 [8832] | I thought it only did it when you invoked the viewtop |
Ingo 30-Oct-2007 [8833] | ... or any of the *-thru funcs |
Ashley 30-Oct-2007 [8834x2] | Yes very annoying, I use the following func to clean things up: |
delete-public: func [dir [file!]] [ foreach file read dir [ if #"/" = last file [ attempt [delete-public dir/:file] ] if find [%public/ %Thumbs.db] file [ attempt [delete dir/:file] print dir/:file ] ] ] delete-public %/c/ | |
Ingo 30-Oct-2007 [8836] | Just thinking aloud (I would have to reboot into windows to test it, and I dont't waht to ;-) It it possible to set view-root in rebol.r or user.r ? (You have to try, 'cause handling of these files differs between versions, too) |
Ashley 30-Oct-2007 [8837] | In the above func on a Mac you could replace %Thumbs.db with %.DS_Store ;) |
Terry 2-Nov-2007 [8838x2] | When it comes to decrypting, is it easier to hack an encrypted string if you know part of the string? Ie: If you knew that a stirng always started with keys: [name " could you decrypt it easier? |
just thinking that if you encrypt an object, it probably starts the same for all. | |
Rebolek 2-Nov-2007 [8840] | I need to sort some French words but REBOL's SORT puts accented characters on the end (sorts just by ASCII). Has anybody got some enhanced SORT for French? |
Gabriele 2-Nov-2007 [8841] | terry: it depends a lot on the crypt algorithm used and the length of the key. it surely helps to know any part of the plain text. however, just compression would reduce that a lot (since the result depends on the whole string); also good algorithms are usually smart enough to resist a simple attack like this. |
Sunanda 2-Nov-2007 [8842] | Sorting: you may be able to adapt this hungarian code: http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlMWWJ |
Rebolek 2-Nov-2007 [8843] | thanks Sunanda |
Henrik 3-Nov-2007 [8844x2] | a: make object [ b: make block! [] c: b ] same? a/b a/c == true ; OK d: make a [] same? d/b d/c == false ; how do I get this to be TRUE? |
apparently I need to do it in the spec block, though i had hoped this could be done inside the object to encapsulate that entirely. cleaner code. | |
[unknown: 5] 4-Nov-2007 [8846] | if your just looking for evaluating the value then use equal? instead. |
Ladislav 4-Nov-2007 [8847x2] | Henrik: this may not be what you want, but it works: d: make a [c: b] |
(your problem is, that cloning does not use much "intelligence", in the case of d: make a [], the cloning code just copies both a/b and a/c and therefore it is obvious, that two copies aren't the same block | |
Henrik 4-Nov-2007 [8849x2] | ladislav, yes, that's what I had to come up with. |
paul, d/b and d/c must be the same block, so equal? is not enough. | |
Oldes 8-Nov-2007 [8851] | Is there any script for LZW decompression? |
Allen 8-Nov-2007 [8852] | Oldes. These might help? http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=gunzip.r http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=rebzip.r |
Oldes 9-Nov-2007 [8853] | No.. these are based on zlib compression... I was interested in LZW. Here is just a compression http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=converter.r ... never mind... I don't need it . It was just for fun. |
Graham 10-Nov-2007 [8854x5] | this is puzzling me ... it's a little loop to remove old files |
foreach f read %./ [ if f <> %. [ inf: info? f probe d: inf/date if all [ inf/type = 'file (difference now d) > 1:00:00 ][ attempt [ delete f ] ] ] ] | |
** Script Error: difference expected set1 argument of type: series bitset ** Where: do-boot ** Near: difference now d | |
using 2.5.0.10.1 | |
ok, fixed. updated to latest Rebol for Solaris sparq. | |
Robert 11-Nov-2007 [8859x3] | Is this consistent? I don't think so: >> a: make hash! [] == make hash! [] >> b: make block! [] == [] >> a == make hash! [] >> b == [] >> |
The hash! property shouldn't be returned, instead just an internal flag. | |
I can use hash? to check for it. | |
Henrik 11-Nov-2007 [8862] | well, I think returning the type in the console can be quite useful. if anything, it's block! that's being inconsistent. |
Robert 11-Nov-2007 [8863x2] | In the console yes, but this longer stuff will be returned in code as well. And this makes parsing a bit complex. |
>> reduce [a] == [make hash! []] >> reduce [b] == [[]] >> | |
Henrik 11-Nov-2007 [8865x3] | how? parsing will immediately return whether it's a hash! or a block!. if you need to keep that information, the block of hash! blocks should be serialized first. |
>> type? first reduce [a] == hash! >> type? first reduce [b] == block! | |
>> c: mold/all reduce [a b] == "[#[hash![]] []]" >> load c == [make hash! [] []] >> first load c == make hash! [] >> type? first load c == hash! No information loss. | |
Robert 11-Nov-2007 [8868] | I mean if you provide a reduce [...] to some parse rules and you have a "make hash!..." in the block you need to parse this. Hence, the parse rules change if you use block or hash. |
older newer | first last |