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

World: r3wp

[Core] Discuss core issues

GrahamC
20-Nov-2010
[529x2]
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 :(
I had padding set to false
Oldes
21-Nov-2010
[531]
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
[532]
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
[533]
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
[534x3]
b/("a"): b/("a")  + 1
is the winner as it's a little bit faster and shorter.
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
I expect that when it's possible to get true on exists?, the delete 
should work.
Izkata
21-Nov-2010
[537]
I get false on the exists? line (linux, 2.7.6)
Anton
22-Nov-2010
[538x3]
Oldes, what filesystem ?
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.
I think you should normalise your files using TO-REBOL-FILE.
Oldes
22-Nov-2010
[541x3]
ntfs. And yes, I normalise now, just wanted to know, why it's different 
and if it's correct. (because I've spent some time to figure out 
this exists?/delete difference).
in other words.. I was expecting, that when I join something to rebol 
file, it will normalise it for me.
But maybe it's more related how join behaves:
>> join %test as-binary "test"
== %testtest
>> join %test ["test"]
== %testtest
>> join %test [as-binary "test"]
== %test#%7B74657374%7D
>> rejoin [%test as-binary "test"]
== %test#%7B74657374%7D
but you ar right, it's my fault that I was lazy.
Izkata
22-Nov-2010
[544]
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
Oldes
22-Nov-2010
[545x2]
I know, but that does not solve my case where I had to build path 
from external sources, which could contain the backslash. Like:
>> dir: %test/
== %test/
>> file: ".\LIBRARY\something"
== ".\LIBRARY\something"
>> dir/:file
== %test/.\LIBRARY\something
But to-rebol-file makes it valid for sure:
>> to-rebol-file dir/:file
== %test/./LIBRARY/something
DideC
24-Nov-2010
[547]
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
[548]
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.
Izkata
24-Nov-2010
[549]
I think I remember seeing something of the sort with:
read%//

But I'm not on Windows right now, so I can't check
Oldes
25-Nov-2010
[550x2]
Do you think that this is correct?
>> integer? round 232.2
== true
I was somehow expecting that the number is still decimal = 232.0
Ah.. now I see that R3 works as I expect.
Gregg
1-Dec-2010
[552]
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.
BrianH
1-Dec-2010
[553]
And we don't need to use integers for loop counters anymore.
GrahamC
1-Dec-2010
[554]
we can use real numbers?
BrianH
1-Dec-2010
[555]
In R3, yes. There is an implicit to-integer.
Oldes
3-Dec-2010
[556x2]
Is it possible to change file-modes of directory? This doe not work:
>> get-modes %/f/dir/ 'creation-date
== 26-Oct-2010/16:55:30+1:00
>> set-modes %/f/dir/ compose [creation-date: (now)]
** Access Error: Cannot open /f/dir/
** Near: set-modes %/f/dir/ compose [creation-date: (now)]
What is the best way to form decimal and avoid the E notation?
>> form .02
== "2E-2"
GrahamC
3-Dec-2010
[558]
form-decimal ... Gabriele has a version around
Steeve
3-Dec-2010
[559]
Nice challenge. To find the smallest mezz to do so
GrahamC
3-Dec-2010
[560x3]
Is there a sql like dialect ( selects ) for rebol blocks in memory 
( not disc based )
I am thinking of coverting a simple read only database to ram based 
for speed ...
I thought I read of one once .. but maybe I am wrong.
Steeve
3-Dec-2010
[563]
I know a good one, it's called PARSE IIRC
GrahamC
3-Dec-2010
[564]
so I can just change the scheme from odbc to ram or whatever
BrianH
3-Dec-2010
[565]
EXTRACT works well for that, and maybe MAP-EACH too if you do nested 
blocks.
GrahamC
3-Dec-2010
[566]
No joins involved
BrianH
3-Dec-2010
[567x2]
There are some databases that are RAM-based already and have SQL.
For that matter, RebDB is SQL-like and RAM-based, iirc.
GrahamC
3-Dec-2010
[569x2]
Ah.. I can look at rebdb then
my queries are currently taking 2 seconds and I need subsecond performance
BrianH
3-Dec-2010
[571]
You might look at EXTRACT or MAP-EACH then. For simple queries with 
no joins, SQL is overrated.
Steeve
3-Dec-2010
[572x2]
If you give us your actual script we can find some improvment rooms. 
Despite beeing lazy, we are not bad at such game.
(if it's not a bloated one)
GrahamC
3-Dec-2010
[574]
I'm hacking into FreeDiams .. a free French drug interaction database 
:)
Steeve
3-Dec-2010
[575]
Don't trust French commercials
GrahamC
3-Dec-2010
[576]
It's a GPL app to do drug prescribing and drug interactions .. I 
am just using their database
BrianH
3-Dec-2010
[577]
Once the database is in memory you don't necessarily need to do set 
operations (SQL select). You can do iterative operations much more 
quickly.
GrahamC
3-Dec-2010
[578]
source is here https://fd.cloud-ehr.net/drugreactions.txt