r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Script Library] REBOL.org: Script library and Mailing list archive

Graham
22-Jul-2010
[1011]
Yep, the users are always wrong!
Anton
22-Jul-2010
[1012]
Mind your hyperbole, Graham!
Sunanda
22-Jul-2010
[1013]
Sometimes users ask for things that are not practical for other users, 
and thus us poor developers have to make choices that can leave some 
unhappy :)
Suppose I wanted this code to execute the first code block....

  do http://synapse-ehr.com/forums/showthread.php?120-RebGUI-table

....That's a reasonable request for me. But is it for all users, 
such as Rixbot?
Graham
22-Jul-2010
[1014x3]
You're missing the point ... if you want to make it easy for users 
to test scripts ..you need to make sure that the links the users 
pass around are usable by rebol
So either educate the users or change your server script
Or, as Mohammed was wont to do ...
Anton
22-Jul-2010
[1017x2]
Would a rebol function named "get-rebol.org-script" in your user.r 
(or built-in to rebol) help alleviate the problem at all?
It would just convert a "view-script.r" link into a "download-a-script.r" 
link, so that users take, for example, the money.r link and type 
this into their console:


 do get-rebol.org-script http://www.rebol.org/view-script.r?script=money.r
Graham
22-Jul-2010
[1019]
I fire up rebol consoles everywhere .. so I would need to have that 
function everywhere. Much simple to fix the source.
Sunanda
22-Jul-2010
[1020]
Simpler for _you_ if we change the source; but perhaps not simpler 
for _others_ who expect it as it is.

Another even easier solution (easier for me, anyway:)


....In theory, REBOL does hunt through verbiage looking for "REBOL 
[" and starts executing from there.


So If the R2/R3 interpretor also de-escaped strings like < then 
the view-script would be executable.
Why not curecode/RAMBO that as a request!?
NickA
22-Jul-2010
[1021]
My 2 cents:  I like the way the links work now, but I also echoed 
Graham's request when I initially started using rebol.org.  Is it 
possible to hide a copy of the actual (downloadable script) code, 
at the top of the web page, so that it's executable by REBOL, but 
not visible by those using a browser?
Sunanda
22-Jul-2010
[1022]
Nice idea. But there is no foolproof way that does not leave someone 
with a screenreader seeing (or not seeing) double.

Also, may mess things up for (the few I hope) people with early CSS 
implementations in their browsers.


I'm still looking for an argument to convince me that one URL should 
serve two separate resources depending on user-agent sniffing.
Graham
22-Jul-2010
[1023]
You want an argument??  Let's step outside and discuss this!
Sunanda
22-Jul-2010
[1024]
:/)
Andreas
20-Oct-2010
[1025x2]
I'm seeing very strange line endings in scripts downloaded from the 
script library.
I am downloading http://www.rebol.org/download-a-script.r?script-name=test-framework.r
Ladislav
20-Oct-2010
[1027]
Did you see such line endings in other library scripts, or do you 
think it is just me doing something strange?
Andreas
20-Oct-2010
[1028x7]
I get it for all scripts, AFAICT.
Just downloaded 2 different scripts at random, same weirdness.
Now let me see what's actually going on.
Okay, I get a script library header inserted, which uses CR LF to 
terminate lines.
Then the rest of the script uses CR LF as well.
But at the very end, there's a trailing single LF.
Ah, and there's a single leading LF as well, right before the script 
library-inserted header.
Sunanda
20-Oct-2010
[1035x2]
We've had all sorts of fun trying to get the line endings to work 
for everyone.


There's a magic, undocumented URL parameter you can add to the URL 
that might make a difference on your platform.

It is MODE=????


I'll just cut'n'paste the comment from the download-a-script source... 
it may help explain it:

;; mode=windows -- the default. Makes LF or CR into CRLF
;; mode=binary  -- sends file as binary
;; mode=carl    -- saved and reloads file first as Carl thought
;;                 this would fix the problem
;; mode=text    -- the old default. Works in most cases. Just
;;                 prints the file (so sends whatever line
;;                 terminations work on the platform the library
;;                 is running on.
But we (s far as I remember) accept contributions with whatever line 
endings they come with, so some may be pre-messed with.
Andreas
20-Oct-2010
[1037x3]
Yeah, unfortunately currently break line endings predictably.
That should be: currently you* break line endings predictably :)
Due to the erroneously inserted leading/trailing LF.
Sunanda
20-Oct-2010
[1040]
Just lookin at the source......We do edit line ending to try to get 
them consistent.
Perhaps consistent, but wrong!
Andreas
20-Oct-2010
[1041]
It's not really the editing of the script per se, something is wicked 
in the surroundings.
Sunanda
20-Oct-2010
[1042]
The aim to to end up with CRLF in all defaiult cases.
Andreas
20-Oct-2010
[1043x3]
Yeah, and you are achieving that.
But somewhere on the way something inserts a single LF as the very 
first and very last character.
Wait, I'll upload a hexdump of what actually goes over the wire.
Sunanda
20-Oct-2010
[1046]
Thanks....That'll help.
Andreas
20-Oct-2010
[1047x2]
There you go: https://gist.github.com/c3ef82f0b05dc1aea045
You see the `0a` at very start and end?
Sunanda
20-Oct-2010
[1049]
Yes, thanks.
Andreas
20-Oct-2010
[1050x3]
That is most certainly a bug.
Inside
 those LFs, everything is nicely and consistently CRLF'd.
Basically it looks like you've some PRINTs somewhere you'd rather 
want PRINs :)
Sunanda
20-Oct-2010
[1053]
Certainly a bug .... and a bit of a mystery. not obvious where they 
come from (not yet, anyway)
The dev server does it right, live does it wrong.
Andreas
20-Oct-2010
[1054]
Hmm, if by "the dev server does it right" you mean the dev server 
has CRLF instead of LF at the start and end, I can tell you what's 
going on.
Sunanda
20-Oct-2010
[1055]
Yes I do.....What's going on!?
Andreas
20-Oct-2010
[1056x4]
But in my opinion, "right" would be _no_ extraneous whitespace at 
the start/end.
The dev server is running Windows, the live server is running Linux.
And the download-script script generates the output by using PRINT. 
Which leads to a terminating LF on Linux and a CRLF on Windows.
Switch the output generation to use PRIN instead (and add a `prin 
crlf` at the start/end if you really want the extra whitespace), 
and it should be fine.
Sunanda
20-Oct-2010
[1060]
Possible.....But if you add &mode=binary, then do not do a PRINT.
We do this instead
   set-modes system/ports/output [binary: true]
    insert system/ports/output script-source
And that also looks wrong on live.