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.

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
[4639x2]
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.
I don't have Excel on this machine, so can't test.
yubrshen
2-Feb-2012
[4641x2]
Gregg, thanks!. Please the pointer on  how to generate the html file 
from *.RDML, is through make-doc?
Actually, I guess the generated html may already be available to 
me: reb-excel-docs
Endo
3-Feb-2012
[4643]
Yes it is in there. You can find that document online in Robert's 
blog.
Gregg
3-Feb-2012
[4644]
Robert extended makedoc, but I'm not sure if this doc might build 
under RT's makedoc. Robert might say, but it sounds like it's on 
the web anyway.
Evgeniy Philippov
13-Feb-2012
[4645x2:last]
I think REBOL is a much better name since it includes "O" (holistic 
approach). All names without "O" are faulty. OBERON has two O's and 
MACHINE CODE has a single O :)
O

 makes mind think it all holistically and perfectly. GOD has O, too. 
 Names without O don't force human recognition apparatum to loop at 
 quality assurance of a code that is being produced. REBOL has O, 
 too.