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

World: r3wp

[Core] Discuss core issues

Dockimbel
19-Mar-2011
[1172x3]
Launching the script with CALL on linux (using /Core 2.7.6) shows 
something interesting at the end :-))

>> s: "" call/output "rebol -c test.cgi" s
== 0
>> probe s                                
foo^/^/^M
Ok, no it's my mistake
Works flawlessly on linux.
PeterWood
19-Mar-2011
[1175]
I came across the issue as I was trying to run REBOL/Services under 
Cheyenne in GCI mode. I have found that 0x0D bytes get changed to 
0x0A, it doesn't matter what they are preceded or followed by.

I also found that 0x0D0D gets converted to a single 0x0A.
PeterWood
20-Mar-2011
[1176x6]
I suspect that the problem is more likely to be with 'call than REBOL 
in CGI mode as REBOL/Services  runs as a CGI under Xitami on Windows.

The problem does not occur on OS X.
I have run a test which seems to show that the problem lies with 
'call.
First I ran a small command line pgm:
Will post the results later ....
This is the console output from the command line pgm:

C:\REBOLServicesTest>cr
)haracter 13 is enclosed in the parentheses (


I then checked that the command line pgm could be successfully called 
with the following two lines of Ruby:

	puts %x{cr}
	print %x{cr}.dump

Which gave the following output:
C:\REBOLServicesTest>ruby call_test.rb
)haracter 13 is enclosed in the parentheses (
Character 13 is enclosed in the parentheses (\r)

I then called the command line pgm from a REBOL Console session:

>> call/console "cr"
Character 13 is enclosed in the parentheses (
)== 0
>> print to-binary {Character 13 is enclosed in the parentheses (
{    )}
#{
43686172616374657220313320697320656E636C6F73656420696E2074686520
706172656E74686573657320280A29
}
>> buffer: make string! 256
== ""
>> call/output "cr" buffer
== 0
>> probe buffer
Character 13 is enclosed in the parentheses (^/)
== "Character 13 is enclosed in the parentheses (^/)"
>> print to-binary buffer
#{
43686172616374657220313320697320656E636C6F73656420696E2074686520
706172656E74686573657320280A29
}


As you can see both call/console and call/output turned the 0x0D 
into a 0x0A.
I've added this to RAMBO.
Dockimbel
21-Mar-2011
[1182]
I concur, it's a CALL issue and not a --cgi one. I did more tests 
with my own CALL/OUTPUT implementation and it doesn't show any newline 
alteration in the binary CGI output.
Henrik
24-Mar-2011
[1183x2]
are there known bugs where DECOMPRESS works on certain data in one 
OS (OSX here), but not in another (Windows XP)?
hmm.. never mind. seems to be a memory problem.
Oldes
25-Mar-2011
[1185]
I guess this is a bug in R2's lexer:
>> 2#
== ##
>> 4#foo
== ##foo
>> 456457#foo
== #56457#foo
Maxim
25-Mar-2011
[1186]
IMHO it should return a syntax error
Geomol
25-Mar-2011
[1187]
That must have changed in later version. I tested such things deeply 
1-2 years ago and wrote a document, that I sent to Carl. Back then 
I noticed:

>> 2.2#
** Syntax error: Invalid "integer" -- "2.2#"


, and I suggested, it should be an invalid decimal, not invalid integer. 
Today I get:

>> 2.2#
== #.2#

There are many such situations.
amacleod
27-Mar-2011
[1188]
trying to get info on a file via ftp using to long version of teh 
port spec as my user name is an email address:

fport: [
    scheme: 'FTP
    host: "ftp.example.com"
    target: %/file.txt
    user: "bill@ example.com"
    pass: "vbs"
]

I can read it with "read fport"

but I can not get other info from it like:

print modified? fport

Whats the method here?
Gregg
27-Mar-2011
[1189]
Have you tried applying this patch?


net-utils/url-parser/user-char: union net-utils/url-parser/user-char 
make bitset! #"@"
GrahamC
27-Mar-2011
[1190]
many sites don't provide that information I've found
amacleod
27-Mar-2011
[1191]
Gregg,

Thanks! That works great....never saw this before!
GrahamC
27-Mar-2011
[1192x2]
Sometimes depending on a flag you might want to call a function with 
a refinement or not.

So:

either flag [ test/refinement ][ test ]


Is there a simpler way this could be done without passing a parameter?
test/(either flag [ refinement ][none] )
looks ugly
PeterWood
27-Mar-2011
[1194]
It doesn't work either.
GrahamC
27-Mar-2011
[1195x3]
no :)  I was just thinking of what syntax could be used !
how about making a refinement of none always legal??
I guess someone would say it adds unnecessary overhead
PeterWood
27-Mar-2011
[1198x2]
You could always add a refinement of /none in the function spec.
I'm not sure if it would affect anyother use of none inside the function 
though.
>> test: func [/refinement /none] [if none [print "yes"]] 
>> test/none
yes
>>
GrahamC
27-Mar-2011
[1200x3]
I guess so :)
Interestingly that turns none into true
>> test: func [/none ][ ?? none ]
>> test
none: none
== none
>> test/none
none: true
== true

so redefining none is not what I had in mind!
BrianH
27-Mar-2011
[1203x3]
APPLY. Try this: apply :test [flag]
R2 has a mezzanine APPLY, R3 has a native one.
We use it a lot in R3 for wrapper functions that forward refinements 
to the functions they call. The names can even be different because 
APPLY is positional. It is a little slow in R2 for small numbers 
of refinements when compared to the conditional code, but really 
easy to use, which makes the difference.
GrahamC
27-Mar-2011
[1206x2]
don't understand
how do you use 'apply for refinements?
Andreas
27-Mar-2011
[1208x4]
>> foo: func [a /b c] [reduce [a b c]]
>> apply :foo [1]
== [1 none none]
>> apply :foo [1 /b 3]
== [1 true 3]
You can use any true? value, you don't have to use the refinement 
name.
>> apply :foo [1 true 3] ;; useful for computed refinement usage
== [1 true 3]
>> apply :foo [1 42 3] ;; probably useless, but still possible :)
== [1 true 3]
And, of course:
>> apply :foo [1 false 3]
== [1 none none]
GrahamC
27-Mar-2011
[1212]
cute
GrahamC
31-Mar-2011
[1213]
Is Rebol's RSA encryption still standard ?  Can I use that for encrypting 
sensitive health data ?
PeterWood
1-Apr-2011
[1214]
RSA is not really designed to encrypt large chunks of data. You'd 
be better of using AES (or  Rijndael as it used to be known as is 
still called in REBOL).


RSA is better used for exchanging passwords and "signing" documents.
GrahamC
1-Apr-2011
[1215x4]
I need a public key encryption method though
RSA is significantly slower than symmetric key encryption algorithms, 
and a single encryption or decryption operation can only process 
an amount of data up to the size of the RSA key. For encrypting or 
decrypting large amounts of data RSA is usually used in combination 
with symmetric key algorithms or secure checksums as follows:
so I would use AES to encrypt the data,and then use RSA to encrypt 
the AES encryption key I guess
trouble is I've not had any luck with decrypting stuff encrypted 
by Rebol with AES by other AES decryption tools
PeterWood
1-Apr-2011
[1219x3]
Yes you would use AES to encrypt the data and then RSA to encrypt 
and send somebody the encryption key.
In my experience, the issues of encrypting in REBOL and decrypting 
in something else usually involve either the chaining method or the 
padding used.
Also, from Wikipedia - AES has a fixed block size of 128 bits whereaas 
Rjindael can have a blocksize in any multiple of 32 between 128 and 
256 bits.