• 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: 38001 end: 38100]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
Anton:
14-Jun-2007
we also had a secure-clean-path....
Henrik:
16-Jun-2007
do func [a b /c] [either c [a + b][a * b]] 2 3

How do I invoke the refinement?
Henrik:
16-Jun-2007
or perhaps:

f. func [a b /c] [either c [a + b][a * b]] 2 3

do :f 2 3 ; <--- here?
Henrik:
16-Jun-2007
nope, didn't work. I need the function in a composed block:


compose [do (:f/c) 2 3] ; causes error, since arguments are not inside 
the compose parantheses.

But the arguments are not used, so:

compose [do (:f/c 2 3)]


But now the arguments are local to the function. The arguments come 
from a different context, so I can't just compose the get-word'ed 
function with the arguments.


So I'll go back to the first question on how to make a refinement 
on an inline function?
Graham:
16-Jun-2007
why use the refinement in a throwaway function?
Henrik:
16-Jun-2007
the block is a database query on a remote machine
Henrik:
16-Jun-2007
and the function helps me to find out whether certain conditions 
for a database entry is true or false
Gabriele:
16-Jun-2007
hmm, since you're composing, why not put a path there?
Gabriele:
16-Jun-2007
>> f: func [a b /c] [either c [a + b][a * b]]
>> do 'f/c 2 3
== 5
>> do 'f 2 3
== 6
Anton:
16-Jun-2007
That is a good question, Henrik.
Volker:
16-Jun-2007
what is wrong with an extra assignment?
f:  func [a b /c] [either c [a + b][a * b]]]    f/c 1 2
Volker:
16-Jun-2007
do (f: func [a b /c] [either c [a + b][a * b]] 'f/c) 2 3
Volker:
16-Jun-2007
or a wrapper, an 'f-without-c and 'f-with-c.
Volker:
16-Jun-2007
and then returns a path with a refinement. 'do gets the path, done.
Volker:
16-Jun-2007
You can put a 'use around it to avoid the temp
Volker:
16-Jun-2007
But not really sure what you want to do. somehow sending a function 
i guess.
Gabriele:
18-Jun-2007
well... if it's to be automatically called etc., i'd suggest avoiding 
refinements as much as possible. just use a logic arg.
Gabriele:
18-Jun-2007
if you really have to use refinements, you have to compose a path, 
no other way around in r2. (you see, that's why we've been asking 
for a low level apply native for so much time)
Terry:
18-Jun-2007
After dealing with strings for so many years with various languages, 
I would say that TRIM should be default with any reading/writing 
functions, and when you don't want something trimmed then use a function.

a: "  my untrimmed string   "
write no-trim a
Anton:
18-Jun-2007
That doesn't make any sense to me as I hardly ever use trim.

In the case where TRIM is embedded into some functionality, disabling 
it becomes an exercise of varying difficulty.

eg. VID's TEXT style trims text automatically, unless you specify 
AS-IS. Discovering where this happens takes a little while.
Maxim:
19-Jun-2007
some things cannot be "undone" and such behavior unless it is switcheable 
is dangerous... I've had many problems with memory useage since Carl 
switch the object model so that it copies all series at each new 
instance... the old way was simple to copy... but now, its almost 
impossible to share data amongst peer instances. 


I know why he did it... but I think more explicit documentation where 
the feature was causing some unexpected effects for newbies would 
have been a better solution. and we still have many of the string 
sharing side effects in View anyways... so it didn't explicitely 
fix the main issue in the first place!
Maxim:
19-Jun-2007
so its a bit like the pre-reduce on apply debate... it can't be undone 
(unless a switch exists, then its ok)  in this case, that is what 
/only usually stands for.
Gabriele:
22-Jun-2007
terry, it's not possible to implement a no-trim function.
ICarii:
23-Jun-2007
a: [a b c [d e f]] - in this is [d e f] referenced?
Henrik:
23-Jun-2007
>> a: ["string"]
== ["string"]
>> append a/1 "2"
== "string2"
>> a
== ["string2"]
>> b: copy a
== ["string2"]
>> append a/1 "3"
== "string23"
>> b
== ["string23"]
>> c: copy/deep a
== ["string23"]
>> append a/1 "4"
== "string234"
>> c
== ["string23"]
>> a
== ["string234"]
>> b
== ["string234"]
Henrik:
23-Jun-2007
not copying deep is a common mistake, when series inside blocks or 
objects don't behave or suddenly change contents where they shouldn't.
Henrik:
23-Jun-2007
is the above not clear enough? I'm not sure how else to explain it. 
If you want to copy everything inside a block, just go for copy/deep.
ICarii:
23-Jun-2007
a: [a b c [d e f]]
b: copy a
append a/4 'g
;b now has g
c: copy a
append a/4 'h
;c does not have h but b does.
ICarii:
23-Jun-2007
something like the following would be useful for new people:
;given the following series
a: [a b c [d e f]]
;perform copy
b: copy a
probe b
>> [a b c [d e f]]
;b contains [a b c [{and references a/4}]]
;this can be seen by appending to a/4 and checking b again
append a/4 'g
probe b
>> [a b c [d e f g]]

;now on copy/deep an exact copy with no referencing of internal series 
is made
c: copy/deep a
append a/4 'h
probe c
>> [a b c [d e f g]]
;c does not have h but b does.
probe b
>> [a b c [d e f g h]]
append a 'i
;and neither b nor c will contain 'i as it is in the outer series
probe c
>> [a b c [d e f g]]
probe b
>> [a b c [d e f g h]]
Geomol:
23-Jun-2007
Should we prepare for a revision of the REBOL wikibook, when R3 is 
out? Either change directly or make a now book copying over, what 
is ok and adding new?
Henrik:
24-Jun-2007
brianH, sorry, I just seemed to remember Carl talking about inverting 
the behaviour so you'd need a refinement to avoid copying deep.
TimW:
30-Jun-2007
How do you set or reset objects within other prototype objects. i.e.
prot: make object![
	num: none
	names: make object![
		a: copy "A"
		b: copy "B"
	]
]

x: make prot[
	foo: 56
	;how do I set a to be different
	;how do I add a 'c here to set
]
Anton:
1-Jul-2007
x: make prot [
	foo: 56
	names: make names [
		a: copy "Different"
		c: copy "Added"
	]
]
Henrik:
2-Jul-2007
Geomol, the book probably needs a good rewrite or rethinking. Only 
a few sections are still usable.
Sunanda:
5-Jul-2007
I'm trying to get a list of all the arguments to get-modes. But, 
right now, the online dictionary is broken for that function:
http://www.rebol.com/docs/words/wget-modes.html
Can anyone help?
(Meanwhile, I'll rambo the problem)
btiffin:
5-Jul-2007
Math question.  Aside from a routine! or Rebcode is there existing 
code to do 32bit by 32bit multiply in REBOL which evaluates to be 
equivalent to C code a * b;  with no overflow throw?
Ladislav:
5-Jul-2007
c-multiply: func [a [integer!] b [integer!]] [first (1x0 * a) * (1x0 
* b)]
Gregg:
5-Jul-2007
I thought I had a list somewhere, but can't find it. You probably 
already have all these.

files:
	file-modes
	copy-modes
net ports:
	network-modes
	interfaces
ports:
	port-modes
Sunanda:
5-Jul-2007
Thanks Gregg -- I was looking for the definite list of file modes: 
world-write etc.
A bit of extra Googling got me to here:
http://www.rebol.com/docs/core25.html#sect1.1.

It would have been easier with some SEO on the .com and .net sites.
ICarii:
7-Jul-2007
updatedir: func [current-dir basedir /local contents base-contents 
item base-item item-info base-item-info][

 unless exists? current-dir [return] ;returns if source is not present 
 - eg someone removes a cd
	contents: read current-dir

 unless exists? basedir [make-dir basedir while [not exists? basedir][wait 
 0]]
	base-contents: read basedir
	foreach item contents [
		base-item: find base-contents item
		either dir? item [
			updatedir join current-dir item join basedir item
		][
			either none? base-item [

    write/binary join basedir item read/binary join current-dir item
			][
				item-info: info? join current-dir item
				base-item-info: info? join basedir base-item
				if item-info/date > base-item-info/date [

     write/binary join basedir item read/binary join current-dir item
				]
			]
		]
	]
]
updatedir %sourcedir/ %destdir/
ICarii:
7-Jul-2007
when run repeatedly (if i trap the error) it completes successfully.. 
is there a 1 write at a time rule in rebol?
Pekr:
7-Jul-2007
it has to be a bug, because it is not logical - it is a result of 
'read operation, yet if you query the result, e.g. exists? %c/ you 
get 'false result. That is not imo correct.
Gabriele:
7-Jul-2007
petr, no, that is not a bug.
Pekr:
7-Jul-2007
what is first slash representing? It is a root-dir? Then it might 
make sense. Or is it just a syntax?
Pekr:
7-Jul-2007
so that %c/, even if being a drive assigned letter, is being treated 
as a directory here ....
Pekr:
7-Jul-2007
is there a bug or what? Can copy-modes be set for directory too?

>> modes: get-modes %sqlite/ get-modes %sqlite/ 'copy-modes

== [creation-date: 2-Jul-2007/10:20:05+2:00 access-date: 2-Jul-2007/10:20:07+2:00 
modification-date: 2-Jul-2007/
10:20:07+2:00 owner...

>> set-modes %sqlite/ modes
** Access Error: Cannot open /c/!rebol/view/sqlite/
** Near: set-modes %sqlite/ modes


I simply wanted also my copied directories, not only files, to carry 
on original attributes ....
Gabriele:
8-Jul-2007
Petr, I'm not sure what you want. Obviously %c/ is a dir, and obviously 
it is at the root, so you have to access it as %/c/. This is called 
platform independent file paths. It's the same for all platforms.
Pekr:
8-Jul-2007
Brock, I was confused about reading %/ and getting %c/ instead of 
%/c/, that is all. I did not regarded %/ a root, I thought it is 
just a helper, as %. is .... that dot surely is not real part of 
filesystem, is it?
Graham:
8-Jul-2007
I reported this a couple of years ago .. it does not work
Pekr:
8-Jul-2007
ok, thanks a lot ... it is a pity, I don't need it in fact, but found 
that possibility in docs, tried it, and it nicely works for files 
....
Pekr:
8-Jul-2007
and is there a way to create directory not using make-dir, directly 
setting such attributes during creation process, not later?
Sunanda:
9-Jul-2007
Given 'does is simply a shortcut for 'func, why not:
    report: func [item] [print item]
btiffin:
9-Jul-2007
Yeah bind is a little ummm, magically delicious.
btiffin:
9-Jul-2007
I've been a little curious about attempt...
if not error? set/any 'value try :value [get/any 'value]

Are there any conditions where the [get/any 'value] could fail and 
as it is outside the try cause an interpreter error trap?  I don't 
know.
Gabriele:
9-Jul-2007
inside foreach and accessible somewhere else == global. the proper 
way to do it is a function argument. you can bind, but that does 
not seem clean to me (argument is clean).
Pekr:
10-Jul-2007
yes, I know I could do that, but why read, as a native, is not catched 
when inside of attempt?
Louis:
10-Jul-2007
Does anyone remember the command for converting a binary file to 
a string so it can be sent by email?
Louis:
10-Jul-2007
Pekr, enbase/base is not what I had in mind. It was a special command 
that did not need a refinement, if I recall correctly.
Louis:
10-Jul-2007
I'm wanting to send a bunch of huge files to my son. I used this 
command awhile back to convert the files to text, then used compress 
to greatly shrink their size. Unfortunately I accidentally erased 
the source file for my script, and now can't remember the name of 
the command.
Graham:
10-Jul-2007
compress creates a binary file
Louis:
10-Jul-2007
What I want to do in convert a binary file to a string.
Jerry:
10-Jul-2007
>> blk: [ delete none ]
== [delete none]
>> type? blk/1
== word!
>> type? blk/2
== word!  
;
; none is not of the none! type, unless it's been evaluated. 
; none is so-called indirect value in the REBOL/CORE doc at
; http://www.rebol.com/docs/core23/rebolcore-4.html
;
; In http://www.rebol.net/r3blogs/0034.html, 
; there is a so-called "Scant Evaluation"
;
>> obj: construct [ n: none d: delete ]
>> type? obj/d
== word!
>> type? obj/n
== none! 
; 
; WHY obj/n IS NOT OF THE WORD! TYPE ???
; The "Scant Evaluation" should not evaluate none here.
Jerry:
10-Jul-2007
Louis, I knew that. My question is ... why none (a word!, not a none!) 
is evaluated in this case. It should not. Notice that none is a word!. 
it has to be evaluated to become a none! That's why Carl called it 
"indirec value" in the REBOL/Core doc.
Louis:
10-Jul-2007
I see what you mean. The actuality seems to contradict those documents.

>> obj: construct [ n: none d: delete ]
>> probe obj
make object! [
    n: none
    d: 'delete
]


It seems that only potentially dangerous evaluation is prevented, 
and not all evaluation.


Scant Evaluation: A minimal form of evaluation used for headers and 
other data blocks that do not allow any level of deep evaluation.
  Perhaps the evaluation of none is not considered "deep."
Graham:
10-Jul-2007
http://www.rebol.net/cookbook/recipes/0026.html


This recipe says that a binary file is being sent.  I wonder how 
this works because the content type is url encoded, but there is 
not url encode function as a mezzanine by default.
Louis:
10-Jul-2007
Jerry, I found this:


The CONSTRUCT function will perform evaluation on the words TRUE, 
FALSE, NONE, ON, and OFF to produce their expected values. Literal 
words and paths will also be evaluated to produce their respective 
words and paths. For example:


    obj: construct [
        a: true
        b: none
        c: 'word
    ]


The obj/a value would be logical TRUE, obj/b would be NONE, and obj/c 
would be WORD.

file:///C:/SDK/docs/changes.html
Jerry:
11-Jul-2007
>> obj: construct [ a: on b: yes ]
>> probe obj
make object! [
    a: true
    b: 'yes
]
Gabriele:
11-Jul-2007
Jerry, this is a "feature" of construct. the words NONE, TRUE and 
FALSE are converted to the respective values. it is done to allow 
construct to work correctly when /all is not used with mold.
Gabriele:
11-Jul-2007
in general, it is much better to use mold/all instead, but i know 
construct can give you headaches if you really want to have a word 
in there.
Henrik:
16-Jul-2007
my bitset creation skills are a bit rusty. how do I create a bitset 
that means 'anything but #" "' ?
Louis:
17-Jul-2007
How can I prevent a window from popping up when I have set security 
to none?
Louis:
17-Jul-2007
Brian, thanks. I forgot to say that this is a script on XP operating 
system. I have the following line in the target field of a shortcut:

C:\.Alkitab\ftp-backup.r -s allow

But the window still pops up.
Louis:
17-Jul-2007
Now, I have just one more problem to solved to be in business. I 
need the script to be run automatically in the background every 10 
minutes, then exit, but windows scheduled tasks can be run no more 
frequently then once a day.
ICarii:
17-Jul-2007
give it a daily end time and you're away laughing :)
BrianH:
17-Jul-2007
Use this function for memory cleanup:

after: func [a b] [:a]
Sunanda:
17-Jul-2007
According to Gabriele, REBOL never frees memory -- ie never hands 
it back to the operating system.

That means (I think) freed / garbage collected memory is kept in 
REBOL's grasp for reallocation, so subsequent allocations are faster 
than ones that need to go to the opsys. But the memory footprint 
of an application can be higher than you'd expect -- especially (say) 
if you do a lot of memory intesmive work at start up: that memory 
will stay allocated to REBOL throughout the life of the application.

One way to avoid that may be to use CALL to run parts of the application 
under another process. Or perhaps use a webserver and split the app 
into several non FastCGI scripts.
***

I've no idea if R3 does allow for opsys memory handback. It would 
be a useful option to have:
    recycle/for-real
Dockimbel:
17-Jul-2007
From a fresh REBOL/View 1.3.2.3.1 :

>> system/stats
== 4236013
>> system/stats/recycle
== [1 2054 2054 183 183 1869648]
>> make string! 1'860'000
== ""
>> system/stats
== 6099084
>> system/stats/recycle
== [1 2054 2054 183 183 7088]
>> make string! 10'000
== ""
>> system/stats
== 3210049
>> system/stats/recycle
== [2 6385 4331 543 360 2999280]

Just guessing: 


REBOL triggers a GC when the "ballast" value (the last one in the 
block) reaches 0. Then the GC frees only the values that aren't referenced 
anymore. So GC are predictable if you know exactly how much memory 
is consumed by each evaluated expression. Remember that it very easy 
in REBOL to keep hidden references on values (like functions persistent 
context)...


So that way, it keeps a fast average time for new allocations. (I 
guess also that series! and scalar values are managed with different 
rules).


The above example also shows that REBOL gives memory back to the 
OS, but the conditions for that to happen are not very clear to me. 
The GC probably uses complex strategies. If the GC internal rules 
were exposed, we could optimize the memory usage of your applications, 
and probably the speed too.
BrianH:
17-Jul-2007
after: func [a b] [:a]

something: func [/local a] [a: make string! 10'000'000  after a a: 
none]


If you use after a lot, the next call will displace the memory taken 
by the last. If you don't want to wait, call
    after none none
Geomol:
17-Jul-2007
Is it a way of cleaning up, so the local a doesn't point to some 
mem area, and so the garbage collector can do its job?
BrianH:
17-Jul-2007
Otherwise (in R2) the function SOMETHING will retain the value of 
the word a until the SOMETHING function is called again, or is itself 
collected. If that value is large it could be a problem - hence the 
really large value in my example.
Geomol:
17-Jul-2007
I situations with strings (or series in general) like that, I use 
to put the function and the variable in a context and do
clear a

when it's needed. That way I reuse the mem area. Would I need the 
after function? hmm ...
Geomol:
17-Jul-2007
To make it clear, I would do something like:

context [
a: ""

something: does [clear a  ... ]     ; do something with a, maybe 
filling it with lots of data or whatever
]
Dockimbel:
17-Jul-2007
if you play a little more with this example allocating big buffers 
then releasing them, you'll see memory used going up and down (I 
even could go back close to initial state after something like  a: 
make string! 100'000 recycle). So REBOL releases some parts to OS, 
but it's hard to predict how much and when...
Rebolek:
19-Jul-2007
From RT Q&A:

Q: While reviewing the action! functions, I noticed the path action. 
The doc comment says "Path selection.". The parameters aren't typed. 
Does anyone know what this action does, and how to use it? Or whether 
it can be or should be called directly at all?


A: the PATH action is what the interpreter uses to evaluate VALUE/selector 
expressions for each datatype. It is an internal action and has no 
external purpose in programs. These kinds of words often appear as 
a sort of "side-effect" from how REBOL is structured.  Datatypes 
are implemented as a sort of object class, where the interpreter 
"sends messages" to the class to evaluate expressions. The PATH action 
is a message that tells the datatype to perform a pick-like or poke-like 
internal function.

Some other discussion:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/aga-display-posts.r?post=r3wp152x1804

http://www.rebol.org/cgi-bin/cgiwrap/rebol/aga-display-posts.r?post=r3wp157x7205
Louis:
22-Jul-2007
s: "Hi engkau. Mengapa kaulari? Topikau ada di sini dan jaskau ada 
di sana."


In string s above, is there an easy way to replace (with "engkau" 
all instances of "kau" that are not preceeded by  " " (a space) or 
immediately followed by a letter?
Louis:
22-Jul-2007
In other words, I only want "kau" to be replace with "engkau" when 
"kau" is preceeded by a letter and followed by a space or puncuation 
mark.
Louis:
22-Jul-2007
Geomol, thanks!  I'll do some testing and get back with you in a 
few hours.
Louis:
22-Jul-2007
Geomol, perfect! and simple. Many, many thanks! You have saved me 
a lot of time.
btiffin:
26-Jul-2007
Is there a way to detect if a script is run from >> do %script.r 
 versus  $ rebol script.r  ??
I'd like to  either from-console [halt] [quit]
btiffin:
26-Jul-2007
I was playing with those...but you tweaked a memory.  There was a 
weirdness in the DevCon presentation...it was system/options/script. 
 Thanks John.
Volker:
26-Jul-2007
parent of system/script. each 'do adds a header there while the sub-script. 
none? system/script/parrent/parrent IIRC.
btiffin:
26-Jul-2007
I think it comes down to  system/options/script  This seems to only 
be set (at least in GNU/Linux land) when the shell $ rebol script.r 
is used to kick start.  I'm pretty sure I can use this for a reasonable 
bail test.   Regardless of how many do levels down,  system/options/script 
 is the original shell start script name (or none if do'ed)  This 
is reasonable right?  If the user starts from the shell, bail to 
the shell, starts from the console, bail to the console.
Geomol:
27-Jul-2007
Given a block with one element:
>> blk: [1]
== [1]
I move the blk pointer forward one position:
>> blk: next blk
== []
I then append one element:
>> append blk 1
== [1 1]

and the head of blk is shown, which is the behaviour of append. The 
address of blk is the same:
>> blk
== [1]
I now clear the whole block:
>> clear head blk
== []
and append yet another element to the now empty block:
>> append blk 1
== [1]
But blk now points to the tail of the block!
>> blk
== []

Shouldn't I see the element at the position of blk? I mean, blk should 
now point to the head of the block, right? I couldn't find this in 
RAMBO.
PeterWood:
27-Jul-2007
Take a look at Gabriele's email signature......

Gabriele Santilli
Rebol Programmer
Geomol:
28-Jul-2007
Is it the language, that specify, what you are? With REBOL I think, 
it's possible to be a script writer, a programmer, a developer, a 
designer, an inventor, a tester, etc.. Doesn't it depends on the 
task or job situation, where you use REBOL?

Like there are many different jobs, where you need good english (language) 
capabilities.
Geomol:
28-Jul-2007
I normally call myself a system developer or just developer, because 
I do many different jobs with REBOL, and "developer" is a more generel 
term.
Geomol:
28-Jul-2007
I guess, the confusion come from back, when the term "script writer" 
popped up first, in the '70 or earlier. Script writers were the ones, 
who wrote scripts (e.g. shell scripts), which were typically small 
pieces of code to be run in the shell on large computers (mainframes). 
Those scripts did operating system maintenance and called programs. 
Programs were written in languages as C, COBOL, etc.. So you had 
a clear distinguish between a script writer and a programmer. What 
we do today with REBOL is more often the programmers job (I think), 
even if it's called a script language.
btiffin:
28-Jul-2007
Yep agree.  It's a blurred line now-a-days.  While I was watching 
a group of C++ programmers p#$$ away some 30 million dollars my poor 
little Tcl/Tk prototype just made them mad.  "Not engineered if it's 
scripted!!!"  :)  Oh well, the original Forth system is still in 
production and corporate will try to replace it with a engineered 
solution...usually started with CASE tool cloud diagrams.
Henrik:
28-Jul-2007
geomol, probably a different word in this context for "not invented 
here"
btiffin:
28-Jul-2007
Umm, I think it means they don't get a chance to overthink the problem. 
 Now to be honest, large projects do need a good work breakdown and 
management back end, but the coding usually ends up far too complicated 
to ever get off the ground (in my somewhat limited experience - I 
only watched them fail 5 times so far).  And polyFORTH keeps chugging 
along... and again in a little defense of corporate...they have very 
few L33t's that can handle poly.
38001 / 6460812345...379380[381] 382383...643644645646647