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

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

todun
25-Oct-2011
[4590]
@james_nak: thanks for your Oct-15th 8:33 PM reply.
MagnussonC
11-Nov-2011
[4591]
Is it possible to open a web page and fill in username, password 
and press send? It is a POST form. I'm thinking of using it to check 
if some (of my own) web pages work and it is possible to login. I've 
tried read URL.
Geomol
11-Nov-2011
[4592x2]
Yes: http://www.rebol.com/docs/core23/rebolcore-13.html#section-8.6
And more here: http://www.rebol.com/docs/core23/rebolcore-13.html#section-13.5
MagnussonC
11-Nov-2011
[4594x2]
Interesting. Thanks, Geomol.
About the example 8.6 on read/custom and post. I can't find any info 
about the arguments for post. There is no help for this word. Can 
I send several arguments at once or do I write one post line for 
each form field?
Sunanda
11-Nov-2011
[4596]
You concatenate the args.
Example: as a GET

   r-get: read http://www.rebol.org/st-topic-details.r?tag=domain//html&start-at=26&limit=25

Same request as a POST:

r-post: read/custom http://www.rebol.org/st-topic-details.r[post 
"tag=domain//html&start-at=26&limit=25"]
MagnussonC
11-Nov-2011
[4597]
Thanks, Sunanda.
Burtm10
12-Nov-2011
[4598]
Hello Helpful person.  I have a need for a local no-server database 
function and have explored the sqlite tools which I can get working 
OK But.  The data I want to be storing needs to be secure.  I have 
looked at the encodings.r and that will work but I was wondering 
if there was another way.  I have used Tsunami Records Manager in 
the past with good success.  I have used Euphoria which has an excellent 
inbuilt database function and I would like something similar if possible. 
 Any clues?
Endo
14-Nov-2011
[4599]
When I examine the functions in altjson.r and altwebform.r written 
by Christopher Ross-Gill, I see function definitions like below:


load-json: use [...<lots of words>...] [... <lots of definitions 
etc.> func [...] ]


is this method for hiding details in function body? or to make the 
function body cleaner?
Gabriele
14-Nov-2011
[4600]
Basically, it's so that the words in the USE are not easily accessible 
from the outside. A "poor man's module" if you wish.
Endo
14-Nov-2011
[4601]
I see, I thought that its a good way to keep the body clean. But 
curious about if there is another reason. Thank you.

Btw, I loved functions in utility.r. Is it 1.22.1 (4-Feb-2005) the 
latest version? fortype, nforeach, import & export are very useful 
functions.
Gabriele
15-Nov-2011
[4602]
yes, that's the latest version.
PeterWood
21-Nov-2011
[4603]
This is a good place to ask questions about getting started with 
REBOL and getting used to AltME.
MagnussonC
30-Nov-2011
[4604]
Is there a LDAP module with authentification available for R2? I 
tried ldap-protocol.r from softinnov.org, but didn't get that to 
work (with anonymous bind) ... Not sure why I get "Error: Invalid 
port spec". I'm on Win7 (x64). Maybe it is something on OS level 
I have to config to use ldap://!?
Dockimbel
30-Nov-2011
[4605]
Invalid port spec

 means that you have provided an incorrect argument to OPEN native.
MagnussonC
30-Nov-2011
[4606]
Thnx, can I not use IP-address for argument?
Dockimbel
30-Nov-2011
[4607]
Sure you can, but your syntax is maybe wrong, can you post here your 
connection opening code?
MagnussonC
30-Nov-2011
[4608]
Hmm, I think I found what was wrong ... *blushing*
Dockimbel
30-Nov-2011
[4609]
Anonymous login with ldap-protocol.r should work fine.
MagnussonC
30-Nov-2011
[4610x3]
Now I got connected at least.  I used include instead of do.
Is there a way to loop throu the objects in LDAP? I seem to be able 
to get just one object at the time.
... and I'm not sure what to make of the "make object!" in the resulting 
block.
BrianH
30-Nov-2011
[4613]
That's just for display, like this:
>> object [a: 1]
== make object! [
    a: 1
]
>> length? reduce [object [a: 1]]
== 1
Dockimbel
30-Nov-2011
[4614]
Loop through objects: I guess you're meaning looping through a block 
of objects, which can be achieved using any of the REBOL looping 
function.
BrianH
30-Nov-2011
[4615]
If you actually want to loop through the key/value pairs of the object 
itself, you need to use R3's FOREACH, or loop through a BODY-OF the 
object.
Izkata
30-Nov-2011
[4616]
It can be done in R2, just a slight bit convoluted:

>> X: make object! [a: 1 b: 2 c: 3]
>> ? X
X is an object of value: 
   a               integer!  1 
   b               integer!  2 
   c               integer!  3 

>> first X
== [self a b c]

>> foreach key next first X [print rejoin [key { -> } get in X key]]
a -> 1
b -> 2
c -> 3
BrianH
30-Nov-2011
[4617]
Shame on you, Izkata, for advocating the use of the old reflectors 
in the "I'm new" group. Don't teach bad habits :(
In R2 and R3:
>> foreach [key value] body-of X [print [key {->} value]]
a -> 1
b -> 2
c -> 3
>> foreach key words-of X [print [key {->} get key]]
a -> 1
b -> 2
c -> 3
Steeve
30-Nov-2011
[4618]
Actually, R3 is more clever than that.
>> foreach [key val] X [print [key "->" val]]
BrianH
30-Nov-2011
[4619]
Yup, and that's more efficient too, but if you need the code to be 
R2 compatible, there're good reasons to make it R3 compatible too. 
For one thing, the code is cleaner and easier to understand and secure 
than old-style R2 code.
Izkata
30-Nov-2011
[4620x2]
Hm, I didn't know about body-of or words-of.  Still on 2.7.6 here, 
apparently before they were introduced
(had several incompatibilities with 2.7.7 and never bothered to figure 
it out at the time)
BrianH
30-Nov-2011
[4622]
They're in R2/Forward too, and that's 2.7.6 compatible. Have you 
tried 2.7.8?
Izkata
30-Nov-2011
[4623]
nope, haven't really thought about it for a while now
Endo
1-Dec-2011
[4624]
Try using FIRST, SECOND and THIRD on your object, that's what words-of 
and body-of do for object values.
>> bind remove first x x
>> third x
MagnussonC
1-Dec-2011
[4625]
Thank you all for the suggestions. I think it is my poor understanding 
of the LDAP syntax that's is the problem. I.e. how to get all users 
from the LDAP connection, and then loop through the user objects/blocks.
Endo
1-Dec-2011
[4626]
I'm also working on very similar to your case right now. I don't 
know if its useful for you but here how I do (on Windows)


command: {csvde -u -f export.ldap -d "ou=myou" -r "(objectClass=user)" 
-s 10.1.31.2 -a "" "" -l "DN,sn,uid,l,givenName,telephoneNumber,mail"}

call/wait/console/shell/error command %export.err  ;export all users, 
bind annonymous

if 0 < get in info? %export.err 'size [print "error" editor %export.err 
halt]
lines: read/lines %export.ldap

;create an object from the first line (field names, order may differ 
from what you give in the batch)

ldap-object: construct append map-each v parse first content none 
[to-set-word v] 'none
foreach line lines [
	(
		set words-of o: make ldap-object []  parse/all line {,}
		append users: [] o
	)
] ;append all valid users as an object to a block
probe users

I hope it gives some idea.
MagnussonC
1-Dec-2011
[4627]
Interesting. Thnx.
Endo
8-Dec-2011
[4628]
There is no "CONTINUE" in any loop in REBOL, right? We have BREAK 
but no CONTINUE as in other languages. Rarely I need it :x
Henrik
8-Dec-2011
[4629]
R2 does AFAIK not have it, but R3 does.
Endo
8-Dec-2011
[4630]
R3 does? I didn't know that. Thanks
Sunanda
8-Dec-2011
[4631]
You can fake 'continue in R2 using 'loop 1 ... as this (incorrect!) 
implemention of BuzzFizz shows:

    for n 1 100 1 [
       loop 1 [
            if n // 3 = 0 [print [n "buzz"] break]
            if n // 5 = 0 [print [n "fizz"] break]
          ]
     ]
Endo
8-Dec-2011
[4632x3]
; use following to have the functionality. I have a very long script 
and I don't want to put it inside a IF block
do-block: [ long long script ]

foreach a b [ if any [a = 3 a = 5 ...] do-block] ;continue on other 
values of a.
Magnusso: I faced a problem parsing exported LDAP users using above 
CSVDE command-line tool.

Because it fails if you don't use -u argument and if your ldap data 
has some unicode data.

And if you use -u the exported file will be unicode and cannot be 
read/parse in R2.
then I found a very simple way to convert a unicode file to ascii 
in DOS,
TYPE my-unicode-file > my-ascii-file


This line converts the file to ascii, just non-convertable characters 
looks wierd but rest is ok.
Gregg
9-Dec-2011
[4635]
You can also use read/binary on the data, then EXTRACT with a value 
of 2 to just remove all the nulls (assuming wide chars). Unicode 
chars will be munged that way too though.
yubrshen
2-Feb-2012
[4636x3]
Hi, I'm tring to use "Excel Interface" of Gregg Irwin, with documentation 
dated 18-Dec-2004. I'm wondering if there is any way to select a 
worksheet's all used content, that's all cells having values? From 
the documentation, I don't see how.
Also to make the Excel Interface to work, I'm wondering, where I 
should put the DLL file?
I guess that this is of some documenation, how can I open it, reb-excel-docs.rdml?
Gregg
2-Feb-2012
[4639]
The DLL should go in the dir with your script or encapped app. RDML 
is plain text, but I can send you the html generated from it if you 
want. I don't remember doing anything for finding cells with contents.