• 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: 45401 end: 45500]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
BrianH:
27-Jul-2009
Sounds like you need a tighter definition, or to resign yourself 
to slow code.
BrianH:
27-Jul-2009
But you can use a consistent REBOL representation of it, and don't 
need objects.
Graham:
27-Jul-2009
Google health has solved the issue by only working with a subset 
of the XSD.
BrianH:
27-Jul-2009
Well, you can clean it up to a usable structure on read, process 
it nicely, then regenerate the bad XML on write.
Graham:
27-Jul-2009
I suspect this is a very common issue and not bad xml.  So, if the 
XSD states an element can be 0 ... n and each element can be of a 
different type, then it's going to be difficult to work with no matter 
what.
BrianH:
27-Jul-2009
If an XSD states that; it should always be a block even in the single 
object case.
BrianH:
27-Jul-2009
Saw a new language the other day that has a native, literal data 
structure which matches the XML object model, without the syntax.
Ashley:
29-Jul-2009
Is this a bug or a feature:

>> to integer! ""
== 0
Henrik:
29-Jul-2009
R3 returns a bug with the first one, but it could be intentional 
in both R2 and R3.
BrianH:
29-Jul-2009
It was an intentional change. TO has been cleaned up a lot in R3 
- the error there tells why:
>> to integer! ""
** Script error: content too short (or just whitespace)
Sunanda:
29-Jul-2009
R2 also works with
  to integer! #
but  not
  to integer! %
Looks like a consistency bug in R2 that has been fixed in R3.
BrianH:
29-Jul-2009
The R2 behavior is more of a "feature": Buggy behavior that you can 
count on remaining in R2 for compatibility reasons.
Graham:
4-Aug-2009
How can i redefine 'now so that it takes into account an offset ( 
which is only calculated once ) .. without causing a stack overflow!
BrianH:
4-Aug-2009
Remember to keep a private reference to the old NOW, or at least 
reference it through system/contexts/system/now. When you set 'now 
in a user script it will copy the value of 'now to the user context 
(system/contexts/user), and then you will be reassigning it there.
Graham:
4-Aug-2009
sounds like a R3 function
Graham:
4-Aug-2009
you're having a dyslexic day :)
Graham:
4-Aug-2009
third :now only gives me a block
BrianH:
4-Aug-2009
You use that block as the spec block of your new function. Save a 
reference to the old, and then call it in your new function from 
your saved reference. Natives don't have body blocks.
Gabriele:
4-Aug-2009
do you need all the refinements to work? otherwise, just make a fixed-now 
function or something like that.
Graham:
4-Aug-2009
I want a drop in replacement 'now that also accesses a fixed time 
offset that is calculated at program start up.
BrianH:
4-Aug-2009
Save a private reference to now like this:
    now*: :now
then use now* in nist-now.
Graham:
4-Aug-2009
the info? function appears to send a http HEAD to a URL, but the 
http protocol doesn't appear to allow a user to send a HEAD.
So, how does info? do it?
Anton:
5-Aug-2009
INFO? uses QUERY, and QUERY's behaviour on a port is defined in the 
port's scheme (in this case the HTTP port scheme).

The QUERY function in the HTTP scheme just sets a flag  querying: 
true  and calls OPEN on the port, so the query behaviour is an   
internal behaviour (closed source).
Gabriele:
5-Aug-2009
Anton, the source to OPEN is there, so no, it's not closed source. 
:) QUERY on HTTP does a HEAD request.
Gabriele:
5-Aug-2009
Graham: if your port is already open, query just returns the information 
that is already available. if the port is not open, query does a 
HEAD instead to just get the information it needs. the same code 
as open is reused.
Graham:
5-Aug-2009
I couldn't see a way to do that with the standard http protocol
Robert:
5-Aug-2009
Just wondering is there a way where I can continue with the next 
round from inside a FOREACH, REPEAT etc. loop?
Anton:
5-Aug-2009
Robert, you can do it using
	loop 1 [
		if cond [break]  ; (Continue)
	]
eg.
	foreach word [a b c][
		loop 1 [
			if word = 'b [break] ; (Continue)
			print word
		]
	]
Anton:
5-Aug-2009
Outputs:
a
c
Robert:
5-Aug-2009
Anton, ah, tricky. Using a wrapper loop. Nice.
Anton:
6-Aug-2009
Gabriele, where do we access the R2 OPEN native function source? 
I had a look in DevBase and didn't see it there.
Dockimbel:
6-Aug-2009
OPEN native is just a shortcut for INIT then OPEN functions in the 
scheme handler. For example :
>> help system/schemes/http/handler
Graham:
7-Aug-2009
I've patched my version of the http protocol http://rebol.wik.is/Protocols/Http
so that I can more easily issue a head command
Graham:
7-Aug-2009
so I can do this ... read/custom url [ HEAD "" ]


which is more like exists? for a url, and returns an error if it 
ain't there.
Graham:
7-Aug-2009
The problem with query on a port is that I can't send custom authentication 
headers that might be needed.  This way I can.

In particular I need to check for the existence of a S3 object which 
needs authentication to access.
james_nak:
7-Aug-2009
How do you "read" a network drive in windows? I can a: read %/c/ 
 but when it's a network drive it doesn't work.
james_nak:
7-Aug-2009
Thanks Graham. User error on my part. I can "read" now. I was wondering 
though if I have just the computer name and not a folder name I get 
an error. In other words, list-dir to-rebol-file "\\xyz\myfolder" 
is OK but not list-dir to-rebol-file "\\xyz\" doesn't.
Graham:
8-Aug-2009
But if I do a wireshark trace, I see this

GET /20090806.7z HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL View 2.7.6.3.1
Host: remr.s3.amazonaws.com

HTTP/1.0 403 Forbidden
Date: Sat, 08 Aug 2009 21:08:07 GMT
Content-Type: application/xml
x-amz-request-id: D03B3FA12CC875D5

x-amz-id-2: u3b7TkPzJc5NBwvov4HRQuMsCsosD7le9xfRMSGiCN2BXgeae6kKMVQAbhzqRDwY
Server: AmazonS3
Via: 1.1 nc1 (NetCache NetApp/6.0.5P1)

<?xml version="1.0" encoding="UTF-8"?>

<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>D03B3FA12CC875D5</RequestId><HostId>u3b7TkPzJc5NBwvov4HRQuMsCsosD7le9xfRMSGiCN2BXgeae6kKMVQAbhzqRDwY</HostId></Error>
Gabriele:
9-Aug-2009
No, the HTTP scheme is working correctly. AWS' behavior is non-standard, 
so it requires some level of custom programming. R3's scheme allows 
you to handle cases like this at a lower level for example, but by 
default it can't do better than that.
Graham:
9-Aug-2009
Maybe there should be a default behaviour which is what it is now, 
and another behaviour where one can specify which  codes are not 
be flagged as user errors?
Graham:
9-Aug-2009
or pehaps an object mode where the whole http response is returned 
as a rebol object
Graham:
10-Aug-2009
http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#AuthProcess


At the bottom of this page, the Google authentication API can provide 
a 403 response as this example below

HTTP/1.0 403 Access Forbidden
Server: GFE/1.3
Content-Type: text/plain
	
Url=http://www.google.com/login/captcha
Error=CaptchaRequired
CaptchaToken=DQAAAGgA...dkI1LK9

CaptchaUrl=Captcha?ctoken=HiteT4b0Bk5Xg18_AcVoP6-yFkHPibe7O9EqxeiI7lUSN
Gabriele:
11-Aug-2009
still, 4xx is an error no matter what. *any* browser would consider 
that an error. then, you handle it. you can't just expect READ to 
handle it for you, as by the standard, there is no way to handle 
this case (auth required can be handled by asking the user for a 
password).
Gabriele:
11-Aug-2009
it would be very nice if proper auth methods were added to HTTP and 
all those APIs were changed to use it, and be RESTful, and so on, 
then maybe we could talk of a standard http scheme that behaves correctly 
"by default".
Gabriele:
11-Aug-2009
don't you agree, that the way R3 handles the issue is the best way? 
R2 can probably be made to behave similarly. (I've actually been 
thinking of backporting R3's HTTP for a long time...)
Graham:
11-Aug-2009
I guess I just don't like the idea of a protocol hiding data from 
me,...
Sunanda:
15-Aug-2009
The number of args:
    join "a" ["b" "c"]
    rejoin ["a" "b" "c"]
Graham:
15-Aug-2009
A different outcome.
Sunanda:
15-Aug-2009
Looks like a bug to me, Graham.
Graham:
15-Aug-2009
Looks like a bug to me too.
Graham:
15-Aug-2009
I was constructing a payload for a http post, and need a combination 
of string and binary data.  I used rejoin... and got an unexpected 
outcome.
BrianH:
15-Aug-2009
ajoin: funco [
	"Reduces and joins a block of values into a new string."
	[throw]
	block [block!]
][
	make string! reduce block
]

Faster than JOIN or REJOIN.
Graham:
15-Aug-2009
does it build a series without corrupting binary data ??
Ashley:
15-Aug-2009
Wow, that make string! change to join/rejoin yields about a 300% 
speed increase! Definiately one to backport to R2.
Ashley:
15-Aug-2009
Just needs a bit of datatype coercing added.
Graham:
15-Aug-2009
this fix allows me to upload a binary document using the googleapi 
.. eg. docx
Ashley:
15-Aug-2009
First cut QAD on join/rejoin, still about twice as fast the originals:

	join: make function! [
		"Concatenates values."
		value "Base value"
		rest "Value or block of values"
	][
		either series? value [
			make type? value reduce [value rest]
		][
			make string! reduce [value rest]
		]
	]


	rejoin: make function! [
		"Reduces and joins a block of values."
		block [block!] "Values to reduce and join"
	][
		either empty? block: reduce block [block] [

   make either series? first block [type? first block] [string!] block
		]

	]
BrianH:
15-Aug-2009
Ashley, that JOIN doesn't work for block types. It should be:
>> join [a b] [1 2]
== [a b 1 2]
Yours returns  [[a b] [1 2]]]
Geomol:
19-Aug-2009
REPEAT is a native. Can it be made as a mezzanine using WHILE? It 
takes 3 arguments:
'word value body


The first is seen as a lit-word by the function. This should be bound 
to body and only be used as a local variable in the function context. 
My first attemp to make a REPEAT mezzanine didn't go well:

my-repeat: func [
	'word value body
][
	bind/copy body word
	word: 0
	while [(word: word + 1) <= value] body
]

>> my-repeat i 10 [print i]
** Script Error: i has no value

Suggestions?
Geomol:
19-Aug-2009
One problem is, that WORD become an integer, when I set it to zero. 
If I write:
set word 0

instead, I create a global variable. I'm wondering, if this can be 
done at all!?
Geomol:
20-Aug-2009
Nice Chris! I expected, it could be done somehow. Do you know, if 
REPEAT was a mezzanine in some of the first versions of REBOL?
Geomol:
20-Aug-2009
Changing 'b to b and it works:


>> f: func ['w b] [use reduce [w] reduce [to set-word! w 1 'do b]]
>> f i [print i]
1

(Still a bit confused.)
Geomol:
20-Aug-2009
Is it possible to give a function with a refinement as an argument 
to another function? If I e.g. would make a MAP function in REBOL, 
it could be:


>> map: func [:function list /local result][result: clear [] foreach 
value list [append result function value]
>> map sine [0 15 100]
== [0.0 0.258819045102521 0.984807753012208]


MAP apply the function to each member of the list. But I can't give 
sine/radians to map:

>> map sine/radians [0 15 100]
== 100

Is there a way around this?
Geomol:
20-Aug-2009
It's because, sine/radians is seen as a path! datatype, when the 
argument is defined as :function
Geomol:
21-Aug-2009
Using INTERSECT leads to a shorter function, but I'm not sure, it's 
the fastest way:

findall: func [s items [block!]] [items = intersect s items]
Geomol:
21-Aug-2009
Being danish, I'm wondering, if the word INTERSECTION cover the same 
meaning as a JOINT set? If yes, why isn't INTERSECT called JOINT?
Graham:
21-Aug-2009
>> findall "this is a test string" [ "this" "not here" ]
** Script Error: Expected one of: string! - not: block!
** Where: findall
** Near: items = intersect s items
>>
Graham:
21-Aug-2009
graham- findall "this is a test string" [ "this" "not here" ]
== none
Geomol:
21-Aug-2009
I guess joint is commonly used for marijuana


LOL, I didn't see that! (And I went to a Reggae festival last week, 
so I should know.) :-)
Geomol:
21-Aug-2009
Do you want your function to find "ring" in this string: "this is 
a test string"?
Graham:
21-Aug-2009
I thought with map you can apply a function over all the parameters 
...
Geomol:
21-Aug-2009
Chris wrote: "G: re. confused - try stepping through the function 
in the order it is interpreted.  Should be clear by the time 'use 
evaluates the two blocks..."


What I find a bit confusing is, when I have to BIND and when I don't. 
It's the context binding rules in REBOL, that is not 100% clear to 
me. Let me give a simple example:

>> b: [print i]
== [print i]
>> f: has [i] [i: 1 do b]
>> f
** Script Error: i has no value


This doesn't work, because the b block is defined outside the f function, 
outside f's function context. Therefore I have to bind b to f's context, 
like this:

>> f: has [i] [i: 1 bind b 'i do b]
>> f
1


That is clear, and I would expect USE to work by the same rules, 
but it doesn't quite, it seems to me:

>> f: does [use [i] [i: 1 do b]]
>> f
1


By some magic, this works without the need to BIND. I'm a bit confused 
by that.
Geomol:
21-Aug-2009
ARGH! It only works, because I first made the f function using BIND. 
So b was already bound to f, when I changed f to include USE. If 
I try to USE version from a fresh REBOL, it doesn't work. (More confusion!) 
:-p
Geomol:
21-Aug-2009
Ok, from a freshly started REBOL, this doesn't work:

>> b: [print i]
== [print i]
>> f: does [use [i] [i: 1 do b]]
>> f
** Script Error: i has no value

But this does work:

>> b: [print i]
== [print i]
>> f: does [use [i] reduce [to set-word! 'i 1 'do b]]
>> f
1


Is it because, when b is reduced, I kinda get a new fresh copy of 
the block? Like if I wrote the block, [print i], myself instead of 
using a reference to b?
Anton:
21-Aug-2009
REDUCE makes a new block, and then USE does its binding.
Anton:
21-Aug-2009
BIND recurses into blocks, eg. 'b will be bound in the nested block 
[[b]],

but if 'b happens to currently have a value that is a block with 
words in it, that doesn't matter to BIND, BIND won't go in there.
Anton:
21-Aug-2009
Let me say that again, to be clear.

eg. Binding [[b]] somewhere will cause 'b to be bound (as long as 
'b exists in the "somewhere" context).

but if, before this bind occurs, b has a block value eg.  b: [some 
words] , then the bind will not touch 'some and 'words,

because it won't look to recurse into word values that happen to 
be blocks.
Geomol:
22-Aug-2009
How to check for a datatype using TYPE? within a function in REBOL 
2? Let's say, I wanted to create my own ACTION? function using TYPE?:

>> a?: func [value] [action! = type? value]
>> a? :action?
== false

Doesn't work. Does the logic work outside a function?

>> action! = type? :action?
== true

Yes. So maybe I need to specify the argument as a get-word! ?

>> a?: func [:value] [action! = type? value]
>> a? action?
== false

No, still doesn't work. Now on to REBOL 3 to see, how that work:

>> a?: func [value] [action! = type? value]
>> a? :action?
** Script error: value is missing its value argument

Huh? Trying with a get-word! :

>> a?: func [:value] [action! = type? value]
>> a? action?
== false

No, doesn't work. What am I missing? Or is it bugs?
Geomol:
22-Aug-2009
Anyone got an old REBOL 1 lying around, I could have a look at?
Geomol:
22-Aug-2009
Anyone got an old REBOL 1 lying around, I could have a look at?
Anton:
22-Aug-2009
I noticed a get-word parameter prevents a paren argument value being 
evaluated first.
>> f: func [a][print mold a]
>> f (action?)
false
>> f: func [:a][print mold a]
>> f (action?)
(action?)
Geomol:
22-Aug-2009
Yeah, and you would probably like it to be mold :a in the function 
to not do the same mistake, I did. In your first example, you have 
evaluation of a two times, first as (action?) leading to false, and 
then false is evaluated when doing mold a.
Geomol:
22-Aug-2009
Hey, I just read all that again. I can't figure out, why your second 
example returns (action?). That parenthesis should be evaluated, 
when you write mold a, shouldn't it?
Geomol:
22-Aug-2009
On the other hand, with the current behaviour, paren! works as block! 
in such situations. Blocks are not evaluated, when we write mold 
a, and a is a block. So why should a, if a is a paren! ? :-)
Geomol:
22-Aug-2009
>> p: to paren! [a b c]
== (a b c)
>> mold p
== "(a b c)"

That's ok, I think.
Maxim:
22-Aug-2009
>> a: [1 2 (3 4)]
== [1 2 (3 4)]
>> third a
== (3 4)
Maxim:
27-Aug-2009
I am beyond mystified!   what is wrong with this code?

(1.3 * (any  [rgb clr]))


both rgb and clr have tuple values... if I remove the any, it works, 
if I try the any and probe it, it returns the proper value... 

this is within a compose block.

 ** Script Error: Cannot use multiply on decimal! value
** Where: refresh-gfx
** Near: 1.3 * (any [rgb clr])
Maxim:
27-Aug-2009
thanks for the help though... this is a really strange bug :-)
Sunanda:
27-Aug-2009
R2 does not allow [decimal! * tuple!] but it does allow [tuple! * 
decimal!] with a tuple! as the result
    1.3 * 9.9.9
    ** Script Error: Cannot use multiply on decimal! value
    9.9.9 * 1.3
    == 11.11.11

R3 allows both, with a tuple! as a result.

Looks like an R2 bug fixed only in R3.
Sunanda:
27-Aug-2009
R3 looks the same as R2 in that respect, at least right now
    pick [ "a" "b" ] true
    == "a"
    pick [ "a" "b" ] false
    == "b"
Sunanda:
27-Aug-2009
Just tried your code on R2.  You do have a faster machine than me, 
and R3 is currently much slower for this benchmark:
== 0:00:00.39
== 0:00:00.046
== 0:00:00.047
Steeve:
27-Aug-2009
So, you can't add or substract a negative integer! to a char!, but 
you can add or substract a positive integer!
Weird, i said
Steeve:
27-Aug-2009
Seems a bug in R3
Steeve:
27-Aug-2009
well, it's just a shame to have to reconvert to a char!
Sunanda:
28-Aug-2009
Is my understanding of find/part wrong, or is this a bug?
     series: ["a" "b" "c" "d" "e"]
     find/part series "c" at series 3  

     == none      ;; fails to match using the [at series 3] part of  'series
    print mold at series 3  
    == ["c" "d" "e"]  ;; but [at series3] does contain the match
Dockimbel:
28-Aug-2009
The /part <range> argument (at series 3) is supposed to mark the 
end of the search range. So, here FIND is searching in ["a" "b"] 
only.
Steeve:
28-Aug-2009
what do you mean Doc ? It has been always like that.

with /part you can specify a length or a terminal pointer to the 
serie.
What's wrong with that ?
Maxim:
28-Aug-2009
/part makes the compare a record.  so its expecting a block to match 
I think.
Steeve:
28-Aug-2009
? find
        /part -- Limits the search to a given length or position
                length (number! series! pair!)

It seems clear to me
Dockimbel:
28-Aug-2009
/part -- Limits the search to a given length or position
, you're right, I've missed the "length or" part..
45401 / 6460812345...453454[455] 456457...643644645646647