• 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: 701 end: 800]

world-name: r4wp

Group: Rebol School ... REBOL School [web-public]
Henrik:
29-Jun-2012
But remember that the panel block as described with [across space 
0x0 label "_" ... etc. is only a description. Adding something to 
that block will not affect your current layout. The LAYOUT function 
parses the block into a tree of objects (faces), which then can be 
displayed with VIEW.
Henrik:
29-Jun-2012
you can make it a bit smoother than that by wrapping the whole thing 
in a panel and assigning a new face tree to that panel every time. 
Then you won't need to close and reopen the window.
Arnold:
29-Jun-2012
Within a panel sure would be smoother. Some larger layouts would 
require resizing as well. 

The example did what was to be expected. And I learned how to return 
to the running REBOL script after escaping in the terminal window!
Henrik:
29-Jun-2012
it's a great way to interactively test and workout techniques for 
updating layouts.
Arnold:
30-Jun-2012
If I could switch it from a text to a label it would be nice. As 
yet I have this puzzling experience:
REBOL []
high-on: high-on-odd: false
swap-even: func [/local n] [

    either high-on [for n 2 8 2 [ panel-rechts/pane/:n/font/color: 'white] 
    high-on: false

    ][              for n 1 7 2 [ panel-rechts/pane/:n/font/color: 'black] 
    high-on: true ]
    show panel-rechts]

swap-odd: func [/local n] [

    either high-on-odd [for n 1 7 2 [panel-rechts/pane/:n/font/color: 
    'white

                                     panel-rechts/pane/:n/style: 'lbl-h-la-white] high-on-odd: false
    ][for n 1 7 2 [panel-rechts/pane/:n/font/color: 'black

                   panel-rechts/pane/:n/style: 'lbl-h-la-normal] high-on-odd: true]
    show panel-rechts]

spiegel-styles: stylize [
    lbl-h-la-normal: text left middle 40x100
    lbl-h-la-white: label left middle 40x100]
    
view layout [styles spiegel-styles
	across
	panel-rechts: panel [below space 0x0

    lbl-h-la-white "_" lbl-h-la-white "_" lbl-h-la-normal "_" lbl-h-la-normal 
    "_"

    lbl-h-la-normal "_" lbl-h-la-normal "_" lbl-h-la-normal "_" lbl-h-la-normal 
    "_"]
    return
    button "Even" [swap-even] button "Odd" [swap-odd]
    button "Debug" [print dump-face panel-rechts
    print panel-rechts/pane/1/font/color
    print panel-rechts/pane/1/color
    print panel-rechts/pane/1/style]
]

Where the first two labels change when button Odd is clicked. and 
then stay unchanged and the debug button shows the changes as expected 
(by me)
Henrik:
30-Jun-2012
You can't simply switch the style by putting a new word in the STYLE 
facet. Each style is a prototype object with very different code 
to manage its internals. Generating a style using layout therefore 
involves getting a face from the style library, performing a set 
of operations on it for correct size and offset and run its initialization 
procedure. Only then is it inserted at the right localtion in the 
pane of the parent panel.
Henrik:
30-Jun-2012
You can study different styles using GET-STYLE.

For example:

probe get-style 'field


It's a bit misleading, though, as many styles share the same code. 
To really see how styles are built, you need to read the sourcecode 
for VID.
Arnold:
30-Jun-2012
When I name the labels lr1 thru lr8 and use the trick I found on 
www.pat665.free.fr/gtk/rebol-view.html which is w: to-word rejoin 
["lr" n] (for n is 1, 2, 3 or    8 you get the picture.) and f: get 
:w 

f/font/color: white and directly show the label: show f I can set 
them seperately. But it is a bit ugly to do it like this if I may 
say so.
Sujoy:
3-Jul-2012
Hi! Have a quick question:
Sujoy:
3-Jul-2012
Hi! Have a quick question:
Sujoy:
3-Jul-2012
i have a block of objects:
each object is constructed like...
  c: #object! [
    name: "wonderwoman"
    attribs: [
      Y1991: #object! [ a: 1 n: 2]
      Y1992: #object! [ a: 1 n: 2]
    ]
  ]

i need to sort the series based on fields of the attribs inner object
i dont want to create a new series...any ideas?
Maxim:
3-Jul-2012
use the /compare refinement of sort (which can be a function).
Maxim:
3-Jul-2012
>> help sort
USAGE:

    SORT series /case /skip size /compare comparator /part length /all 
    /reverse


DESCRIPTION:
     Sorts a series.
     SORT is an action value.

ARGUMENTS:
     series -- (Type: series port)

REFINEMENTS:
     /case -- Case sensitive sort.
     /skip -- Treat the series as records of fixed size.
         size -- Size of each record. (Type: integer)
     /compare -- Comparator offset, block or function.
         comparator -- (Type: integer block function)
     /part -- Sort only part of a series.
         length -- Length of series to sort. (Type: integer)
     /all -- Compare all fields
     /reverse -- Reverse sort order
Sujoy:
3-Jul-2012
this works great for fields in a simple object series:
sort-object-series: func [
  series
  field
] [

  sort/compare series func[a b][lesser? get in a field get in b field]
]
Maxim:
3-Jul-2012
sf: func [a b][   a/attribs/Y1991/n > b/attribs/Y1991/n  ]
Sujoy:
3-Jul-2012
can i introduce an additional complexity?
what if i need to sort a hash?
m: #hash! [key-a obj-a key-b obj-b]
Sujoy:
3-Jul-2012
h: #hash! [k-a object! [
    name: "wonderwoman"
    attribs: make hash! ["1993-1994" #object! [
            rebal-year: 1993
            m: 160.018245
        ] "1992-1993" #object! [
            rebal-year: 1992
            m: 104.293
        ] "1991-1992" #object! [
            rebal-year: 1991
            m: 26.628
        ]]
...and so on...
Maxim:
3-Jul-2012
>> sort/skip/compare/all [1 [2  "a"] 0 [4 "z"] 5 [4 "m"]] 2 func 
[a b][a/2/2 < b/2/2 ]
== [1 [2 "a"] 5 [4 "m"] 0 [4 "z"]]
Maxim:
3-Jul-2012
a, m, z are sorted.
Maxim:
3-Jul-2012
yes, you just need to adapt the paths you lookup.  the sort func 
gets a pair of blocks which are the whole records, which is why I 
start with a /2 to get the second field, which is the block ... in 
your case, that would be the object
Maxim:
3-Jul-2012
the mod has been so heavily modified, its almost a complete rewrite. 
 its also heavily embeded within our production environement (libs 
and stuff) so that making it a stand-alone mod again will take some 
time... some time which currently, I don't have.  though note that 
we didin't actually add json support but greatly increased the flexibility 
of the i/o format conversion.
Sujoy:
3-Jul-2012
sounds great...since i'm a noob, not sure i can help, but will gladly 
pitch in
Maxim:
3-Jul-2012
we neededed to support, xml rest, SOAP and direct get/post interface 
to the same functions, and that is now working via a configuration, 
which allows you to tweak how the url is read and switch interfaces 
on the fly.
Maxim:
3-Jul-2012
like I said , right now I can't rip it out easily because a lot of 
the code is shared with the code it serves (which is not part of 
the open source package).   It wasn't built with the task of making 
it independent... but it can be done.  It just takes time, which 
I currently don't have.
Sujoy:
3-Jul-2012
sorry maxim - not having any luck with the sort function

>> sf: func [a b][o: select a/attribs "1991-1992" m: select b/attribs 
"1991-1992" o/m > m/m ]
>> sort/skip/compare/all comps 2 :sf
** Script Error: Invalid path value: attribs
** Near: o: select a/attribs "1991-1992"
Sujoy:
3-Jul-2012
this is the structure i'm using:
h: #hash! [k-a object! [
    name: "wonderwoman"
    attribs: make hash! ["1993-1994" #object! [
            rebal-year: 1993
            m: 160.018245
        ] "1992-1993" #object! [
            rebal-year: 1992
            m: 104.293
        ] "1991-1992" #object! [
            rebal-year: 1991
            m: 26.628
        ] ] k-b object! [
    name: "wonderwoman"
    attribs: make hash! ["1993-1994" #object! [
            rebal-year: 1993
            m: 160.018245
        ] "1992-1993" #object! [
            rebal-year: 1992
            m: 104.293
        ] "1991-1992" #object! [
            rebal-year: 1991
            m: 26.628
        ] ]
Sujoy:
3-Jul-2012
yes - its actually a string
Sujoy:
3-Jul-2012
ah - so i should do:

>> sf: func [a b c d] [ o: select b/attribs "1991-1992" m: select 
d/attribs "1991-1992" o/m > m/m]
??
Arnold:
3-Jul-2012
Back to the drawing board Sujoy and displaying the elements you want 
to use in your function piece by piece and maybe dump-obj is of any 
use?
(Now you don't use a and c)
Sujoy:
3-Jul-2012
the sort/compare works great if its an object...am stuck because 
its a hash
Henrik:
3-Jul-2012
The structure is a little strange. Are you trying to sort the outer 
hash or the inner hash?
Sujoy:
3-Jul-2012
both actually - need the outer hash sorted based on a property of 
the object inside the inner hash
Sujoy:
3-Jul-2012
i need to sort the hash based on a param (mcap) for an input year 
(say "1991-1992")
Sujoy:
3-Jul-2012
apologies again - extracted this fragment from a gzillion mb file 
- there should be     
  ]]]]
at the end
Sujoy:
3-Jul-2012
yes...
>> sort/skip/compare/all comps 2 func [a b][a > b ]
..sorts in reverse order
Sujoy:
3-Jul-2012
if i do:

>> sort/skip/compare/all comps 2 func [a b][length? a/mcapz > length? 
b/mcapz ]
i get an invalid path error
Henrik:
3-Jul-2012
you can do a REVERSE H before and after the sorting. That allows 
SORT to grab the objects.
Sujoy:
3-Jul-2012
>> reverse comps sort/skip/compare/all comps 2 func [a b][length? 
a/mcapz  > length? b/mcapz ]
** Script Error: Invalid path value: mcapz
** Near: length? a/mcapz > length? b/mcapz
Henrik:
3-Jul-2012
Try:


func [a b][probe type? a probe type? b length? a/mcapz  > length? 
b/mcapz ]
Sujoy:
3-Jul-2012
reverse comps sort/skip/compare/all comps 2  func [a b][probe type? 
a probe type? b length? a/mcapz  > length? b/mcapz ]

block!
block!
** Script Error: Invalid path value: mcapz
** Near: length? a/mcapz > length? b/mcapz
Maxim:
3-Jul-2012
my last example above with ?? added shows this clearly:


>>  sort/skip/compare/all [1 [2  "a"] 0 [4 "z"] 5 [4 "m"]] 2 func 
[a b][ ?? a  ?? b   a/2/2 < b/2/2 ]
a: [0 [4 "z"]]
b: [5 [4 "m"]]
a: [1 [2 "a"]]
b: [0 [4 "z"]]
a: [5 [4 "m"]]
b: [1 [2 "a"]]
== [1 [2 "a"] 5 [4 "m"] 0 [4 "z"]]


what is part of the record is completely irrelevant to sort, it transfers 
all control to your function.
Maxim:
3-Jul-2012
the only really problem with a compare func is that you must be sure 
that your data can be compared (which is not true for all types.

ex:  true/false  is not defined for all comparison ops:
>>   true > false
** Script Error: Cannot use greater? on logic! value
** Near: true > false
Sujoy:
3-Jul-2012
am getting somewhere (i think)
>> sort/skip/compare/all comps 2 func [a b][o: a/2/mcapz probe o]
=== make hash! ["2003-2004" make object! [
        yyyymmdd: 30-Sep-2003
        rebal-year: 2003
        ...]]
etc
Sujoy:
3-Jul-2012
so it is a referencing problem
Sujoy:
3-Jul-2012
looks like i will have to collect the objects/inner-hash-objects 
into a separate collection, then apply the sorting on the new collection
Maxim:
3-Jul-2012
you can simply say that when an entry doesn't have a year, it is 
always larger,  so you have them at the end of the list.  you could 
then sort those without a date according to their name.


if you want just the list for "1991-1992" yes, that is a good approach... 


however usually, the fastest way to filter-out lists, is to copy 
the block (not deep, so its quick) and then use remove-each on the 
new block... like-so:

filtered-data: copy data

remove-each [hash mcapz] filtered-data [ not select mcapz "1991-1992"]
Sujoy:
3-Jul-2012
s is a sorted series, p is a decimal from 0.0 to 1.0
Arnold:
4-Jul-2012
Those radio buttons are a real pain in the ... . Somebody please 
rewrite those and make a radiogroup that makes sense?
ChristianE:
4-Jul-2012
view layout [
    radio-line of 'a "Check this out"
    radio-line of 'a "or this"
    pad 8
    radio-line of 'b "Or Check this out"
    radio-line of 'b "or this"
    radio-line of 'b "or that"
]
Arnold:
4-Jul-2012
Well it was quite a problem to get the selected value. I ended up 
first initialising all /data fields to their respective values beforehand 
to true for the one on and false for the two unselected ones. After 
that the fields behaved like you would expect, being true in case 
the selection was on this button and false if not selected.
Radio-line is new to me.
Arnold:
4-Jul-2012
Something like this cost me only a couple of hours trial and err 
(mostly err) for there was no proper example to copy and it didn't 
work out of the box without the initialisations. 
main: layout [
a: radio on 'things lbl-a: "A"
b: radio of 'things lbl-b: "B"
etc]
a/data: true
b/data: false
view main
Maxim:
4-Jul-2012
by default all radio buttons in the same pane switch together, you 
can just wrap your radio buttons in a panel.
Arnold:
4-Jul-2012
In my previous example b/data had a value none in stead of false 
and I could have two radioselections selected at the same time.
Maxim:
4-Jul-2012
yeah, well, all I can say is that whenever view or more specifically 
VID is frustrating, you should just mold the face which is aggravating 
you, save the code to a file and read it in your favorite syntax 
highlighted editor.


you will learn A LOT about how VID.view works and learn quite a few 
Reboling techniques too.
Maxim:
4-Jul-2012
(Carl wrote VID, so its a good example of his Rebol coding)
Maxim:
4-Jul-2012
here is a simple way to get the code for a face within the layout 
function ( I found it the easiest to remember):

view layout [
	across
	text "1"
	my-radio: radio on 
	do [probe my-radio]
	text "2"
	radio
]


the advantage of this system is that you get the actual face with 
any facets setup as they really are in your gui.  this is often the 
easiest way to identify just where and how a specific facet affects 
a face... probe it without your change, and then run it again, with 
your change... comparing both probes in a diff or merge tool.
Maxim:
4-Jul-2012
the other way is to use get-style.   the advantage here is that is 
preserves the init block, instead of clearing it after VID has done 
its work


a good look at the 'init block is often useful to understand why 
changing some of the face values is ineffective (like changing face/color 
is often useles... since that face is setup to use face/colors). 
 

this block is run after all the facets have been applied. 

note that you can set or append to this block in your own styles.
Arnold:
4-Jul-2012
I have view.txt in my rebol/script folder a copy from system/view, 
it is 80000 lines mostly object definitions and images. quite different 
from the ancient one http://www.rebol.com/view/vid.rthat at least 
makes some sense to me ;-)
Arnold:
5-Jul-2012
getter/setter is a nice theoretical concept, nice for OO purposes. 
Radio buttons of a group should function like this: always 1 selected, 
the default to begin with, each option should have a value that is 
copied to the radiogroup's /data field, so to know what was selected 
can be found just like that. Not more not less.
rg: radiogroup rg1
radio on 'rg1  "Text 1" "A" 
radio     'rg1 "Text 2" "B"
and in your program 
switch rg1/data [
A
 [do this]
B
 [do that]]
Henrik:
5-Jul-2012
Arnold, take a look at the VID Extension Kit. It attempts to make 
VID more complete, although it's no longer directly compatible with 
VID.
Henrik:
5-Jul-2012
One thing to note about VID: It was a demo toolkit that Carl wrote 
about 10 years ago in a couple of weeks. He expected someone to come 
up with something better.
Arnold:
5-Jul-2012
It is hard to beat in its simplicity. But also hard to improve in 
its current state. More a modular way would have been nicer. So it 
would have been clear where to start if you want to improve (or first 
find out) the behaviour of radio buttons for example.
Arnold:
7-Jul-2012
Hi Chris! Thank you. I consulted this site also. But there is better 
news to this! In stead of the words on and of you have to use the 
words true and false and the problems are solved! Didn't even have 
to initialize the /data fields between creating the layout and calling 
it in action with view.

Not documented but stil possible. (Like it is also undocumented on 
the REBOL site that you can have a checkbox followed by an action 
block.And this is also possible on text-labels making them clickable 
and have an mouse-over effect.)
Arnold:
11-Jul-2012
Today I experimented with calling a REBOL script from my php script. 
Thanks to previous contributions of a.o. Ralph Roberts of abooks.com 
from 1999(!) and an entry on the PHP site I found out how to do this 
on my apache driven site.

It was not quite as straightforward as Robert said like: include 
("rebolnow.r");
Nor was it as simple as: system("rebolnow.r 2>&1", $myout);
echo $myout;

But it worked when I called out for the REBOL program first. Both 
two of the next examples worked for me:
system("/path/to/cgi-bin/rebol -c %rebolnow.r 2>&1", $myout);
echo $myout;
AND secondly
echo system("/path/to/cgi-bin/rebol -c %rebolnow.r");
Work!

The REBOL script must be in the same dir as your PHP script (Not 
in your cgi-bin directory)(I didn't test sub dirs and other dirs 
but I suppose they work like usual)
The script does not need the #!/path/to/rebol line at the top.
The script should not print http-headers and

When printing stuff the last line should read print "" because the 
last printed line will be repeated.

Hope this helps more people to switch from php scripting to REBOL 
scripting for their websites.
Arnold:
12-Jul-2012
This says it is for binary data like images. In the first lines of 
this post http://www.mail-archive.com/[list-:-rebol-:-com]/msg01452.html 
it is mentioned as bringing not the solution to this wish. I passed 
this by, I'll stil have a second look, things in php could have 'suffered' 
improvements..
Arnold:
12-Jul-2012
I'm not in a hurry?! :)
Arnold:
12-Jul-2012
With the 'large' programs I have in mind there will never be lots 
of garbage to collect. I don't know much/anything about robitics 
and control engineering by the way, I am interested in this because 
I realized using REBOL to do things like this could have large potential. 
And I want to move a little car with a photocamera and taking photo's 
from centain positions. The car may also be guided by a rail of some 
sort.
Arnold:
12-Jul-2012
Domotica could also be a nice DSL.
Arnold:
13-Jul-2012
I meant system. exec didn't work. I still prefer system above passthru. 
I have integrated my first REBOL module within my website. I needed 
to add a cookie section to obey the new cookie law anyway. I even 
used a REBOL script to generate all cookie pictures to the same size 
and png format.
Endo:
23-Jul-2012
Great! Thanks a lot Doc.
Arnold:
26-Jul-2012
I am busy with a little chess program. Just the board and the pieces 
to be moved on the board. (I have seen the examples on rebol.org). 
It is meant to be for a chess learning/training program and possibly 
demonstration/game review and maybe have a coupling with an open 
source chess engine like Stockfish.. I am going to write a little 
script to determine all possible legal moves.  

 I want some information for what is an appropriate way to represent 
 the board and moves in REBOL, for example the 8-bit white/black init-position 
 king queen rook bisschop kNight pawn and board could be a1-h8 or 
 an array of 64 elements or a block (of blocks)
Suggestions welcome please. Tia.
Arnold:
26-Jul-2012
Yes I tried all variations [merge oval key 127] [merge key 0.0.0 
oval] etc. I got a hole in the middle at some points but never the 
other way around like the comment mentions :(
Arnold:
26-Jul-2012
The chess program I want to make give the moves of a piece like on 
the shredder site http://www.shredderchess.com/daily-chess-puzzle.html
and it will have a minimal validation routine so my kids (and me 
too) can beat the machine.
Sunanda:
30-Jul-2012
Anyone want to have a try at this little puzzle? I have a working 
solution, but I am sure there is way more REBOLish way.


I have two objects that each contain simple REBOL values (ie imagine 
they've just been created from some serialised data, so no recursive 
blocks or anything tricky):
    obj1: make object! [aaa: 1 bbb: "xx"]
    obj2: make object! [bbb: "XX" aaa: 1]


All I want to do is confirm that they contain identical words and 
values under normal REBOL comparison rules -- so obj1 and obj2 should 
be treated as identical, while the next few are not identical to 
obj1 or obj2:
    obj3: make object! [bbb: "xx"]    ;; no 'aaa word
    obj4: make object! [bbb: "XX" aaa: 1 ccc: 3]  ;; extra word

    obj5: make object! [bbb: "XX" aaa: -1]  ;; different 'aaa word value


I am sure there is a simple one-line 'parse solution .... Isn't there 
always!? Thanks!
Maxim:
30-Jul-2012
if you really want a one-liner  ;-)



all [  obj2: make obj1 obj2     (words-of   obj1) =  (words-of   
obj2)    (values-of  obj1) = ( values-of  (make obj1 obj2))  ]
Maxim:
30-Jul-2012
the only way the above can fail is if a word in obj1 is set to none 
and that word is missing in obj2
Arnold:
30-Jul-2012
Two little questions. I have a block like [ 0 0 0 0 ]. When first 
'declared' should I use a: [ 0 0 0 0 ] or a: copy [ 0 0 0 0 ]? (I 
know I should use copy when c: copy a). Second question when to use 
b: make block [ 0 0 0 0 ] in stead of just b: [ 0 0 0 0 ]??
Kaj:
30-Jul-2012
Depends on how you intend to use it. If you declare a series without 
COPY or MAKE, it references the data in what you usually think of 
as your source code
Kaj:
30-Jul-2012
This is one of the standard REBOL pitfalls. You can think of such 
data as a constant. If you change it anyway, you're changing the 
representation of your program code
Kaj:
30-Jul-2012
So if you're not going to use the data as constant, use COPY or MAKE. 
For a block with scalar values in it, it doesn't make much difference
Endo:
30-Jul-2012
Sunanda: I wrote this function a few months ago for the same task: 
It may not a very good solution but its ok (I think)

similar?: func [
    {Returns true if both object has same words in same types.}
    o [object!] p [object!] /local test
][

    test: [if not equal? type? get in o word type? get in p word [return 
    false]]
    foreach word sort first o test
    foreach word sort first p test
    true
]
Endo:
30-Jul-2012
It compares words and types, not values.
>> o: context [a: 1 b: "x"]
>> p: context [b: "x" a: 1]
>> s: context [b: "o" a: 1]
>> similar? o p
== true
>> similar? o c
== true
Maxim:
30-Jul-2012
sunanda, actually, I just realized that if I switched the order in 
the all, I can fix the issue :-)

and you are right, I should generate a temp object...  but if you 
put the above in a function it would be like so:

equivalent?: func [ o1  o2 ][

 all [   (words-of   o1) =  (words-of   o2)    o2: make o1 o2     
 (values-of  o1) = ( values-of  (make o1 o2))  ] 	
]
Sunanda:
30-Jul-2012
Endo -- thanks....That's a  useful starting point for a function 
that is capable of listing what the differences are.


Steeve -- 'difference on third was my first design ....But it fails 
on (say)
   obj1: make object! [a: 1 b: 2]
   obj2: make object! [a: 2 b: 1]

Maxim .... Nice!
Maxim:
30-Jul-2012
note that my function what specifically designed to detect mis-aligned 
words... so this is by design:

>> equivalent? context [a: 1 b: 2] context [b: 2 a: 1 ]
== none
Arnold:
30-Jul-2012
Hi looking for a better REBOL way to do the next thing: a: [ 1 2 
3 4 5 6 ] I have 1 of the values in this series and  want to do a 
foreach/forall on the series left of this value from right to left 
and also a foreach on the series on the right of this value but now 
from left to right. So say I chose 3 for the value then I need [ 
2 1 ] and [ 4 5 6 7 ]. This is my solution b: reverse copy/part a 
find a 3 and c: reverse copy/part a find reverse a 3 but now >> a
== [6 5 4 3 2 1]

And I don't want that and I don't like undoing the reverse each time. 
Do I need a temp for reverse a because c: reverse copy/part a find/last 
reverse copy a 3
** Script Error: Invalid /part count: 3 2 1
?
MaxV:
31-Jul-2012
a: [ 1 2 3 4 5 6]
b: copy  find/tail a 3 ; you get [4 5 6]
c: reverse copy/part a ((index? find a 3 ) - 1)
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.
Steeve:
31-Jul-2012
Arnold, actually you can save one copy and the index? computation.
One liner solution:
>> c: reverse copy/part a skip b: find/tail a 3 -2
Steeve:
31-Jul-2012
Oups no need for the skip -2, so it's even a little faster just using 
back
>> c: reverse copy/part a back b: find/tail a 3
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.
Arnold:
31-Jul-2012
Steeve, I like it. Most of the time I prefer readability over speed. 
This time a little speeding things up comes in handy.
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.
Kaj:
31-Jul-2012
Look at my Try REBOL site for a simple AJAX example
BrianH:
31-Jul-2012
Here's an interactive example that you can adapt to your script:
>> a: [1 2 3 4 5 6 7]
== [1 2 3 4 5 6 7]
>> i: find a 3
== [3 4 5 6 7]
>> b: back i
== [2 3 4 5 6 7]
>> f: next i
== [4 5 6 7]
>> forskip b -1 [print first b]
2
1
>> forskip f 1 [print first f]
4
5
6
7
BrianH:
31-Jul-2012
The only trick is that you either need extra temp vars for the loop 
variables, or to modify an existing temp var. As a bonus in R3, FORSKIP 
and FORALL are faster than FOR or FOREACH, since no rebinding of 
the code block is necessary.
BrianH:
31-Jul-2012
You can roll your own code in R2 using WHILE and have it be a little 
faster, but not necessarily a lot faster.
701 / 646081234567[8] 910...643644645646647