World: r3wp
[Core] Discuss core issues
older newer | first last |
Graham 29-Nov-2006 [6432] | 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? |
Rebolek 14-Dec-2006 [6456] | hm, not sure, but you can have one face per line (or column - don't know which direction Jerrry uses :) filled with draw block |
Maxim 14-Dec-2006 [6457] | well, I guess it depends on exactly what he is outputting... but by what I understand, the display is less an issue than the actual loading of all the characters. |
Rebolek 14-Dec-2006 [6458x2] | if he's just loading characters then keeping images in block is definitely better |
you can have block like this: [unicode-number image! unicode-number image! ...] and then just use SELECT | |
Maxim 14-Dec-2006 [6460] | yep. |
Jerry 14-Dec-2006 [6461] | Thank you for all your comments. I'll try them out. |
Graham 16-Dec-2006 [6462] | How about a /native refinement to return files in 'request-file to return files in the native file format? |
Anton 17-Dec-2006 [6463] | Why not just write a TO-LOCAL-FILES function to do that for all files in a block ? |
Graham 17-Dec-2006 [6464x4] | because it means I could do this |
show-text field form any [ request-file/only/native copy "" ] | |
and not get "none" in the field | |
umm.. let me rephrase that! | |
Anton 17-Dec-2006 [6468] | >> form to-local-file any [%hello %""] == "hello" >> form to-local-file any [#[none] %""] == "" |
Graham 17-Dec-2006 [6469x3] | form any [ to-local-file request-file/only/native copy "" ] |
form any [ to-local-file request-file/only copy "" ] | |
which errors if request-file returns none | |
Anton 17-Dec-2006 [6472] | This doesn't: form to-local-file any [request-file/only %""] |
Graham 17-Dec-2006 [6473] | ahh.. :) |
Anton 17-Dec-2006 [6474] | Too easy, eh ? |
Graham 17-Dec-2006 [6475] | yeah .. but I think it would be good to still have the switch as it reduces the work. |
Anton 17-Dec-2006 [6476] | mmm... I'm not convinced. |
Graham 17-Dec-2006 [6477] | it's a switch to control what is being returned by a function |
Chris 18-Dec-2006 [6478x3] | I'd like an inverse of the 'case function. It goes through conditions and evaluates the associated block if the condition is *false*. The following does what I need: inverse-case: func [conditions [block!] /local test][ while [not tail? conditions][ set [test conditions] do/next conditions either test [ conditions: next conditions ][ return do first conditions ] ] return test ] Any pitfalls with this approach? Also, any naming suggestions? I was thinking 'assert or 'assert-all. |
Example: | |
assert [ exists? %rebol.exe [make error! "rebol.exe does not exist"] 0 < size? %rebol.exe [make error! "rebol.exe is empty"] ] | |
Graham 18-Dec-2006 [6481] | 0 < (size? %rebol.exe) |
older newer | first last |