Killer Application
[1/13] from: reffy:ulrich at: 16-Aug-2002 18:22
Hi List,
I am bored ... so forgive me for I wish to babble ...
I want a unique number which is 1 greater than the last one obtained, worldwide.
How do I do this in Rebol?
Dick
[2/13] from: reffy:ulrich at: 16-Aug-2002 18:20
Hi List,
Where is the formal documentation that describes IOS?
Dick
[3/13] from: reffy:ulrich at: 16-Aug-2002 18:26
Hi List,
I am bored ...
Considering the expression: a + b
Where is the code that actually performs the '+' operation located?
Is it in the client or on the server?
Where is the value of 'a' and 'b'?
Is it in the client or on the server, or mixed?
How can we learn where the service called '+' is located?
Dick
[4/13] from: reffy:ulrich at: 16-Aug-2002 18:33
Hi List,
You can see I am still bored ...
Has anyone constructed a multi-user spreadsheet with Rebol?
Dick
[5/13] from: al:bri:xtra at: 17-Aug-2002 12:09
Dick wrote:
> Has anyone constructed a multi-user spreadsheet with Rebol?
I've got a multi-user Wiki written in Rebol being used by teachers and staff
at the local high school. Does that count?
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[6/13] from: al:bri:xtra at: 17-Aug-2002 12:16
Dick wrote:
> Considering the expression: a + b
>
> Where is the code that actually performs the '+' operation located?
> Is it in the client or on the server?
Usually it's on the client. But that also depends on the code that's been
executed before this. This could have reassigned the value of '+ to mean
something else.
> Where is the value of 'a' and 'b'?
> Is it in the client or on the server, or mixed?
The value of 'a or 'b could be a simple value or a series or a object, or a
function.
> How can we learn where the service called '+' is located?
probe system/words
Unless '+ is given a new value in an surrounding object/context.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[7/13] from: al:bri:xtra at: 17-Aug-2002 12:23
Dick wrote:
> I want a unique number which is 1 greater than the last one obtained,
worldwide.
> How do I do this in Rebol?
Rebol [
Name: 'Number
Title: "Title"
File: %Number.r
Author: "Andrew Martin"
eMail: [Al--Bri--xtra--co--nz]
Date: 17/Aug/2002
]
Number: has [File Number] [
File: %Number.txt
if not exists? File [
save File 0
]
Number: load File
Number: Number + 1
save File Number
Number
]
probe Number
probe Number
probe Number
probe Number
probe Number
probe Number
halt
Which after some tests, produced:
13
14
15
16
17
18
It's not the most optimal solution in the world (there's two 'save words for
instance)...
You're welcome to use it as you wish.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[8/13] from: reffy:ulrich at: 16-Aug-2002 20:21
What is a Wiki ?
> Dick wrote:
> > Has anyone constructed a multi-user spreadsheet with Rebol?
>
> I've got a multi-user Wiki written in Rebol being used by teachers and staff
> at the local high school. Does that count?
Dick
[9/13] from: reffy:ulrich at: 16-Aug-2002 20:36
Thanks Andrew,
That is a cute solution!
Now, if we had a need for that on a continuous basis 24x7,
would it be written differently? I suppose it could be a daemon running
on some machine somewhere and would receive message requesting a number
and periodically it would write the file, thus providing a high-speed lean-resource implementation
?
[10/13] from: al:bri:xtra at: 17-Aug-2002 17:39
Dick wrote:
> Now, if we had a need for that on a continuous basis 24x7, would it be
written differently? I suppose it could be a daemon running on some machine
somewhere and would receive message requesting a number and periodically it
would write the file, thus providing a high-speed lean-resource
implementation ?
You'll need to check out Rugby, which, IIRC, provides just such a service.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[11/13] from: al:bri:xtra at: 17-Aug-2002 17:37
> What is a Wiki ?
Check out the original Wiki at:
http://c2.com/cgi/wiki
It's a far better explanation than my feeble attempts.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[12/13] from: joel:neely:fedex at: 17-Aug-2002 8:43
Hi, Dick,
The best answer comes from the original, referenced below.
[reffy--ulrich--net] wrote:
> What is a Wiki ?
>
http://c2.com/cgi/wiki?WikiWiki
However, briefly, it is a self-organizing, dynamic, interactive,
participatory web site requiring no participant tool more fancy
than a standard browser.
Alternately, a shared virtual notebook maintainable via the web.
I've written a couple myself, and have found them very useful,
both at a group and personal level. I have one on my laptop that
serves as my private notebook (ambiguity intended ;-)
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]
[13/13] from: atruter:hih:au at: 19-Aug-2002 10:19
<snip>
Rebol [
Name: 'Number
Title: "Title"
File: %Number.r
Author: "Andrew Martin"
eMail: [Al--Bri--xtra--co--nz]
Date: 17/Aug/2002
]
Number: has [File Number] [
File: %Number.txt
if not exists? File [
save File 0
]
Number: load File
Number: Number + 1
save File Number
Number
]
</snip>
To prevent more than one session obtaining the same number (assuming the
file is stored on shared media) some form of locking may be required. The
following code could serve as the basis for such:
<code>
lock-index: function [path] [lock?] [
lock?: false
repeat cnt 5 [
either none? attempt [rename join path %index.dat %lock.dat] [
wait 1
print reform ["Waited:" cnt]
][
lock?: true
break
]
]
if not lock? [print reform ["Could not lock" join path %index.dat]]
]
; ... code that reads / writes path/lock.dat
unlock-index: func [path] [
if none? attempt [rename join path %lock.dat %index.dat] [
print reform ["Could not unlock" join path %lock.dat]
]
]
</code>
Regards,
Ashley