• 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: 39001 end: 39100]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
btiffin:
29-Oct-2008
And just to place credit where it belongs ... Our good Chris was 
first with truncate   ... I was simply using it as a good launch 
point for a thesaurus scan.
Graham:
29-Oct-2008
never seen that word used in a REBOL script!  :)
Anton:
30-Oct-2008
'lop is pretty good, because it (probably) implies a fixed length. 
eg. a forester might lop the tops off some trees.
BrianH:
30-Oct-2008
Tom, that wouldn't work with REBOL's evaluation rules. Native or 
not, you can't write a function that way.
Henrik:
31-Oct-2008
In this sense, CUT would mean split in two parts, I think. TRUNCATE 
is accurate, but TRIM/TO is a little shorter.
Chris:
5-Nov-2008
That's where a range! datatype would come in handy:

copy/part "[Something]" 1..-1
Chris:
5-Nov-2008
You could produce a 'truncate function that uses a pair! to similar 
effect...

truncate: func [string limit [pair! integer!]][
	if integer? limit [limit: 1x0 * limit]
	string: copy string
	case [
		negative? limit/x [remove/part string skip tail string limit/x]
		positive? limit/x [remove/part string limit/x]
		negative? limit/y [clear skip tail string limit/y]
		positive? limit/x [clear skip string limit/y]
	]
	string
]
Graham:
5-Nov-2008
the power of a language lies partly in it's ability to express things 
concisely
PeterWood:
5-Nov-2008
If you are removing characters from both ends of a string 'strip 
would appear to be a more precise description.
Graham:
5-Nov-2008
strip a joint ... = remove the contents
Graham:
5-Nov-2008
so, peel has a more restrictive meaning being a subset of strip.
Gregg:
5-Nov-2008
I'm not a big fan of the -n syntax to mean "from the end", but that's 
just me. It's convenient to type, but doesn't provide meaning. My 
BOUNDS/RANGE dialect supports .. notation via tuples so you can't 
use negative numbers.


For the trim/strip stuff, I ended up with a bunch of related funcs 
(begins-with?, ends-with?, enclose, etc.), and it works for more 
than single chars. Not as simple as a standalone func, but more robust 
and flexible for the general case.
Graham:
7-Nov-2008
Why can't we have functions that return a value to the calling function, 
but then continue to do something else ?  Is this because we lack 
multithreading?
Henrik:
12-Nov-2008
Is there a way to read out the uptime for a rebol process inside 
rebol?
Henrik:
12-Nov-2008
I'm writing a simple log from Cheyenne to see if I can catch a bug 
in the HTML dialect, but it could be useful to read out something 
like system/uptime without relying on someone making a timestamp 
at startup beforehand.
amacleod:
24-Nov-2008
How do I download an .exe file and save it locally preserving the 
icon data.  If I download a file trhough my browser the Icon downloads 
too. 

How do I do this with rebol? Do I read-thru and write to save it? 
I seem lose the icon this way. THe windows default .exe icon shows.
amacleod:
24-Nov-2008
Is it possible to use get-modes on files on a server? 
ie. Can I extraxt the creation date from a file on a web site.?
Gabriele:
26-Nov-2008
you might be able to use iptables (or equivalent) to do something 
like that, by basically doing a sort of nat.
Pavel:
26-Nov-2008
What is a difference between block, hash, list how to use them properly, 
what is an advantage and payof of each one? This is not properly 
described in documentation IMHO, exist some good resource of knowledges?
Sunanda:
26-Nov-2008
A hash is a block optimsed for 'find
A list is a block optimised for 'insert and 'append
Hash is very likely to be replaced by something else in R3
A note from Gregg about using list:
http://www.rebol.org/ml-display-thread.r?m=rmlQFPC
BrianH:
26-Nov-2008
The list! type is likely to not be in R3 (unless added as a third-party 
UDT).
Nicolas:
29-Nov-2008
I'd avoid it if I could. I have a gui that updates at every keystroke.
Nicolas:
29-Nov-2008
I can probably get around it with a hack
Henrik:
29-Nov-2008
ah, it's a user generated error.
Henrik:
29-Nov-2008
you can do that by attempting a load of a string and if it loads, 
then it works:

a: "%"
load a ;== error
error? try [load a] ;== true
Nicolas:
29-Nov-2008
you're a genius. thank you.
[unknown: 5]:
29-Nov-2008
it doesn't break a line at the with argument
[unknown: 5]:
29-Nov-2008
Yeah there is definately a problem.
[unknown: 5]:
29-Nov-2008
ok I have the following data posted in a file:    {1 ["paul" "tretter" 
41]*EOR*2 ["darla" "jean" 45]*EOR*}
[unknown: 5]:
29-Nov-2008
Now write that to a file and try to open/lines/with %filename "*eor*"
Anton:
29-Nov-2008
Post a bug report/feature request to update the OPEN docs on that.
[unknown: 5]:
1-Dec-2008
If we dont' have a simple way of doing this now I hope R3 offers 
the capability.
Ashley:
1-Dec-2008
How can I iterate over a range of IP addresses (looking for a particular 
response) and "time out" the ones that "hang". I've got something 
like:

ip: 10.1.1.0
loop 100 [
	rc: read join http:// ip
	if find rc ... [...]
	ip: ip + 0.0.0.1
]


This works great on most devices (IP Phones, Printers, etc) but hangs 
when it hits a computer with Stealth mode. I've tried read/no-wait 
but that doesn't seem to make a differemce.
[unknown: 5]:
1-Dec-2008
STill if a computer is in sleep mode it may not work (not sure).
Ammon:
1-Dec-2008
Ashley think I did something like that a long time ago by construction 
a port! and then calling wait [port! 0:03] in a loop.
Nicolas:
1-Dec-2008
how do you read files off a computer in your network?
Nicolas:
1-Dec-2008
do I need to have a server on the other computer?
Graham:
4-Dec-2008
REBOL used to have a graphical network indicator ... pity that is 
not controllable in this way too.
james_nak:
5-Dec-2008
Yeah, these are separate emails only sent to one person at a time. 
And the content is just simple words (these are tests) and no symbols.
Will:
8-Dec-2008
btw,I'm using a hash! , is there a faster way?
Steeve:
8-Dec-2008
ah you want a 16 bit integer ?
Steeve:
8-Dec-2008
i'm using a preconstructed struct! [] to do the conversion (i don't 
use debase) , it's fast enough.
[unknown: 5]:
8-Dec-2008
Yeah I'm going to have to make a function it seems.
[unknown: 5]:
8-Dec-2008
my issue is a bit more complicated.
[unknown: 5]:
8-Dec-2008
I'll come up with a solution - thanks Steeve, you still may have 
helped me out.
Graham:
9-Dec-2008
Anyone got a robust dialect for dealing with command line, or other 
parameters passed by dropping ?
Robert:
9-Dec-2008
Is there a way that I can constrain a listening port to only accept 
connection from localhost? Using:
	open tcp://:40000

opens a listening port on port 40000 for all connections. Something 
like: open tcp://:127.0.0.1:44000
Gregg:
9-Dec-2008
Need to look for the public location, if there was one, or just look 
at what I have here. 


Are you dropping on a desktop icon, or using the system port to file 
drop on a console window? (I assume the former)
Graham:
9-Dec-2008
one is passed as a block, the other as a string
Maxim:
10-Dec-2008
Graham... FYI, I am working on my args.r module in order to make 
it public... just for you ... adding in-script documentation and 
cleaning up a few details  :-)
eFishAnt:
18-Dec-2008
I have a situation where I wish inside a while loop I could do a 
continue.  There is break, but I just want to go back to the top 
where my wait sits and wait for the next event coming in.

Has anyone done some solution to this?
Steeve:
18-Dec-2008
i use port/state/index to skip in the opened file.
beware, port/state/index is a zero-based index
Steeve:
18-Dec-2008
to read the first byte of a file, you need to set port/state/inedx: 
0
Steeve:
18-Dec-2008
i think it's a bug but it wroks like that
Sunanda:
18-Dec-2008
EFishAnt -- use  a loop 1 [...] inside the while to simuate a "continue"
n: 1
while [n <> 10][
   loop 1 [
    n: n + 1
    if n = 5 [break]
    print n  
   ]
 ]
Steeve:
18-Dec-2008
generaly, i  like to use a case structure inside my loop.
while [n <> 10][
	n: n + 1
	case [
		n = 5 []		; break
		other-case [...]
		true [print n]   
	]
]
BrianH:
18-Dec-2008
R3 has a CONTINUE native. Not much help now I guess...
BrianH:
18-Dec-2008
The R3 continue works the way it does in any structured language 
with a continue operation. It's basically goto the end of the loop, 
while break is goto the point right after the loop.
Steeve:
18-Dec-2008
in fact i remember having to simulate a goto command when i tried 
to develop a Z80 emulator.
i had build a simple engine working like that:
code: [
	[ some code....]
	[ some code...]
	[ some code ... GOTO: 1]	; goto the first line of code
]
GOTO: 0
forever [
	GOTO: GOTO + 1
	do pick code goto
]
BrianH:
18-Dec-2008
That's a pretty standard switch interpreter model.
eFishAnt:
18-Dec-2008
print "Continue hack for a forever loop using Catch and Throw"
n: 0
forever [ ;from sqlab
	n: n + 1
	print join "top of FOREVER LN:" [n]
	catch [
		print "top of CATCH"
		if n > 100 [ break ] 
		if random 10 > 5 [ throw ]
		print "BOTTOM BELOW THROW CONDITIONAL"
	]
	print "BOTTOM BELOW CATCH"
]
print "BREAK forever loop and halt"
halt ;this is what I did to mess with it, sqlab
Steeve:
18-Dec-2008
in that case a simple exit or return is enough:
continue: :exit
continuing: func [code][do code]
Steeve:
18-Dec-2008
according to forskip source, perhaps a dual [throw catch] attribute 
is required, i'm not well versed in using such tricks
BrianH:
18-Dec-2008
The [catch] attribute is like a CATCH block for errors in the function, 
in this case used to catch the error! thrown in the source on the 
first and fifth lines. There is no need for the [catch] attribute 
in the CONTINUING function above, or for any function attribute in 
the CONTINUE function above.
BrianH:
18-Dec-2008
They are infrequently used functions, and as such are a good candidate 
to be mezzanines, for 2 reasons:
- Frees up some native space for more important functions.
- Easier to modify or replace with better functions.
[unknown: 5]:
18-Dec-2008
efishant - for what you want to do with the loop just put the while 
loop inside a function (assuming you manipulation a series) and then 
have it break out on a conidtion is met and then change the series 
to the desires position and pass back to the function if needed. 
 Not sure exactly what your trying to accomplish.
BrianH:
18-Dec-2008
No, but actions are handled on a type-specific basis, and R3 will 
have user-defined types.
BrianH:
18-Dec-2008
Paul, does the INDEX? function return the port/state/index of a port! 
type?
BrianH:
18-Dec-2008
Steeve, I'm not sure how well you can override a built-in types (not 
decided yet), but you will be able to create new ones.
[unknown: 5]:
18-Dec-2008
if you open a port in direct mode it is always at head but in seek 
mode you can pick from the a specific point in the file.
Steeve:
18-Dec-2008
Paul, it's just using port/state/index is theoricaly faster than 
at (because at is a wrapper)
Steeve:
18-Dec-2008
read-io and write-io use correctly the port/state/index, just don't 
forget that port/state/index is zero based (seems to be a bug)
[unknown: 5]:
18-Dec-2008
Steeve, yeah I would assume that is the case.  So the difference 
your seeing in performance is really just a small one as a result 
of the 'at then being a wrapper?
Steeve:
18-Dec-2008
agreed it's a small overhead concerning at, but not concerning copy 
(see the source if you find it)
[unknown: 5]:
18-Dec-2008
I never check to see how significant the difference was though.  
I might try  a test on a million records or so
[unknown: 5]:
18-Dec-2008
speaking of backporting is 2.7.6 the end or is 2.7.7 still a possibility?
[unknown: 5]:
18-Dec-2008
pass it a greater number and it will still only return 15
[unknown: 5]:
18-Dec-2008
It doesn't expand beyond a default of 15 characters unless you define 
it as such.
Steeve:
18-Dec-2008
i give you a script i used to profile the ideal size of the buffer 
used with read-io to have the best perfs.
On my computer the best size for the buffer is 8ko or 16ko.

REBOL []
f: open/seek/binary %large.dta

foreach len [64 128 256 1024 2048 4096 8192 10240 16384 32768 65536 
131072] [

	f/state/index: 0		;*** Problème quand on emploie read-io :
					;*** apparement c'est un bug, par défaut l'index est à 1
					;*** du coup, le premier octet n'est jamais lu
	

 buff: make binary! len + 1	;*** Encore un bizarerie, si le buffer 
 a exactement
					;*** la taille voulue, read-io lit un octet de moins
	n: 0
	recycle
	t: now/time/precise

 while [0 < read-io f buff len] [n: n + 1 clear buff f/state/index: 
 f/state/index + len]
	print [len tab v: now/time/precise - t tab v / n tab n]
]

close f
halt
[unknown: 5]:
18-Dec-2008
I copy data from a port using /seek and simply do-    to-block port-data 
and need no other conversion.
Steeve:
18-Dec-2008
you need to use a big file as data
BrianH:
18-Dec-2008
Looks like 64k is a good value for you.
Steeve:
18-Dec-2008
in fact you can see that 16ko buffer would be a better choice (regarding 
to the first column)
Steeve:
18-Dec-2008
you must have a special computer, it's not quiet logical and i have 
opposite results on my computer
[unknown: 5]:
18-Dec-2008
s: now/precise
a: open/direct/binary %blah
idx: 0
a/state/index: 0
buff: make binary! 16

loop 100000 [read-io a buff 16 a/state/index: a/state/index + 16 
clear buff]
close a
t: now/precise
difference t s
[unknown: 5]:
18-Dec-2008
s: now/precise
a: open/seek %blah
idx: 0
loop 100000 [copy/part at a (idx: idx + 16) 16]
close a
t: now/precise
difference t s
Steeve:
18-Dec-2008
using a buffer of 16 bytes is YOUR problem, didn't you understand 
the result of the pofiling script
Steeve:
18-Dec-2008
use a 16ko buffer instead (16ko = 16 * 1024)
Steeve:
18-Dec-2008
but copy use a larger buffer that 16 bytes, you don't compare same 
things
Steeve:
18-Dec-2008
each time you do a copy/part a new internal buffer is created, it's 
better to use always the same buffer. easy to understand.

more of that, the profiling script say that it''s faster to read 
16ko than 2 times  16 bytes
Steeve:
18-Dec-2008
because each time you do a copy/part you create new buffers in memory 
which are not erased by the recycler so that you should consider

using always the same buffer especially if you do thousands and thousands 
access in one second
Steeve:
18-Dec-2008
performance you will have too with a well sized buff
[unknown: 5]:
18-Dec-2008
let me put it another way Steeve, I will not be reading more than 
16 bytes per request (because I don't need any more than that) and 
it isn't a 16  bytes segment that is next to another 16 byte segment 
really I'm moving back and forth all over the file to get 16 byte 
segments each time.
[unknown: 5]:
18-Dec-2008
I can't think of a better options than copy/part at this point
[unknown: 5]:
18-Dec-2008
I might do a test to see how fast 4 successive picks would be
BrianH:
18-Dec-2008
That is a lot slower. I am not wondering how, I've followed the discussions 
in your group.
[unknown: 5]:
18-Dec-2008
But at a cost
[unknown: 5]:
18-Dec-2008
What if declared a field varchar[2000] and you only populate it with 
50?
[unknown: 5]:
18-Dec-2008
I have minimized it to a greater extent.
BrianH:
18-Dec-2008
A read of less than 1 disk page is just as slow as a read of 1 disk 
page.
39001 / 6460812345...389390[391] 392393...643644645646647