• 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: 32101 end: 32200]

world-name: r3wp

Group: Rebol School ... Rebol School [web-public]
Steeve:
10-Mar-2009
just overide print functions during a short time
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.
Dockimbel:
10-Mar-2009
You can also use this script : http://www.rebol.org/view-script.r?script=capture.r

do http://www.rebol.org/download-a-script.r?script-name=capture.r
capture on
list-dir
capture off
probe get-captured
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
Dockimbel, I'll give it a try
PatrickP61:
10-Mar-2009
Thank Steeve and Dockimbel, I think I can play with it a little more
Dockimbel:
10-Mar-2009
If you use LIST-DIR in a script, you should provide the directory 
argument or enclose it with brackets like : do [list-dir]
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?
PatrickP61:
12-Mar-2009
I see a small error in my conditions, it should read  time/hour < 
12 instead of > 12
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?
Chris:
27-Mar-2009
'Dialect' is a good term for what a dialect is, but 'Domain Specific 
Language' is perhaps a better indicator of the problems dialects 
solve.
Sunanda:
27-Mar-2009
A dialect is a good way of structuring a user interface.

I think your question is more related to the underlying structure 
of the code that implements the whole application -- not just the 
dialect.. Does that sound about right?
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.
Henrik:
27-Mar-2009
I don't think there is a particularly REBOLish way to write large 
programs. You just figure out a reasonable way to do it.
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
I'll need a minute to understand what you wrote :)
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.
Henrik:
27-Mar-2009
when you know enough REBOL, you can flip a problem in any angle to 
your advantage. here it was advantageous to keep two separate parts 
strictly in sync.
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.....
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
How does ERROR work?  What does the kernal actually do when it encounters 
an error?

I see that errors condition can be trapped with commands such as 
TRY, DISARM, ATTEMPT, but is there a way I can capture the printed 
results of an error without the error causing my script to stop running?
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
sorry, I thought you had a result to test.
PatrickP61:
7-Apr-2009
I've been reading up a little on generating errors at http://rebol.com/r3/docs/concepts/errors-generating.html
one line in particular captured my attention:


The error message generated for my-error can be printed without stopping 
the script:

disarmed: disarm err
print bind (get disarmed/id) (in disarmed 'id)
this doesn't go into that using my-function

-- Not sure if this has any legs for me?
Henrik:
7-Apr-2009
if you want to generally test the entire script, the only way is 
to wrap it in a TRY or the elements you run in a TRY. REBOL will 
stop evaluating a block if it encounters an error in it.
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"
]
PatrickP61:
7-Apr-2009
trying to understand -- :-/  (still a newbie!!!)
PatrickP61:
7-Apr-2009
OK, lets take a simple example that I know errors out
UNSET [x]
print x
PatrickP61:
7-Apr-2009
so how would I change the PRINT X in such a way to capture an error 
withotu stopping the script?
PatrickP61:
7-Apr-2009
giving it a try!
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
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?
sqlab:
8-Apr-2009
Wrap your tests in a block, then you can do at least in R2
until [ 
	either error? set/any 'err try [
		t:  do/next tests
	] [
		print disarm err
		tests: next tests
	] [
		tests: second t
	]
	empty? tests
]
 
Unfortunately it does not work with R3. .(

There you have to wrap every statement in a block  inside the main 
block.
Then you can do them one  by one.
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?
sqlab:
16-Apr-2009
You can use this method, if you don't want to get copies

 A: make object! [ add: func [ ] [ .... ]     sub: make object! [parse-rule: 
 [ ..... ] ]]
then the elements in the subobject are just references.
Janko:
16-Apr-2009
I was away... I tested on these 3 cases... started new rebol each 
time, it took 13MB of ram at start


A: make object! [ a: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 
b: [ 123 1231 13 123 12313 1

2312 3123 123123 12 231 21 312 12 123 31231231 2312 312 1231 2123 
123 12 3123 12 312 312 312 312 31 23 123 123 12 312 31 23 123 12 
312 312 3 123 12 312 31 23

123 12 312 3 123 12 31 3 123 13 12  123 123 12 3 123 1231 23 123 
123 12 312 3 123 12 312 3 123 12 312 3 123 12 31 23 123 12 31 23 
123 1 23 123 12 31 2 23 12 3
1 3 12 312 3 123 12 3 ] ] AS: copy []
loop 100000 [ append AS make A [ ] ]

went to 250MB RAM
-- 



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

went to 50MB of ram
--

A: make object! [ a: "" ] AS: copy []
loop 100000 [ append AS make A [ ] ]

went to 25MB of ram
--
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
I also tried this but it works the same as if I define block in object 

A-a: [ print "something" a: 2 + 3 + 5 loop 10 [ print "a" ] ]
A: make object! [ a: does A-a ] AS: copy []
loop 100000 [ append AS make A [ ] ]
Janko:
16-Apr-2009
sqlab: hm.. but do you know for a way that subobject could access 
parent's objects data?
sqlab:
16-Apr-2009
You have to give the parent object as a parameter to the functions 
in the sub objects, then you can acces the elements as 
pobj/name
Janko:
16-Apr-2009
so they can be used like this... this is how it currently worked 
(without static)  ... 

cat-boss: make actor [ 
	act-match: [

   [ still-seeking ] [ print "cat boss: our cat agent is still seeking!!" 
   ]
			[ found-fish ] [ print "cat boss: yeey, we found a fish!!" ]
	]
]


... anyway, thanks for your help so far a lot! I need to start my 
brain, it seems it doesn't work very well today
TomBon:
16-Apr-2009
hi janko,

have you seen the erlang concept of concurrent distributed programming? 
http://erlang.org/doc/getting_started/part_frame.html
perhaps you can find there some additional ideas.
A robust and complete p2p component in rebol would be fantastic.
sqlab:
16-Apr-2009
Do I understand that you want to send actors a message and they should 
act upon the elements of an objects of the sending process?
Janko:
16-Apr-2009
no no,... upthere I was trying to make actors lighter... each actor 
is a object now , and each carries around code in it's methods so 
it's not as lightweight as it could be.. but this is more of a theoretical 
probem for now.. as I said I am more interested in them for distributted 
programming so I maybe won't be spawning and having 100 000 actors 
around like in erlang for ecample
sqlab:
16-Apr-2009
I am not sure if this can help, but you can get objects with references 
instead of copies, when you modify them after creation.
maybe like this
>> template: make object! [
[     a: 1
[     b: 3
[     c:  "times"
[    ]
>>
>> obj1: make template [
[     a: 2
[     b: 4
[     c: none
[     f: does [print [ a c b "gives" a * b] ]
[    ]
>>
>> obj1/c: template/c
== "times"
>>
>> obj1/f
2 times 4 gives 8

here c is just a reference, not a copy
>>
Janko:
16-Apr-2009
sqlab .. you are a real object magician :) ... not sure either if 
this can help me right now but good to know for this
Anton:
20-Apr-2009
On 19-Feb-2009 in this group I said that Tiny C Compiler (TCC) had 
problems. Well, I tried again using the latest version from git repository 
and successfully created a shared object library which can be accessed 
by Rebol. So, Vladimir's tunel.r code, which I ported to C, can now 
be compiled using TCC (as well as GCC). This is good because TCC 
is much smaller (and faster) than GCC and can hopefully be integrated 
in nice, small cross-platform packages.
Pekr:
20-Apr-2009
I wonder what would be the option? REBOL would found out there is 
a "rebcode" in it, it would be a C code, and then your app would 
have to compile and link it in order for being able to execute it? 
Could there be a precompiled (or compile at first run) option? Because 
if not, then it would be slow, no?
Anton:
20-Apr-2009
Well, the TCC binary here is 129ko. I don't think Carl will be adding 
it to the Rebol executable, anyway.

The trick, I think, is to have a simple set of instructions to install 
TCC ready to use with Rebol.
Anton:
20-Apr-2009
After that, I suppose it could grow into a plugin.
BrianH:
20-Apr-2009
The plugin model should be compatible with a wide variety of licenses, 
so there may be better candidates for this kind of thing. Most of 
the other languages in REBOL's class are working on LLVM, CIL and 
JVM backends, but those are all pretty large. Perhaps libjit now 
that it is LGPL - that would be a plugin-compatible license, I expect.
Janko:
20-Apr-2009
BrianH, yes interesting question... ocaml is closing in to c if you 
want FP, Java speed-wise also but has a bigger ram usage and startup 
times I guess. but it's also hard to say "what is the high level" 
that we want. Is it Java like, is it dynamic langs, is it FP
Anton:
21-Apr-2009
(I didn't figure out how to bundle TCC standalone yet.. just a few 
experiments, so that's why you need to install TCC to the system.)
Steeve:
21-Apr-2009
Hmm, Anton, i can't figure where is your source of draw-tunnel.c
Can you give a direct link, please ?
Anton:
21-Apr-2009
If you tried DO-THRU above, then it should be the most recent file 
in your public cache.
But anyway, here is a direct link.
http://anton.wildit.net.au/rebol/os/nix/draw-tunnel/draw-tunnel.c
Vladimir:
25-Apr-2009
1. What method would you recomend for printing invoices ?

    I promised my sister, I will make small aplication for invoices till 
    the end of this week :)

    I guess best way would be making HTML or PDF file and then leting 
    systm deal with actual printing ?

    Or making a face looking just like the needed document (like print 
    preview) and then printing that picture ?

2. Is there a way to scale face ? like zoom in and out ?
Dockimbel:
25-Apr-2009
This driver is best suited for direct printing, i.e., when you don't 
need to generate a document. Invoices are document that need to be 
saved and transmitted, so I would recommend generating PDF files 
in such case.
Dockimbel:
25-Apr-2009
Yes, a subset of Draw dialect
Dockimbel:
25-Apr-2009
The PDF example in the archive is generated by using a free virtual 
PDF printer like Bullzip's one (http://www.bullzip.com).
Henrik:
25-Apr-2009
Do you think it would be possible to translate a VID layout to your 
dialect? I have a method for that for direct postscript generation 
using Geomol's postscript dialect. This could be useful for a unified 
printing system, as I'm building a printing front end for my own 
apps.
Dockimbel:
25-Apr-2009
Btw, it's not a Windows only driver, it works equally well on all 
OS using the CUPS printing system (like Linux, OS X, ...)
Dockimbel:
25-Apr-2009
As I said, "my dialect" is a Draw subset, so if you can convert View 
faces to Draw dialect, you could print VID windows.
Dockimbel:
25-Apr-2009
Why converting VID to postscript? Is converting a View window to 
image for printing not enough? Do you have some special needs or 
requirements?
PatrickP61:
28-Apr-2009
I need a little help to figure something out.

I have been using R3 for some time and I have a small mystery I can't 
figure out.

Some time ago, I created a script called REBOL.r3a which simply invoked 
the r3-curr.exe file (which is currently a copy of the r3-a49.exe 
that was just released).
This script was simply defined a path for the T variable:
t:	does [do %test.r]

my purpose was to simply type the letter T to invoke the test.r script 
as a quick way of running it while I had the test.r script open in 
an editor on a separate window.
Steeve:
28-Apr-2009
eh i don't have it, maybe it's a virus
PatrickP61:
28-Apr-2009
I am speculating that the author intended this as a quick way of 
testing a script, just as I happened to write the exact same code 
in my script.
Janko:
12-Jun-2009
...
I don't get this example:
    >> words: [a b c]
    >> fun: func [a b c][print bind words 'a]
    >> fun 1 2 3
    1 2 3

You give it just 'a to bind but is seems to bind b and c too??
PatrickP61:
15-Jul-2009
Asking for help on a formatting problem


I have the following block that cotains some rebol code which I wish 
to print  on the console and then execute the code:
>> code-blk: [print "ok"]          
== [print "ok"]              <-- assigned a code block just fine
>> do code-blk
== ok                            <-- looks good so far 
>> print code-blk

== ok                           <-- Nope that isn't what I was looking 
for, but I understand why since it is like print the results of print 
"ok"
>> print form code-blk

== print ok                  <-- getting closer to what I desire, 
but the quotes are missing
>> print mold form code-blk

== "print ok"               <-- not what I desired   -- I want the 
original code block to be printed as   print "ok" with the quotes

Any ideas on how to fix this?
PatrickP61:
15-Jul-2009
>> source code-blk

code-blk: [print "ok"]        <-- My goal is to just get     print 
"ok"    


Another way to pose the question is    How can I convert the entire 
contents of a block, including spaces, into a string?
Graham:
15-Jul-2009
have a look at source source
ChristianE:
15-Jul-2009
MOLD/ONLY, ha! As always, there's a refinement you don't think of 
...
BrianH:
15-Jul-2009
As always, there's a refinement you don't think of
 - that's the best thing to remember about REBOL :)
Sunanda:
5-Aug-2009
Several people have written such a function. Here's one of them:
http://www.rebol.org/ml-display-message.r?m=rmlQGBC
Ashley:
6-Aug-2009
Here's a QAD I use:

>> i: 1
== 1
>> join skip "0000" length? form i i
== "0001"
Gregg:
7-Aug-2009
Doesn't measure that much faster here, and you have to add the FORM 
call as well. Still nice. :-)


If performance is important, you can do two things: 1) cache NOW, 
2) cache the whole result once a day.
Maxim:
7-Aug-2009
wow a bug with experience  :-)
CharlesW:
20-Oct-2009
I am trying to retrieve email from a godaddy account. Their server 
however uses a username with the @ sign. I am not sure but I think 
this is messing up the pop protocol. 

The error I receive is:

connecting to: companyname.com
** Access Error: Cannot connect to companyname.com
** Where: open-proto



Notice that my pop statment has two @ signs in it but is needed to 
login to goDaddy's multi-tenent pop server.


foreach message read pop://[user-:-companyname-:-com]:[password-:-pop-:-secureserver-:-net] 
[
    print message
]

Any Suggestions?
Henrik:
20-Oct-2009
I think there is a fix for that, but I can't remember what it is.
Graham:
1-Jan-2010
Andreas helped me today to debug the vanilla issue that was causing 
a server error for most pages ...
Graham:
1-Jan-2010
Basically the data about the user Graham was set to a zero byte file 
when my site was hacked .. and vanilla looks at the user file when 
it displays a snip authored  by that user.  It was unable to load 
this data causing an error, and since I authored many of the snips, 
it caused most of the site to go down.
PatrickP61:
7-Mar-2010
Question:  I'd like to define a function that essentially prints 
out a stored message like this:
PatrickP61:
7-Mar-2010
debug: func [a] [print a]
PatrickP61:
7-Mar-2010
but I want it to print only when debug? is on.  Since debug? is outside 
of the function, how can I define it so that it checks this value 
before printing a
PatrickP61:
7-Mar-2010
debug: funct [a] [if debug? print a]
Steeve:
7-Mar-2010
debug: funct [a] [if debug? [print a]]
PatrickP61:
7-Mar-2010
Hi Steeve, it doesnt work.  If debug? is on or off, it still prints 
a
PatrickP61:
7-Mar-2010
oops I made a mistake
PatrickP61:
7-Mar-2010
Sorry steve,  You were right, I did a typo on my test.  Thank you
BrianH:
7-Mar-2010
And you don't need funct here because there are no locals (though 
it's a cool function) :)
Steeve:
7-Mar-2010
funct "Defines a function with all set-words as locals"
PatrickP61:
7-Mar-2010
to clarify, locals is all variables that is local to the main script, 
 outside of the function.  Is that a good way to describe it?
BrianH:
7-Mar-2010
Look at the source of FUNCT, it's a good lesson on function creation 
tricks. And compare the R2 and R3 versions.
BrianH:
7-Mar-2010
The source in DevBase has some comments that help explain things 
a bit, so you might start there.
Steeve:
7-Mar-2010
Houston, you've got a problem
PatrickP61:
7-Mar-2010
Only $10 -- you got it.  maybe I can buy you a round or two if we 
ever get at a DevCon!!!
PatrickP61:
7-Mar-2010
What is the best way to determine the number of seconds that has 
occurred between two timestamps?

I want to determine that offset, then apply it to another timestamp 
and then get a new timestamp.  
ex:
ts-bgn:		01-jan-2001/01:01:01
ts-end:		02-mar-2004/05:06:07
ts-offset:	ts-end - ts-bgn

I am hoping to get the difference in the number of days, and the 
number of hours, minutes, seconds. but I only get the number of days 
1156

Is it possible to get a fraction of a day that is accurate enough 
to the second?

ts-offset:	to-decimal (ts-end - ts-bgn)		This gives 1156.0 which 
is not right.  Any ideas?
32101 / 6460812345...320321[322] 323324...643644645646647