• 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
r4wp158
r3wp1415
total:1573

results window for this page: [start: 1 end: 100]

world-name: r4wp

Group: #Red ... Red language group [web-public]
Andreas:
26-Feb-2012
Indeed, the spec is misleading here. All literals are float64!, float32! 
has no literal form.
Pekr:
7-Mar-2012
is that plain C, or C++? Btw - how does Cyphre wrap AGG, if AGG is 
said to be strict C++? Does he have to write any wrapper in C first? 
(He said he has AGG in a form of DLL for R2)
Kaj:
13-Mar-2012
print [
	"Fibonacci " parameter ": " fibonacci parameter  newline
	"Elapsed time: " subtract-time  now-time none  start  newline
	"Process time: "
		(to-float form-integer process-time) /
		to-float form-integer clocks-per-second  newline
]
Kaj:
27-Mar-2012
to-integer form-float
Kaj:
27-Mar-2012
Note that the string returned by form-float should be freed
Kaj:
27-Mar-2012
to-float form-integer
Kaj:
27-Mar-2012
Since the browser is in the form of a GTK widget, this viewer is 
also a GTK widget
DocKimbel:
5-Jul-2012
No object! nor series! support planned for Red/System, remember that's 
supposed to be just a low-level dialect callable from Red meant for 
system programming. However, as Peter mentioned, it will be possible 
to access Red values and actions (mainly series and I/O actions) 
from Red/System when deeper interfacing with Red is needed.


OOP is just not necessary to Red/System, only code and data encapsulation 
is IMO worth adding in the form of a module system. I'm not a big 
fan of intensive use of OOP, as done in C++ or Java (or I'm probably 
just repelled by class-based OOP). I find prototype-based OOP (REBOL, 
Javascript,...) much more appealing and will support it in Red.
Kaj:
11-Jul-2012
The form-* functions in the C library binding do pretty much that:
DocKimbel:
27-Jul-2012
Pekr: "btw - what is the 0.3.0 branch? I forgot what it was about?"


Initially, it was for completing the Red runtime but, as it was not 
possible for me to achieve that without implementing the Red compiler 
itself (even in an alpha state), it's now dedicated to Red compiler 
first alpha. So I guess that v0.4.0 will mark the completion of Red 
compiler (in the bootstrapped form).
Kaj:
18-Aug-2012
Yes, except that Red/System is designed to fit Red, and Red will 
pass code to Red/System efficiently in loaded block form, instead 
of text form that the C compilers had to parse again
Oldes:
22-Aug-2012
There is no literal form for float32! datatype values, so why not 
use literal form used in C, mostly seen in GL functions like:  glColor3f( 
1.0f, 0.0f, 0.0f ); ?
DocKimbel:
23-Aug-2012
BTW, we can also decide that C-like hex format is more important 
than pair! syntax and find another literal form for pairs, but that 
would push us further away from REBOL (and clones) compatibility.
DocKimbel:
5-Sep-2012
Got my first real Red program working: 
    Red [] print 1
outputs:
    1


It doesn't look like much, but it validates the compiler + runtime 
from end to end, and at this point, it's really cool! FYI, the native 
PRINT here triggers a FORM (action) on the passed argument. No REDUCE 
yet (not implemented).
DocKimbel:
13-Sep-2012
I will push the current Red compiler & runtime code base tomorrow, 
still some more code cleaning to do. It will contain the Red boot 
script with all base definitions (currently actions, ops, a few natives 
and a few char! values) and a compiler front-end (similar to %rsc.r).


Don't expect too much, only MAKE has been fully implemented and FORM 
on integer! values only. PRINT is the only native currently.


This is not the first Red alpha, but it's a working base we can implement 
the alpha on (basically implementing actions and natives).
Kaj:
17-Sep-2012
Yes, I use relative include paths of that form in all my bindings 
and examples
Kaj:
17-Sep-2012
This form of #system-include is probably still handy
DocKimbel:
17-Sep-2012
I'll extend FORM tomorrow so we can print more types.
DocKimbel:
23-Sep-2012
Ah, there's maybe something that you could do: I need to port my 
current Red test script in Quick-Test (QT) form. I can send you the 
script (very very simple) and the expected unit tests format used 
by QT, you would just have to convert it and check if all tests are 
reported as passing in QT...it's not a big task, but you will save 
me some time for advancing on the code. Interested?
BrianH:
17-Oct-2012
Doc, would you consider it sufficient to have a license that doesn't 
require that the license be included with (like MIT code) or distributed 
with (like BSD code) the product? The Apache license only requires 
that the license be given to the recipient - it hoesn't specify how 
- and it doesn't even require a copyright reference be included unless 
the product is distributed in source form. I'm just trying to determine 
the extent that you'll be able to include Apache-licensed code in 
Red, or how much this factor matters to you.
BrianH:
17-Oct-2012
Kaj, clause 4.3: "You must retain, in the Source form of any Derivative 
Works that You distribute, all copyright, patent, trademark, and 
attribution notices from the Source form of the Work, excluding those 
notices that do not pertain to any part of the Derivative Works"


It's the only place in the distribution section where they specifically 
mention Source form rather than Source or Binary, and that's the 
only clause that requires copyright or other notices be retained. 
Except for that weird NOTICE file requirement, of course.
Kaj:
18-Oct-2012

Work" shall mean the work of authorship, whether in Source or Object 
form, made available under the License, as indicated by a copyright 
notice that is included in or attached to the work (an example is 
provided in the Appendix below)."
DocKimbel:
20-Oct-2012
You should take upcoming red|rebin format also into account. That 
might be a preferable method sometimes rather than compressed scripts. 
Red will pre-compile most of the scripts content, but we might keep 
some "code" blocks in source form for reflection (when used by the 
script and inferred by the compiler).
DocKimbel:
23-Oct-2012
Also, the literals series construction is taking much more space 
than it should. The boot.red script is precompiled and stored as 
code in all binaries, we should rather keep it in compressed source 
form or, even better, in redbin format. But currently, precompilation 
is the only option we have.
DocKimbel:
23-Oct-2012
Henrik: networking protocols at mezz level shouldn't take much space. 
In compressed souce form, each should weight only a few KB.
DocKimbel:
23-Oct-2012
For more open platforms, you'll be able to compile your Red apps 
to a binary with externalized runtime library (in form of a shared 
library pre-installed or to install with the app).
DocKimbel:
1-Nov-2012
Gabriele: that was my first intent, but I gave up to avoid having 
to code and maintain a dynamic web page...Also, I would need to set 
up a workflow, so that donators would need to fill a form first before 
accessing the donation options. I wanted to keep it simple, but maybe 
we need that.
Henrik:
5-Nov-2012
It may be time to consider REBOL an idea, a good one and one that 
now needs to have its true wings in the form of Red.
DocKimbel:
7-Nov-2012
Pekr: the difference between AOT and JIT compilation is much thiner 
than you think. Just load Red/System compiler code to your R2 app, 
pass it any source code at runtime, use the link?: no option and 
you get compiled code and related data in form of binary! values...and 
voilą! :-) The rest is same as for Cyphre's JIT, you need a way to 
call native code in memory, something that is hardly possible in 
R2, but maybe Cyphre found a hole to achieve it anyway.
DocKimbel:
10-Nov-2012
Also, Red will add its own features, like specific datatypes, natives, 
actions,... For example, MOLD and FORM both have a /PART refinement.
Jerry:
16-Nov-2012
Doc, Will you publish a Red/System standard function guide, listing 
all the functions, such as: print, print-line, length?, size?, zero?, 
form-type, ...
Arnold:
23-Nov-2012
I read the docs http://www.rebol.com/docs/words/walias.htmland as 
I understand it stampa: :print differs from alias 'print stampa 

because the latter does this in a way where ALL occurences of stampa 
even in different contexts are 'replaced' whereas the first form 
only applies to the current or global context not interfering with 
local usage.
Is that about it?
Kaj:
25-Nov-2012
If you can use the array in that form, you can use that trick, but 
you have to stay within the function because the array is on the 
stack
Pekr:
30-Nov-2012
Doc - I know - what I want is - free form GUI, not necessarily a 
native GUI, which is mostly good for forms like apps imo. Or just 
please show me particles.r 1.6KB demo rewritten to GTK :-)
Pekr:
7-Dec-2012
as for following wish - i: FFFFFFFFh ..... why i: #FFFFFFFF? The 
literal form with "h" - I almost missed the "h" at first sight ...
DocKimbel:
7-Dec-2012
Pekr: your proposition is not as bad as it could be at first look. 
;-) 


REBOL allows to prefix binary values with a base integer, with base 
16 as default::

    #{F0}
    16#{F0}
    2#{1111111100000000}
    64#{8A==}


We could use a similar convention, but as a suffix, for specifying 
the base for an integer! value:

    123
     7B# 	(default base would be 16 too)
     7B#16
     01111011#2
     173#8


Such literal forms with base explicitly specified would be converted 
to integer! decimal form at LOADing stage. This is just me thinking 
loud, but how does that look like to you?
DocKimbel:
8-Dec-2012
In REBOL, 'a and 'A are aliases of the same symbol. Red/System converts 
them to their integer identifier, right?


Symbols have two representations in Red compiler, one is at runtime 
(like in REBOL), the other is a compile-time, in the form of Red/System 
variables. In a very early version of the compiler, I was using integers 
(indexes in symbol table) instead of variables, but quickly realizef 
that it was obfuscating the generated Red/System code a lot, making 
it difficult to debug. Also, the integer approach had an additional 
runtime cost at it required to make an array access in order to retrieve 
the symbol value.


Currently, the Red/System ~<name> variables directly point to a word! 
value version, instead of a symbol! for simplicity and efficiency.
DocKimbel:
8-Dec-2012
0%... prefix will clash with percent! datatype literal form.
DocKimbel:
10-Dec-2012
What about to convert all the words into lowercase in compile time?


Words values are not "compilable", they are data (words used as variables 
can be "compiled" to some extents). Converting all words into lowercase 
during compilation (including JIT-compilation for words constructed 
at runtime) would make you loose the ability to distinguish lower/upper-cased 
letters, leading to big issues and pitfalls in the language. For 
example: (form 'A) = "a" (beause 'A would get converted to 'a). Not 
an option.
DocKimbel:
15-Dec-2012
Red 0.3.1 released: http://www.red-lang.org/2012/12/red-v031-functions-support-added.html

- function support
- path get/set notation support
- refinement support for native functions
- expressions in parentheses compilation

- new datatypes: function!, paren!, path!, lit-path!, get-path!, 
set-path!

- new actions and natives: find, select, copy, reflect, type?, halt,...

- extended mold, form and comparison operators to all new and existing 
datatypes
- many new mezzanines functions

- modulo and remainder operators on floats implemented for ARM backend
- Quick-Test testing framework ported to Red
- a truckload of new unit tests
- many bugfixes
- about 200 new commits to the Github repository
- updated Red/System formal description document
DocKimbel:
22-Dec-2012
That's cool, it's something like rebcode.

It has a broader range of usage and it's faster than rebcode.


How about something like having a block of Red/System code inside 
Red code?

System [...some R/S code...]


This is already implemented since a while in form of a Red compiler 
directive: #system [...]
Gerard:
26-Dec-2012
@Doc : I never thought you would do so much work in a so short time. 
If my support can help you a bit to go further and leave behind - 
with the help of the other donators - the bad feeling of having to 
work elsewhere to  get money for your living, then it's a pleasure 
for me to do it as much as I can.  Keep up the good work Doc and 
have a happy new Year form Quebec, Canada.
Group: Announce ... Announcements only - use Ann-reply to chat [web-public]
Arnold:
2-Aug-2012
I have put my example script for CGI forms with validation and refilling 
previously filled fields online on the rebol.org site. http://www.rebol.org/view-script.r?script=cgi-form-val-example.r
Maybe somebody with more (CGI security) expertise can look at it 
and comment on safety issues please.
Oldes:
16-Nov-2012
I've uploaded new script:

https://github.com/Oldes/rs/blob/master/projects-rswf/pack-assets/latest/pack-assets.r
which I'm using with this one:

https://github.com/Oldes/rs/blob/master/projects-rswf/form-timeline/latest/form-timeline.r

to pack assets (bitmaps and animations) for prototype of Adobe AIR 
framework I'm working on which can be seen here:

https://github.com/Oldes/Starling-timeline-example(as a Flashdevelop 
project)
Oldes:
16-Nov-2012
ech.. f..ing altme links..
I've uploaded new script:

https://github.com/Oldes/rs/blob/master/projects-rswf/pack-assets/latest/pack-assets.r

which I'm using with this one:

https://github.com/Oldes/rs/blob/master/projects-rswf/form-timeline/latest/form-timeline.r


to pack assets (bitmaps and animations) for prototype of Adobe AIR 
framework I'm working on which can be seen here:

https://github.com/Oldes/Starling-timeline-example(as a Flashdevelop 
project)
Group: Ann-Reply ... Reply to Announce group [web-public]
Pekr:
25-Sep-2012
Andreas - even if you link libraries dynamically? Well, maybe so, 
because that's why LGPL exists? You can use the code in the form 
of dynamically loadable library, but not statically?
BrianH:
26-Sep-2012
It is common to use this FAQ entry as a way to make GPL extensions 
that wrap proprietary components: http://www.gnu.org/licenses/gpl-faq.html#WindowsRuntimeAndGPL


Developers commonly put links on their web site to the vendor's web 
site to download the DLL. However, it's iffy with GPL2 because the 
actual exception is worded like this:

However, as a special exception, the source code distributed need 
not include anything that is normally distributed (in either source 
or binary form) with the major components (compiler, kernel, and 
so on) of the operating system on which the executable runs, unless 
that component itself accompanies the executable.


Read literally, it would exclude runtime libraries that aren't bundled 
with the OS. It's more unambiguously OK with GPL3.
BrianH:
27-Sep-2012
Andreas, there is apparently a difference between code/data that 
is considered to be part of the interpreter and code/data that is 
considered to be part of the runtime library, according to this FAQ: 
http://www.gnu.org/licenses/gpl-faq.html#IfInterpreterIsGPL

Ladislav is stating that being statically linked makes it part of 
the interpreter, though there are counter-examples of statically 
linked runtime libraries in other programming languages that legally 
infect the code they run. It is considered bad form though, so you 
don't see it often. It's an ambiguous situation, so a statement resolving 
the ambiguity would be helpful here.
Group: Rebol School ... REBOL School [web-public]
james_nak:
26-Apr-2012
Christopher Gill's form-date.r is something I can't live without.
http://www.rebol.org/view-script.r?script=form-date.r
Endo:
26-Apr-2012
I use my own functions, returns always in ISO format, YYYY-MM-DD 
HH:NN:SS


padz: func ["Pad to right with zero." s n [integer!] /left /with 
c [char! string!]] [

    head insert/dup either left [tail form s] [form s] first form either 
    with [c] [#"0"] n - length? form s
]

format-date: func [d [date!]] [

 ajoin [d/date/year "-" padz d/date/month 2 "-" padz d/date/day 2 
 either d/time [ajoin [" " padz d/time/hour 2 ":" padz d/time/minute 
 2 ":" padz to-integer d/time/second 2]] [""]]
]
GrahamC:
27-Apr-2012
eg.  next form 100 + now/day

will give you 2 digits, and those less than 10 will have a leading 
zero
GrahamC:
14-May-2012
You need to seed the random generator first eg. with the datestamp 
or something, and then generate your random number.  But a better 
way is to create a UUID if you want something guaranteed to be unique.

The library has code for windows http://www.rebol.org/view-script.r?script=guid.r

Just using random, something like this should work

random/seed form now/precise


send [person-:-example-:-com] rejoin [ "Thank you. Your number is " random/secure 
1000000  "." ]
GrahamC:
15-May-2012
BTW, looks like the 'form is not needed above
JohnM:
15-May-2012
Thank you all for addressing my concerns and for your answers about 
my first coding question.


Ahh.. rejoin. Reading up on it makes me better understand how some 
things are to be done in Rebol.

 Continuing to the final goal...


I have to extract an email address from a GET transfer. The methoed 
of sending the info to me is completely out of my control. An email 
address will be entered into a form on a website not controled by 
me. GET methoed will send the data to my script. The people who created 
the form on the external site advised that they label the email address 
as "trnEmailAddress".


 So now I want to see if I am correct in thinking how to extract and 
 use the email address. Will using the decode a cgi form command (I 
 know they are not commands in the tradiational sense)  work. How 
 does it work, does it create variables out of the GET (or Post when 
 using Post, but I am forced to recieve the info via GET) stream?


The GET stream in my case will include "&trnEmailAddress=person%40example%2Ecom. 
So can I do this?

decode-cgi system/options/cgi/query-string

send trnEmailAddress "Thank you. Rest of message." 

Thanks for your help.
JohnM:
16-May-2012
Sunanda: Thanks again for issuing the World invitation. Everyone 
thanks for the continuing help.


I have read the cited document, but it just leaves me with more questions.

Is the following literal?

cgi-string: read-cgi
cgi-block: decode-cgi cgi-string
cgi-obj: make object! cgi-block 


 That is to say should I type exactly that? Or is cgi-string for example 
 a theoretical variable assignment that I could call anything? Are 
 they all proper commands, or is any part of that just for example 
 purposes?  I am thinking I should copy and paste it verbatium. I 
 am also thinking I mispelt verbatum.


 I am stuck with GET. Does this mean I can leave out some code that 
 makes up for  not knowing if the original data is POST vs GET? These 
 are hypothetical questions for better long term learning. I for now 
 will go with the idea that everything is as straight fowarrd as it 
 seems. I know that my GET stream will have "trnEmailAddress" in it 
 which is a field that will contains an email address.


 So will the following  generate a random number, extract the address 
 and email the same random number to that email address?

token: random/seed now/percise

cgi-string: read-cgi
cgi-block: decode-cgi cgi-string
cgi-obj: make object! cgi-block 


send trnEmailAddress rejoin [ "Thank you. Your number is" token "." 
]


 Graham: Thank you for the extra info on GUID, but Windows is not 
 involved here. I realize that random number generating really isn't 
 unless you have a monkey throwing darts at a numbered board. Regardless 
 extra effort to 
make a number unique is useful and your advice appreciated. 


 I do not think the corner cases will come up and the people who control 
 the original form assured me that web page issues warnings if the 
 form is not filled out correct which should help. I do realize that 
 people are idiots, systems are not fool proof, etc. What I am saying 
 is my basic needs are basic and I should be OK so I am not fretting 
 over those examples. It is great though to know the solutions are 
 out there when I need them.

 Tahnks.
Sunanda:
16-May-2012
If the CGI string was yadda.com

which is what a lot of indexing bots will use, then the cgi-obj will 
look like this:
    make object! [
 ]

Hence you do need to do some data sanitisation, no matter how much 
the form people assure you the data will be right.
Endo:
17-May-2012
Here is an example:

cgi-obj: construct decode-cgi read-cgi

;check the input
all [
	in cgi-obj 'email
	trnEmailAddress: to-email trim form cgi-obj/email
	not empty? trnEmailAddress
] [
	;evrything seems ok

 send trnEmailAddress reform ["Thank you. Your number is" token "."]
	quit
]
print "Error!"
JohnM:
20-May-2012
Graham: Thanks. That makes sense out of something someone else told 
me. I thought the information was contradicting what you guys said 
earlier, it just means I misunderstood the order of things. The modiffer 
after the slash is closer to making a new command than it is an agrument 
than I had envisioned. The fact that random is part of both made 
me think they could be done together. Thank you for catching that 
I did not know that detail.


 Next part of myscrip enters something into a database. The server 
 will have an mySQL database installed. It is possible that alternative 
 could be used, but knowing for sure I have at no extra charge this 
 options means I am starting with this option.


 So I found a MySQL Driver for REBOL from here: http://softinnov.org/rebol/mysql.shtml


 I am following the instructions that came with the download. Is there 
 anything I should know. Maybe it is not the driver people use because 
 there are better ones. Maybe the author kills kittens on the weekend 
 and it is consider bad form to use it. Maybe it is harder than it 
 looks. Basically, please just tell me if there is general info about 
 it I should know that is not obvious. Thanks.


Hey, someone else is asking questions? i thought this was all about 
me! :-) :-)
Arnold:
20-May-2012
MOLD is definitely more vague, could become anyshape the form of 
the mold is. An ENQUOTE saves the time finding out what it does.
DocKimbel:
23-Jul-2012
This function should help you:

form-error: func [err [object!]][
	foreach w [arg1 arg2 arg3][
		set w either unset? get/any in err w [none][
			get/any in err w
		]
	]
	reform [
		"***" system/error/(err/type)/type #":"
		reduce system/error/(err/type)/(err/id) newline
		"*** Where:" mold/flat get in err 'where newline
		"*** Near: " mold/flat get in err 'near newline
	]
]
Gabriele:
24-Jul-2012
this is my version: http://www.rebol.it/power-mezz/mezz/form-error.html

note that it does not make arg1, arg2 and arg3 global.
Arnold:
31-Jul-2012
And now for something completely different. I have a php based form 
I want to make into a REBOL cgi program. It is to upload some fields 
into an article-base in my mysql database. Where action is article.php 
in the php version I changed this to article.r for the REBOL version. 
I have now the article form shown and when I fill in some fields 
(but not all) and send the form I get the cgi object ( I use safe-cgi-data-read) 
but the contents of the formfields is now empty? Any clues what may 
be the case please?
SWhite:
31-Jul-2012
I believe that if you do not fill in a field on the form, you do 
not get an item in the cgi objectl.  I seem to recall being confused 
by that for a while.
Arnold:
31-Jul-2012
Well, I tested again and I was mistaken in thinking php did show 
the field I previously had filled in when returning after submit 
and noticing some field was empty. It is the way the browser refills 
the field when it recognises what you have typed in before.. In the 
php version all fields of the form are empty as well.

So no problem with how REBOL works. (I can display all of the cgi 
block and everything I typed in is there.)
Arnold:
31-Jul-2012
The second thing is the validation I have in mind is in fact a client 
side Javascript/jQuery script before sending the form.
Sunanda:
31-Jul-2012
Client-side validation is a nice courtesy touch for the user -- they 
get told of errors without a network delay. But the server-side code 
needs to also do full validation as there is no way of guaranteeing 
the data has been POSTed from your form....Or perhaps the user had 
Javascript turned off.
Arnold:
31-Jul-2012
Sunanda, absolutely. I went way too fast on this. 

Unfortunately there is no way to refill the form fields from the 
cgi data. Now I say so the DOM and a Javascript maybe able to. I 
tried some little things but it seems to mess things up more than 
doing good.
Sunanda:
31-Jul-2012
If you want the server-sideCGI to send updated values to the client-side 
JS for that JS to update the web form.....You may need to look at 
AJAX -- a way for JS to do just that.
Arnold:
1-Aug-2012
On the form validation issue. I managed to get things working as 
I initially intented. Using a Javascript function to change the text 
of the field: 
var changer = document.getElementById('fieldid');
changer.value = fieldvalue;
Where fieldvalue was filled from the cgi data block cgi/fieldname

It was really fun to get this right with all the needed double-quotes 
and curly braces that alle represent comments in rebol as you know 
and generate this from within the well-known function emit: func 
[code] [ repend html code]
I had to add an id tag to all the form fields.
Arnold:
1-Aug-2012
If there is an interest in the basic script with a form with the 
field testing and refilling of field in the case some errors were 
found wrt the input. I make a translated anonimised version showing 
the working.
Steeve:
3-Oct-2012
I think I included all your modifications Ladislav but shortly :-)

rfunc: [spec body /local args][
	args: to-block form first (

  do second func spec compose [bind? (to-lit-word first find spec word!)]
	)
	funct spec compose/deep [
		recur: func spec [
				throw/name reduce [(args)] 'recur
		]
		forever [
		   set [(args)] catch/name [
			  return do [(body)]
		   ] 'recur
		]
	]
]
Steeve:
3-Oct-2012
Should do the trick:

rfunc: [spec body /local args][
	args: to-block form first do second 
		func spec compose [bind? (to-lit-word first find spec word!)]
	funct spec compose/deep [

  recur: quote (func spec compose/deep [throw/name reduce [(args)] 
  'recur])
		forever [
		   set [(args)] catch/name [return do [(body)]] 'recur
		]
	]
]
Steeve:
3-Oct-2012
Notice the weird sequence
>> to-block form first object!

That is because the local context returned from a function is not 
well formed.

If the specs of the function are [a [block!] /local b], it will return 
a strange objetc! where:
>> first object!
== [a /local b]
So to correct its format, I do 
>> to-block form first object
== [a local b]
Steeve:
4-Oct-2012
Last version.

- Any spec accepted but needs at least one parameter (can be just 
a local)

rfunc: func [
    [catch]
    spec [block!] body [block!] /local arg obj recur
][
    throw-on-error [

        if error? try [arg: to-lit-word first find spec any-word!][
            make error! "rfunc needs at least one parameter."
        ]
        recur: func spec compose [throw/name bind? (:arg) 'recur]
        obj: catch/name [do second :recur] 'recur
        funct spec compose/deep [
            recur: quote (:recur)
            forever [

                set/any [(to-block form first obj)] second catch/name [
                    return do [(body)]
                ] 'recur
            ]
        ]
    ]
]
Steeve:
4-Oct-2012
Completly changed my mind. It's lot leasier to manage /recur as a 
refinement! 
- eg. safe/recur instead of recur

- no words collision anymore (obviously /recur can't be used as a 
parameter).
Also really short code 

rfunc: func [[catch] spec [block!] body [block!] /local ctx fun][
    spec: append copy spec /recur

    ctx: bind? first second fun: throw-on-error [func spec [recur]]
    change second :fun compose/deep [
        if (in ctx 'recur) [throw/name second (ctx) 'recur]
        while [true][

            set/any [(bind to-block form first ctx ctx)] catch/name [
                return do [(bind/copy body ctx)]
            ] 'recur
        ]
    ]
    :fun
]
Steeve:
5-Oct-2012
;Go back to recur as a function.
;Still recur can't be used as a parameter, local or a refinement.

;This implementation is much more clean (no shitty compose/deep) 
and still very short.

;The collision of words is avoided by the use of singleton functions 
#[function!]
;I'm confident with this one. It could be the last one -_-;


rfunc: func [[catch] spec [block!] body [block!] /local ctx args][
    ctx: bind? first second throw-on-error [
        ;* Temporary function created to retrieve parameters
        ;* and to get a new context for 'recur.
        ;* The context will remain alive (not GC'ed).
        func append copy spec /recur [recur]
    ]
    args: bind to-block form first ctx ctx
    ctx/recur: func spec reduce [

        quote #[function! ['word] [throw/name second bind? word 'recur]] 

        first args ;* may be 'recur if empty specs (still, it's ok)
    ]
    func spec reduce [
        quote #[function! [args body][

            while [true][set/any args catch/name [return do body] 'recur]
        ]] 
        head remove back tail args ;* remove 'recur
        bind/copy body ctx         ;* bound 'recur
    ]
]
Steeve:
5-Oct-2012
;Go back to recur as a function.
;Still recur can't be used as a parameter, local or a refinement.

;This implementation is much more clean (no shitty compose/deep) 
and still very short.

;The collision of words is avoided by the use of singleton functions 
#[function!]
;I'm confident with this one. It could be the last one -_-;


rfunc: func [[catch] spec [block!] body [block!] /local ctx args][
    ctx: bind? first second throw-on-error [
        ;* Temporary function created to retrieve parameters
        ;* and to get a new context for 'recur.
        ;* The context will remain alive (not GC'ed).
        func append copy spec /recur [recur]
    ]
    args: bind to-block form first ctx ctx
    ctx/recur: func spec reduce [

        quote #[function! ['word] [throw/name second bind? word 'recur]] 

        first args ;* may be 'recur if empty specs (still, it's ok)
    ]
    func spec reduce [
        quote #[function! [args body][

            while [true][set/any args catch/name [return do body] 'recur]
        ]] 
        head remove back tail args ;* remove 'recur
        bind/copy body ctx         ;* bound 'recur
    ]
]
Ladislav:
5-Oct-2012
rfunc: func [[catch] spec [block!] body [block!] /local ctx fun][
    spec: append copy spec /recur

    ctx: bind? first second fun: throw-on-error [func spec [recur]]
    change second :fun compose/deep [
        if (in ctx 'recur) [throw' second (ctx)]
        while [true][
            set/any [(bind to-block form first ctx ctx)] catch' [
                return do [(bind/copy body ctx)]
            ]
        ]
    ]
    :fun
]
Steeve:
5-Oct-2012
; Sorry Ladislav I've stolen your idea one should avoid catch/throw 
interferences

; As an extra (also your idea ?), f/recur and recur are now both 
allowed.

rfunc: func [[catch] spec [block!] body [block!] /local ctx fun][
    ctx: bind? take second fun: throw-on-error [
        func append copy spec /recur reduce ['recur body]
    ]
    insert second :fun reduce [

        quote #[function! [[throw] ctx args 'fun body /local ret][

            if :ctx/recur [ctx/recur: ctx throw/name second ctx 'recur]
            ctx/recur: :fun
            while [true][
                set/any 'ret catch/name [return do body] 'recur

                unless all [value? 'ret block? :ret same? ctx last ret][
                    throw/name get/any 'ret 'recur
                ]
                set/any args ret
            ]
        ]]

        ctx (bind head remove back tail to-block form first ctx ctx) :fun
    ]
    :fun
]
Steeve:
5-Oct-2012
; Ladislav I can't see if you posted new code (WTF Altme)

; So I've tried your idea one should avoid catch/throw interferences

; As an extra (also your idea ?), f/recur and recur are now both 
allowed.

rfunc: func [[catch] spec [block!] body [block!] /local ctx fun][
    ctx: bind? take second fun: throw-on-error [
        func append copy spec /recur reduce ['recur body]
    ]
    insert second :fun reduce [

        quote #[function! [[throw] ctx args 'fun body /local ret][

            if :ctx/recur [ctx/recur: ctx throw/name second ctx 'recur]
            ctx/recur: :fun
            while [true][
                set/any 'ret catch/name [return do body] 'recur

                unless all [value? 'ret block? :ret same? ctx last ret][
                    throw/name get/any 'ret 'recur
                ]
                set/any args ret
            ]
        ]]

        ctx (bind head remove back tail to-block form first ctx ctx) :fun
    ]
    :fun
]
Steeve:
5-Oct-2012
; Ladislav I can't see if you posted new code (WTF Altme)

; So I've tried your idea one should avoid catch/throw interferences

; As an extra (also your idea ?), f/recur and recur are now both 
allowed.

rfunc: func [[catch] spec [block!] body [block!] /local ctx fun][
    ctx: bind? take second fun: throw-on-error [
        func append copy spec /recur reduce ['recur body]
    ]
    insert second :fun reduce [

        quote #[function! [[throw] ctx args 'fun body /local ret][

            if :ctx/recur [ctx/recur: ctx throw/name second ctx 'recur]
            ctx/recur: :fun
            while [true][
                set/any 'ret catch/name [return do body] 'recur

                unless all [value? 'ret block? :ret same? ctx last ret][
                    throw/name get/any 'ret 'recur
                ]
                set/any args ret
            ]
        ]]

        ctx (bind head remove back tail to-block form first ctx ctx) :fun
    ]
    :fun
]
Steeve:
5-Oct-2012
This time it's really really my final version T_T
- Both f/recur and recur allowed
- Catch/throw interferences ok.

NB: The code would be simpler in R3 since several workarounds are 
used to correct misbehaviors of object related natives of R2.

Also the lack of the reflexive capability for a function to read 
its own context in a easy way is definitivly a huge miss.

(On can't create anonymous functions without analysing their specs 
first. What a pain)

One would need a reserved word holding the context (like SELF for 
objects).

These shortcomings are making the code too much obfuscated and huge 
for my taste.
I hope it will be corrected in R3..

rfunc: func [
    [catch] spec [block!] body [block!] 
    /local ctx args call-tail
][
    ctx: bind? first second throw-on-error [
        func spec: append copy spec /recur [recur]
    ]
    args: bind head remove back tail to-block form first ctx ctx
    call-tail: func ['word] compose/deep [
        set/any [(args)] second bind? word 
        throw/name (ctx) 'recur
    ]
    ctx/recur: func spec reduce [:call-tail 'recur]
    func spec reduce [
        quote #[function! [
            [throw] 'recur 'call-tail ctx args body /local ret
        ][
            if get/any recur [call-tail :recur]
            set recur get in ctx 'recur
            while [true][
                set/any 'ret catch/name [return do body] 'recur
                unless all [value? 'ret same? :ret ctx][
                    throw/name get/any 'ret 'recur
                ]
                set/any args second ctx
            ]
        ]]
        'recur :call-tail ctx args body
    ]
]
Group: Databases ... group to discuss various database issues and drivers [web-public]
ChristianE:
5-Sep-2012
I've just updated the R3 ODBC Extension to work with more SQL types 
and, with the support of BrianH, fixed and improved the boot code 
OPEN and COPY actors.


The extension is available over at Github in both source form as 
well as a DLL compiled for windows, see https://github.com/gurzgri/r3-odbc
Arnold:
10-Nov-2012
select * from table where answer = useranswer
select * form table1, table2 where table1.field = table2.field

Do you have google? Any MySQL tutorial out there holds the answer 
to your question.

Or want to compare from wihin your REBOL script? It is either [ left 
= right][do-something][do-else-thing].
afsanehsamim:
11-Nov-2012
#! "C:/wamp/bin/apache/Apache2.2.11/cgi-bin/rebol-core-278-3-1.exe" 
-cs
REBOL [Title: "Table"]
do %mysql-protocol.r 
db: open mysql://[root-:-localhost]/test
insert db { DROP TABLE IF EXISTS data1;
create table data1 (
    oneone        varchar(1),
    onetwo        varchar(1),  
    onethree      varchar(1),       
    twoone        varchar(1),
    twothree      varchar(1),
    threeone      varchar(1),
    threetwo      varchar(1),
    threethree    varchar(1)
  )} 

print "content-type: text/html^/"
print [<HTML><BODY>]
print [<form><input type="submit" value=" submit !" />]
print [<TABLE  bgcolor="black" border="1">]
print {<tr bgcolor="white">

<td style="width:30px; height:30px;"><input name="oneone" type="text" 
size="1">}
insert db ["insert into data1 (oneone) values (?)" ]
results: copy db
print {</td>}
afsanehsamim:
11-Nov-2012
my form should get value from <input name="oneone" type="text">....
afsanehsamim:
11-Nov-2012
when i write like this :print [<form><input type="submit" value=" 
submit !" />]
print [<TABLE  bgcolor="black" border="1">]
print {<tr bgcolor="white">

<td style="width:30px; height:30px;"><input name="oneone" type="text" 
size="1">}
insert db ["insert into data1(oneone) values(c)"]
results: copy db
print {</td>}
Pekr:
11-Nov-2012
you want to save value from the form into the db?
afsanehsamim:
11-Nov-2012
i  want to save value from the form into the database!
Pekr:
11-Nov-2012
I think, that your script is wrongly constructed! What you seem to 
do is to just print a form, which then gets delivered to user's browser 
screen. But at that time, there is no value yet. You should study, 
how to do CGI in REBOL. You need a separate html form, then you need 
to read CGI values and store them in a DB ...
afsanehsamim:
11-Nov-2012
but in those links ,i can not find database example! i read that 
link before ,i created html form and cgi as well, it is working properly 
... the point is when user enter input and click submit it goes to 
cgi page. i need save that input in database ...plz guid me or show 
me one example how can i save value from the form into db?
Pekr:
11-Nov-2012
there are two things - 1) you have to write a form, basically a html 
file, with fields, etc., and submit button, linking it to your cgi 
script 2) you have to write a CGI script, being able to read submitted 
values ...
afsanehsamim:
11-Nov-2012
Any one knows how can we save value from the form into database?
afsanehsamim:
11-Nov-2012
i did not say do my code Arnold !!! i wanted only help ... because 
till now whatever guys said  here was not related to form ! my problem 
is only saving value  from form in database ...
Ladislav:
11-Nov-2012
Any one knows how can we save value from the form into database?
 - sure, Pekr told you how to do it.


Your problem is that you do not do what Pekr told you to do. First, 
you need to create the form. Check: Do you really have the form?

Second, you need to create a CGI script (this is not the form from 
the first point, the form from the first point is not a CGI script). 
Check: do you really have a CGI script ?


Pekr told you that the example you posted was neither the form, nor 
the CGI script.
Ladislav:
11-Nov-2012
One more note: your problem is much more elementary than handling 
the database. Before writing data to the database you need to have 
a script accepting (decoding) the data obtained from the form.
Pekr:
12-Nov-2012
Create 2 files. Call the first one e.g. cgi-test.html, and upload 
it to your server. The only thing you have to change is the link 
to your .cgi script in there:

<HTML>
<TITLE>Simple Web Form</TITLE>
<BODY>
<b>Simple Web Form</b><p>
<FORM ACTION="http://www.xidys.com/cgi-bin/cgi-test.cgi">
<INPUT TYPE="TEXT" NAME="Field" SIZE="25"><BR>
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Submit">
</FORM>
</BODY>
</HTML>



Create a second file, called cgi-test.cgi (it has to align to how 
you name it in the above source file). Upload it to your cgi working 
directory. Remember to change the first line to contain the path, 
where your REBOL executable is placed:

#!/usr/local/bin/rebcmd -sqc

REBOL []

print join "Content-type: text/plain" newline
start: now/time/precise

submitted: decode-cgi read-cgi
values: construct submitted

prin "Submitted: " print mold submitted
prin "values: " print mold values
prin "values/field: " print mold values/field

print now/time/precise - start
print newline
 

Now go to your URL, and try to submit some values. You can test it 
on my site at: http://www.xidys.com/cgi-test.html
afsanehsamim:
16-Nov-2012
Endo  values should get from form ,it is a big problem till now that 
no one could underestand ...
TomBon:
16-Nov-2012
afsa, did you succesfull echo back the decoded form values to the 
browser andreas told you before?
Group: !Syllable ... Syllable free operating system family [web-public]
AdrianS:
22-Sep-2012
packed manually - the archive form is OVA, but workstation only produces 
the files
1 / 1573[1] 2345...1213141516