• 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
r4wp4382
r3wp44224
total:48606

results window for this page: [start: 20901 end: 21000]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
yeksoon:
1-Mar-2006
is there a reason why 'NOW' does not have refinements for hour, minutes 
and seconds.?


I would have thought that it make sense to provide those refinements 
as well..since NOW will return a value that comprise date, time and 
GMT offset
Ingo:
5-Mar-2006
How can I position the internal (imap) scheme position? I'm trying 
to do sth. along the lines of: 

i: open imap://....
insert i [get mail 7]

and want to get the 7th mail ...
Ingo:
5-Mar-2006
and then 

insert i [get mail next]
Graham:
5-Mar-2006
oh, you want to set i to the 7th mail and then read consecutively 
with 'next ?
Ashley:
5-Mar-2006
Ever have a script that is used by other scripts but occassionaly 
needs to be run standalone and accessed from the console? Well I 
have, and my usual solution was to comment/uncomment a 'halt as the 
last line; but this got a bit tiresome so I came up with the following 
little trick:

	any [system/script/parent/header halt]


  just add it as the last line of your script and you can now run the 
  script directly as a console script or have others scripts use it 
  without being dropped to the console.
Ammon:
6-Mar-2006
system/script/parent/header contains the header for a script that 
has DOne another script so if the parent header exists then ANY will 
be satisfied and the script won't halt allowing other scripts to 
load it but if the parent header doesn't exist ANY isn't satisfied 
and the script halts.  This is a rather useful concept for a library 
where you would like to be able to test new changes at the console 
and run it from another script without having to modify the script 
depending on how you want to execute it.
PeterWood:
7-Mar-2006
Purely a matter of opinion.... or raather a couple of opinions...


Should now be immutable?  Of course not unless you want to reset 
the time on the machine for testing.


Can a timeone take the value 8:01 - not in real life at the moment 
- I  came across this odd behaviour when investigating the difference 
between mydate/zone: and to-date. I found out that there are a few 
:30 minute timezones and a couple of 0:15 (or 0:45) time zones, the 
rest were all hours.
PeterWood:
7-Mar-2006
but you still have a point - today the only four valid values for 
minutes are 00, 15, 30 and 60 - and I don't think they are that likely 
to change.
Claude:
7-Mar-2006
and here http://www.rebol.net/cookbook/recipes/0012.htmlfor   Louis
Claude:
7-Mar-2006
and this function   [    sort-db: func [db field [word!] /local result 
offset] [
        offset: find fields field
        either offset [offset: index? offset][
            print ["ERROR:" field "does not exist"]
            halt
        ]
        db: copy db
        sort/compare db func [a b] [
            if a/:offset = b/:offset [return 0]
            either a/:offset > b/:offset [1][-1]
        ]
        db
    ]
JaimeVargas:
7-Mar-2006
One specifies the size of the record and the second one the column 
to use.
Ingo:
8-Mar-2006
Hi Graham, yes that's it ...

I actuallly add some things to the protocol, like mailbox handling, 
the ability to fetch only specific headers, etc. so I would like 
to be able to use a unified interface. 

Additionally I'd like to fetch by uid,  and it would be nice if I 
were able to position to the read mail.
PeterWood:
9-Mar-2006
and the rounding:
>> a: 9-mar-2006 15:23
== 15:23
>> a/zone: +8:15
== 8:15
>> print a/zone
8:00
>> a/zone: +8:31
== 8:31
>> print a/zone
8:30
PeterWood:
9-Mar-2006
I would be good if the "zone" behavious was documented at least in 
the Datatypes! Appendix to the core user guide.

I'll try to draft something and submit via Rabo.
Oldes:
14-Mar-2006
only wait if you want to wait and do not want to quit;-)
Pekr:
14-Mar-2006
if I wait on multiple ports, and I am not using wait/all, what if 
there is event happening on two ports? Will it return one of them, 
or both in block?
Pekr:
15-Mar-2006
if I have something like following:

event: wait [server client1 client2 ... clientx 0.001]
if block? event [event: first events]


and now I just maintain one port and its data, I wonder what happens 
with next 'wait? Remember I am not using wait/all, but still I am 
not sure, what happens if there is even waiting on more than one 
port?
sqlab:
15-Mar-2006
I do not know if you will get your first port again as the first, 
if you did for example just copy/part from it.

But imagine, that you do a copy on it, and new data arrives at the 
same time. This will probably raise a new event on it and this port 
will probaby the last in your queue of waiting events.
sqlab:
15-Mar-2006
Just what I think is a little bit annyoing, that sometimes you do 
not get the proper timeout, if you have a timeout value in your wait 
list  and many events.

Yes, I always thought that I got the ports ordered according their 
event time and not according their position in the event list.
sqlab:
15-Mar-2006
I have to correct me.
I just tested this approach, and it does not look so good.
It always gave me the data from one port
Pekr:
15-Mar-2006
ah, that is bad .... but expectable ... so I have to prioritise ports 
myself and probably always use wait/all ... but then - I am not sure 
I want to maintain them all at once ....
Pekr:
15-Mar-2006
but maybe that is the only corrent aproach - to use wait/all and 
maintain data on all ports in a loop, then go for the next wait ...
Pekr:
15-Mar-2006
anyway - I am doing very small util for my friend who programs our 
new board for kiosk system event detection and am having fun with 
it :-)
sqlab:
15-Mar-2006
Just use small messages.

I gather every day messages in the tenth of thousands with peaks 
during the working hours and it is working so far.
sqlab:
15-Mar-2006
I just tested it with awake functions and this gave me data from 
two ports alternately.  Thanks god, that I use this approach since 
I heard about it. Probably the efficiency and the time granularity 
there is higher.
Tomc:
21-Mar-2006
that said it has been solved here and on the maillist several times
Maxim:
22-Mar-2006
I have searched the net, the update docs and have no found it.  ' 
:-/
Maxim:
22-Mar-2006
strange, I just searched it again, and for some reason, now, new-line 
is the first thing returned in google... damn... last week it wasn't 
in the first 3 pages   > :-(
Sunanda:
24-Mar-2006
difference in recent versions will subtract dates and times
JaimeVargas:
24-Mar-2006
Maybe we need three types instead of two. date! time! and idate! 
or stamp!
Gregg:
24-Mar-2006
I don't like hacks, but the minus op is a very practical shortcut. 
Should it try to be smart and return days if no time exists for either 
arg; otherwise do the same thing DIFFERENCE does (and what time do 
you assume if only given for one arg; midnight UTC?)?
Jarod:
26-Mar-2006
it would be interesting if it could also do arrays of objects, and 
hashes of objects
Jarod:
26-Mar-2006
but let's say I set some words to some blocks, and I put those words 
into another block, do I always have to reduce to actually see the 
stuff pointed to by the words in the blocks, or is there a way to 
actually insert the content of the words themselves into the blocks
Gregg:
26-Mar-2006
You can reduce or not; that is, the choice of when to evaluate is 
up to you; and, yes, any type of block can contain any type of data 
nested to any level.
Gregg:
26-Mar-2006
You need to be aware that the behavior of lists is *slightly* different 
than for blocks and hashes, WRT what INSERT does, etc. The Core manual 
covers it correctly I think.
Jarod:
26-Mar-2006
and I want b to have a in it
Jarod:
26-Mar-2006
what I do b: [a] and have it put value1 value2 value3 in b instead 
of a itself
Anton:
27-Mar-2006
It reduces the expressions found within the block (and it returns 
the results in a new block).
Jarod:
27-Mar-2006
rebol's help also should have a see also at the bottom of commands, 
to direct attention to other rebol commands and functions of interest
Jarod:
27-Mar-2006
the language as a whole feels very fragmented, I recognize the power 
of Rebol only because of its lispy nature, but I feel limited compared 
to a language like perl, because examples are far too scattered about, 
and the names for functions are often oddly named or sometimes the 
functionality exists but is so obscured that I never knew it was 
there at all in the first place
Jarod:
27-Mar-2006
and sure perl ain't the prettiest languages on earth, but it is well 
documented
Jarod:
27-Mar-2006
for example, how could I take a date, and add 3 months or 3 weeks 
to the date?
Jarod:
27-Mar-2006
But I am actually talking thorough discussion and documentation of 
every nook and cranny and how to do basic things people want and 
need to do with the language
Jarod:
27-Mar-2006
that was one of the things that drove me crazy about lisp, yeah it 
is a powerful language, and yeah it is a programmable language, but 
to some degree the only way to do anything really useful in the langauge 
was to in essence program lisp to function similar to other languages 
you were already familiar with, or to in essence extend lisp with 
functionality it should have already had before you even started 
programming in it it
Jarod:
27-Mar-2006
I dunno, I think that languages like java or .NET would be far less 
successful if people had to implement a majority of the class library 
by hand, anytime they wanted to take advantage of advanced functionality. 
There is just some functionality that people come to expect regardless 
of what higher level language they are coding in. And for a language 
that supposedly can be used to parse and manipulate text and data, 
not having a built in substring function is pretty crazy
Jarod:
27-Mar-2006
that is my primary need or want to use rebol for, is to manipulate 
text. I like perl, but  love rebol's small footprint, if it can give 
me the same power of perl in a much smaller package, with a gui, 
that is all the better. I could potentially replace access and a 
lot of proprietary tools with a small rebol view application.
Jarod:
27-Mar-2006
I dunno maybe I am being anal, or stupid, or just plain unreasonable. 
But this sort of irked me, when I found people offering a solution, 
and it was so simple as to have just been a part of the darn language 
from the beginning.
Bo:
27-Mar-2006
Someone (or a group of someones) should write a .r file for the common 
languages (i.e. basic.r would include 'substr, 'peek, 'poke, etc.; 
rexx.r would include 'mid, etc.).  That way, new users from other 
languages could move into Rebol with the knowledge they already have. 
 Of course, the script flow would be different, but their favorite 
functions would be available, and they could see how to implement 
their favorite functions natively using 'source.  There could also 
be a %c.r for those coming straight from C. :-)
Graham:
27-Mar-2006
and things like .. cd, dir and other common dos functions
Jarod:
27-Mar-2006
yeah, but I mean, let's say I took two dates, and I wanted to know 
the number of months between them, the date/month thing doesn't work
Jarod:
27-Mar-2006
maybe if I take the number of days and divide by 12
Jarod:
27-Mar-2006
yeah, and I could continue converting that
Bo:
27-Mar-2006
Over a period of time, dividing by 365.25 and multiplying by 12 is 
pretty accurate.
Geomol:
28-Mar-2006
I start with 2 dates:
>> d1: now/date
== 28-Mar-2006
>> d2: 1-1-08
== 1-Jan-2008
To calculate the number of months between them:
>> months: (d2/year * 12 + d2/month) - (d1/year * 12 + d1/month)
== 22
>> if d1/day > d2/day [months: months - 1]
== 21
To calculate the number of remaining days:
>> d1/month: d1/month + months
== 24
>> d1
== 28-Dec-2007
>> d2 - d1
== 4


So there are 21 months and 4 days between the 2 dates (if I calculated 
right).
Geomol:
28-Mar-2006
The situation with REBOL is, that you can do almost anything with 
it. If someone should document that, she could start now and not 
be finish, before she turned 100 years old. I saw myself as a very 
competent programmer with many years of experience in many different 
languages, before I discovered REBOL. It took me a year or so do 
'get' REBOL, because it's so different. I could very fast write simple 
things, but to get in under the skin of REBOL takes some time. In 
some way REBOL is a bit hard at first, and it takes some time to 
'get' it, then suddently it become very easy.
Gregg:
28-Mar-2006
Also, WRT language docs, there is the online dictionary and the Word 
Browser in Viewtop.
Gregg:
28-Mar-2006
As far as what is included, this is tough because everybody coming 
to REBOL will want different things, and including all of it would 
make REBOL a complete mess. Is a substring function a good idea? 
Sure; I've written a lot of them. :-) I'm still working on a whole 
*bunch* of functions that might be useful, but they are hard to design 
well, so they are easy to use, flexible, and intuitive.
Gregg:
28-Mar-2006
Fore example In the case of "substring", that's a bad name IMO, because 
you can use the same concept on any series, not just strings. Is 
"subseries" a good name? Does it read well? Not so much. It could 
mean different things to different people (e.g. are you looking for 
nested series values?). What about "extract", ah, that's used already, 
and what are the implied semantics if we do override it and add behavior? 
I like EXCERPT myself, but it's not a nice short word that's easy 
to guess if you're not sure what it might be called. Whatever the 
name, should there be a /REMOVE refinement, or should there be a 
separate function for that?


OK, so let's assume we have a good name now, how do you define the 
bounds? There is no range! or bounds! type in REBOL. Do you just 
use lower and upper bounds, or should it take an offset and length? 
Should we define a dialect for this? If so, how flexibile should 
it be? Can you get multiple "pieces" all at once? Can you handle 
2D extractions easily and clearly? Should you? Can you specify reverse 
extractions (e.g. from the tail)? Should it return the elements in 
reverse in that case, or should it throw an error if the lower bound 
is higher than the upper bound? etc.
Gregg:
28-Mar-2006
So, you have to do this:
	COPY/PART AT xxx 5 10
instead of
	SUBSTRING xxx 5 14
	(or maybe SUBSTRING 5 10) 


Yeah, it's a few extra characters, but it's actually pretty expressive 
and clear.
Gregg:
28-Mar-2006
And maybe someday we'll have one, who knows.
Gregg:
28-Mar-2006
I can give you mine, and I do have some one-liner versions around 
I think, but I assume you already have some, and are just talking 
about having a standard one.
[unknown: 10]:
28-Mar-2006
How do i check If a value in serie a does occeur in b on a specific 
position ? Currently im doing that with a foreach including a for 
loop..But somehow rebol should have something buildin i thought? 
or not.. unqiue intersect and difference are not good enough for 
this...and speed is a concern too..
Allen:
28-Mar-2006
Rebolinth: Need you to show an example with the expected results. 
Also are A and B of fixed length or varied?
[unknown: 10]:
29-Mar-2006
yes well find and index where not what i searched for...ill drop 
an example...hold on a few hours ;-) back ltr...
[unknown: 10]:
29-Mar-2006
...an example...


I build in lisp a latin-square example and rebuil it in rebol.. the 
bottle neck is not the random generator

but its for me the function called 'clean? (can this function be 
exchanged with a rebol buildin funtion? or
even be made smaler?)


; a latin square in rebol

random/seed now

clean?: func [ x /local bb i ][ 

 catch [ foreach bb b [for i 1 9 1 [ if = pick bb i pick x i [throw 
 false] true ]]]]

print "---- running ----"

T1: now/time/precise
insert/only b: copy [] random/seed [ 1 2 3 4 5 6 7 8 9 ]
print first b

while [ < length? b 9 ][  

 if clean? set 'x random [ 1 2 3 4 5 6 7 8 9 ] [ print x insert/only 
 b x ]]

print rejoin [ "Timed: " now/time/precise - T1 ]

wait 0:0:5
quit
DideC:
30-Mar-2006
; Try :
	source for
	source repeat
; and see !!!
Anton:
2-Apr-2006
Ok I have a question.


I would like to catch an error inside a function and throw it out 
so the error position is reported "near"

the function itself. As far as I understand we should do that with 
something like this:

check: func [

 [catch]  ; <-- function spec attribute flag which changes the reported 
 position of the error.
][
	load "http://("  ; <-- cause an error on purpose
]

Now I have tried various things:

>> check: func [][load "http://("]
>> check
** Syntax Error: Missing ) at end-of-script
** Near: (line 1) http://(

>> check: func [[catch]][load "http://("]
>> check
** Syntax Error: Missing ) at end-of-script
** Near: (line 1) http://(

>> check: func [[catch]][throw-on-error [load "http://("]]
>> check
** Syntax Error: Missing ) at end-of-script
** Near: 



But none of these seems to be reporting the "Near:" position that 
I'm expecting.

(Indeed, the last one looks kind of buggy reporting to me. Anyone?)
Jerry:
5-Apr-2006
Outer: context [
	name: "Outer"
	Inner: context [
		name: "Innter"
		get-outer-name: does [
			; I would like to return the outer name.
			; How would I do that? Thank you.
		]
	] 
]

; Making the get-outer-name function return Outer/name is not
; a good idea, since Outer can be cloned and its name can be
; changed, as follows 

Outer2: make Outer [ name: "Outer2"]
Outer2/Inner/get-outer-name

; Any help will be appreciated.
Jerry:
5-Apr-2006
Thanks. Anton and Sunanda.
JeffM:
10-Apr-2006
Can REBOL/SDK define functions that will be called from C and passed 
to a C function? For example:
Pekr:
10-Apr-2006
i know - that method was suggested to me by Oldes IIRC. Because in 
other way, that is one of rebol's aspects I don't like and I regard 
it being inconsitent - to-binary 15 - It is a NUMBER, not two chars 
1 and 5, so I don't understand, why it tranlates each char .... it 
should change for 3.0
Pekr:
10-Apr-2006
so the way to go is to use to-hex, but when you need a binary e.g. 
for struct!, you have to compose it, at least I did it that way in 
the past iirc :-) But maybe I am missing something obvious. But if 
not, those things should be looked into fro 3.0 .... as so far I 
like Carl's aproach = willingness for change, if the change makes 
sense of course and improves consistency ....
Anton:
10-Apr-2006
Two bytes:

>> to-binary reduce [(i and 65280 / 256) (i and 255)]
== #{01B0}
Vincent:
10-Apr-2006
yes - but to have the same code running on both little and big endian 
platforms, it needs some work (when to apply 'reverse)
BrianH:
10-Apr-2006
That's easy, you just set a conversion function at the beggining 
of your app, picking a bigendian or littleendian one based on the 
platform, and then just use it like a black box. A bigger problem 
is that struct! is currently only available on /Pro, /View/Pro or 
/Command, which means that you can't run the code on Mac right now 
anyways. Making struct! available in /Core and /Base has been requested 
though.
BrianH:
10-Apr-2006
It has been aailable in versions of View that can be upgraded to 
View/Pro with a license, even when the Pro features are disabled 
by the lack of a license. However, the struct! type is implemented 
by the library extension, along with routine! and such. Can anyone 
confirm that struct! is available in versions of View that do not 
have the library extension at all, like View for Mac?
Vincent:
11-Apr-2006
but not for /View 1.2.1 : no system:// port, and debase crashes sometimes. 
A little better than "load rejoin" : 
load join "#{" [to-hex value "}"]
JeffM:
11-Apr-2006
Not sure the best forum to put this on (to where Carl will see it). 
Are there plans in the future for actual bit operations besides and/or/xor? 
RIght now, bit shifting, rotating, etc. are extremely painful (and 
slow compared to what they should be) to do.
JeffM:
11-Apr-2006
shifting is a very basic operation. I don't understand how it couldn't 
be part of the core, native functions. The same could be said of 
AND and OR, and just make them logical operators instead of bitwise.
Gabriele:
12-Apr-2006
well, shifting is very lowlevel, and there are not many use cases 
outside of rebcode.
JeffM:
12-Apr-2006
I disagree, but that's fine. I imagine the majority of those using 
REBOL are using it for non-low level things. I just don't happen 
to be one of them. REBOL is a great language for making domain specific 
languages, and many DSLs would benefit from a little more low-level 
control.
Gregg:
12-Apr-2006
Well, you can write your own; if just prototyping, the speed isn't 
critical (we did 160 bit math for Maarten, using bitsets, at one 
point). That said, if you can use a version with rebcode, just wrap 
a mezzanine around the ops. 


That said, I wouldn't mind having standard SHIFT and ROTATE funcs 
that can operate on integer, or series values. Bit ops are also necessary 
for implementing certain algorithms.
Gregg:
12-Apr-2006
Here are prototype funcs for SHIFT and ROTATE (plus a couple supporting 
funcs). Is it worth some time to come up with good ones and submit 
them for inclusion in R3?
Anton:
12-Apr-2006
... and I have my head deep in FTP handler... :)
JeffM:
18-Apr-2006
Like bit shifting. I do appreciate Gregg's functions. However, when 
something that boils down to a single instruction in hardware requires 
6 lines of code and multiple function calls, something is wrong. 
;)
Ingo:
19-Apr-2006
Do you mean like this?

>> b: "(blue)"
== "(blue)"
>> compose bind to block! b 'white
== [0.0.255]


You just have to give any word from the same context to bind ... 
so inthis case any word from the global context (i.e. system/words).

The only point to be aware of: If all this happens in a different 
context, and you happen to have a word named 'white in this context, 
then you have to use another word.
Henrik:
19-Apr-2006
this is probably outside of core and more at the OS level, but it 
would be nice to somehow check if a script is already running via 
LAUNCH, to make sure it's only launched one instance at a time. Is 
this possible?
Anton:
19-Apr-2006
maybe try to launch a dummy script and catch the error.
Henrik:
19-Apr-2006
another thing could be to have a masterscript running and let the 
other scripts report to it via LNS, but that's not very elegant...
Anton:
19-Apr-2006
- the original script will be able to launch the dummy script and 
thus no error

- the launched script will not be able to launch the dummy script 
and thus an error
Anton:
19-Apr-2006
So you won't have to fiddle with files or ports and worry about deadlock 
conditions etc.
Henrik:
19-Apr-2006
what if I have a menu system which launches subscripts A, B, C, D 
and E. I launch A and C. Then the menu crashes or is accidentally 
quit. I launch the menu system again, but then it should know the 
state of the running programs.
Ingo:
19-Apr-2006
re. fetchmail ...

What exactly are you looking for? fetchmail in its current incarnation 
fetches mail via pop3, and sends it via smtp to a local mta ... shouldn't 
be too hard.
sqlab:
19-Apr-2006
Henrik: you can either assign every script an unique port number 
and try to open it at startup or (under window) give the console 
window a name and check if a window with that name already exists 
or (under **ix) check the command line with ps
Graham:
19-Apr-2006
That is what I do .. my scripts up a listen port, and if they can't, 
they know an instance is already up and running.
Ingo:
19-Apr-2006
Well, I once did a script that just downloads and stores mails locally, 
but none that works like fetchmail ... on linux I have fetchmail 
installed, and on win I don't have an mta ;-)
Graham:
19-Apr-2006
I'm trying to setup Scalix on Suse, and just noted that Scalix lacks 
this facility natively.
Geomol:
20-Apr-2006
This also doesn't work with negative integers, because the left-most 
bit is set in those cases. I have bit-operations for shift and rotate, 
that works on full 32-bit integers, if anyone needs those.
eFishAnt:
24-Apr-2006
HELP (please) I have installed Core 2.6 on an embedded Ubuntu Linux, 
and when I try to open the comm port, I get and Access Error for 
ttyC0 but when I look in the /dev/ directory, I see a ttyc0 but not 
a ttyC0  ...   I tried as root to ln -s /dev/ttyc0 ttyC0  ...  but 
get the same error.
eFishAnt:
24-Apr-2006
I found REBOL ubuntu, and downloaded, but same problem, Access error: 
Cannot Open ttyC0
20901 / 4860612345...208209[210] 211212...483484485486487