• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[Rebol School] REBOL School

Maxim
5-Sep-2012
[925]
a one liner:

until [  view layout [fld: field]    not empty? fld/text ]
Kaj
5-Sep-2012
[926]
You seem to be trying to access datetime outside the VID context, 
where it is not defined
Maxim
5-Sep-2012
[927x3]
here, the field's action compares the field when pressing tab/enter, 
and will close the window when its not empty.


until [view layout [fld: field [unless empty? face/text [unview]]] 
not empty? fld/text]
not that within an action func, you can use  'FACE  to refer to the 
control triggering the action.
not => note
caelum
5-Sep-2012
[930x2]
Maxim thanks for the code. I'll experiment.
Kaj, I think you are right. I'll check to see if that is what's hapening.
GrahamC
5-Sep-2012
[932]
you get that vid error because you are referring to it before the 
layout function has run.
caelum
5-Sep-2012
[933]
GrahamC, It was simpler than that. The program I am working on has 
over 1300 lines of code, and I mis-typed a variable name! So it turns 
out I was trying to access a word that did not exist, was not defined. 
I'll remember that for next time. (Yes, there will be a next time). 
Thanks for all the help. I am beginning to feel competent programming 
in Rebol2.
Sunanda
5-Sep-2012
[934]
Caelem, D'oh moments are possible in any language.
I once wrote
    return: true
rather than
    return true

The protracted debug session that followed taught me the value of 
protect-system.
Arnold
7-Sep-2012
[935]
Hi I am trying to replicate this in Rebol: http://www.alistapart.com/articles/succeed/
I have the redirect setup but I want to know what url the user entered. 
Where can I get $DOCUMENT_ROOT.$REQUEST_URI ??
DocKimbel
7-Sep-2012
[936]
If you are using REBOL in CGI mode:

    get-env "DOCUMENT_ROOT"
    get-env  "REQUEST_URI"
Arnold
7-Sep-2012
[937x2]
Thank you, this works! I found and old conversation on ALTME this 
afternoon but that could not convince me being the answer, this answer 
will replace the old one. (I even typed get_env the first time). 
And for completeness I will write how to use it (cut and paste code) 
requestedurl: get-env "REQUEST_URI"
And the next step get-env "SCRIPT_FILENAME" 
guess I will have to post the complete script when I finish it.
Kaj
7-Sep-2012
[939x2]
These values are already processed by REBOL when it is started in 
CGI mode. I'm using
	cgi: system/options/cgi
The request URI is then in cgi/path-info
The script name is in cgi/script-name or something like that
Arnold
7-Sep-2012
[941x2]
Hi Kaj, wish it was that simple. I have put some strings into action 
and you can view the result here http://arnoldvanhofwegen.com/rebol/doesnotexist.html
Well as you can see path-info is none.
The script name is the script name of the script that is being executed, 
I knew that one already I redirected to it, not the requested page.
Kaj
8-Sep-2012
[943]
Ah, so REBOL does follow the major rule of other software: it does 
everything except the thing you need
Arnold
11-Sep-2012
[944x2]
Found some code/documentation about playing a sound (wav) on www.rebol.com/docs/sound.html 
 

but although rebol/view 2.7.8 (Win XP) has Sound 1.4.0 on board it 
seems using the sound:// port is reserved for use by the SDK version? 
** Access Error: Cannot open sound
** Where: halt-view
** Near: sound-port: open sound://
on MacOSX I get
** Access Error: Invalid port spec: sound://
** Where: halt-view
** Near: sound-port: open sound://

But that is less surprising since there is no Sound module available 
there.
So what is Sound (1.4.0) about?
Kaj is right again
Kaj
11-Sep-2012
[946x2]
Sound in REBOL is primitive, but I thought it had been in the free 
versions for many years
Did you initialise events like the doc says?
Arnold
11-Sep-2012
[948]
could be a rights issue? That the port may not be freely accessible.
Kaj
11-Sep-2012
[949]
That was a long time ago, and it should say "Feature not available 
in this REBOL"
james_nak
11-Sep-2012
[950]
Arnold, I've been using sound in a recent app with 2.7.8.3.1 with 
no issues (on XP too). I use a version of Nick's code http://musiclessonz.com/rebol_tutorial.html.
Look for "play-sound"
Endo
11-Sep-2012
[951]
this works for me on free version of View: (XP)

sound-port: open sound://
play: func [file] [
 wait sound-port
 clear sound-port
 insert sound-port file
 wait sound-port
]
Maxim
12-Sep-2012
[952]
yes enabled in View. not core (like all /pro features) .
Kaj
12-Sep-2012
[953]
Ah, is that the problem again. Sigh
Arnold
12-Sep-2012
[954]
An answer in a not web public group -> Chit chat
Arnold
13-Sep-2012
[955]
Somehow indeed I managed to mix up core and view console so sound 
did work afterall. Sorry for the noise :( 
But still a wish for sound in REBOL on other platforms.
Maxim
13-Sep-2012
[956]
in R3 we can add sound support via the host-kit, but its not as good 
as it could be because we cannot add devices and/or any new type 
of event to easily (asynchronously) signal audio-related events.
Kaj
13-Sep-2012
[957]
Devices cannot be added?
BrianH
13-Sep-2012
[958]
Not at the moment, as far as we know. At least if there's a workaround 
noone has figured it out yet. You can signal asynchronous events 
with callbacks though, afaik.
Kaj
13-Sep-2012
[959]
I never realised, because I only looked at them in the C code. I 
suppose devices can be added there, but not yet afterwards from REBOL
BrianH
13-Sep-2012
[960]
They can't necessarily be added in the C code either. IIRC the devices 
table is fixed-sixe and allocated in the core code. I welcome evidence 
to the contrary.
Maxim
13-Sep-2012
[961x4]
even the event list is a hard-coded list.  which is part of the problem.
there is no device code in the host-kit (which is the C api to rebol)
callbacks do have issues which make them unusable in the real-world 
IIRC (its been a while)
wasn't there a bug wrt errors and stuff like that?
BrianH
13-Sep-2012
[965x2]
There was a plan to make device extensions, but Carl didn't know 
what API to use. He did a callout for advice, but that didn't get 
much response.
There are bugs and design flaws in R2's callbacks, but I'm not sure 
there still are in R3's. Robert's group uses them IIRC, and might 
have fixed the bug. They'd have to chime in here.
Maxim
13-Sep-2012
[967]
people who where able to help did respond and he liked a few of the 
ideas, he just never acted on it or actualy start a real discussion.
Kaj
13-Sep-2012
[968]
I thought devices were always built on top of extensions. Anyway, 
the devices are in the host kit, about six of them
Maxim
13-Sep-2012
[969]
you can only implement the devices which are built-in, you cannot 
add your own.
Kaj
13-Sep-2012
[970]
OK, but the implementations are in the host kit
BrianH
13-Sep-2012
[971]
All of the implementations of the current devices are built into 
the host portion of the C code, but are not made with extensions.
Kaj
13-Sep-2012
[972]
As far as I know, Saphirion hasn't been able to solve the threading 
and callback problems
Maxim
13-Sep-2012
[973]
yes, cause they are platform dependent.    

The latest host-kits merged two projects... the command! interface 
(extensions) and the platform abstraction (host)
BrianH
13-Sep-2012
[974]
IIRC they had some success with the pattern of using a callback to 
signal R3 to grab data using a synchronous call.