• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp5907
r3wp58701
total:64608

results window for this page: [start: 56401 end: 56500]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
BrianH:
16-Nov-2010
In R3:
>> while b: [change back tail b false true] [1]
== none
>> while b: [remove back tail b false true] [1]
== none
>> while b: [false true] [print 1 remove back tail b]
1
== []
>> while b: [true] [print 1 append b false]
1
== [true false]
>> while b: [append b false true] [print 1]
== none
>> while b: [append/dup b false 1000 true] [print 1]
== none


Clearly modifications seem to work in R3, at least to the tail (which 
is the portion of the block that would affect the result), even if 
a realloc is necessary.
GrahamC:
16-Nov-2010
>> 1 ** 2
== 1.0
>> help **
USAGE:
    number ** exponent

DESCRIPTION:
     Returns the first number raised to the second number.
     ** is an op value.

ARGUMENTS:
     number -- (Type: number)
     exponent -- (Type: number)
>>

what's the justification of returning a decimal value?
BrianH:
16-Nov-2010
** uses a decimal operation, so if it didn't return a decimal it 
would have conversion losses. For powers of 2 SHIFT is better.
Ladislav:
17-Nov-2010
we need to make distinction between overwriting a variable, and overwriting 
a block
Anton:
17-Nov-2010
Perhaps WHILE could also accept a word! for its condition parameter, 
and when it does, evaluates it to the block it is expected to reference 
before continuing to evaluate as usual.
Eg.
	while 'cb [...]
BrianH:
19-Nov-2010
What should this function be called, and what options does it need?

change-in: funct [key value] [
    either a: find block key [change next a :value][
        repend block [key :value]
    ]
]


It basically implements the a/key: value operation of maps, but for 
series.
ChristianE:
19-Nov-2010
Yes, of course, Gregg, UPDATE only working on ports seems indeed 
too limited for such a nice word. 


BTW, Brian, is the above behaviour to return after the change for 
updates and at the insertion for inserts intended?

>> update: :change-in
>> attributes: []
== []
>> update attributes 'color red
== [color 255.0.0]
>> update attributes 'color blue
== [] ; or rather [color 0.0.255]
ChristianE:
19-Nov-2010
On the other side, to answer your question, it's related to SELECT 
and should probably support most, if not all, of SELECT's refinements, 
too. That's a bit of a stretch, because for ports UPDATE probably 
needs to be very fast and can't be thwarted by too complicated refinement 
handling?
GrahamC:
19-Nov-2010
Can anyone suggest a free tool that can be used to decrypt files 
that have been encrypted using Rebol's Rijndael using a 128 bit key?
GrahamC:
19-Nov-2010
ie. I want to be sure that if I send a file encrypted using AES, 
that someone can decrypt it.
GrahamC:
19-Nov-2010
those only encrypt/decrypt text .. looking for a file tool
GrahamC:
20-Nov-2010
aescrypt looks good .. now to see if it can read a file encrypted 
by Rebol
GrahamC:
20-Nov-2010
Hmm ... http://www.rebol.org/view-script.r?script=crypt.r


I changed the strength to 256, and algorithm to rijndael .. and encrypted 
a file, but get an out of memory when I try to decrypt it :(
GrahamC:
20-Nov-2010
the other issue is that Carl uses checksum/secure to turn the passphrase 
into a binary encryption so tricky to get another tool to decrypt 
using that binary key
Sunanda:
20-Nov-2010
checksum/secure is a SHA-1 hash.....Hashes are not decryptable, but 
you should find other tools that can produce a SHA-1 hash.
GrahamC:
20-Nov-2010
I'm not even sure that the encryption needs a binary encryption key
GrahamC:
20-Nov-2010
Well, I used the encryption key as a string instead and encrypted 
to 256 bits using Rijndael and successfully decrypted with Rebol. 
 But aescrypt was not able to decrypt the file :(
Oldes:
21-Nov-2010
If you have counters block and want to increment it, is there some 
better solution than this one?
	b: ["a" 1 "b" 1]
	change f: find/tail b "a" f/1 + 1
	probe b
Cyphre:
21-Nov-2010
don't know if any of these are better(and in which sense better):

change n: next find b "b" n/1 + 1

b/("a"): b/("a")  + 1
...
Sunanda:
21-Nov-2010
This does it without using a temporary word....and it should work 
even if the counter name is not amenable to Cyphre's path notation 
(ie you are using something more exotic that strings for counter 
ids, or are using an older version of /Core).
   b:  next find/skip head b "a" 2 b b/1: b/1 + 1
Just remember to reset ....
   b: head b
....once in a while:)
Oldes:
21-Nov-2010
b/("a"): b/("a")  + 1
is the winner as it's a little bit faster and shorter.
Oldes:
21-Nov-2010
Isn't this a bug?

>> make-dir %tmp/
== %tmp/
>> write %tmp/test ""
>> exists? probe first reduce [join %.\tmp "\test"]
%./tmp\test
== true
>> delete probe first reduce [join %.\tmp "\test"]
%./tmp\test
** Access Error: Cannot delete ./tmp\test
** Near: delete probe first reduce [join %./tmp "\test"]
>> delete probe first [%.\tmp\test] ;this works
%./tmp/test
Anton:
22-Nov-2010
EXISTS? creates a port from the file! argument, then queries that.
DELETE doesn't work with ports.

I guess it is the creation of a port or QUERY which is able to handle 
backslashes, and DELETE cannot.
Izkata:
22-Nov-2010
There is another way to put a directory together with a file than 
'join, and it handles more cases with the forward/back-slash on its 
own:
>> Dir: %foo/bar
== %foo/bar
>> File: %test  
== %test
>> Dir/:File    
== %foo/bar/test
>> Dir: %foo/bar/
== %foo/bar/
>> Dir/:File     
== %foo/bar/test
>> File: %\test  
== %/test
>> Dir/:File   
== %foo/bar/test
DideC:
24-Nov-2010
To read the content of a shared folder on a machine, it's :
	read %/machinename/sharename/


But how (if its possible) can I read the list of the shared folders 
?

	read %/machine/		...does not work !!
Gregg:
24-Nov-2010
I believe the share has to be a mapped drive to show up that way. 
I don't recall every enumerating shares this way, but maybe someone 
else has.
Gregg:
1-Dec-2010
ROUND under R2 was a mezzanine, and was designed so the result would 
be an integer when possible, for use as a loop counter. It's no longer 
a mezzanine under R3. I don't remember if it was mentioned that it 
was an intentional change.
GrahamC:
3-Dec-2010
form-decimal ... Gabriele has a version around
GrahamC:
3-Dec-2010
Is there a sql like dialect ( selects ) for rebol blocks in memory 
( not disc based )
GrahamC:
3-Dec-2010
I am thinking of coverting a simple read only database to ram based 
for speed ...
Steeve:
3-Dec-2010
I know a good one, it's called PARSE IIRC
Steeve:
3-Dec-2010
(if it's not a bloated one)
GrahamC:
3-Dec-2010
I'm hacking into FreeDiams .. a free French drug interaction database 
:)
GrahamC:
3-Dec-2010
It's a GPL app to do drug prescribing and drug interactions .. I 
am just using their database
GrahamC:
3-Dec-2010
This is a RSP app .. we've already had the discussion why Cheyenne 
is not ported to R3 :)
GrahamC:
3-Dec-2010
huge?  Only 250 lines where a line is 2-3 rebol words :)
Steeve:
3-Dec-2010
It's late here, and if see more than a dozen of lines, I could die
GrahamC:
3-Dec-2010
there is probably a better method than the one I use to generate 
the permutations
Steeve:
3-Dec-2010
And what about purchasing a faster computer ? 

(I'm in a deep shit right know, I don't understand what he's talking 
about)
GrahamC:
3-Dec-2010
There's a big difference in price between the various CPU configurations 
on amazon
GrahamC:
4-Dec-2010
We have find/only for this

a: [ [ 1 2 ] [ 3 4 ] [ 5 6 ]]
find/only a [ 3 4 ]


but what if we wanted to find [ 4 3 ] where we want [ 3 4 ] to be 
equal [ 4 3 ] ie. same set?
Andreas:
4-Dec-2010
Store sorted in a and sort the query before find.
BrianH:
4-Dec-2010
There is a ticket for that.
GrahamC:
4-Dec-2010
I guess the sql indices are just faster than using a brute force 
search thru blocks
Henrik:
5-Dec-2010
does a REBOL tar dearchiver exist? I can find an archiver in rebol.org, 
but not one the other way around.
BrianH:
9-Dec-2010
SWAP is designed for just this situation, and has been backported 
to R2 as well. Here is the source if you have an old R2 version:
swap: func [
    "Swaps elements of a series. (Modifies)"
    series1 [series!]
    series2 [series!]
][
    unless any [empty? series1 empty? series2] [

        poke series1 1 also pick series2 1 poke series2 1 pick series1 1
    ]
    series1
]
BrianH:
9-Dec-2010
Note that the unless guard above is compatible with the R3 version. 
If either series is empty or at its tail at that position, it's a 
noop, silently.
BrianH:
9-Dec-2010
Watch out for this limit in R3 too (which I forgot to backport):
>> swap a: "a" b: %b
** Script error: values must be of the same type
** Where: swap
** Near: swap a: "a" b: %b
BrianH:
9-Dec-2010
If it doesn't, this needs a ticket. There are other similar gob bugs 
(CHANGE comes to mind).
BrianH:
9-Dec-2010
Then we need a ticket for that. I would think that there would be 
some GUI reasons for doing SWAP, though more for doing MOVE.
Steeve:
9-Dec-2010
Well it' s a bad example, because
>> swap g next g
is easly performed with:
>> insert g g/2
:-)
Ladislav:
9-Dec-2010
??

>> g: [a b]
== [a b]
>> insert g g/2
== [a b]
>> g
== [b a b]
BrianH:
9-Dec-2010
I just checked, and all of the functions called by MOVE are compatible 
with gobs. If they behave in a similar way then we can add gob support 
to MOVE.
Ladislav:
9-Dec-2010
working with gobs only
 - isn't it a bug, then?
Steeve:
9-Dec-2010
No it's a feature
Steeve:
9-Dec-2010
A Gob can only have one parent at a time.
Steeve:
9-Dec-2010
when you insert a gob already connected somewhere, it's automacly 
removed from the old place
GrahamC:
9-Dec-2010
My question is .. what does rebol do when it builds a function from 
the function definition
BrianH:
9-Dec-2010
This seems like a job for PROBE.
GrahamC:
9-Dec-2010
If ''layout completes, then FN will be a VID field object
BrianH:
9-Dec-2010
If there are no rows returned then that makes sense. Looks like the 
database access needs some work. And even if the path succeeded, 
the SQL at the end of btn-save would fail because the database is 
disconnected. Plus, the create statement at the beginning just creates 
a database, not a table.
BrianH:
9-Dec-2010
The error message itself refers to some fairly limited code. A couple 
probe statements would narrow things down even further.
BrianH:
10-Dec-2010
Not a stable one (there's a ticket about that). It could be guessed 
by using a logging compare function.
Dockimbel:
10-Dec-2010
I would bet on a quick sort.
BrianH:
10-Dec-2010
Merge sort is for when comparisons are *really* slow, sorting disk 
records slow. You have to have a really heavyweight mezz compare 
function to justify that. The overhead of the second series would 
be pretty high in cases where the speed difference would really matter. 
One of the inplace sorts would be better, as long as it's stable.
BrianH:
10-Dec-2010
Apparently the actual algo varies from compiler to compiler, but 
it is a mix of qsort, heapsort and insertion sort depending on which 
is fastest in particular circumstances.
BrianH:
10-Dec-2010
Interesting. It's been a long time since I used C++ (there were no 
standard libraries then). It never occured to me that someone would 
use an unstable sort algorithm without checking first whether it 
would be safe to do so. I must have missed that in college.
Ladislav:
10-Dec-2010
, which proves, that it just uses a wrong operator somewhere
BrianH:
10-Dec-2010
Or to reverse a sort, or for whatever you need it to be for.
Ladislav:
10-Dec-2010
I know, that it is documented somewhere, that the Comparator can 
yield either logic! value or a number, where a negative number means 
"<", zero means "=", and a positive number means ">"
BrianH:
10-Dec-2010
Read the ticket. "Stable" means a different thing when applied to 
sorting algorithms.
Andreas:
10-Dec-2010
I guess I wouldn't have told you about std::sort being unstable, 
if I wouldn't know what a stable sort is?
BrianH:
10-Dec-2010
If so, please mention that in a ticket comment.
BrianH:
10-Dec-2010
It might be a compiler problem.
Andreas:
10-Dec-2010
A library problem, yes.
Andreas:
10-Dec-2010
; Verification using SAME?
>> set [c d] sort reduce [a: "a" b: "a"]
== ["a" "a"]
>> same? c a
== false  ; should be true
>> same? c b
== true  ; should be false
>> same? d a
== true  ; should be true
>> same? d b
== false  ; should be false
Andreas:
10-Dec-2010
same? d a ; should be false
same? d b ; should be true
Steeve:
10-Dec-2010
Btw, by reading again your samples Brian, I think now it"s weird 
for a quick sort.
Not exactly what I expected....
Andreas:
10-Dec-2010
At least on Linux, it definitely is a qsort.
BrianH:
10-Dec-2010
Definitely mention that in a ticket comment. We might be able to 
make this a platform-specific ticket.
Andreas:
10-Dec-2010
(Neither is it guaranteed to be a quicksort.)
BrianH:
10-Dec-2010
I ran into the problem when I was sorting words in a block and the 
bindings mattered.
BrianH:
10-Dec-2010
That would explain why the ticket is still not fixed. Please mention 
this in a ticket comment - it might lead to changing its status.
BrianH:
10-Dec-2010
Does qsort take a comparison function? If so, it might be a error 
in that function.
BrianH:
10-Dec-2010
Same here - a C function pointer.
Andreas:
10-Dec-2010
Sorry, missed that. Yes, qsort takes a callback used for comparison. 
Here's the decl:


void qsort(void *base, size_t nitems, size_t size, int (*compar)(const 
void *, const void*));
BrianH:
10-Dec-2010
I still think that you need to write this stuff in a ticket comment. 
Writing it here will have no effect - the ticket is where the real 
discussion happens, and I don't seem to understand your argument 
well enough in this case to paraphrase you there.
Gabriele:
11-Dec-2010
Are we talking R2's sort or R3's sort here? I know for a fact that 
R2's sort is stable. Obviously you can't get a stable sort if you 
use a comparator function and you return a logic! value.
Steeve:
11-Dec-2010
We must focus on algos which are doing the fewer comarisons and are 
fast with data almost sorted (it's our common case).

in that sense, Timsort would be a good choice because it's unsing 
a combination of merge sort + insertion sort
merge sort = fewer comparisons.

insertion sort = the faster one on data already sorted and small 
subsets of data
Maxim:
12-Dec-2010
yes looks pretty decent... a nice wrap up here:
http://corte.si/posts/code/timsort/index.html
Steeve:
14-Dec-2010
>> heapsort serie func [a b][a < b]
GrahamC:
14-Dec-2010
Mindblock

a: "testing"

foreach v [ a ] [  .... ]

in .. .how to test if v is an empty? string?
Ladislav:
14-Dec-2010
don't you mean:

foreach v reduce [a] [if all [string? :v empty? :v] [...]...]
GrahamC:
14-Dec-2010
say I have a: "testing" b: ""

how would I say .. variable b is empty?
Ladislav:
14-Dec-2010
if you have foreach v [a] [...] , then v is a word, not a string, 
so, in case you really mean it, you need something like:

if all [string? get v empty? get v]
Steeve:
14-Dec-2010
s: make block! len: 1000
loop len [append s random len]
s2: copy s

n: 0
heapsort s func [a b][++ n a < b]
print ["bottom-up heapsort, number of comparisons =" n]

n: 0
sort/compare s2 func [a b][++ n a < b]
print ["Rebol sort (R3 + Vista), number of comparisons =" n]
Ladislav:
14-Dec-2010
Steeve, my measurements suggest, that your previous version was a 
bit faster (is it caused by the fact, that you have to provide also 
for :lesser-or-equal?
Ladislav:
14-Dec-2010
My result:

random/seed 0
s: make block! len: 1000
loop len [append s random len]

n: 0
heapsort copy s func [a b][++ n a < b]
print ["bottom-up heapsort, number of comparisons =" n]

n: 0
sort/compare copy s func [a b][++ n a < b]

print ["Rebol sort (R3 + Windows 7 Home Premium), number of comparisons 
=" n]

n: 0
msort copy s func [a b][++ n a < b]
print ["Merge sort, number of comparisons =" n]
Steeve:
14-Dec-2010
I should have a look on your merge implementation.

It's said that "merging" merge with insertion sort give better results
Steeve:
15-Dec-2010
Searching for an optimal (small and fast) implementation of the following 
pattern.
* Swap two subsets inside a serie.

input 
	block:  [4  5  6   1 2] (5 values)
	Starting index of the 2nd subset inside the block: 4

Output:
	[ 1 2    4  5  6] 

Easy to do in plain Rebol right ?

But here's the trouble, It must be memory safe. You're not allowed 
to do any memory allocation.

You're can only swap values inside the block. And the number of swaps 
should be optimal.
(no sort, no parse, no copy/make/insert/append/change)
56401 / 6460812345...563564[565] 566567...643644645646647