• 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: 38101 end: 38200]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
btiffin:
28-Jul-2007
Ok, next one.  I'm thinking about quit/halt.  If a script is started 
from the console with do,  it should halt to the console right?  
If started from an icon click or a shell command it should quit? 
 Or do people mind just restarting up another REBOL console when 
an app quits on them?  Or other way round, an app started with an 
icon click should never halt, correct?
Geomol:
28-Jul-2007
Started from console, and it should just halt. I get this wrong sometimes 
myself. It could be good to have an equal way of doing this, so please 
tell me, when you find a good way! Standards! (It should also work 
equally on all version of REBOL on all platforms.)
btiffin:
28-Jul-2007
I'm using  system/options/script  - it is only set if a script is 
started up along with REBOL.  I was thinking of posting a   cease 
 idiom.   It is kind of a pain to do a script that quits, but on 
the other hand, I don't think that in the general case, a script 
started from an icon should ever halt, so quit seems to be a better 
'default'.
Geomol:
28-Jul-2007
Would it work, if scripts always use QUIT, and then when in a console, 
we redefine QUIT like:
>> quit: :halt
btiffin:
28-Jul-2007
I'd buy into that.  Now can someone wield a big enough stick? :)
Geomol:
28-Jul-2007
If I remember correctly, an action is some kind of a wrapper, that 
can handle different datatypes. In practise, they work like a native.
Henrik:
28-Jul-2007
yes, a lot of them also has "Returns TRUE..." in their help text
Henrik:
28-Jul-2007
well, value? is a native, because it only accepts word! ?
Geomol:
28-Jul-2007
input? is also a native.
Henrik:
28-Jul-2007
I think it's purely an implementation issue. If APPEND in R3 was 
a native rather than an action, it would not be able to use as many 
types as arguments as it does.
btiffin:
28-Jul-2007
Has anyone ever written a version of clean-script.r that will (attempt 
to) pretty print at email safe 80 column limits?
btiffin:
29-Jul-2007
Ok...is there a function that emulates the behaviour of flowing through 
a script?

Outter.r
rebol []


while [true] [print "calling inner" do %inner.r  print "called inner"]

Inner.r

rebol []

if confirm "Quit? " [quit]
if confirm "Halt? " [halt]
if confirm "Break? " [break/return 10]
print "Bottom of inner"


The only way I can get outter.r to continue the while loop is by 
answering No to all the prompts and flowing through.  I'm questing 
for a way to get out of a do'ed script without breaking outter and 
recoding the whole inner script to have it flow through.  I'd like 
to be able to use do and not launch or call.
btiffin:
29-Jul-2007
Thanks gentlemen;  Found a solution.  catch and throw.
outter.r

while [true] [print "doing inner" catch [do %inner.r]  print "done 
inner"]

inner.r
rebol[]
if confirm "Throw? " [throw "some value"]
print "Bottom of inner"


And with /name, why I think I'll write spaghetti.r    Just kidding. 
 rebols don't cook spaghetti.
Gregg:
29-Jul-2007
I don't know of a width-limited formatter, but it would be a good 
thing to have.
Henrik:
31-Jul-2007
when doing a read/part http://www.somewhere.com500


does it really only read the first 500 bytes, or does the server 
deliver everything and REBOL just cuts it down to 500 bytes client 
side? it seems to take an equal amount of time to read 500 bytes 
and 100 kb.
Pekr:
4-Aug-2007
Today I was thinking about REBOL paths and namespaces navigation 
"problem". I would like some clever persons 

here, to educate me a bit in that area. So far I think, that REBOL 
breaks on some path rules, of course it 

depends, upon what "philosophy" you provide as an explanation. So, 
I was thinking about 

namespaces/paths/context, as of a tree .... So, all words are defined 
in top (global) context = root, right? 

(excuse simplification). Then comes first question - how can be following 
valid?:

a: 5
b: context [print a]


My objection is, that from the point of  'b "node", there is no 'a. 
So, my explanation is:

1) in the case of directory, we would use ../a
2) or we should go via root reference - b: context [print /a]

3) we create "philosophical" rule, stating that global (top) context 
words are propagated to subsidiary nodes 
(contexts)


I don't mind case 3), if such rules are well defined, and it will 
come, once we switch to modules.


How did I came to think about above? I have somehow aesthetical issue 
with REBOL, when I look at e.g. scheme 

code in R2. It is full of awfull system/words/word references. I 
don't like it. What I would like to see is to 
have some abbreviations. I know that we can do e.g.:

_print: system/words/print


My question is, if we could have some more abstracted solution? Do 
you remember 'with keyword? I don't 

remember how it worked, but I would like to have some ability to 
"bind" particular word from existing context 
to actual context:

bind system/words node here, so that I don't need to use paths
 (kind of like when you create links in unix 
filesystem hierarchy ....


Of course, here we go - we could easily get some colision, e.g. if 
target context contains the same words. But 

maybe that could be somehow taken care for (I thought e.g. about 
automatic adding of underscores, e.g. _print, 
but that is not good solution).


Well, the thing is, that I am not actually even sure, what am I asking 
for :-) So, I would like to ask, if 

some REBOL gurus thought about such topics, or am I completly unrealistic 
here?

Thanks ...
btiffin:
4-Aug-2007
Pekr;  I'm kinda of kidding, but not.  Avoid Multiple Inheritance 
 it a plague :)
btiffin:
4-Aug-2007
I agree.  Relative context is the way to go.  (But, always a but), 
Petr's point about system/words/copy inside the scheme overlays seems 
a little, hacky? for such core functionality.  I'd almost prefer 
to see the scheme front end code made a little more complex and include 
a uses block or some such that allows clear mapping from redefined 
words to 'previous' behaviour.
sqlab:
14-Aug-2007
You can also have a look at dispatch
james_nak:
15-Aug-2007
I was wondering if I am going about searching for particular values 
wrong. If I have a block of objects  and I want to search for a particular 
value within one of those objects should I go though each obj using 
something like "foreach" or is there a better way.
For example
movies: [m1 m2 m2]
where m1 is an object with a "title" value, etc.

foreach movie movies [
  if movie/title == "Star Wars" [.....]
]
Of course that works but it seems primitive.
Brock:
15-Aug-2007
I know there is a sql dialect out there, it would be interesting 
to know how it performs this type of query.
james_nak:
15-Aug-2007
Gregg, well in the back of my mind since I started programming with 
BASIC, C and Assembler (which, without wanting to start an Altme-war, 
I refer to as 'procedural' as opposed to OO), I was just wondering 
if there was another "object-oriented" way. You know, like "find" 
but with special parameters that tell it to do what my "foreach" 
actually does. I don't know, it just seemed kind of "Dorky." : )

I'm writing an app that will produce php code to help me administer 
mysql db's. I'm at the point where it can read the table and field 
data and create objects with that info. Now I'm at the part where 
it goes back and pulls that data out. So, I've assigned each table 
an index # then in the "columns" object, it refers back to that index. 
Since I have a block of those column objects I was just looking for 
a spiffy way of finding which ones, for example, of finding all of 
the objects that are part of table index #3.

I've always used the "foreach " method but you know, I'm always looking 
for a way to improve my code. Thanks Gregg for your input.
Geomol:
15-Aug-2007
James, are you after a search three? Do you know those data structures? 
Examples are binary search threes, B-threes, etc.
james_nak:
15-Aug-2007
Actually I was just wanting to know if I was missing something in 
the way I am checking for a value within an object that is part of 
a block of objects. Nothing really sophisticated and these blocks 
are really small so no need for speed increases. 

To be frank,  I often look at the code you all write and say to myself: 
" Self, how in the world did they think of that?" or "Oh, I didn't 
know you could do that." For example when I first started using Rebol, 
I didn't know about the  "in" word as in "Get in object 'word.." 
so I was always using paths and trying to figure out how one would 
make the path a "variable." (object/mypath, where mypath could be 
some changing value). 
Thanks for your input though.
Geomol:
15-Aug-2007
Maybe you could make a block with the titles and the objects together, 
and then just use a path to get to the object? Something like:


>> movies: reduce ["Star Wars" make object! [status: 'good!] "Matrix" 
make object! [status: 'cool]]
>> movies/("Star Wars")/status
== good!
>> movies/("Matrix")/status
== cool
Gregg:
16-Aug-2007
Another thing to consider is that this is a general need, so FOREACH 
(e.g.) may be used, but you can hide it in a wrapper func, maybe 
called SELECT-ALL, that works like REMOVE-EACH. I have different 
variations, based on how other langs do it, e.g. select/inject in 
smalltalk. Here's a very quick way to leverage REVMOE-EACH.

    filter: keep-each: func [

        "Keeps only values from a series where body block returns TRUE."

        'word  [get-word! word! block!] "Word or block of words to set each 
        time (will be local)"
        series [series!] "Series to traverse"

        body   [block!]  "Block to evaluate. Return TRUE to collect."
    ] [
        remove-each :word series join [not] to paren! body
    ]
    comment {
        filter x [1 2 3] [x = 2]
        filter x [1 2 3] [odd? x]
        filter res [1 2 3] [odd? res]
        filter [x y] [a 1 b 2 c 3] [all [odd? y  'c = x]]
    }
Joe:
17-Aug-2007
pekr,sqlab, thank you for your answers. I thought that sync ports 
also had a timeout like the async kernel (set-modes port [timeout: 
30]) but they do not. thanks
Geomol:
21-Aug-2007
Any thoughts on this?

>> #"a" * 2
== #"Â"
>> 2 * #"a"
== 194


So multiply is commutative in a 'funny' way. In this example, you 
get the result in the same datatype as the first argument. This also 
works:

>> #"a" * 2.0
== #"Â"

But you can't do:

>> 2.0 * #"a"
** Script Error: Cannot use multiply on decimal! value


So multiply is not commutative, when it comes to decimals and chars. 
Any comments? Also think of other datatypes, you wanna multiply.
[unknown: 5]:
29-Aug-2007
I once heard that R2 doesn't allow you to free memory and that R3 
will.  Anyone know if we are able to free memory in R2?  I think 
it was concerning a stats command discussion somewhere.
btiffin:
30-Aug-2007
Paul; Check http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=free-mem.r
for a small blurb and a way to free memory in R2.
btiffin:
30-Aug-2007
Newer versions of REBOL allow a simple  unset 'var  recycle  sequence. 
 But GC is voodoo a lot of times, not just in REBOL, so there are 
probably cases that this won't apply.
DanielSz:
30-Aug-2007
Hi Rebol community, I was wondering about how you deal with error 
handling in Rebol in those situations where you have a number of 
network operations which are likely to fail part of the time. Of 
course, you already raised the timeout for network protocols (system/schemes/default/timeout: 
0:10). Now say your script contains a number of network operations 
(read url, for example) wrapped in user functions. This is a very 
common situation.

For example:

fetch-actual-ip: does [

        page: read-url-with-basic-auth http://192.168.1.1/Status.htm(http-basic-auth-key 
        router_username router_password)
	parse page [thru <td class="stdbold" nowrap> copy ip to </td>]
	return to-tuple ip
]


Now this is fine, but if your read operation fails, the script will 
abort. You would like the function to try again a couple of times.


The first thing you would be tempted to do is to redefine the function 
to repeat the function in case of error or unexpected result. A recursive 
function like the next one may provide some solace: 

fetch-actual-ip: does [

        page: read-url-with-basic-auth http://192.168.1.1/Status.htm(http-basic-auth-key 
        router_username router_password)
        either none? tmp: find/tail page "ip address"
                [
                print "Retrying..."
                retries: retries + 1

                if retries > 10 [print "Retried 10 times. Exiting" quit]
                fetch-actual-ip
               ] [

                parse tmp [thru <td class="stdbold" nowrap> copy ip to </td>]
                retries: 0
                return to-tuple ip
                ]
]


You might have a number of user functions and each can fail, so transforming 
every user function into a recursive one with its own error handling 
block can be tedious. 


Wouldn't it be better to abstract the process with a meta-function 
that accepts as input the user function itself? The error handling 
logic would then be exclusively handled by that meta-function, which 
will save you from redundancy if you have multiple user functions. 

Let's do it:


retry: func [external_function [function!] retries [integer!] /local 
.retry [function!] tries [integer!] value] [
	tries: 0
	.retry: func [.external_function [function!]] [
		either not error? try [value: .external_function]
			[
			if not none? value [return value]
			]
			[
			print "Retrying..."
			tries: tries + 1

   if tries > retries [print rejoin ["Tried function " tries " times. 
   Exiting"] return]
			.retry :.external_function
			]
	]
	.retry :external_function
]

Now you call the short version of fetch-actual-ip like this:

retry :fetch-actual-ip 5

(try the user function 'fetch-actual-ip up to 5 times)

Anyone wants to comment or improve on this?
DanielSz:
30-Aug-2007
One difficulty is to refine the meta-function 'retry to accept user 
functions with a variable number of arguments. Tricky. Anyone got 
an idea?
Graham:
30-Aug-2007
provide the argument list in a block to the retry function
DanielSz:
31-Aug-2007
Exactly, Graham, argument passing in a block is a decent solution. 
I saw here and there rebol code implementing this for similar purposes. 
I'll repost a an updated 'retry version when I get around it.
Louis:
31-Aug-2007
Attention whoever is in charge of documentation. Section 11.12 of 
the Core Users Manual give an example that will not work. A clear 
buffer statement is needed after the write-io line, and the ports 
need to be closed after sending each file.
DanielSz:
31-Aug-2007
Ok, here is an updated version of 'retry. What is it?  It is a higher 
-level function that takes as input a user function and repeats it 
the number of times specified. The current version handles user functions 
that take arguments.
DanielSz:
31-Aug-2007
Usage:

retry :user_function 5 

For a user function that doesn't take arguments

retry/args :user_function 5 [args]

For a user function that take arguments


retry: func [user_function [function!] retries [integer!] /local 
.retry [function!] tries [integer!] value [any-type!] args_length 
[integer!] /args block [block!]] [
	tries: 0
	args_length: length? first :user_function

 if ((args_length > 0) and (not args)) [print ["User function require" 
 args_length "arguments. Provide them in a block and use the /args 
 refinement."] return]
	if not args [args_length: 0 block: []]
	.retry: func [.user_function [function!]] [

  either not error? try [value: do compose [.user_function (copy/part 
  block args_length)]]
			[
			if not unset? value [return value]
			]
			[
			print "Retrying..."
			tries: tries + 1

   if tries > retries [print rejoin ["Tried function " tries " times. 
   Exiting"] return]
			.retry :.user_function
			]
	]
	.retry :user_function
]

Everybody is invited to improve on this.
DanielSz:
31-Aug-2007
I wrote 'retry to use in scripts heavy in network calls where failure 
is, by nature of the internet, common, so instead of aborting when 
such a failure occurs, I can use 'retry to repeat individual functions 
any number of times I wish, improving the success of the script.
DanielSz:
1-Sep-2007
Another requirement is tthat if the code returns a value, retry should 
return that exact same value as well. I believe your version currently 
doesn't.
Gabriele:
1-Sep-2007
Daniel, since my version takes a block, you can pass as many args 
as needed.
DanielSz:
1-Sep-2007
I was going to apologize to you, Gabriele, a few minutes ago I had 
the sudden realization that your version can indeed handle user-function 
with arguments, as your latest post explains.
DanielSz:
1-Sep-2007
Antoher issue that might be a rebol bug is the use of attempt. Normally 
attempt should return a none  value when an error occurs, but consider 
this.
DanielSz:
1-Sep-2007
Again apologies, again my stupidity, all the issues I raised in the 
latest posts are non issues, I made a mistake referencing my functions, 
it should be retry :f1 4, retry :f2 4 (note the colon before the 
function name). and then it behaves as expected. Thanks, Gabriele, 
for this humbling lesson in rebol.
Gabriele:
2-Sep-2007
i'd actually suggest retry [f1] 4  or   retry [f2] 4   with my code. 
 :f also works but if f takes arguments it would break. so it's cleaner 
to just always use a block.
DanielSz:
2-Sep-2007
Thanks for the advice, Gabriele, I'll play around with it for a while...
DanielSz:
2-Sep-2007
Gabriele, I'm trying to understand in what kind of situation a throw 
is required. f1: func [] [if true [return "something"]] works without 
a throw, for example. Can you provide a concrete example of code 
that requires the throw attribute to 'retry? Thanks!
btiffin:
4-Sep-2007
Joe;  I think you need to pass sort/compare a function! not a block! 
 The function template is [a b] and returns true or false or whether 
to swap.  Something like
sort/compare data func [a b] [a > b]

(Note: the names a and b could be any words but the function is called 
with two arguments).
Graham:
5-Sep-2007
Can someone remind me how bind a bunch of words to a different context? 
 I want to use the named colors in a special context.
Graham:
6-Sep-2007
I'll give it a go :)
btiffin:
11-Sep-2007
Request for opinions;  What would you rather read? 
   var: none
...
   var: either flag [value] [none]
or 
   var: if flag [value]


Assuming var can safely be none or a value but the init may not be 
close to the code.
btiffin:
12-Sep-2007
Certainly, but that would not bounce out at me during a quick grok...perhaps 
with exposure.
Henrik:
13-Sep-2007
this is spinning my brain:

foreach [a b] [1 2 3 4] [print get load "a"]
** Script error: a has no value

How do I bring "a" under the correct context?
Gregg:
13-Sep-2007
foreach [a b] [1 2 3 4] [print get bind load "a" 'b]
james_nak:
14-Sep-2007
How do you clear out a local variable within a function? I have this 
scenario and I can't get the function to run more than once. I could 
copy the contents to a temp var but that seems silly.

a: func [ some-var /local s] [

	s: "example %text% string"
	replace/all s "%text%" some-var
]

Once I run this thing "s" never gets its orginal value.
Thanks
james_nak:
14-Sep-2007
Habia uno hace uno o dos anos. A ver si puedo hallar lo....
PatrickP61:
19-Sep-2007
While doing a google search on "Rebol AS400"  I came across this 
entry dated Nov 19th 1999: 


One of the best aspects of REBOL is that it is supported on over 
35 platforms, with support for 50 or more platforms expected by the 
end of the year. One of those platforms, fortunately, is the AS/400...With 
the strength of REBOL’s cross-platform support, REBOL scripts will 
run exactly the same way on the AS/400 as they do on any other platform, 
so you can start REBOL programming before the final release of the 
AS/400 version...

--Chuck Lundgren


I work on an AS/400 and would like to get more info on this ability. 
 Anyone know of any updated info for Rebol and AS/400?
PatrickP61:
24-Sep-2007
Hi Phil.  I guess it depends on what OS the AS/400 is running.  I 
have seen some references to AIX  or Linix, which Rebol does have 
a version for, although it is probably an old version.  http://www.rebol.com/platforms-core.html
james_nak:
1-Oct-2007
I was loading a file, one which contained a block of make object! 
and the other with a single make object!  I noticed that I could 
do a  "reduce" on the block and get the expected results of having 
a block of objects but I had to use "do" on the single object instead 
of reduce. What is the difference between do and reduce?
Gregg:
2-Oct-2007
DO returns the last value in the block it DOes, but both evaluate, 
so I'm not sure what the exact data looks like that you're loading, 
or how you're loading it. LOAD can behave differently, based on file 
contents; returning a block or not.
james_nak:
2-Oct-2007
Thank you guys, that explains some of the behavior right off the 
bat. It was just one of those odd things to me that pops up once 
in a while.
DanielSz:
10-Oct-2007
Hi there, are there any rebol wrappers or bindings for LDAP stuff? 
Apart from the fact that the ldif format is already very close to 
native rebol syntax, it would be a neat thing to have.
Pekr:
10-Oct-2007
If LDAP is a complex thing, it would be maybe to create some wrapper 
to some existing open-source library, if there is any ....
DanielSz:
10-Oct-2007
Thanks, Pekr, DocKimbel would be indeed the person to ask because 
of his work on the mySQL drivers. After all, a directory (on which 
LDAP focuses)  is nothing but a specialized database. I'm not sure 
what my needs are because I just started playing with it. Maybe Rebol 
can assist in the conversion of external sources (CSV for example) 
to ldif format and possibly populating the directory automatically.
DanielSz:
10-Oct-2007
This project aims to propose a standard LDAP support for REBOL/Core 
by implementing the LDAP protocol using REBOL schemes (ldap://), 
so standard functions like open, insert, find, remove,... can be 
used directly on the port.


The implementation is an on-going work and has been suspended for 
some months now (due to higher priority projects). The current alpha 
supports the following features : 
BER encoding/decoding logic.
REBOL dialect for BER structures representation.
Basic LDAP v3 protocol.
Searching for record using a high level dialect
Port handler implemented.
What's not currently implemented: 
Clean and reliable low-level I/O.
Full v2/v3 protocol support.
Adding, Modifying, Deleting data.
Authentication.

The current work has been done following the classic REBOL port! 
communication model, that means : synchronous communications. There's 
great chances that I choose to port the current work under Uniserve 
to benefit from a full async model and not push the sync version 
to the end...
Henrik:
11-Oct-2007
I'm stuck with a BIND problem. What may cause a value that is a string 
to become NONE when it's bound to a block? It's only this one value 
out of several that I have problems with. There are other strings 
bound to the block that work correctly. I have no idea what's going 
on. Suggestions?
Henrik:
11-Oct-2007
the bind is in a foreach loop that very roughly looks like so:

a: [c d e]

f: [stuff (c)  more stuff (d)]

foreach :a b [
...stuff
  compose/deep bind f 'c
...stuff
]


For some reason 'c in the bound block is NONE. I tried binding to 
'd, copy/deep the block, but nothing.
Henrik:
11-Oct-2007
DO MOLDing a block should shake off all bindings right? it doesn't 
seem to happen here.
Henrik:
11-Oct-2007
Very interesting stuff... but hard to explain. I've not solved the 
problem, but my bindings are apparently a mess.
Henrik:
11-Oct-2007
sorry about that, but this problem has bugged me for several days. 
Finally nailed it. I figured it out: If you have a function with 
local words, FOREACH creates its own context for the words that it 
uses. I had 'value both as a local word and as a word inside the 
FOREACH, hence the confusion.
[unknown: 5]:
11-Oct-2007
I have had problems before with using 'value.  I try to avoid it 
now - maybe it was a foreach function - I don't recall.
Henrik:
15-Oct-2007
is there a simple way of converting a block of true/false values 
into bits in a binary?
Gregg:
15-Oct-2007
Use INSERT for the true values, and remember that bitsets have a 
zero base.

>> bs: make bitset! []
== make bitset! #{
0000000000000000000000000000000000000000000000000000000000000000
}
>> blk: [true false true false true false true]
== [true false true false true false true]
>> repeat i length? blk [if blk/:i [insert bs i - 1]]
== make bitset! #{
7F00000000000000000000000000000000000000000000000000000000000000
}
Terry:
16-Oct-2007
a: [11 22 33 44 55 66 77 88 99]

b: 44
foreach [ s p v] a [ if s = b [ remove s p v ???]
sqlab:
16-Oct-2007
while [pick set [s p v] a 1] [if s = b  [remove/part a 3  a: skip 
a -3] a: skip a 3]
btiffin:
16-Oct-2007
Another opinion piece;
While developing I've taken to starting each script with


;; if a symbol exists and is true, when will evaluate the block of 
code
;; when/not will evaluate the code if the symbol is not set
when: func ['condition [word!] code [block!] /not] [
    either not [
        unless value? condition code
    ][
        if all [value? condition  get condition] code
    ]
]

This allows for

; See if testing requested as script argument or it could be set 
by a caller
when/not testing [

    if all [system/script/args  find system/script/args "/test"] [
        testing: on
    ]
]
; If requested, try loading the test facility or stub it.
when testing [
    absent test [
        if error? try [do %../Test/test.r] [
            test: func ["test stub" drop [block!]] []
        ]
    ]
]


I had been using  given  and  absent (for when/not).  Anyone got 
a better way of handling conditional load sequences and command line 
argument passing that supports development cycles while not having 
to change the code for testing, autodocing  and production rollout?
Ladislav:
17-Oct-2007
foreach [ s p v] a [ if s = b [ remove s p v ???]
 - this is the Rebol way:
remove-each [s p v] a [s = b]
Terry:
21-Oct-2007
With inline javascript in HTML, it's not uncommon to find a brace, 
apostrophe and a double quote in a single line  ie:


<a href="#"  onclick="$('test').function(){'some', 'options';}">Hrmm</a>

So, what's the best method for prepping this for output?

output: {}   ... then escape the all braces?
Terry:
21-Oct-2007
Braces are ok, if there's always a pair.. otherwise i guess the best 
method is braces, and escape any in the string with ^{   or ^}
Graham:
21-Oct-2007
So, I would want some way to redefine temporarily the {  or } pair. 
 Eg use a pipe character instead .. hardly ever see those used in 
 web pages
btiffin:
25-Oct-2007
Rebol.org  exif-image.r  (uses exif-core.r) and has a jpeg-size function. 
 Didn't read enough to see if it loads the whole file before it looks 
for the size fieldsm but I don't think Piotr's routines requires 
a load.
Graham:
25-Oct-2007
Is there any way for a rebol process to detect other versions of 
itself running and to kill them?
Steeve:
25-Oct-2007
very strange behaviour when using skip command during parsing of 
a binary string
Steeve:
25-Oct-2007
f: read/binary %15.jpg

get-len: [header: skip  (len: to integer! as-binary cp/part header 
2) ]
skip-len: [:header (header: skip header len) :header]
parse f [
        #{FFD8}   ; jpeg Header
        [
                #{FFE0}                         ;JFIF header

                        get-len                 ;get length of a header (2 octets)

                         #{4A46494600}          ;yeah it's a JFIF (confirmation)
                        skip-len
                        some [
                                #{FF}

                                        #{C0}           ;good ! i found the length properties

                                        (print ["height" to integer! as-binary cp/part at header 6 2])

                                        (print ["width" to integer! as-binary cp/part at header 8 2])
                                        break

                                | #{FF}                 ;don't know this header
                                        skip    
                                        get-len 
                                        skip-len
                                | 

                                        [end  skip]     ;error format
                        ]
                        
                        
                | #{FFE1}                       ;EXIF header

                        get-len                 ;get length of a header
                                                ;... to do
                        [end skip]
        ]
        to end
]
Steeve:
25-Oct-2007
it's just a proof of concept, it's not usable as-is for an open/seek 
 file mode
Steeve:
25-Oct-2007
made an async parser (not fully tested - some problems may occur 
when the parser go back in the stream )

but the concept works :  when the parser encouter a skip command, 
the data are not readed from the file but the offset is modified.
Steeve:
25-Oct-2007
REBOL []

parse-async: func [
        file rules
        /local port buffer offset getf seek meta & && result
][
        port: open/seek/binary  file
        buffer: clear #{}
        offset: 1
        getf: func [len][
                offset: offset - length? buffer
                clear buffer 
                append buffer copy/part at port offset len 
                offset: offset + len 
        ]
        seek: [(offset: offset + 1)]
        ..: func [blk] [change/part & compose/deep blk && ]
        parse rules meta: [
                some [

                        &: binary! &&: (.. [buffer: (to-paren reduce ['getf length? &/1]) 
                        (&/1)]) :& 3 skip 
                        | &: 'skip &&: (.. [seek]) :& skip
                        | &: 'get word! integer! &&:

                                (.. [buffer: (to-paren compose/deep [getf (&/3) set [(&/2)] to integer! 
                                as-binary cp buffer]) to end]) :& 4 skip

                        | &: string! &&: (.. [(as-binary &/1)]) :& 
                        | 'end 'skip 
                        | into meta
                        | skip
                ]
        ]
        result: parse/all buffer rules
        close port
        result
 ]
 
if parse-async %15.jpg [
        #{FFD8}   ; jpeg Header
        [
                 #{FFE0}                        ;JFIF header

                        get len 2               ;get data length  for the current header 
                        (2 bytes)

                         "JFIF"                 ;yeah it's a JFIF (confirmation)

                        (len: len - 6) len skip ;skip data (len) times
                        some [

                                 #{FFC0}        ;good ! i found the length properties

                                        2 skip  ; skip length of this header

                                        skip    ; filler ??? always = #{08}
                                        get height 2
                                        get width 2
                                        break   ; finished

                                | #{FF} skip    ;skip this header
                                        get len 2 
                                        (len: len - 2) len skip
                                | 

                                        [end skip]     ;error format
                        ]

                | #{FFE1}                       ;EXIF header

                        get len 2               ;get length of a header
                                                ;... to do
                        [end skip]
        ]
        to end
][
   ?? height
   ?? width
]        
halt
Steeve:
25-Oct-2007
you can probe the contain of the 'buffer'  variable to have a proof
Steeve:
26-Oct-2007
yeah i'm a cool guy
Graham:
27-Oct-2007
>> c: make object! [ a: "test" ]
>> save/all c make binary! 1024

** Script Error: save expected where argument of type: file url binary
** Near: save/all c make binary! 1024
Gregg:
28-Oct-2007
A few extra posts is no problem when you end up with a nice, useful, 
working func. :-)
Henrik:
30-Oct-2007
terry, I posted a bug report on this once. I don't think you can 
stop it.
Gregg:
30-Oct-2007
I thought the newer releases stopped doing that. There were a number 
of builds that did it though. Very annoying.
Gabriele:
30-Oct-2007
it has never done it for me, but it has always done it for others. 
so, it's not clear yet how/when that happens. afaik the code does 
a make-dir view-root/public so in theory it should always be in view-root 
not in the cd.
Ashley:
30-Oct-2007
In the above func on a Mac you could replace %Thumbs.db with %.DS_Store 
;)
Terry:
2-Nov-2007
When it comes to decrypting, is it easier to hack an encrypted string 
if you know part of the string?

Ie:  If you knew that a stirng always started with   keys: [name 
"     could you decrypt it easier?
Gabriele:
2-Nov-2007
terry: it depends a lot on the crypt algorithm used and the length 
of the key. it surely helps to know any part of the plain text. however, 
just compression would reduce that a lot (since the result depends 
on the whole string); also good algorithms are usually smart enough 
to resist a simple attack like this.
Henrik:
3-Nov-2007
a: make object [
  b: make block! []
  c: b
]

same? a/b a/c
== true ; OK

d: make a []

same? d/b d/c
== false ; how do I get this to be TRUE?
Ladislav:
4-Nov-2007
Henrik: this may not be what you want, but it works:
    d: make a [c: b]
Ladislav:
4-Nov-2007
(your problem is, that cloning does not use much "intelligence", 
in the case of d: make a [], the cloning code just copies both a/b 
and a/c and therefore it is obvious, that two copies aren't the same 
block
38101 / 6460812345...380381[382] 383384...643644645646647