r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Gregg
19-Apr-2006
[3980]
You could use a semaphore of some kind (port/file).
Anton
19-Apr-2006
[3981]
- 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
Henrik
19-Apr-2006
[3982]
a script can't launch itself?
Anton
19-Apr-2006
[3983]
So you won't have to fiddle with files or ports and worry about deadlock 
conditions etc.
Henrik
19-Apr-2006
[3984]
or "cascade launch" scripts
Anton
19-Apr-2006
[3985x2]
A launched script cannot launch further scripts.
So:
	do original-script
		-> launch sub-script
			-> launch ---> failure
Henrik
19-Apr-2006
[3987]
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.
Gregg
19-Apr-2006
[3988]
Sounds like you want an IPC mechanism of some kind.
Henrik
19-Apr-2006
[3989]
seems it would be necessary...
Ingo
19-Apr-2006
[3990x2]
Hi Graham, hope you understood my explanation - I wouldn't ;-)
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.
Graham
19-Apr-2006
[3992x2]
Ingo, exactly .. not hard so has anyone done it?
I am wondering whether I should install fetchmail, or just use/write 
a rebol version.
sqlab
19-Apr-2006
[3994]
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
[3995]
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
[3996]
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
[3997]
I'm trying to setup Scalix on Suse, and just noted that Scalix lacks 
this facility natively.
Geomol
20-Apr-2006
[3998x2]
Bit-shifting

One way to do bit-shifting is to multiply or divide with (2 ** positions). 
To make the code more readable, I could start making a shift block:

shift: []
repeat i 16 [append shift to-integer 2 ** i]

== [2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536]

To e.g. shift the number 123 left 5 positions, you do:
123 * shift/5
== 3936
To check, that 3936 is actually 123 shifted left 5 positions:
>> enbase/base debase/base to-hex 123 16 2
== "00000000000000000000000001111011"
>> enbase/base debase/base to-hex 3936 16 2
== "00000000000000000000111101100000"

To shift 3936 right 5 positions:
3936 / shift/5
== 123


As long as the numbers are not close to 4 byte long integer (2 ** 
32), we don't get number overflow.
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
[4000x10]
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.
Anyone have an idea how to trick out Linux on this?
(or how to trick REBOL into asking for ttyc0 instead?
I do a   serial-port: open/direct/binary/no-wait serial://port/38400/8/none/1 
serial://port1/38400/8/none/1
rather... serial-port: open/direct/binary/no-wait serial://port/38400/8/none/1
no, exactly... serial-port: open/direct/binary/no-wait serial://port1/38400/8/none/1
aha...just found some Ubuntu notes on www.rebol.net/builds/lib-dep.html...mahbe 
I need to get the debian update.
I found REBOL ubuntu, and downloaded, but same problem, Access error: 
Cannot Open ttyC0
...simply doing open serial://port1
added RAMBO  Ticket #-639
DideC
24-Apr-2006
[4010]
Look at system/port/serial and change it to reflect what you have 
in /dev/
I guess with [ttyc0 ttyc1]
Almost it's what we have to do under Windows.
eFishAnt
24-Apr-2006
[4011x6]
Thanks, DideC, it is [ttyC0 ttyC1] ; with caps...
aha...system/ports/serial  (was going fish-eyed on that...0-o-o<
portS
get in get in system 'ports 'serial
hmmn, system/ports/serial: [ttyc0 ttyc1] is not enough to prevent 
the problem
neither does system/ports/serial: [ttys0 ttys1]
Graham
24-Apr-2006
[4017x2]
Anyone got a way of operating on each element of a series except 
the last ?
Or, doing something different to the last element.
Geomol
24-Apr-2006
[4019x2]
>> s: [1 2 3 4]
== [1 2 3 4]

>> forall s [either tail? next s [print ["Last item is" s/1]] [print 
s/1]]
1
2
3
Last item is 4
eFishAnt, a wild guess: what about rebooting the OS after you've 
made the link to ttyc0? Maybe some internal list of devices is made, 
when the OS boots?
Graham
24-Apr-2006
[4021]
Thanks .. I was using a while block, but yours is shorter.
Anton
24-Apr-2006
[4022x2]
eFishAnt, you have replaced the block at system/ports/serial. Try 
replacing just the first word in the original block with 'ttyc0. 
 Just a wild guess.
I just tried hex-editing rebol.exe in Rebol/View 1.3.2.3.1 here on 
windows. I found "com1" and changed it to "COM1". Then when I started 
again system/ports/serial == [COM1 com2]
Maxim
25-Apr-2006
[4024x4]
I've discovered that the GC seems to accelerate as it processes more 
and more of the same data... A 10 million allocated, linked and initalised 
liquid node test is proving this once more, so my guess is that Carl 
put some kind of heuristic detection or what have not, which adapts 
the sizes of the values in the allocation and GC, based on recurring 
tasks.
right now every time it creates 100000 new nodes, my loop's speed 
steadily increases by about 0.065 %
and the memory foot print of my application stays the same at ~  
300 MB
I manually call a recycle at the end of each iteration. so 300MB 
is what is needed to have 100000 nodes in memory without any GC.
Pekr
25-Apr-2006
[4028]
so many nodes, what for? :-) What is node in liquid terms anyway?
Maxim
25-Apr-2006
[4029]
I am stress testing the library.