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

World: r3wp

[Core] Discuss core issues

Rebolek
28-Nov-2006
[6406]
Can somebody explain to me, how does FIND work in file! ?

>> path: %/disk/drawer/
== %/disk/drawer/
>> file: %/disk/drawer/file
== %/disk/drawer/file
>> find/match file path
== %file
>> find/match file %/disk
== %/drawer/file
>> find/match file %/disk/
== %drawer/file
>> find/match file %disk/
== none
>> find/match file %drawer
== none


It seems to work only if the searched string stars on begining of 
file!
Anton
28-Nov-2006
[6407x2]
That's right, the /MATCH refinement causes exact matching to occur 
from the position you specify (eg. the start). I was a bit confused 
by this at first too. What you probably want is the /ANY refinement, 
which switches on wildcards. So use /ANY instead of /MATCH and you'll 
be alright.
There's nothing special about FIND's treatment of FILE! datatype 
here. It's just another any-string!
Rebolek
28-Nov-2006
[6409]
I'm using /MATCH because I want to strip part of path. I'll probably 
make parse rule for it :/
Anton
28-Nov-2006
[6410x2]
Ah.. maybe you want FIND/ANY/TAIL
or just FIND/TAIL
Rebolek
28-Nov-2006
[6412]
Anton great, that's exatly it!
Maxim
28-Nov-2006
[6413]
Cyphre, where is this documented?
Gregg
28-Nov-2006
[6414]
You can also use the API to get the current keyboard state, whether 
or not you trap the key yourself. And, yes, if we ever get system 
ports working under View, it will be nice; for file drops alone it 
would be great.
Jerry
28-Nov-2006
[6415]
About the numLock and capsLock, the problem is solved. In ActionScript, 
there are "flash.ui.Keyboard.numLock" and "flash.ui.Keyboard.capsLock". 
I am programming my GUI using ActionScript and my engine using REBOL. 
And ActionScript and REBOL talk to each other through sockets.
Gregg
28-Nov-2006
[6416]
Cool.
Cyphre
28-Nov-2006
[6417]
Maxim: AFAIK the only info about system port I know is here:
http://www.rebol.com/docs/changes.html#section-5.10and 
and also Gregg's script at rebol.org:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=sys-port-drag-accept.r
Maxim
28-Nov-2006
[6418x3]
my god... how can such a big feature pass by virtually unused...
I didnt even know about the system port being something we could 
program.
I was asking and ranting about being able to accept OS events ... 
and IIRC no one droped this on me !
Geomol
28-Nov-2006
[6421]
Max, you're always ranting maybe!? ;-P (joking)
Maxim
28-Nov-2006
[6422x2]
hehhee
I'm the Canadian Pekr  ;-)
Pekr
28-Nov-2006
[6424]
what? hehe :-)
Geomol
28-Nov-2006
[6425]
I wan't my x-mas present NOW! .... oh, wrong channel... ;o)
Maxim
28-Nov-2006
[6426]
hahaha
Rebolek
28-Nov-2006
[6427]
maxim lol :)))
ICarii
28-Nov-2006
[6428]
More info on the abilities of system port would be great - till then 
ill experiment with it to see just what its range is under windows..
Graham
28-Nov-2006
[6429]
If Carl is still writing learner docs, perhaps he could finally document 
the system port.
Gregg
29-Nov-2006
[6430]
Under Windows, you can trap pretty much any WM IIRC, but you can't 
do it from a View window, which is the big limitation. Still useful 
for some things though.
Graham
29-Nov-2006
[6431x2]
Eh ?
the system port can't be used for drag and drop and View faces?
Gregg
29-Nov-2006
[6433x2]
Nope.
At least I could never get it to work.
Graham
29-Nov-2006
[6435]
Hope this is rectified in r3
Henrik
29-Nov-2006
[6436]
what's the fastest way to sort a directory of files chronologically?
Rebolek
29-Nov-2006
[6437]
This needs 'foreach-file from rebol.org

>> include %foreach-file.r
>> out: copy [] ff: func [file][repend out [file modified? file]]
>> foreach-file %./ :ff

== [%./!/basics_wide_desktop_computer_system.xml.ttx 21-Jun-2006/16:05+1:00 
%./!/basi
cs_wide_hard_disk_drive.xml.ttx 21-Jun-2006/8:...
>> sort/skip/compare out 2 2

== [%./ft/wavs/balloon.wav 23-Aug-2001/13:00+1:00 %./ft/wavs/down.wav 
23-Aug-2001/13:
00+1:00 %./ft/wavs/error.wav 23-Aug-2001/13:00...
Henrik
29-Nov-2006
[6438]
thanks
Gregg
29-Nov-2006
[6439]
Hmmm, has anyone looked at my FILE-LIST script on REBOL.org? If so, 
would it make sense to add an option to sort the results, or an option 
to have extra data returned (e.g. attrs or date-time) along with 
the file names themselves?
Jerry
14-Dec-2006
[6440]
; version 1
my-face: make face [
    my-data: none
]
make-my-face: func [ extra-data ] [
    make my-face [ 
        my-data: extra-data 
    ]
]
; end of version 1

; version 2
my-face: make face [
    my-data: none
    new: func [ extra-data ] [
        make my-face [ 
            my-data: extra-data 
        ] 
    ]
]
; end of version 2


Quesion: I have a lot of my-face objects ( 1,000,000+ ) in an appication. 
Which version is better? Will the version 2 take more memory since 
the "new" is a object method instead of a function?
Maxim
14-Dec-2006
[6441]
1 million objects?  how much RAM is that taking?
Jerry
14-Dec-2006
[6442]
It depends. Every my-face shows an Unicode character bitmap. They 
are put in a pool for saving memory. If a character is not needed, 
it won't be loaded. ... Showing a long article wich Chinese character 
in it is a nightmare. Short article is not a problem though.
Maxim
14-Dec-2006
[6443x3]
why don't you simply use AGG to "stamp" each character in a bitmap? 
 using the draw command over and over (per character or per line)
this can limit your memory use a lot! especially if you do a pre 
analysis and count the recurrence of each character in the article 
(so you can keep only those that recur, saving some speed).
I guess some of this is what you already do...
Gabriele
14-Dec-2006
[6446]
version 2 definitely takes more memory.
BrianH
14-Dec-2006
[6447]
With v2 that object method will be copied to every object. The factory 
function approach you use in v1 is better.
Gregg
14-Dec-2006
[6448]
And with that number of objects, if you can use blocks instead of 
objects, it will reduce the weight even more.
Maxim
14-Dec-2006
[6449]
but notice he is creating faces... can't replace that with block 
 !
Rebolek
14-Dec-2006
[6450]
it's possible to replace it with block, when you create draw dialect 
instead of pane of faces
Gregg
14-Dec-2006
[6451x3]
Right, to clarify, if your my-face object has other overhead that 
could be externalized, do that, and use blocks that contain a reference 
to the lightest-weight face you can use.
Yes, even better rebolek.
It's exciting to see someone pushing REBOL this way though!
Rebolek
14-Dec-2006
[6454]
placing bitmaps with draw is possible even in non-AGG versions of 
View
Maxim
14-Dec-2006
[6455]
do you think such a big draw block will hold?