• 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: 24201 end: 24300]

world-name: r3wp

Group: Rebol School ... Rebol School [web-public]
Anton:
19-Feb-2009
Can't upload to my website at the moment for some reason, so I'll 
just post it to Vladimir privately for the moment, and try again 
later.
Claude:
19-Feb-2009
that create a folder and you must  execute the script with rebol 
START.R
Claude:
19-Feb-2009
i use rebGui 118 and rebDB203 to do it
Vladimir:
19-Feb-2009
Looks interesting, but I don't speak french :)
And what is it suppossed to do ?
Graham:
19-Feb-2009
Create Retrieve Update and Destroy records = CRUD
Claude:
19-Feb-2009
i would like to optimize this with rebdb and rebgui
Claude:
19-Feb-2009
with entity and "percistence"  i would like to have a java EE5  but 
in rebol or better in R3
Claude:
19-Feb-2009
I would like to see proposals from the community to improve this 
point in R2 and rebdb, rebgui at first.
and later in R3!
kib2:
23-Feb-2009
Hi. Is there a build-in function do do something like this : given 
the number 5 and the string "abc"  construct the string "abcabcabcabcabc" 
(equal 5 times "abc")?
Geomol:
23-Feb-2009
And if you're really concerned about speed, this is a little faster:

to string! array/initial 5 "abc"
Geomol:
23-Feb-2009
Yes, and it looks nice. I have someting to think about. On one side 
keep it as simple as possible, on the other side, it should look 
nice.
Geomol:
23-Feb-2009
A motto I like very much and think about daily:
Everything should be made as simple as possible, but not simpler.
- A. Einstein
Geomol:
23-Feb-2009
And my own:
It's more important to get it right than to get it fast.
:-)
Gregg:
23-Feb-2009
And then just wrap it up:

    string-of: func [
        "Returns a string of <value> repeated <count> times."
        count [integer!]
        value [word! char! any-string!]
    ][
        head insert/dup copy "" value count
    ]
kib2:
23-Feb-2009
BrianH and Gregg : thanks, I need to write all these tips on a page 
now.
kib2:
23-Feb-2009
Geomol: more than ever. But I'm rather fed up now working on this 
markup engine. I need fresh air.

I was thinking of a game, and in fact I've found one, but I think 
I need your help. Beware : that's not easy !
Geomol:
23-Feb-2009
:-) We have a game group. You could start posting there and see, 
what will happen.
kib2:
24-Feb-2009
How could I generate a random number (a real number) between 2 given 
values, ie between -pi and pi ?
Geomol:
24-Feb-2009
You can build a hex value from an integer with TO-HEX.
And you can put that hex value into a decimal using struct!
Henrik:
24-Feb-2009
how about randoming a big integer and divide by that integer and 
multiply with your desired max-value?
Anton:
24-Feb-2009
Rebol decimal! is 8 bytes and integer! is only 4 bytes. So you would 
need to make a struct of 2 integer!, then swap its contents with 
a struct of 1 decimal!
Anton:
24-Feb-2009
Now divide by max-decimal (whatever that is) and multiply by desired 
range (eg. pi).
Geomol:
24-Feb-2009
And since we don't have a 16 bit datatype (or maybe we do with a 
string or other series somehow!?), we have to make 8 times random 
256 (and subtract 1).
Geomol:
24-Feb-2009
Kib asked a simple question about random and decimals. It seems to 
be a bit of a hazzle to get what we want, and this should be pointed 
out to Carl for R3, I think.
Geomol:
24-Feb-2009
Kib, I think, the answer is, that REBOL do a lot and then some more, 
but there are a few holes.
kib2:
24-Feb-2009
Yes, this one and repeating a string are essential to me. I may find 
other cases too :)
Geomol:
24-Feb-2009
:-)

Kib, feel free to ask questions about all this. It may easily get 
blurred, when we talk like this. And it shows you, that we're often 
in doubt, because REBOL is so deep. (I hope, it's ok, we do this 
in the Rebol School group.)
Geomol:
24-Feb-2009
You asked how to make a random number between e.g. pi and -pi. There 
are a number of ULPs (Unit in the Last Place) between those two numbers. 
For 64 bit decimals, it's a large number. The possible decimals in 
computer arithmetic lie closer together around zero than for large 
numbers. If you had a routine, that would give you any possible 64 
bit decimal number between pi and -pi with equal probability, then 
you would get a lot more numbers close to zero than close to either 
pi or -pi. The distribution wouldn't be flat (as you would expect).


It's much better to choose, how many different values between pi 
and -pi, you need, and then make a random integer of that number, 
and do some calc to get the result between pi and -pi.

I hope, it makes sense.
Geomol:
24-Feb-2009
Yes, an interesting approach. Just remember, that random 9 will return 
1-9, never zero. So maybe you wanna add one before doing the random, 
and then subtract one afterwards?


Another thing, you might wanna have those explanation strings in 
the variable block? Try:


>> random-dec: func ["i digits before, n after" i n /fromdigits "i: 
number of digits before, n: number of digits after"] []          
                          
>> ? random-dec
Geomol:
24-Feb-2009
REBOL allow thousand separation with ', like: 11'231, but it's only 
for readability. You would probably convert to string and put #"." 
in for nice output.
Janko:
24-Feb-2009
well, it's not the nicest function probably but I am tired and just 
need it to work
PatrickP61:
25-Feb-2009
Simple Question: I want to assign a specific script name to the word 
RUN and have it execute it whenever I type it into the console.
RUN: do %script.r

But upon the assignment, it evaluates the expression and executes 
it.  So I tried it in a block as RUN: [do %script.r]
but this returns == [do %script.r]


I can do this: IT: %script.r    and then type DO IT to perform the 
script, but I want a way to combine the DO and the IT together.  
Any ideas?
Geomol:
25-Feb-2009
Try

source does


and you see, DOES simply makes a function. So instead of using DOES, 
you could also have written:

run: func [] [do %script.r]

, but of course DOES is easier and shorter in this case.
Geomol:
25-Feb-2009
And now you're at it, try

source func

and see how similar to DOES it is.
Geomol:
25-Feb-2009
And the last one in this group of function-defining functions, try

? has
source has
Geomol:
25-Feb-2009
I use FUNC, DOES and HAS a lot in my scripts.
Geomol:
25-Feb-2009
A little tutorial on HAS, functions and objects. Let's say, I wanted 
to make a function with a local variable, that works like a counter, 
so 1 is added to it every time, I call my function. This doesn't 
work:

>> f: has [a] [a: 0 a: a + 1]
>> f
== 1
>> f
== 1


because a has to be defined (given a value and by that a datatype), 
before I can use it, and I need to use it, when I add 1. So I can 
use an object:

>> o: make object! [a: 0 f: does [a: a + 1]]
>> o/f
== 1
>> o/f
== 2


But there is a trick to do the same thing with HAS and without making 
an object:

>> f: has [a] [a: [0] a/1: a/1 + 1]
>> f
== 1
>> f
== 2


The thing is, that a is giving a block with zero inside the first 
time. The second time, I call f, a is just the same block (part of 
memory), and the value inside isn't touched (it is 1 now), so it 
works. I can see the block inside my function with:

>> source f
f: func [/local a][a: [2] a/1: a/1 + 1]


and we see, a is a block with 2 inside, because I've called my function 
2 times.
Geomol:
25-Feb-2009
This is only within functions. If you write a: [0] at the console 
prompt, a become a new block with zero inside (you typed a new block, 
so it isn't the same, and it kinda makes sense). :-)
Geomol:
25-Feb-2009
abc is seen as a word, and it doens't have a value. <abc> is a tag! 
datatype, like "abc" is a string datatype:
>> type? <abc>
== tag!
Geomol:
25-Feb-2009
and it also is a series, like strings are series:
>> second <abc>
== #"b"
Geomol:
25-Feb-2009
And answers go to Puzzle Answers
Geomol:
25-Feb-2009
And people expect rewards. ;-)
kib2:
25-Feb-2009
I already solved it, but it's not nice (and maybe faulty)
PatrickP61:
25-Feb-2009
Another question:  How do you setup Rebol code to be performed when 
a button is pressed?

Lets say I want a VID to show a list of websites to open to, and 
I set the default to HULU.
I have the following to setup the correct url:
 k-prefix:	[http://www.]
k-suffix:	[.com]
txt-site:	[hulu]
url-site:	to-url ajoin [k-prefix txt-site k-suffix]
PatrickP61:
25-Feb-2009
I tried to replace the browse url-site with
browse to-url ajoin [k-prefix txt-site k-suffix]   to no avail.

Is there a way to "predefine" the code above the VIEW so that when 
the button is pressed, it will perform the desired task like

button "Open"    format-and-browse-site    <-- where this has been 
set to do the url-site assignment and browse funtions?
Henrik:
25-Feb-2009
As I said, you need a DO block (I think you missed that). Then you 
create a function to create the URL-SITE url. Then you use that as 
input with BROWSE and that will work.
PatrickP61:
25-Feb-2009
Henrik,  I added the following code:

    eval-url-site:	does [to-url ajoin [k-prefix txt-site k-suffix]]
and then after the button "open" i have:
    button "Open"	browse eval-url-site
PeterWood:
26-Feb-2009
When you are making the container Rebol evaluates the code in the 
argument block. So in this case, it first  sets infile to none and 
then tries to set input-file to the result of evaluting read join 
infile ".txt".
Geomol:
26-Feb-2009
Or use DOES again:
input-file: does [read join infile ".txt"]


When stuff is evaluated can be a bit difficult to figure out. The 
more you use and learn about REBOL, the more clear it will become.
kib2:
26-Feb-2009
I named my script "ooo.r" and I have a "user.r" file inside that 
directory too.
PatrickP61:
2-Mar-2009
I have a question on same?  Do the following:
a: "apple"
b: to-string 'apple
same? a b
== false


Why is that, they are both strings of the same length and datatype, 
just not created in the same way?
kib2:
2-Mar-2009
I know that = compares values, == compares values and types. Same? 
is native, and the docs says "Returns TRUE if the values are identical".
kib2:
2-Mar-2009
ok, it's clearer now. But how do you explain this ?
a: "apple"
b: to-string a
same? a b ; --> returns false


Does that mean that to-string makes just a copy of a, and so does 
not point to the same location ?
BrianH:
4-Mar-2009
Core 2.5.0.15.5 for WinCE 2.0 Handheld PC works on PocketPC 2002, 
but is not onscreen-keyboard aware - the onscreen keyboard obscures 
the command line, so you better have a builtin or bluetooth keyboard, 
or perfect typing. As with all R2 WinCE releases, there is no support 
for the clipboard, program command line, file associations, or background 
operation. This makes it almost unusable, even on a machine with 
a hardware keyboard.


I was the one who requested the build, and there hasn't been a WinCE 
build since.
kib2:
4-Mar-2009
BrianH: weird...and I suppose it's only R.Core, not R.View.
BrianH:
4-Mar-2009
Of course. The HP Journada 820 only had 16 MB of RAM, shared with 
storage. Not enough memory for View. It wouldn't matter anyway - 
the screens and interaction models of palm-size touch-screen computers 
are incompatible with the interaction and layout model of R2's View.
kib2:
5-Mar-2009
I've updated the page and the cheatsheet: http://kib2.free.fr/REBOL/papers/cheatsheet.html
. You'll also find the original ods file.
Henrik:
5-Mar-2009
kib2, you could also color code them, for example by native and mezzanine.
Henrik:
5-Mar-2009
since you have created the sheet manually (if I'm correct), I would 
create a block with the words in the sheet in the order as shown 
on the sheet and then do something like:

foreach word words [
	print [word type? get word]
]
kib2:
5-Mar-2009
hum... I've made some rules in my OO calc sheet to set some styles 
(ie color a line on two), and if I had native/mezzanines it will 
break all.
I've to find an issue.: maybe add a column for that.
Henrik:
5-Mar-2009
it's probably a good idea to keep separate sheets for R2 and R3, 
since some functions have moved from mezzanine to native and vice 
versa in R3.
Geomol:
5-Mar-2009
I'm wondering, if it's important for a newbie to the language to 
distinguish between natives, actions and functions. Wouldn't it just 
confure more?
Geomol:
5-Mar-2009
The effect isn't attached to a style. You have style definitions, 
and then effect.
Geomol:
5-Mar-2009
Put extra p and node at the bottom of your momlayout.
Geomol:
7-Mar-2009
And note, that things like = is also an operator.

>> if 3 = 1 + 2 [print 'ok]
** Script Error: Expected one of: logic! - not: integer!
>> if 1 + 2 = 3 [print 'ok]
ok
Geomol:
7-Mar-2009
And operators can also be prefix, which looks kinda weird:

>> + 4 5
== 9
>> random + 4 5
== 2
kib2:
7-Mar-2009
Geomol: sorry for the delay, it was lunch time for me.

It's the first langage where i see no operator priority (maybe with 
Lisp, but it's because of its notation).

Thanks, and that may explain why I wasn't able to draw something 
correctly in a GUI app.
BrianH:
7-Mar-2009
Having only a single level of operator precedence was done to make 
it faster to program in REBOL. It makes it easier to remember the 
precedence rules when reading or writing REBOL, something that anyone 
with experience in most programming languages can tell you is tricky 
at times. Having fewer language rules to remember makes the language 
less distracting from the programming process. Though it is also 
faster to run, as it makes DO simpler (and even moreso in R3).
PatrickP61:
10-Mar-2009
ahhh, so you temporarily capture the source of PRINT into P
then clear a block called OUT
then change the print to append results to it,
then LIST-DIR will invoke the PRINT command to the new function
and reset PRINT back to original defintion.
PatrickP61:
10-Mar-2009
tried it out, but no luck, R3 is giving Script error: list-dir does 
not allow set-word! for it's 'path argument

I think I have to dig into the LIST-DIR a little more to see how 
it works

I had hoped there would be an easier way to take the results of a 
PRINT and be able to load it into a block instead of putting to the 
console.
PatrickP61:
10-Mar-2009
Thank Steeve and Dockimbel, I think I can play with it a little more
PatrickP61:
12-Mar-2009
I'm playing around with FORM-DATE.R from the rebol.org site and I'm 
having trouble with a couple of commands

I am trying to define a new date-code of lowercase h to return the 
hour in regular time, not military time such that 13-24 would be 
1-12.

ie	#"h"	[PICK	[ time/hour  ( time/hour - 12 ) ]  time/hour > 12 ]		<-- 
pick the value of time/hour to be between 1-12
but when I try an example such as:

am: does [form-date 2009-01-02/03:04:05 "%y%m%d %h:%M%P"]	<-- I get 
 "090102 time/hour - 12:04AM"    hours is realy 03

pm: does [form-date 2009-11-12/13:14:15 "%y%m%d %h:%M%P"]	<-- I get 
"091112 time/hour:14PM"

how do I get r3 to evaluate the time/hour - 12 or the time/hour value 
before it picks the results?
Vladimir:
27-Mar-2009
I guess this is the best place to ask this question:


I wrote many scripts in rebol that helped me a lot but they were 
all just that... small scripts (I think biggest of them all was 40-50 
lines...).

My question is, what would be "Rebol way" of writing more complicated 
applications in rebol ?

Stuff like game or accounting application, something with many parts....

What would be differences from other languages? And why would it 
be better? :)
What about dialects?

Should rebol programmer start with making a specific dialect first?
Vladimir:
27-Mar-2009
ok... :) thats what I ment... 

So should one start from bottom, from basics? Like in in accounting 
"calculate tax for one item" and then make functions for all more 
complicated stuff ? something like that?
Vladimir:
27-Mar-2009
Yes.... for example I used Visual Fox pro a lot... and its great 
for stuff like that... It has Separate concepts like Database, Data 
entry forms, Print reports etc....
Chris:
27-Mar-2009
It's similar I suppose to prototyping with a GUI, designing the front-end 
first and building the application to drive it.  I prefer working 
that way...
Henrik:
27-Mar-2009
Well, I tend to write a lot of small code files and string them together 
with a preprocessor.
Vladimir:
27-Mar-2009
I had an idea.... :) bare with me.... is it possible to start a script 
that would while running, change itself (file on disk), and than 
transfer control to this new version of itself ?
Henrik:
27-Mar-2009
I once built a db protocol using a dialect, which would generate 
the server side code and the client side code. Both sides were dialects 
too. This was wrapped inside another dialect which could build the 
server and multiple client programs by preprocessing and putting 
together multiple other scripts. Works pretty well and it takes about 
5 minutes to add a new command to the protocol and update server 
and client.
Vladimir:
27-Mar-2009
Henrik: What did you mean by generating code?

When I started writing applications that requiered data entry, I 
always first wrote an object that takes text as input (something 
like this: "'Name' c20 'Address' c30 'Town' c30) and displays modal 
dialog with those fields, OK and Cancel buttons, and all the logic 
that is needed...

So all my data entry dialogs looked and worked the same and all that 
usually fit in one screen of code....
Graham:
27-Mar-2009
I created the screens first .. then built the data structures and 
then the supporting code after that.
Henrik:
27-Mar-2009
Vladimir, it's a poor explanation, so don't get a headache. :-) Basically 
REBOL allowed me to create a dialect that would flesh out a database 
protocol in one single 10k script and then use that dialect to separate 
bits and pieces out in a server and client part. That way, I didn't 
have to manually write a server script and a client script in two 
separate parts.
Vladimir:
27-Mar-2009
So what I got from this small discussion (in no particullar order)::
1. Create gui, create data, add supporting code...
2. Create rebol code with rebol...
3. Create a dialect or two (or more :)) specific to the task...

4. Create small code files and put them together using preprocessor...
5. Figure out a "reasonable" way to do it :)
Vladimir:
27-Mar-2009
Its working :) I guess this is cool.... Made a function in a separate 
file that calculates sum. But with a press on a button, I rewrote 
part of that  file with function that multiplies two numbers instead 
of adding... And from that point on its multiply that you get...
It has a lot of potential but have to find good use for it.... :)
Thanks guys, Im of to sleep, its been a long day.....
Graham:
27-Mar-2009
What I have found working with asynchronous functions that return 
data from database calls ... one should create some type of gui at 
the start of the call, and then replace that in the callback.
PatrickP61:
7-Apr-2009
Does anyone know of a way to have a rebol script continue to execute 
even after it recieves an error?


I have a script VERSION-TESTER, that will gather code examples and 
create another script VT-SCRIPT that will test them all out against 
the newest version of R3 alpha.


VT-SCRIPT is extremely simple, capturing all console results into 
an ECHO file, but I need a way to have the script continue even when 
it finds an error.
Any ideas?  See this simple example:

Rebol [script: %VT-Script.r   will verify R3 documented examples]
echo  %VT-Results.txt
print {Results below generated from %VT-Script.r}
print {---------------------------------------TIME examples			}
print {var: now														}
       var: now
print {print var													}
       print var
print {7-Apr-2009/11:53:26-6:00             	<-- same?			}
print {}
print {---------------------------------------WRITE examples		}
print {write %junkme.txt "This is a junk file."						}
       write %junkme.txt "This is a junk file."
print {print read %junkme.txt										}
       print read %junkme.txt
print {This is a junk file.                 	<-- same?			}
print {}
print {write/binary %data compress "this is compressed data"		}
       write/binary %data compress "this is compressed data"
print {print decompress read %data									}
print {this is compressed data              	<-- same?			}
print {}
print {---------------------------------------PROTECT examples		}
print {test: "text"													}
       test: "text"
print {protect test													}
       protect test
print {append test "a"												}

print {** Script error: protected value or series - cannot modify	}
print {** Where: append												}
print {** Near: append test "a"										}
print {}
print {** Note: use WHY? for more about this error					}
print {}
print {----------------------------------------OTHER examples		}
print {unset [var]													}
       unset [var]
print {print var													}
       print var
print {** Script error: var has no value    	<-- same?			}
print {}
print {** Note: use WHY? for more about this error					}
print {}
print {---------------------------------------TEST COMPLETED		}

print {See results stored in %VT-Results.txt file}
echo off
PatrickP61:
7-Apr-2009
Hi Henrik

It is just fine that the console error messages print whatever they 
print, but I want some way of having my script continue depsite the 
error message encountered.

Is there a way to have REBOL invoke a separate independent console 
that it could do its own commands in.  Then, I could simply submit 
one rebol command per session, and capture the results in the ECHO 
file regardless of wheter the command errored out or not.  

Could that work?
Henrik:
7-Apr-2009
'err in that example means you have evaluated a block and the result 
is returned to 'err. you can then test if 'err contains a good result 
or an error like so:

if error? err [
	print "oops"
]
Henrik:
7-Apr-2009
that's the only way. the only way to simply keep going is to wrap 
small bits of code in TRY and that's not good style.
PatrickP61:
7-Apr-2009
x is undefined and has no value
Henrik:
7-Apr-2009
and you may continue after that if err is not an error.
PatrickP61:
7-Apr-2009
Yes, you are correct,  The purpose of THIS script is to test and 
verify the R3 documents and see if the results printed on the website 
is the same as the results you get (for r3alpha)
PatrickP61:
7-Apr-2009
So, I want to capture the error message as it would appear -- even 
though I know it will stop the script.  I just hoped there was a 
way of having R3 print the error message as it normally would, but 
then have R3 continue to run the script instead of stopping it.  


For example, if I knew that R3 was using the HALT command, then I 
could temprarily redefine the HALT command to an empty block and 
R3 should continue to run, but I am just spouting this off the top 
of my head -- I don't know how R3 "stops" the script.
PatrickP61:
7-Apr-2009
oops, wrong cut and paste -- here is the revised results:

Results below generated from %VT-Script.r
unset [x]
print x
** error

print x
** error

See results stored in %VT-Results.txt file
PatrickP61:
7-Apr-2009
If only there was a way to "capture" the specific error message at 
the time of disarm err, and print those results 
Could that be done?
Janko:
16-Apr-2009
if I have rebol object  R2 >>


A: make object [ add: func [ ] [ .... ]   remove: func [ ] [ ....... 
]  parse-rule: [ ..... ] ]
B: make A [ change: func [ ] [ .... ] ]

<< 

and if I make 100 objects like B from A ... does this mean each of 
them has it's own "add remove parse-rules" copy in memory or there 
is just one copy of these functions/blocks that they share it?
Janko:
16-Apr-2009
( It is understandable why is this , block (like parse block or block 
of code) , and also func in rebol body is just "data" and you can 
change it in each instance ) ..
Janko:
16-Apr-2009
sqlab - bravo! your trick works..  


A: make object! [ proto: make object! [ a: does [ print "something" 
a: 2 + 3 + 5 loop 10 [ print "a" ] ] ] ] AS: copy []
loop 100000 [ append AS make A [ ] ]

went to 21MB ram
 
---

I have to see what this means to inheritance and other things
Janko:
16-Apr-2009
http://itmmetelko.com/blog/2009/04/12/playing-with-making-an-actor-like-distributed-system-in-rebol/
 ... I am thinking that I won't change it all and make usage more 
ugly becase right now I don't even know If I will ever need to have 
100000 actors running..  so for now I will continue using object 
and try to make it elegant without worying about this
Janko:
16-Apr-2009
(again , it hot distorted) ... I am thinking that I won't change 
it all and make usage more ugly becase right now I don't even know 
If I will ever need to have 100000 actors running..  so for now I 
will continue using object and try to make it elegant without worying 
about this
24201 / 4860612345...241242[243] 244245...483484485486487