
| # | User | Message | Date |
| 10746 | james_nak | Janeks, Dockimbel recently put some code in the MySql group regarding how to check for Mysql port being opened. | Wed 15:31 |
| 10745 | Gregg | There's no official way. I think DocKimbel had a value in flags or state that he said worked. If he doesn't jump in, I'll dig for it. | Wed 8:51 |
| 10744 | Janeks | What is the right way to check is port (ODBC, mySQL) open? Is it a-port/port-id ? | Wed 6:02 |
| 10743 | Graham | Ok, sussed it out .. the compare can be an integer offset | Tue 10:39 |
| 10742 | Graham | Looks like the comparator function takes two arguments ... which are the first of each set | Tue 10:22 |
| 10741 | Graham | Anyone know how to use sort on some data where eg. skip value is 10 and you want to sort of anything but the first element? | Tue 10:20 |
| 10740 | Gregg | Alan Dechert <dechert@gmail.com> asked the same thing on the ML earlier this month. Maybe the two of you can collaborate on a solution. If you could enhance SEND to allow it, maybe with a new refinement, we can try to get Carl to make it the standard. | Mon 15:35 |
| 10739 | Janeks | O'k. But how to put Content -ID into message part? | Mon 10:31 |
| 10738 | Graham | the send/attach can generate the multipart components for you. | Mon 10:04 |
| 10737 | Janeks | I am working on sript, that composes and sends html e-mail.
It is rather simple, but now I would like that e-mail will contain inline images.
I found out that they are multipart messages, and that image is referenced with cid in html image and in image part it is marked as Content-ID: </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3D"Courier New" size=3D2></FONT><IMG height=3D47=20 src=3D"cid:26DB76551F2E4591BBC3B599C3A7CCAE" width=3D320></DIV> <DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV> </BODY></HTML> ------=_NextPart_001_00A9_01C8DAAB.A817E460-- ------=_NextPart_000_00A8_01C8DAAB.A817E460 Content-Type: image/bmp; name="ML.bmp" Content-Transfer-Encoding: base64 Content-ID: <26DB76551F2E4591BBC3B599C3A7CCAE> Qk22vQEAAAAAADYAAAAoAAAADwIAAEgAAAABABgAAAAAAIC9AQDEDgAAxA4AAAAAAAAAAAAA//// //////////////////////////////////////////////////////////////////////////// How to implement such html e-mail generation in rebol script? | Mon 9:43 |
| 10736 | Chris | You could use 'foreach which'd be fast, but then you'd have to block! your case as well as your fallback losing readability. | Sun 1:37 |
| 10735 | Chris | Indeed 'all would be fastest yet, except you don't get feedback at the point of failure. | Sun 1:35 |
| 10734 | Chris | Readability. I want it to be fast, of course, but long-term it's not worth the compromise. I want to do more with less. | Sun 0:38 |
| 10733 | Graham | If it's a time critical app like a web server I'd go for speed ... | Sat 22:55 |
| 10732 | Graham | Should one go for speed or readability? | Sat 22:52 |
| 10731 | Paul | Chris - 'case is native so even adding a 'not statement is going to be faster solution I think. | Sat 22:16 |
| 10730 | Henrik | well, I tried a single line of code with it, and it didn't do what I wanted. I guess I could ask myself if I would write that kind of code today. :-) | Sat 22:08 |
| 10729 | Chris | I get that -- a sign of personal progress, perhaps? | Sat 21:59 |
| 10728 | Henrik | sorry, it does not work very well. I think I would build a new one from scratch if I needed it again. | Sat 21:53 |
| 10727 | Henrik | found it, but I remember it being more elegant than the code I found here... | Sat 21:47 |
| 10726 | Chris | I'm curious re. approach, expression and naming... | Sat 21:17 |
| 10725 | Henrik | Chris, I guess it could work. | Sat 21:16 |
| 10724 | Chris | That is, I have a series of tests, each requiring a case for failure... | Sat 21:13 |
| 10723 | Chris | H: is this the type of problem you were addressing? | Sat 21:12 |
| 10722 | Chris | Graham, I'm still pondering naming. 'assert seems to evoke unit tests, that's not what this is. 'all-nots doesn't quite get the essence either. 'all-else is a possibility? Until then, I still lean toward 'assert-all. | Sat 21:11 |
| 10721 | Henrik | I had a function that does this a while ago, but I have to dig it up | Sat 21:10 |
| 10720 | Chris | Henrik, how does your scenario differ? Do you have a sample of your solution at work? | Sat 21:09 |
| 10719 | Chris | Paul: it's a common enough pattern, I'd like to find the most appropriate way to express it. Actually, that's the principle behind QM (which of course, this is intended for). The alternative case above would be: case [ not a < 10 [print "a is more than 10"] not result: a > 0 [print "a is less than 0"] ] result Requires a 'not statement for each test, requires an extra word to track the result and does not return a meaningful value. Consider this: if assert-all [ user/has-role? 'editor [make error! "You do not have required permission"] article: get-param 'article [redirect-to %/articles/create] 10'000 < length? article [make error! "Article is too long"] ][ save %article.txt article redirect-to %/articles/list ] | Sat 21:07 |
| 10718 | Graham | all-nots ? | Sat 20:24 |
| 10717 | Henrik | although I've recently switched to state machines for that kind of code. | Sat 20:18 |
| 10716 | Henrik | I would like to see a good implementation of a function that performs a sequence of code blocks. If a code block is good, the next one is run. If the code block causes an error, a secondary code block that is either generic for all code blocks or specific to that particular code block is run. I'm thinking step-by-step code that either runs successfully or causes a generic or specific error. I don't know if it makes sense to do that, but I sometimes miss that if I need to do something with user friendly network connectivity. | Sat 20:16 |
| 10715 | Paul | Why would we need that as opposed to just changing the current evaluation of existing case? | Sat 20:12 |
| 10714 | Chris | Usage: assert-all [ a < 10 [print "a is more than 10"] a > 0 [print "a is less than 0"] ] It's the opposite of 'case really. If any of the cases are false, the related block is evaluated and the function returns none/false. If all cases are true, it returns the value of the last successful case. | Sat 18:58 |
| 10713 | Chris | ; request for comments -- assert-all: func [cases [block!] /local value][ until [ set [value cases] do/next cases unless value cases/1 cases: next cases any [not value tail? cases] ] value ] | Sat 18:48 |
| 10712 | Paul | I went into the registry and found the reference to rebview and deleted its registry keys and reassociated the .r extension with the rebol/view 2.7.6 product. | 23-Jun 14:11 |
| 10711 | Paul | Fixed it. | 23-Jun 14:08 |
| 10710 | Paul | It appears to see a broken path and sees the rest of the path as an argument. Not sure where it is checking yet to get this information. | 23-Jun 14:06 |
| 10709 | Paul | I have reassociated my scripts in windows with the new 2.7.6 core but I now get an error whenever I attempt to open them which is: ** Access Error: Cannot open /C/Documents ** Near: do/args script system/script/args Any ideas? | 23-Jun 14:02 |
| 10708 | PeterWood | There is a lot of information about Rebol's memory usage in the mailing list archive. You culd start here: http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-topic-index.r?i=memory | 22-Jun 7:07 |
| 10707 | Henrik | interesting, dockimbel. thanks. | 22-Jun 7:02 |
| 10706 | Paul | These are the kinda things I wish Carl would go over so we can best optimize our use of memory. | 22-Jun 1:47 |
| 10705 | Paul | I know that in a string each character represents a byte but even then how much overhead is allocated merely by a: make string! 0? | 22-Jun 1:46 |
| 10704 | Paul | I know we can initilize the block with for example: a: make block! 10 But how do we determine what is in the block comprises a byte? | 22-Jun 1:46 |
| 10703 | Paul | So how to we define those things in a block? | 22-Jun 1:45 |
| 10702 | Paul | I that in the following the 10 represents 10 "bytes"? a: make string! 10 | 22-Jun 1:44 |
| 10701 | Paul | Let's talk memory... | 22-Jun 1:43 |
| 10700 | Dockimbel | >> a: make list! [1 2 3 4 5] == make list! [1 2 3 4 5] >> b: at a 3 == make list! [3 4 5] >> a == make list! [1 2 3 4 5] >> b == make list! [3 4 5] >> remove a == make list! [2 3 4 5] >> b == make list! [3 4 5] | 21-Jun 23:05 |
| 10699 | Henrik | (but if it were possible, some code would be greatly simplified) | 21-Jun 14:03 |
| 10698 | Henrik | yes, it is. it would be too hard to track from inside rebol when an index should move. | 21-Jun 14:02 |
| 10697 | Paul | yeah you'll definately have to be more judicial with your code but I'm thinking that the mechanics of it is the way it is intended to operate. | 21-Jun 13:58 |
| 10696 | Henrik | yes. that's janitoring of the index, which could be prone to bugs, etc. | 21-Jun 13:57 |
| 10695 | Paul | can you just get around the problem by setting a: next a ? | 21-Jun 13:53 |
| 10694 | Henrik | half a feature request and half trying to find a quick way to solve it. seems there is not an easy way. | 21-Jun 12:24 |
| 10693 | Chris | Unless this is a feature request, you'll need an alternative to remove... | 21-Jun 12:04 |
| 10692 | Henrik | it must be the same series | 21-Jun 11:18 |
| 10691 | Graham | and if you copy the index? as well? | 21-Jun 10:41 |
| 10690 | Henrik | nope, it has to be the same series | 21-Jun 10:39 |
| 10689 | Graham | copy it first! :) | 21-Jun 10:35 |
| 10688 | Henrik | simple problem: >> a: [1 2 3 4 5] == [1 2 3 4 5] >> b: at a 3 == [3 4 5] >> a == [1 2 3 4 5] >> b == [3 4 5] >> remove a == [2 3 4 5] >> b == [4 5] ; I wonder if it's possible to make the index "sticky" at [3 4 5] in a relatively simple way. If it were, that would be very cool. | 21-Jun 10:06 |
| 10687 | Anton | It's kind of like an "apply-any". | 20-Jun 15:22 |
| 10686 | Paul | Very nice Chris! | 19-Jun 11:42 |
| 10685 | Chris | Oops, forgot the function at the end there... | 19-Jun 4:06 |
| 10684 | Chris | ; Here's a thought: any-where: func [series [block!] test [block!]][ foreach value series compose [if (test) [break/return value]] ] probe any-where [1 2 3 4][value > 4] probe any-where [1 2 3 4][value >= 4] probe any-where [1 2 3 4][value < 4] ; I know it's a two block solution, but it's pretty language friendly. You can recycle tests too: test: [value > 4] probe [1 2 3 4] :test probe [5 6 7 8] :test | 19-Jun 4:04 |
| 10683 | Paul | heh but cool Gregg. | 18-Jun 20:50 |
| 10682 | Gregg | You can sort of trick your way around things with ops in most cases. e.g. >> fn: func ['op a b] [op: get op op a b] >> fn < 1 2 == true But I avoid doing that. It ends up not being worth it, IMO, when you start to reuse things, generate code, etc. Just use func alternatives. | 18-Jun 19:51 |
| 10681 | Paul | ;a bit revised: lop?: func ['op][if all [op? get op find form op charset "<>="] [return true] false] | 18-Jun 17:14 |
| 10680 | Paul | could be modified to become a true mezz | 18-Jun 17:09 |
| 10679 | Paul | seems handy to me. | 18-Jun 17:08 |
| 10678 | Henrik | I see. | 18-Jun 17:07 |
| 10677 | Paul | >> lop? + == false >> lop? < == true | 18-Jun 17:06 |
| 10676 | Paul | lop?: func ['op][if find form op charset "<>=" [return true] false] | 18-Jun 17:06 |
| 10675 | Paul | all the ones that return logic are those operators that are or have in their form the characters "<" ">" or "=" | 18-Jun 17:05 |
| 10674 | Paul | I'm just checking the charset | 18-Jun 17:05 |
| 10673 | Henrik | please explain, because I can't see where you do that. :-) | 18-Jun 17:04 |
| 10672 | Paul | just like I do in the function above that I wrote. | 18-Jun 17:01 |
| 10671 | Paul | yeah you can | 18-Jun 17:01 |
| 10670 | Henrik | well, you wouldn't know without running actual tests with the operator. | 18-Jun 17:01 |
| 10669 | Paul | lop? would be a function | 18-Jun 17:00 |
| 10668 | Henrik | ok | 18-Jun 17:00 |
| 10667 | Henrik | what do you mean? | 18-Jun 17:00 |
| 10666 | Paul | lop? - returns true or false if operator returns logic values. | 18-Jun 17:00 |
| 10665 | Paul | would be nice to have lop? | 18-Jun 16:59 |
| 10664 | Paul | yeah I know I thought it would return logic and op depending on the test. | 18-Jun 16:59 |
| 10663 | Paul | >> op+ [1 2 3 4 > 2] == true | 18-Jun 16:58 |
| 10662 | Henrik | what you return is that the datatype is op!, not logic!, so logic? returns false. | 18-Jun 16:58 |
| 10661 | Paul | >> op+ [1 2 3 4 + 1] == [2 3 4 5] | 18-Jun 16:58 |
| 10660 | Paul | op+: func [blk /local op args arg blk2 blk3][ op: first back back tail blk blk3: copy [] arg: last blk if word? :arg [arg: get :arg] args: copy/part blk find blk op blk2: reduce [op arg] foreach item args [ insert blk2 item if item: attempt [do blk2][ either find form blk charset "<>=" [return item][append blk3 item] ] remove blk2 ] if not empty? blk3 [return blk3] false ] | 18-Jun 16:57 |
| 10659 | Paul | some modifications made: | 18-Jun 16:57 |
| 10658 | Paul | I guess because it doesn't return true or false until it operates on something it wont return a logic value. But maybe we should at least subclassify some operators to distingish them more. | 18-Jun 16:51 |
| 10657 | Paul | >> logic? get to-word "<" == false >> | 18-Jun 16:49 |
| 10656 | Paul | Shouldn't < > and = return as a logic values as well as being op values? | 18-Jun 16:49 |
| 10655 | Paul | I'm sure we can do something in the mezz sense once R3 gets released. | 18-Jun 16:30 |
| 10654 | Henrik | I would love to see it in R3, but so far nothing from Carl WRT this particular feature. I think it might complicate op! way too much. | 18-Jun 16:28 |
| 10653 | Paul | No outside of a single block though. | 18-Jun 16:24 |
| 10652 | Paul | I could make that change to my function and easily accomodate that. | 18-Jun 16:24 |
| 10651 | Henrik | because I would also like to see: >> 1 + [2 3 4 5] == [3 4 5 6] in R3 there are ways to do this with a bit more code. | 18-Jun 16:23 |
| 10650 | Paul | My function is actually very restricted in that it looks for the op! as the second to last value and the comparator as the last item. | 18-Jun 16:22 |
| 10649 | Henrik | I remember from my HP48 calculator that any numbers put in a block, could be operated on like that. But I think this is the beginnings of vector operations, which is a big area that should be done right. | 18-Jun 16:21 |
| 10648 | Paul | yeah that is what I initially wanted to do Henrik. | 18-Jun 16:21 |
| 10647 | Paul | Would be nice if we use op! values as an argument to functions. | 18-Jun 16:20 |
| 10646 | Henrik | a < [1 2 3 4] | 18-Jun 16:20 |
| 10645 | Henrik | I would want to put all values that are going to be tested in a block. | 18-Jun 16:20 |
| 10644 | Paul | I think we can. One that can probably accomodate much more. | 18-Jun 16:20 |
| 10643 | Henrik | it's good, but I wonder if we can come up with an even better syntax. | 18-Jun 16:19 |
| 10642 | Paul | For example: any+ [1 2 3 4 > 3] | 18-Jun 16:19 |
| 10641 | Paul | for the any+ function you put the multiple items on the left side of your block and the single item to compare to on the right side | 18-Jun 16:19 |
| 10640 | Paul | ;here is my little 'any+ function: any+: func [blk /local op args arg blk2][ op: first back back tail blk arg: last blk if word? :arg [arg: get :arg] args: copy/part blk find blk op blk2: reduce [op arg] foreach item args [ insert blk2 item if attempt [do blk2][return true] remove blk2 ] false ] | 18-Jun 16:17 |
| 10639 | Paul | nice Gregg. | 18-Jun 16:17 |
| 10638 | Gregg | There isn't anything built in that does that. For simple min/max comparisons, you could do something like this: if a < first maximum-of [1 2 4] [print "cool"] I also have a shortcut for FIRST MAXIMUM-OF. pick-max: func [series [series!]] [attempt [pick maximum-of series 1]] if a < pick-max [1 2 4] [print "cool"] For the general case, I would use a map and anonymous func combo. R3 has a native MAP func, but you have to roll your own in R2. | 18-Jun 16:16 |
| 10637 | Paul | I have a handy little function I made and don't know if there is already an easy way to do this in REBOL but I have a function called 'any+ that simply keeps me from repeating any statements. For example: >> a: 3 == 3 >> if any+ [1 2 4 > a][print "cool"] cool Got a bit tired of writing ANY [1 > a 2 > a 4 > a] This is one of those things that I often wonder if we already can do this easlier and I just don't know what it is. | 18-Jun 14:16 |
| 10636 | Paul | looks like in R3 we get 'AT expanded to 64 bit possible to access the open/direct files. | 16-Jun 23:37 |
| 10635 | Paul | Would be nice to have the feature to access the currently indexed position of the open port and perform a function on it. For example, modify /awake to work with files. Such that any reference to the file or altering of the position can be handle via an awake/handler. | 16-Jun 23:22 |
| 10634 | BrianH | Nope. Anyone else want to give this a shot? | 16-Jun 23:03 |
| 10633 | Paul | Any ideas what the numbers mean in the port/state/misc section of a file port? | 16-Jun 23:02 |
| 10632 | Paul | That isn't the kinda of answer I was looking for but expected. | 16-Jun 23:00 |
| 10631 | BrianH | This may be one of those use-another-tool-through-call or use-R3's-64-bit-integers situations. | 16-Jun 22:38 |
| 10630 | Paul | ahhh time to eat - be back in a few. | 16-Jun 22:36 |
| 10629 | Paul | A work around? | 16-Jun 22:36 |
| 10628 | Paul | Do you know anyway around this limit? | 16-Jun 22:36 |
| 10627 | Paul | I don't know what the port flags or the port/state/misc counters are used for. | 16-Jun 22:36 |
| 10626 | BrianH | I expect that /direct is just using file handles and isn't setting offsets like /seek. | 16-Jun 22:35 |
| 10625 | Paul | My need is to be able to get the tail or index of files larger than the 32 bit integer limit. | 16-Jun 22:35 |
| 10624 | Paul | Well I would assume that the 32 bit integers are being used on open/direct so I'm not sure why this limitation only affect /seek and not /direct as well. | 16-Jun 22:34 |
| 10623 | BrianH | The source of OPEN, isn't. It seems likely that the 32-bit integers of R2 are at fault here. | 16-Jun 22:33 |
| 10622 | Paul | So next question - do we have any source of /seek to understand why we have such a limitation? | 16-Jun 22:30 |
| 10621 | Paul | The only limitation I could find is in /seek. | 16-Jun 22:29 |
| 10620 | Paul | I noticed using his refinements I no longer have access to tail from querying the port. | 16-Jun 17:23 |
| 10619 | Paul | I tried Oldes method and able to get it over the limit. | 16-Jun 17:20 |
| 10618 | Paul | REBOL should be able to break this limitation. Even if it means holding a pointer to a file position and then looping over again. | 16-Jun 16:45 |
| 10617 | Paul | I would have thought that write would be using open also. | 16-Jun 16:45 |
| 10616 | Henrik | I wonder if WRITE/APPEND allows files over 4 GB? | 16-Jun 16:44 |
| 10615 | Paul | Not sure how OLDES was able to get his file over 5GB on NTFS as my test was also on NTFS. | 16-Jun 16:43 |
| 10614 | Paul | Now the port can still be read via open/direct but no longer accessible via open/seek at that point. | 16-Jun 16:41 |
| 10613 | Paul | when the port/state/tail value reaches 2 ** 31 it converts it to a negative number and gives an error which is an "access error writing to port". | 16-Jun 16:40 |
| 10612 | Paul | Interesting the limit for file size in REBOL is 2 ** 31 | 16-Jun 16:28 |
| 10611 | Paul | That is where my interest lies Anton. | 16-Jun 14:21 |
| 10610 | Paul | Well I'm testing a new indexing system for TRETBASE and need to know some significant data to fine tune it. | 16-Jun 14:20 |
| 10609 | Oldes | I'm not going to read such a file if I have only 1GB memory:) | 16-Jun 14:20 |
| 10608 | Anton | you run into a problem then. | 16-Jun 14:20 |
| 10607 | Anton | I think it's when you want to seek to a position greater than 2 ^ 31 - 1 | 16-Jun 14:20 |
| 10606 | Oldes | But not impossible I guess. Using such a big files is not practical imho. | 16-Jun 14:20 |
| 10605 | Paul | You having problem reading that file now? | 16-Jun 14:19 |
| 10604 | Oldes | The problem is with reading anyway | 16-Jun 14:19 |
| 10603 | Paul | on the port rather. | 16-Jun 14:18 |
| 10602 | Paul | I want to be able to do some probes on the file once I get it to size. | 16-Jun 14:18 |
| 10601 | Paul | ok cool. | 16-Jun 14:18 |
| 10600 | Oldes | WIN/ ntfs | 16-Jun 14:18 |
| 10599 | Paul | what OS? | 16-Jun 14:17 |
| 10598 | Oldes | created file ower 5GB here... than I stoped it. | 16-Jun 14:17 |
| 10597 | Oldes | 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] | 16-Jun 14:17 |
| 10596 | Anton | Ok, that makes sense. | 16-Jun 14:16 |
| 10595 | Paul | That number I posted is the highest in my algorithm I could hit. | 16-Jun 14:16 |
| 10594 | Anton | Maybe it was 2 ^ 31 - your buffer size ? | 16-Jun 14:16 |
| 10593 | Paul | 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. | 16-Jun 14:15 |
| 10592 | Anton | 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 | 16-Jun 14:14 |
| 10591 | Paul | Actually a bit larger than that. | 16-Jun 14:13 |
| 10590 | Paul | I was curious because I'm interested in what happens when I hit 2099999999 size. | 16-Jun 14:13 |
| 10589 | Paul | ahhh ok. | 16-Jun 14:13 |
| 10588 | Anton | Sorry, not using Rebol, but in Linux, creating a file in a FAT32 partition. | 16-Jun 14:12 |
| 10587 | Paul | Anton, you created a 4GB file using REBOL or was reading one when you got the error? | 16-Jun 14:11 |
| 10586 | Paul | currently still writing a file which is only at 668 Megs at the moment. | 16-Jun 14:09 |
| 10585 | Paul | I'm on NTFS. I'll post what I find out. | 16-Jun 14:09 |
| 10584 | Anton | Yep, hit it today on FAT32 - 4GB file was produced. | 16-Jun 14:01 |
| 10583 | Henrik | FAT32 is the one with that limit. | 16-Jun 13:47 |
| 10582 | Geomol | The file system might have max-size for files. I remember something about 2 or 4GB for some file systems. | 16-Jun 13:47 |
| 10581 | Geomol | :-) Be sure, you have enough HD space! | 16-Jun 13:45 |
| 10580 | Paul | I'm actually running an experiment now. I'm going to write a file that will attempt to exceed those sizes. | 16-Jun 13:27 |
| 10579 | Geomol | 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 | 16-Jun 13:20 |
| 10578 | Paul | 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. | 16-Jun 13:12 |
| 10577 | Paul | Since integers greater than that number cause errors. | 15-Jun 1:00 |
| 10576 | Paul | I'm also assuming since a port/size is integer! that the file size can be no greater than 2099999999 bytes. | 15-Jun 0:59 |
| 10575 | Paul | 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. | 15-Jun 0:45 |
| 10574 | Paul | What is the limitation on file size that REBOL 7.6 can handle? | 15-Jun 0:38 |
| 10573 | Josh | Nevermind, I think I just had a typo in my code. :) | 12-Jun 22:11 |
| 10572 | Josh | Which version of rebol allows for evaluation in paths? (i.e. block/(1+i): "hello" ) Or am I not remembering this correctly? | 12-Jun 22:05 |
| 10571 | Will | 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) | 1-Jun 15:03 |
| 10570 | Will | 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 | 1-Jun 15:00 |
| 10569 | Graham | 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. | 1-Jun 7:34 |
| 10568 | Henrik | or if you want to avoid loading the image twice: i: read/binary %image.png checksum i i: load i | 1-Jun 6:33 |
| 10567 | Henrik | convert it to binary first | 1-Jun 6:31 |
| 10566 | Graham | guess I can't | 1-Jun 6:25 |
| 10565 | Graham | 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 ? | 1-Jun 5:35 |
| 10564 | Paul | a: compose [(pick [["b"][]] 0 > 1)] | 24-May 19:44 |
| 10563 | Dockimbel | Clean and simple solution. | 24-May 15:32 |
| 10562 | ChristianE | 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"]) ] | 24-May 15:05 |
| 10561 | Paul | I might be able to figure this out if I take a look at the protect-system. | 24-May 14:28 |
| 10560 | Paul | 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? | 24-May 14:14 |
| 10559 | Henrik | >> a: compose [(either 0 > 1 ["b"][])] == [] | 24-May 13:24 |
| 10558 | Dockimbel | >> if*: func [cond body][either cond body [[ ]]] >> a: compose [ (if* 0 > 1 ["b"]) ] == [ ] | 24-May 12:57 |
| 10557 | Dockimbel | if you want to hide the "tricky part" : | 24-May 12:57 |
| 10556 | Robert | Ok... very tricky. ;-) | 24-May 12:39 |
| 10555 | Dockimbel | >> void: [ ] >> a: compose [ (either 0 > 1 ["b"][void]) ] == [ ] | 24-May 12:22 |
| 10554 | Robert | Hi, how can I avoid to get back NONE for something like this:
a: compose [ (if 0 > 1 ["b"]) ] I just want to get nothing back, like the parens were never there. | 24-May 12:14 |
| 10553 | BrianH | Google is really specific about which languages it will support itself - they won't even let their employees use alternate languages for Google products. REBOL's niche is taken up by Python there. Nothing stopping you from cloning one of the official APIs for a third-party API though. | 20-May 20:51 |
| 10552 | Graham | No REBOL included of course | 20-May 20:06 |
| 10551 | Graham | Google api client libraries ... http://code.google.com/apis/gdata/clientlibs.html | 20-May 20:06 |
| 10550 | sqlab | Looks my solution for changing the name.) | 19-May 16:07 |
| 10549 | Geomol | >> to integer! #7fffffff
== 2147483647 No unsigned version directly. You might be able to make code, that can implement unsigned int. | 19-May 16:06 |
| 10548 | Robert | I know it's 2 ** 31 - 1 but any other way? Is there an unsigned version as well? | 19-May 14:54 |
| 10547 | Robert | Is there a way to get MAX-INT from Rebol? | 19-May 14:49 |
| 10546 | Oldes | Use Resource Hacker http://www.angusj.com/resourcehacker/ to change the title and or icons. | 19-May 6:26 |
| 10545 | Graham | Actually maybe it was Terry that wrote this .. can't recall now. | 18-May 23:41 |
| 10544 | Graham | win-lib: make object! [
user-lib: load/library %user32.dll SetWindowText: make routine! [ handle [integer!] Title [string!] return: [integer!] ] user-lib "SetWindowTextA" set 'WindowTitle func [ Title [string!] ] [ SetWindowText get-modes system/ports/system 'window Title ] ] | 18-May 23:40 |
| 10543 | eFishAnt | shucks. | 18-May 23:38 |
| 10542 | Graham | I asked Carl years ago to allow us to change this within REBOL ... he agreed but has not done this. So, I too use Winapi calls. | 18-May 20:37 |
| 10541 | Paul | I do that via winapi calls currently. | 18-May 17:47 |
| 10540 | eFishAnt | Right now it is "REBOL/View" on the console title bar. I know I'm gonna be embarrased when I find out what it is... | 18-May 17:22 |
| 10539 | eFishAnt | As better at REBOL I am getting, I am trying to find the trick to rename the title of the Console window itself. I am glad I can probe system, but I just haven't probed it in the right orafice... | 18-May 17:16 |
| 10538 | btiffin | A psych prof I knew, wrote papers on the quantum clock in our brains. Google "kristofferson professor rate of tone and brain clock" for some references to his research. Sorry for clogging Core. But yeah, his experiments concluded that we definetly think in "waves"; some events go undetected if they occur between 'brain ticks'. He couldn't explain the 'how or why', but he could measure the effect. | 10-May 23:41 |
| 10537 | Gabriele | wave equations have nothing to do with the human brain as far as we know it. if you know more, you should publish an article somewhere, as that would be a breakthrough. | 10-May 17:41 |
| 10536 | Gabriele | besides... neurons are know to only be able to fire or not to fire. they are digital, not analog. if the input is above the threashold, the neuron fires. otherwise it does not fire. | 10-May 17:39 |
| 10535 | Gabriele | if you feed a human a 32 bit int and ask him/her to get you back a password, and it has to give you the same password for the same int, then how many password would the user give you? | 10-May 17:37 |
| 10534 | Gabriele | about 2 ** 32, that's a limitation of *your* algorithm, not RANDOM. indeed, if you don't reset the seed each time, and use random/secure, you probably get all of the possible passwords (and very likely more than humans would pick). besides, it is not proven that random/seed only takes 32 bits of data when seeded with a date!. (C rand() is most likely 32 bit, but random/secure could be using more than that.) | 10-May 17:36 |
| 10533 | Gabriele | a human picking chars "randomly" will most likely not be random. sadly, i guess we're not going to be able to do a test with a few million people to get a decent sample. | 10-May 17:34 |
| 10532 | Gregg | A long time ago, I remember reading something where the author suggested, as a shared seed, using a substring of PI. | 9-May 13:51 |
| 10531 | Geomol | Moving to chat | 9-May 11:21 |
| 10530 | Dockimbel | reading mouse moves is usually a good source for seeding | 9-May 11:13 |
| 10529 | Dockimbel | can = can't | 9-May 11:11 |
| 10528 | Dockimbel | Maybe this thread should be move in another channel | 9-May 11:10 |
| 10527 | Geomol | How do I use a better random function, now that it's a routine programmed in REBOL? I could get the source of a better routine and implement it myself. That will give me a better result, yes. I'm not going to do that, as my current routine is good enough for the purpose. How do I access a source of true randomness from within REBOL? random.org has been suggested. Other ways? | 9-May 11:10 |
| 10526 | Dockimbel | Well...the magical "quantum" is back again. :-) Sorry, but you still didn't prove anything...Do we need to get back to how a neuron fires ? Show me any experiment that has been done proving that neuron's firing is not deterministic (meaning it can be predicted knowing the inputs). | 9-May 11:10 |
| 10525 | Geomol | "That needs to be proved. It can be very high without being infinite." I think, it's proven by quantum mechanics in the number of possible outcome from a wave equation. | 9-May 11:07 |
| 10524 | Dockimbel | By using a better than REBOL default RANDOM function and using a source of true randomness for seeding. | 9-May 11:07 |
| 10523 | Geomol | In my password generator, how would you feed it with more input? | 9-May 11:05 |
| 10522 | Dockimbel | "In general, I would say the pool from human thoughts and decisions is infinite". That needs to be proved. It can be very high without being infinite. | 9-May 11:01 |
| 10521 | Dockimbel | Why restricting the computer to 32bits input only, when you can feed it with gigabits of inputs ? That's not a fair comparaison. | 9-May 10:59 |
| 10520 | Geomol | Yes, valid points, but it's not what I described at first.
If I should construct a random password given the rules, my output will land in a pool of 60 ** 8 possible passwords. I don't have to actual do it. The statement holds anyway.
If a computer should construct a random password given the rules (using any deterministic computer and any algorithm, but only with a 32-bit integer input, as in the case of REBOL random/seed), the output will land i a pool of 2 ** 32 possible passwords at most. Of course we can change the frame and get a better result from the computer, but then we change the 'experiment'. In general, I would say the pool from human thoughts and decisions is infinite. It's not from a deterministic computer. So we need true random input and true analog computing with infinite states, if we want our computers to be as good as our brains. | 9-May 10:51 |
| 10519 | Dockimbel | Given a good algorithm (like Mersenne twister), and a true random generator for seeding (like hardware sensors) a computer could cover the 60**8 range. A humain brain, even given enough time, can't (I'm talking about generating random combinations, not using loops to generate every single combination). Even worse, humain results would show heterogeneous distribution of results, while computer will give a uniform distribution. So in that case, computers would give you better randomness than analog brains. | 9-May 10:35 |
| 10518 | Geomol | I'm not fair using the word "ignorance". I don't think, you are. I base my conclusion on the following: See the password generator as a black box, that you feed with an integer, and out come a password. The integer input has 2 ** 32 different combinations and is used for the random/seed. Out come a password, and there can only be 2 ** 32 different passwords coming out at most. It doesn't matter, how the algorithm is constructed, if you put time delay in, call random or random/seed more than once, etc, as long as you don't get other input as the first integer. This is basic in information theory. And it's related to the determinism in digital computing. | 9-May 10:15 |
| 10517 | Geomol | "so if you pick each character separately you don't make 60 ** 8 different password?" If I, as a human, pick each char separately, I can make 60 ** 8 different passwords. If I make a digital computer do it based on 2 ** 32 integer pseudo-randomness, I can't! If you disagree, then show me. Doc seems to get it now, so I'm not completely alone with my insight. | 9-May 10:01 |
| 10516 | Geomol | (For the record, I'm not religious.) | 9-May 9:58 |
| 10515 | Geomol | :-) No, it's what happens, when insight takes the place of ignorance. | 9-May 9:57 |
| 10514 | Gabriele | lol, so if you pick each character separately you don't make 60 ** 8 different password? Geomol, you're being really funny. I guess this is what happens when religion takes the place of logic. | 9-May 8:54 |
| 10513 | Reichart | Keno, yup....keno programmers are like script kiddies... | 8-May 23:42 |
| 10512 | btiffin | Yep. Bean counter code by bean counter people. :) But the random packages, there are at least five, go into great detail and the issues. Then again, this is REBOL/Core. Beats the pants off R, we just lack the bean counters. :) | 8-May 19:55 |
| 10511 | Geomol | I installed R on my Mac more than a year ago, but haven't found the time to use it yet (or did't find the need). I've heard, it should be good at doing graphs. | 8-May 19:48 |
| 10510 | btiffin | John; If you ever get a chance, check out R. http://www.r-project.org It's a statistical analysis language (in the main) and goes to great length to ensure a reproducible random sequence on each run. This allows for verification, stable screen shots of sample graphs etc. I like the fact that REBOL has the same feature of "known" random numbers across runs, until a forced seeding. In Quebec, someone figured out the sequence of the provinicial Keno game. He won three times before someone got suspicious. The lotto corp wanted to deny him his prize money. A judge ruled that if they did, they would have to deny and claw back all winnings from everyone. So they paid. And fumed and puffed out their chest, and then went back to school to learn better programming. :) Last I heard, the guy hasn't cracked the new sequence ... yet. | 8-May 19:16 |
| 10509 | Reichart | "And if a hacker get acces to the state stored on disk, we're screwed again. ;-)" And that is why we set the random seed randomly... | 8-May 18:59 |
| 10508 | Gregg | This is the randomize func I use, FWIW: Alan Parman did quite a bit of R&D and posted this as his best solution. randomize: func [ "Reseed the random number generator." /with seed "date, time, and integer values are used directly; others are converted." ][ random/seed either find [date! time! integer!] type?/word seed [seed] [ to-integer checksum/secure form any [seed now/precise] ] ] | 8-May 16:36 |
| 10507 | Dockimbel | "The algorithm used in the C library provided with gcc has a period of 2.88 * 10E9" http://hepwww.ph.qmul.ac.uk/sim/random.html | 8-May 16:03 |
| 10506 | Geomol | And if a hacker get acces to the state stored on disk, we're screwed again. ;-) | 8-May 15:50 |
| 10505 | Geomol | Cool, thanks! :-) | 8-May 15:47 |
| 10504 | Dockimbel | Exactly. | 8-May 15:47 |
| 10503 | Geomol | So a way to get good random numbers over a long period of time, is to start such a routine (like the Mersenne twister) only once. The routine should then work with a high number of bits, the more the better and store the state, it has come to, to disk. Every time the computer is turned on, it can pick the state from disk, and start from where it left off. A password generator should use this routine and call it between each character in the password. If the routine has high enough resolution, it should be possible to produce 60 ** 8 different passwords. | 8-May 15:46 |
| 10502 | Dockimbel | You should maybe search for a free implementation of Mersenne twister generator, it can give you up to 2**19937 unique combinations which is far enough for covering the 60**8 range. http://en.wikipedia.org/wiki/Mersenne_twister | 8-May 15:36 |
| 10501 | Geomol | !!! :-) | 8-May 15:35 |
| 10500 | Dockimbel | The more I think about it, the more I come to the conclusion that you're right. REBOL's random function might have a period of 2**32 (with a 32bits seed) maybe even less (I can't find the exact period of C rand( )). | 8-May 15:34 |
| 10499 | Geomol | Peter, yes random.org is a solution, and a good one. But it doesn't hold in a real application, because what if there's no web connection. I have a routine, that is good enough for my problem. What I'm after, is the best way to do this. I and others might learn from this. | 8-May 15:30 |
| 10498 | Geomol | Doc, then I can't see, how I can get close to 60 ** 8 different passwords, as you claimed. | 8-May 15:27 |
| 10497 | PeterWood | A psuedo-random generator should always give the same sequence if you start with the same seed. That's what Reichart was saing. Try the site that Sunanda suggested for an explanation; random.org | 8-May 15:26 |
| 10496 | Geomol | Peter, I'm just investigating, what's the best way to produce random passwords. In some applications, they might need to be unique, not in others. If they need to be unique, the easiest would be to check with passwords produced in the past, I guess. | 8-May 15:26 |
| 10495 | Dockimbel | "that random/secure give the exact same sequence of numbers every time, if started with the same seed" That's an intended feature ! You should set the seed only *once* with a random (or pseudo-random) value like now/time. | 8-May 15:24 |
| 10494 | PeterWood | Do you need the passwords to be unique? | 8-May 15:24 |
| 10493 | Geomol | My test show, that random/secure give the exact same sequence of numbers every time, if started with the same seed. Check it with code like:
>> random/seed 1 loop 1000000 [random/secure 10000000] random/secure 10000000
== 1253129
>> x: 1 loop 10 [random/seed 1 loop 1000000 [random/secure 10000000] if 1253129 <> random/secure 10000000 [print x] x: x + 1] So I conclude, that I can only make 2 ** 32 different passwords with this, not 60 ** 8. | 8-May 15:21 |
| 10492 | Geomol | It puzzles me, how you can get more than 2 ** 32 possible outcome from 2 ** 32 different input, so I'll start reading... :-) | 8-May 15:05 |
| 10491 | Dockimbel | I guess that a good start woul be : http://en.wikipedia.org/wiki/Pseudorandom_number_generator | 8-May 15:01 |
| 10490 | Dockimbel | pseudo random number generator | 8-May 15:01 |
| 10489 | Dockimbel | google for pseudo number generator | 8-May 15:00 |
| 10488 | Geomol | "The seed just gives the starting point in a series of values produced by a math formula with a far greater range than the 32 or 64bits would give. So, if your code is correctly written, you'll get close to 60 ** 8 possible passwords" That's interesting. Do you know a good link, where I can read more about this? | 8-May 14:50 |
| 10487 | Reichart | John wrote "It seems to be 1." And this is probably correct from a social point of view. But I will stick with "unkown without extensive testing" because many integers can give the same sequence, and might even give the same sequence for a long time before they diverge. This is the subtle point I'm trying to make about what is random vs pattern. Things that "seem" are the reason hackers crack codes…this is where I used to start when I cracked other people's systems… | 8-May 14:44 |
| 10486 | Dockimbel | The pseudo-random generator used in REBOL (rand( ) C function) like in most other languages, is not limited to the size of the seed, it doesn't work that way. The seed just gives the starting point in a series of values produced by a math formula with a far greater range than the 32 or 64bits would give. So, if your code is correctly written, you'll get close to 60 ** 8 possible passwords (depends on the quality of value distribution in the internal math formula). The C rand( ) is notoriously poor, but far enough for most uses. IIRC python, for example, uses a different generator with a period or 2**19937-1. | 8-May 14:39 |
| 10485 | Geomol | Yes, something like that would be needed between each character to raise the number of possible passwords produced. | 8-May 14:23 |
| 10484 | Sunanda | You could grab some starter randomness from http://random.org | 8-May 13:55 |
| 10483 | Geomol | This might be a good example to illustrate my point in the other thread about randomness and the difference between digital computers and analog human brains. In my example, I'm about to produce a 8 character random password. Each character can be one of 60 possible chars. So I set up a random/seed with 2 ** 32 = 4'294'967'296 possible start values, so I can at best produce the same amount, 4'294'967'296, different passwords with my routine. I can't change this by putting new random/seed in after each character found, because of the determinism in how a computer work. I would need to get input from the outside to produce more different 8 char passwords. As a human, I can pick between 60 possible chars, and I have to do it 8 times, so I can make 60 ** 8 = 167'961'600'000'000 different passwords. That's a lot more than the computer. When we go to abstract thoughts with no clear limits (like 60 and 8), we are far superior to the digital computer. It would be much easier to make an artificial intelligence, if our computers were analog. | 8-May 13:11 |
| 10482 | Geomol | So this should be about as good: random/seed to integer! 2 ** 32 / 86400 * (to decimal! now/time/precise) - (2 ** 31) | 8-May 12:48 |
| 10481 | Geomol | Now I think of it, all this probably isn't necessary, because the actual number of possible outcome of my routine still is low compared to all the bits in an integer. I don't get 2 ** 32 possible passwords from this. If the routine is mainly used doing the day (maybe 12 hours), I still just get half the possible outcome, even with all this, right? | 8-May 12:45 |
| 10480 | Geomol | A suggestion for an algorithm to produce a random seed from the time: s: to integer! 2 ** 32 / 86400 * (to decimal! now/time/precise) - (2 ** 31) s: enbase/base debase/base to-hex s 16 2 reverse s s: to integer! to issue! enbase/base debase/base s 2 16 random/seed s It does this: 1) convert now/time/precise to an integer using all possible bits 2) make a string of 0 and 1 from it 3) reverse the string 4) convert it back to an integer 5) And finally use it as a seed Doing it this way, I hope to have a good span of possible start values for the random generator. Did I miss anything? | 8-May 12:36 |
| 10479 | Geomol | Oh no, I go for 0:00. :-) | 8-May 11:27 |
| 10478 | Pekr | try to switch you PC to 23:59 and do some loop which will print time :-) | 8-May 11:26 |
| 10477 | Geomol | that -> what | 8-May 11:24 |
| 10476 | Geomol | Does anyone know, that now/time show at midnight? Is it 24:00 or 0:00? | 8-May 11:22 |
| 10475 | Geomol | It seems, that random/seed now does exactly the same as random/seed now/precise (Only tested under OS X so far.) | 8-May 10:54 |
| 10474 | Geomol | This is misleading to me. I got the impression, that I could do random/seed to decimal! now/time/precise but that's no good! Should it be reported as a bug/flaw? | 8-May 10:50 |
| 10473 | Geomol | Yes, random/seed with a decimal doesn't use the seed:
>> loop 10 [random/seed 1 random/seed to decimal! now/time/precise prin [random 100 ""]]
52 52 52 52 52 52 52 52 52 52 So I need to construct an integer from the time. | 8-May 10:48 |
| 10472 | Geomol | Maybe random ignore the /seed and just give me a decimal random number? | 8-May 10:44 |
| 10471 | Geomol | Ah yes, there is a 24 hour cycle problem with my approach. I could construct a more unique decimal taking year, month and day into account. Hm, random/seed returns a value, if called with a decimal!? Called with an integer, it doesn't. A reason for this? >> random/seed 100 >> random/seed 100.0 == 41.0 | 8-May 10:43 |
| 10470 | Geomol | The starting seed seems to be 1. | 8-May 10:39 |
| 10469 | Gabriele | no /seed - rebol always starts with the same seed (not sure, maybe 0), in order to allow testing | 8-May 10:33 |
| 10468 | Gabriele | random/secure - it has been explained already, instead of using the libc rand() call, a crypto-safe random algo is used. | 8-May 10:33 |
| 10467 | Gabriele | Geomol, you need a single daemon to give you out random numbers, or, if you're on Linux, use /dev/random or something like that. to decimal! now/time/precise means that your numbers just cycle in 24 hours, that is, i can easily predict what your password will be at a certain time of the day. | 8-May 10:31 |
| 10466 | Sunanda | random/seed now/time/precise followed by an indeterminate number of
random/secure to-decimal now/time/precise
or a few waits
will make it harder for anyone trying to guess your passwords. But none of that guarantees you won't produce a random number you already have. If you need your passwords to be unique, you need to do one of several things: -- check each one against all previously issued (as I've suggested) -- generate a unique pool in advance (as Gregg suggests) Both approaches introduce a potential security flaw: the table/pool of passwords is an attack point for a hacker. | 8-May 9:23 |
| 10465 | Geomol | I think, I should do, as I first suggested: random/seed to binary! now/time/precise before making my random password. If I put in a little wait, I can also make sure, I don't produce the same password two times in a row. | 8-May 8:34 |
| 10464 | Geomol | "REBOL has a starting seed value (unknown with out extensive testing)" It seems to be 1. The first random call right after a startup will give the same result as random/seed 1 followed by the same random call. It's hard for me to see, what secure does, as seen in this example: >> loop 10 [random/secure/seed 1 prin [random/secure 100 ""]] 47 47 47 47 47 47 47 47 47 47 | 8-May 8:30 |
| 10463 | Geomol | :-D | 8-May 8:25 |
| 10462 | Reichart | LOL... | 8-May 5:50 |
| 10461 | Graham | just pick words out of the evolution thread .. for random noise | 8-May 5:44 |
| 10460 | Reichart | "what happens if no random/seed is used in a REBOL program?" That same thing that happens with almost all random generators, which is a pattern is used. REBOL has a starting seed value (unknown with out extensive testing). However, it will (and should) have the same value upon start up. The problem (you are perceiving) is with the word "RANDOM" Perhaps it should be called PATTERN instead. However, if seeded, RANDOM in turn will use a formula to generate more in the series. This is indeed true random, in as much as the seed's size sets the size of the universe. So, if you want to always have a random set, you need to get fresh random data (hmmm, I seem to recall mentioning this in another thread). Of note, the RANDOM we use in slot machines is NOT like REBOL's random function. REBOL's RANDOM (like most language random functions) is really SEED+OFFSET in a series. (thus a pattern). I'm not sure what Carl did to make it secure, but my best guess is he is sucking in what ever he can find to make it Random (this doing what I'm suggesting in the first place). For example, reading the mouse port, temperature, current time (to the jiffy), etc. This would make RANDOM what you expected it to be in the first place…but in theory this would be slower. In your case, this would be the way to go. | 8-May 5:27 |
| 10459 | Geomol | Great idea! :-) And a simple solution. | 7-May 17:45 |
| 10458 | Gregg | Generate pools of passwords, and store a counter to use when you need to re-seed and generate a new pool. That way you can generate them over a long period of time and just pull them as necessary. | 7-May 17:44 |
| 10457 | Geomol | I need to do something like Sunanda suggest. But before I do that, I would like to know, if I can do it in another way. And then it would be cool, if I learned, what exactly random/secure mean. | 7-May 17:21 |
| 10456 | Geomol | To illustrate my point, try create this rebol script (call it random.r or whatever) on you disk: REBOL [] print random 100 ask "OK" Now click it from the explorer in windows. I get the result 95 every time. That's not random! | 7-May 17:19 |
| 10455 | Geomol | Edgar, I know that. My question is, what happens if no random/seed is used in a REBOL program? My other question is, what does random/secure mean? | 7-May 17:11 |
| 10454 | Edgar | Geomol, the problem with your loop is that yuo have the random/seed in the loop. The random/seed is called once then make your loop with just the random or random/secure. | 7-May 17:05 |
| 10453 | Sunanda | As I suggested above, if it is a webservice, you can use other things in addition to the precise time: -- caller's ip address -- referer URL They will vary between calls -- unless exactly the same incoming URL is processed at exactly the same moment....That's unlikely, even if someone is resetting the server's time. | 7-May 15:34 |
| 10452 | Geomol | What I'm after, is a secure way to produce a password, also in a webservice, that could be called many times each second. RANDOM/secure can produce the same output again and again, as can be seen with this: >> loop 10 [random/seed now/precise prin [random/secure 100 ""]] 61 61 61 61 61 61 61 61 61 61 See the block as the webservice. So here it's not good to use random/seed. If I leave out random/seed, what then define the initial state of the random generator? I need to know this to figure out, if this is a secure way to produce a password or not. | 7-May 11:08 |
| 10451 | Sunanda | It claims to be a "cryptographically secure random".
That won't stop clashes though http://www.rebol.com/docs/words/wrandom.html | 7-May 10:38 |
| 10450 | Geomol | What do random/secure do precisely? Does anyone know? | 7-May 10:36 |
| 10449 | Sunanda | You could drop the seeding and just use random/secure loop 10 [prin [random/secure 100 " "]] 99 22 67 18 31 6 54 80 94 24 | 7-May 10:33 |
| 10448 | Geomol | Gabriele, I'm afraid, that's not good enough. Try this:
>> loop 10 [random/seed now/precise print random 100]
28
28
28
28
28
28
28
28
28
28 While if I do it my way, I get this: >> loop 10 [random/seed to decimal! now/time/precise print random 100] 75 53 21 3 2 57 54 69 74 15 (I did it under OS X with version 2.7.6) | 7-May 10:28 |
| 10447 | Gabriele | Geomol, use RANDOM/SEED NOW/PRECISE (no /time and no to decimal!) | 7-May 10:21 |