• 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: 38801 end: 38900]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
Oldes:
16-Jun-2008
I'm not going to read such a file if I have only 1GB memory:)
[unknown: 5]:
16-Jun-2008
Well I'm testing a new indexing system for TRETBASE and need to know 
some significant data to fine tune it.
[unknown: 5]:
16-Jun-2008
when the port/state/tail value reaches 2 ** 31 it converts it to 
a negative number and gives an error which is an "access error writing 
to port".
[unknown: 5]:
16-Jun-2008
REBOL should be able to break this limitation.  Even if it means 
holding a pointer to a file position and then looping over again.
[unknown: 5]:
16-Jun-2008
So next question - do we have any source of /seek to understand why 
we have such a limitation?
[unknown: 5]:
16-Jun-2008
A work around?
[unknown: 5]:
16-Jun-2008
ahhh time to eat - be back in a few.
[unknown: 5]:
16-Jun-2008
Any ideas what the numbers mean in the port/state/misc section of 
a file port?
BrianH:
16-Jun-2008
Nope. Anyone else want to give this a shot?
[unknown: 5]:
16-Jun-2008
Would be nice to have the feature to access the currently indexed 
position of the open port and perform a function on it.  For example, 
modify /awake to work with files.  Such that any reference to the 
file or altering of the position can be handle via an awake/handler.
[unknown: 5]:
18-Jun-2008
I have a handy little function I made and don't know if there is 
already an easy way to do this in REBOL but I have a function called 
'any+ that simply keeps me from repeating any statements.  For example:

>> a: 3
== 3
>> if any+ [1 2 4 > a][print "cool"]
cool

Got a bit tired of writing  ANY [1 > a 2 > a 4 > a]

This is one of those things that I often wonder if we already can 
do this easlier and I just don't know what it is.
Gregg:
18-Jun-2008
There isn't anything built in that does that. For simple min/max 
comparisons, you could do something like this:

	if a < first maximum-of [1 2 4] [print "cool"]

I also have a shortcut for FIRST MAXIMUM-OF.


 pick-max: func [series [series!]] [attempt [pick maximum-of series 
 1]]
	if a < pick-max [1 2 4] [print "cool"]


For the general case, I would use a map and anonymous func combo. 
R3 has a native MAP func, but you have to roll your own in R2.
Henrik:
18-Jun-2008
I would want to put all values that are going to be tested in a block.
Henrik:
18-Jun-2008
a < [1 2 3 4]
Henrik:
18-Jun-2008
I remember from my HP48 calculator that any numbers put in a block, 
could be operated on like that. But I think this is the beginnings 
of vector operations, which is a big area that should be done right.
Henrik:
18-Jun-2008
because I would also like to see:

>> 1 + [2 3 4 5]
== [3 4 5 6]

in R3 there are ways to do this with a bit more code.
[unknown: 5]:
18-Jun-2008
No outside of a single block though.
[unknown: 5]:
18-Jun-2008
Shouldn't < > and = return as a logic values as well as being op 
values?
[unknown: 5]:
18-Jun-2008
I guess because it doesn't return true or false until it operates 
on something it wont return a logic value.  But maybe we should at 
least subclassify some operators to distingish them more.
[unknown: 5]:
18-Jun-2008
lop? would be a function
[unknown: 5]:
18-Jun-2008
could be modified to become a true mezz
[unknown: 5]:
18-Jun-2008
;a bit revised:

lop?: func ['op][if all [op? get op find form op charset "<>="] [return 
true] false]
Gregg:
18-Jun-2008
You can sort of trick your way around things with ops in most cases. 
e.g.

	>> fn: func ['op a b] [op: get op  op a b]
	>> fn < 1 2
	== true


But I avoid doing that. It ends up not being worth it, IMO, when 
you start to reuse things, generate code, etc. Just use func alternatives.
Chris:
19-Jun-2008
; Here's a thought:

	any-where: func [series [block!] test [block!]][
		foreach value series compose [if (test) [break/return value]]
	]

	probe any-where [1 2 3 4][value > 4]
	probe any-where [1 2 3 4][value >= 4]
	probe any-where [1 2 3 4][value < 4]


; I know it's a two block solution, but it's pretty language friendly. 
 You can recycle tests too:

	test: [value > 4]
	probe [1 2 3 4] :test
	probe [5 6 7 8] :test
Henrik:
21-Jun-2008
simple problem:

>> a: [1 2 3 4 5]
== [1 2 3 4 5]
>> b: at a 3
== [3 4 5]
>> a
== [1 2 3 4 5]
>> b
== [3 4 5]
>> remove a
== [2 3 4 5]
>> b

== [4 5] ; I wonder if it's possible to make the index "sticky" at 
[3 4 5] in a relatively simple way. If it were, that would be very 
cool.
Chris:
21-Jun-2008
Unless this is a feature request, you'll need an alternative to remove...
Henrik:
21-Jun-2008
half a feature request and half trying to find a quick way to solve 
it. seems there is not an easy way.
[unknown: 5]:
21-Jun-2008
can you just get around the problem by setting a: next a   ?
Dockimbel:
21-Jun-2008
>> a: make list! [1 2 3 4 5]
== make list! [1 2 3 4 5]
>> b: at a 3
== make list! [3 4 5]
>> a
== make list! [1 2 3 4 5]
>> b
== make list! [3 4 5]
>> remove a
== make list! [2 3 4 5]
>> b
== make list! [3 4 5]
[unknown: 5]:
21-Jun-2008
I that in the following the 10 represents 10 "bytes"?  a: make string! 
10
[unknown: 5]:
21-Jun-2008
So how to we define those things in a block?
[unknown: 5]:
21-Jun-2008
I know we can initilize the block with for example:

a: make block! 10 

But how do we determine what is in the block comprises a byte?
[unknown: 5]:
21-Jun-2008
I know that in a string each character represents a byte but even 
then how much overhead is allocated merely by a: make string! 0?
PeterWood:
22-Jun-2008
There is a lot of information about Rebol's memory usage in the mailing 
list archive. You culd start here: http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-topic-index.r?i=memory
[unknown: 5]:
23-Jun-2008
It appears to see a broken path and sees the rest of the path as 
an argument.  Not sure where it is checking yet to get this information.
Chris:
28-Jun-2008
Usage:

	assert-all [
		a < 10 [print "a is more than 10"]
		a > 0 [print "a is less than 0"]
	]


It's the opposite of 'case really.  If any of the cases are false, 
the related block is evaluated and the function returns none/false. 
 If all cases are true, it returns the value of the last successful 
case.
Henrik:
28-Jun-2008
I would like to see a good implementation of a function that performs 
a sequence of code blocks. If a code block is good, the next one 
is run. If the code block causes an error, a secondary code block 
that is either generic for all code blocks or specific to that particular 
code block is run. I'm thinking step-by-step code that either runs 
successfully or causes a generic or specific error.


I don't know if it makes sense to do that, but I sometimes miss that 
if I need to do something with user friendly network connectivity.
Chris:
28-Jun-2008
Paul: it's a common enough pattern, I'd like to find the most appropriate 
way to express it.  Actually, that's the principle behind QM (which 
of course, this is intended for).  The alternative case above would 
be:

	case [
		not a < 10 [print "a is more than 10"]
		not result: a > 0 [print "a is less than 0"]
	]
	result


Requires a 'not statement for each test, requires an extra word to 
track the result and does not return a meaningful value.  Consider 
this:

	if assert-all [

  user/has-role? 'editor [make error! "You do not have required permission"]
		article: get-param 'article [redirect-to %/articles/create]
		10'000 < length? article [make error! "Article is too long"]
	][
		save %article.txt article
		redirect-to %/articles/list
	]
Chris:
28-Jun-2008
Henrik, how does your scenario differ?  Do you have a sample of your 
solution at work?
Henrik:
28-Jun-2008
I had a function that does this a while ago, but I have to dig it 
up
Chris:
28-Jun-2008
Graham, I'm still pondering naming.  'assert seems to evoke unit 
tests, that's not what this is.  'all-nots doesn't quite get the 
essence either.  'all-else is a possibility?  Until then, I still 
lean toward 'assert-all.
Chris:
28-Jun-2008
That is, I have a series of tests, each requiring a case for failure...
Henrik:
28-Jun-2008
sorry, it does not work very well. I think I would build a new one 
from scratch if I needed it again.
Chris:
28-Jun-2008
I get that -- a sign of personal progress, perhaps?
Henrik:
28-Jun-2008
well, I tried a single line of code with it, and it didn't do what 
I wanted. I guess I could ask myself if I would write that kind of 
code today. :-)
[unknown: 5]:
28-Jun-2008
Chris - 'case is native so even adding a 'not statement is going 
to be faster solution I think.
Graham:
28-Jun-2008
If it's a time critical app like a web server I'd go for speed ...
Gregg:
30-Jun-2008
Alan Dechert <[dechert-:-gmail-:-com]> asked the same thing on the ML earlier 
this month. Maybe the two of you can collaborate on a solution. If 
you could enhance SEND to allow it, maybe with a new refinement, 
we can try to get Carl to make it the standard.
Janeks:
2-Jul-2008
What is the right way to check  is port (ODBC, mySQL) open?
Is it a-port/port-id ?
Gregg:
2-Jul-2008
There's no official way. I think DocKimbel had a value in flags or 
state that he said worked. If he doesn't jump in, I'll dig for it.
Henrik:
7-Jul-2008
has anyone worked on a method to convert a rebol block to a php array 
inside php?
Dockimbel:
8-Jul-2008
For checking if a port! value is "opened", you can use this function 
: open?: func [port][zero? port/state/flags and 1024]. But that just 
checks for the "close" flag, it doesn't check the real TCP connection 
state.
TimW:
9-Jul-2008
Is there a way to specify precision with rounding?   My specific 
example has to do with money.  Not only does it always chop it off 
to exact cents, but it rounds down.  so .125 -> $0.12   This is horrible 
for accounting purposes.  I just put everything in decimal and completely 
ignore the money! datatype, but this seems like a real shame.  So 
is it possible to specify the decimal out to 4 or 5 places?
Sunanda:
9-Jul-2008
Also, I am not seeing the always-down effect you report.
   round/to $.125 .001
   == $0.13    ;; correctly rounded up


Round did go through a couple of development stages. Perhaps your 
version of REBOL has an outdated one. This is the source from the 
version I am using:

round: func [

    {Returns the nearest integer. Halves round up (away from zero) by 
    default
.}
    [catch]
    n [number! money! time!] "The value to round"
    /even "Halves round toward even results"

    /down {Round toward zero, ignoring discarded digits. (truncate)}
    /half-down "Halves round toward zero"
    /floor "Round in negative direction"
    /ceiling "Round in positive direction"
    /half-ceiling "Halves round in positive direction"
    /to "Return the nearest multiple of the scale parameter"
    scale [number! money! time!] "Must be a non-zero value"
    /local m
][
    throw-on-error [
        scale: abs any [scale 1]
        any [number? n scale: make n scale]
        make scale either any [even half-ceiling] [
            m: 0.5 * scale + n
            any [
                all [
                    m = m: m - mod m scale
                    even
                    positive? m - n
                    m - mod m scale + scale
                ]
                m
            ]
        ] [
            any [
                floor
                ceiling

                (ceiling: (found? half-down) xor negative? n down)
                n: add n scale * pick [-0.5 0.5] ceiling
            ]

            either ceiling [n + mod negate n scale] [n - mod n scale]
        ]
    ]
]
Henrik:
9-Jul-2008
As a note: In R3, money! is of much greater precision (infinite?) 
and should round properly using conventional ROUND/TO (once bug #492 
is fixed, that is :-)).
Chris:
13-Jul-2008
Uck, this is unsightly:

	>> to-path [
	[    a
	[    b
	[    c
	[    ]
	==
	a/
	b/
	c
Chris:
13-Jul-2008
Why does it not result in:

	== a/b/c
[unknown: 5]:
13-Jul-2008
The newline character is being detected so it is treating each as 
a separate statement.  I would think that isn't a bug but rather 
a feature.
[unknown: 5]:
13-Jul-2008
Since the following works fine:

>> to-path [a b c]
== a/b/c
Chris:
13-Jul-2008
I think it's a bug in to-path.  Why would you possibly want to retain 
that behaviour?
Chris:
13-Jul-2008
I can understand silently storing newline settings between block 
sessions (I use 'new-line a little to control this behaviour), but 
what scenarios benefit from this when working with paths?
Gabriele:
14-Jul-2008
chris, there is no purpose, it's just that internally path! = block!, 
so path! behaves exactly like block! does. it probably should strip 
newlines when converting though, or at least ignore them when molding... 
(that is, i'm saying this is a bug.)
Henrik:
14-Jul-2008
perhaps it's a good idea to check on any char that does not belong 
in a path! R3 has a bug where it includes none! as part of a path.
[unknown: 5]:
14-Jul-2008
Chris, you raised a good point when you said "Why would you possibly 
want to retain that behavior?".  We wouldn't - add it to RAMBO please.
TimW:
17-Jul-2008
sorry I didn't reply sooner.  The version of round I was using was 
on a linux box so it was the latest debian rebol release.  It does 
round up correctly on the windows version I have.
Henrik:
21-Jul-2008
what I mean is that for single-standing tags, like <br>, XHTML 1.0 
and upwards requires them to end with a slash. This creates a correct 
tag for this case:

>> build-tag [input type checkbox value test /]
== <input type="checkbox" value="test" />

But this is not correct:

>> build-tag [input type checkbox value test checked /]
== <input type="checkbox" value="test" checked="/">
Henrik:
23-Jul-2008
I'd say it's a bug
Graham:
23-Jul-2008
a very old bug
Henrik:
23-Jul-2008
I make a habit of testing R2 bugs in R3 as well.
Graham:
23-Jul-2008
I'm trying to rename a few 100 directories to conform to a naming 
scheme
Sunanda:
23-Jul-2008
I've been telling my clients for years not to install REBOL applications 
in folders that have a space in the name -- like "program files/rebol"
It just creates too many problems.
[unknown: 5]:
23-Jul-2008
If you want to the know the short format for a directory just use 
the dir/x command from the command prompt.
Chris:
23-Jul-2008
All three of which are a pain.
Henrik:
23-Jul-2008
there are also problems with using non-english characters at times. 
it backfires when you type a directory name in a macOSX script that 
makes a directory on a windows machine. results in chaos, because 
the dir name is read differently depending on the platform and whether 
you are reading it across the network.
[unknown: 5]:
23-Jul-2008
Yeah Chris, I guess it depends on what your going.  For example, 
if you collecting directory information and must parse thru it then 
the spaces are obviously a pain.
Sunanda:
23-Jul-2008
It's been a longstanding problem, Tim.

These two blog posts discuss it and a solution. I do not know if 
the solution has been implemented:
http://www.rebol.com/article/0198.html
ICarii:
3-Aug-2008
i have about 50,000 word strings in a single block.  I would like 
to do a find/any wordsblock "sear?ch*" ;on it but no go - am i missing 
some fundamental feature of Core or is this broken?
ICarii:
3-Aug-2008
example:
a: ["one" "two" "once" "twice" "three" "thrice"]
find/any a "on*"
ICarii:
3-Aug-2008
lol deep in a 1 level block :P
Henrik:
3-Aug-2008
I know :-) I guess you have to wonder what result you want back, 
because it has to search each string in the block. what you are looking 
for is a find on each string in the block and what if that is not 
found in the beginning? Does it return two indexes, one for the string 
and one for the block? That's where /deep comes in.
Henrik:
3-Aug-2008
it helps if you are searching a hash
ICarii:
3-Aug-2008
wildcard searching a hash is rather messy tho isnt it?
ICarii:
3-Aug-2008
eg "?ex??w*a"
ICarii:
3-Aug-2008
ive got some old code i did a few years ago in C# that uses regex 
to do it but I was just curious if rebol could do it in a timely 
manner
Graham:
2-Sep-2008
Anyone consider this a bug?
Gregg:
2-Sep-2008
That's caught me a couple times as well.
Brock:
3-Sep-2008
Any way to get a copy of the R3 Alpha?  I have a very simple script 
that has to deal with utf-8 text that this would really help with.
Pekr:
3-Sep-2008
Can I have something like following? My friend asked me to do small 
"multiserver" in TCP mode, he is testing his HW device. IT works 
like a charm, but it is only console app (no GUI). Last week he asked 
me for another method of interruption of script - when he presses 
ESC (or closes console), the connection is RSTed, but he would like 
clean FIN, ACK.  So - can I somehow trap keyboard press while in 
the wait loop? Or do I need to rewrite script to GUI version? I thought 
about adding console port to the wait block, but dunno if it would 
work :-)
Graham:
19-Sep-2008
Read/custom allows you to send a custom header as in a cookie header 
like this

read/custom url [post "postdata" [Cookie: "name=value"]]
Graham:
19-Sep-2008
but it doesn't allow you to send a custom header except by using 
the post method.
Louis:
20-Sep-2008
I'm having a strange problem. I'm trying to convert a file created 
with a Win XP program to work with a Linux program. Rebol seems to 
read past the end of the file into RAM. 

>>x: read %file1.txt
>>print x

AS: 

{5F65606E-93B2-4B16-BB24-ADC663FC8B5A}$éx


AS: is the last line in the file. I'm just showing a small amount 
of the following output.  Note that the program seems to be unable 
to recognize the end of file marker.  So, I did this:

write %file2.txt read %file1.txt
x: read %file2.txt
print x


But it didn't help. I got the same results. Any idea what is causing 
this?
amacleod:
20-Sep-2008
Having a bock of blocks that I want to look more readable how do 
I get each block to start on a new line...


I've tried to append 'newline to end of each block but it does not 
seem to work.


Now I'm having a similar problem using Paul's tretbase. I've been 
using MySQL to store formatted text that when I load it I can run 
my parse function on. When I sttore the same text in tretbase and 
load it my parse function fails. 
When I probe the text from each tehy look different:

MySQL preserves the carriage returns: 
[5 "FFP-LADDERS" "1-PORTABLE LADDERS" "2.1.2" {
\table
Straight Weight^-Ladders
20'^-55 lbs.
20'(Hook)^-60 lbs.
12'(Hook)^-35 lbs.
/table
} "" "2008-07-22 00:12:24"]


Tretbase seems to store the carriage return's character code but 
displays 'flat':

[5 "FFP-LADDERS" "1-PORTABLE LADDERS" "2.1.2" { \table Straight Weight^-Ladders 
20'^-55 lbs. 20'(Hook)^-60 lbs. 12'(Hook)^-35 lbs. /table } "" 20-Sep-2008/3:07:19-4:00]

What Might I be doing wrong?
Henrik:
21-Sep-2008
Graham, did you study my wiki-tools for Mediawiki? They have been 
available for over a year.
Henrik:
21-Sep-2008
so it should be possible to create a local editor to edit mediawiki 
pages, or to upload series of pages generated locally.
Graham:
22-Sep-2008
Looks like I need to do a HTTP PUT to upload binary files ....
Graham:
22-Sep-2008
So, I guess I need a way to add the PUT method, and then switch the 
IO from lines mode to binary and then back again.
Graham:
22-Sep-2008
apart from it not working ... anyone see a problem with this?


   either all [block? port/state/custom post-data: find port/state/custom 
   'post post-data/2] [
				http-command: "POST"
				HTTP-Get-Header: make HTTP-Get-Header append [

     Referer: either find port/url #"?" [head clear find copy port/url 
     #"?"] [port/url]
					Content-Type: "application/x-www-form-urlencoded"
					Content-Length: length? post-data/2
				] either block? post-data/3 [post-data/3] [[]]
				post-data: post-data/2
			][

    either all [block? port/state/custom post-data: find port/state/custom 
    'get post-data/2] [
					http-command: "GET"
					HTTP-Get-Header: make HTTP-Get-Header append [

      Referer: either find port/url #"?" [head clear find copy port/url 
      #"?"] [port/url]
					] either block? post-data/3 [post-data/3] [[]]
					post-data: none
				][

     if all [block? port/state/custom post-data: find port/state/custom 
     'put post-data/2] [
						http-command: "PUT"
						data: system/words/read/binary post-data/2
						HTTP-Get-Header: make HTTP-Get-Header append [
							Content-Type: "application/octet-stream"
							Content-Length: length? data
						] either block? post-data/3 [post-data/3] [[]]
					]
					post-data: post-data/2
				]
			]
Graham:
22-Sep-2008
read/custom URL compose/deep [ PUT %file.png [ Cookie: (cookie) ]]


will use the http put method to upload a binary file and sets the 
cookie
Graham:
22-Sep-2008
So, this will work with large files, it should be changed so that 
it does a skip/binary and inserts the file in chunks.
Graham:
22-Sep-2008
Wouldn't it be better if we had access to the data sent to us without 
doing an 'open instead of a 'read ?
38801 / 6460812345...387388[389] 390391...643644645646647