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

World: r3wp

[Core] Discuss core issues

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
[1219x4]
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.
It would seem from the docs at http://www.rebol.com/docs/encryption.html#section-3
that there is no way to specify the block size with Rebol.
GrahamC
1-Apr-2011
[1223]
encrypting something that only rebol can decrypt is not ideal for 
my purposes :(
PeterWood
1-Apr-2011
[1224]
It may well be that REBOL uses a 128-bit block size with Rijndael 
but it isn't clear from the documentation.
GrahamC
1-Apr-2011
[1225]
Has ne1 had any luck unencrypting rebol encrypted stuff?
PeterWood
1-Apr-2011
[1226x2]
If you only need to encrypt data at a single source, you could easily 
call a command line tool such as OpenSSL to perform the encryption 
for you. (It could well be quicker than REBOL too).
I have successfully decrypted something in REBOL that was encrypted 
in JavaScript using RSA.
GrahamC
1-Apr-2011
[1228]
Good to know!
PeterWood
1-Apr-2011
[1229]
If I remember correctly, I was also able to exchange test data that 
was Blowfish encrypted with REBOL but I handled the padding myself:

plain: to binary! text
  
len: remainder length? plain 8

  if 0 < len [

    padding: 8 - len

    insert/dup tail plain to char! padding padding
 
  ]
james_nak
1-Apr-2011
[1230x2]
Again, this might be a Graham question: I'm still working with that 
video encoder which uses http to communicate. They have a .cgi script 
which downloads the recorded video file from the internal SD card 
to the requester. My problem is the content I receive is somehow 
different than the files which I can download via a browser and of 
course will not play. I still using your http-tools to GET/POST. 
My initial thought was that  data returned is somehow being translated. 
Any thoughts?
Perhaps something to do with the http-port-private: open/lines  part. 
If I could open/binary that would be better, no?
GrahamC
1-Apr-2011
[1232]
if there is a binary switch ... it has to occurr after the port is 
opened.
james_nak
2-Apr-2011
[1233]
Thanks. Graham. Good advice. So far I haven't been able to correct 
it but the tip was good.
GrahamC
2-Apr-2011
[1234]
set-modes
james_nak
2-Apr-2011
[1235x2]
Yes, I have it so I read the header info then do set-modes. The data 
still isn't right though.
Got it Graham. I wasn't separating my variable types so there was 
some  unwanted conversion going on. Thanks again for the help.
MikeL
4-Apr-2011
[1237]
I am making a simple (I hope) worfkflow prototype and want to use 
REBOL objects which I can SAVE and LOAD.  A workflow object!  to 
have a node-map collection in it of simple nodes of the workflow 
graph.   Source ->A -> B -> SINK where the workflow knows about the 
next node and status. Externally there is UI to support the work 
part ... which is URL data on a given node.   Looks like it fits 
into Cheyenne RSP well - maybe zmq when I get a bit further along. 
  Save a flow in process as a .txt file using SAVE/ALL filename.txt 
work-flow-instance.   But no success with work-flow-instance: LOAD 
filename.txt        Do I have to BIND on LOAD to re-instantiate the 
object?
GrahamC
4-Apr-2011
[1238]
What do you get when you do a load?
MikeL
4-Apr-2011
[1239x2]
probe load %/c/cheyenne/www/makework/data/wf001.txt
[make object! [
        id: 'wf001
        name: "Add Work"
        node-map: [make object! [
                id: 'SOURCE
                Description: "Add new software for Site"
                status: 'Complete
                Next-Node: 'A
                sub-tasks: "1. Used RFA to enter."
                When-completed: []
                Time: 60
                Notify: none
                status-url: func [] [

                    join http://localhost/makework/status.rsp?id=ID
                ]
                action-url: none
                mark-complete: func [] [
                    Status: 'Complete
                ]
            ] make object! [ ....
The SAVE is a workflow function persist: does [save/all to-file rejoin 
[%data/ id ".txt"] self]
GrahamC
4-Apr-2011
[1241x2]
so looks like you have a block containing an object?
so what happens if you do this

obj: do load wf001.txt ?
MikeL
4-Apr-2011
[1243]
They stay as object! definitions viz  obj: do load %data/wf001.txt
>> probe obj
make object! [
    id: 'wf001
    name: "Add Software"
    node-map: [make object! [
            id: 'SOURCE
            Description: "Add new software for Site"