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
[1016]
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.
Andreas
20-Oct-2010
[1061x3]
Yeah, because that's not where trouble occurs.
Most likely you have a PRINT before and after that.
Or, depending on where the SCRIPT-SOURCE in the above comes from, 
you do one unchecked reform/rejoin somewhere.
Sunanda
20-Oct-2010
[1064]
We have a print for the HTTP headers, prior to chaning modes....that 
may be part of the problem.
Andreas
20-Oct-2010
[1065]
Maybe even in the upload process, so that the scripts are already 
stored on disk with the leading/tralinig LF.