From jay at jays.net Wed Feb 1 11:18:02 2012 From: jay at jays.net (Jay Hannah) Date: Wed, 1 Feb 2012 13:18:02 -0600 Subject: [Omaha.pm] Shit Programmers Say Message-ID: <44E1F929-0F6C-4412-81A6-8F8058F7BCDB@jays.net> lol! https://www.youtube.com/watch?v=8WZr6fvtEgk Make sure to watch the end. :) j From jay at jays.net Tue Feb 14 11:10:00 2012 From: jay at jays.net (Jay Hannah) Date: Tue, 14 Feb 2012 13:10:00 -0600 Subject: [Omaha.pm] Meeting tonight! 7pm! Message-ID: Wow, it's been a month again?! See you at PKI tonight at 7pm! Print one of these (.docx or .pdf, whichever is easier for you) and stick it on your dashboard. http://odlug.org Thanks, j -------------- next part -------------- A non-text attachment was scrubbed... Name: Feb ePermit PKI UDLUG 1-10-12.docx Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document Size: 17965 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Feb ePermit PKI UDLUG 1-10-12.pdf Type: application/pdf Size: 27640 bytes Desc: not available URL: From jay at jays.net Mon Feb 20 10:36:03 2012 From: jay at jays.net (Jay Hannah) Date: Mon, 20 Feb 2012 12:36:03 -0600 Subject: [Omaha.pm] Programming Perl, 4th edition Message-ID: http://shop.oreilly.com/product/9780596004927.do Ebook now ($20), print book ($55) soon. Woot! :) j From topher-pm at zyp.org Mon Feb 20 10:48:15 2012 From: topher-pm at zyp.org (Christopher Cashell) Date: Mon, 20 Feb 2012 12:48:15 -0600 Subject: [Omaha.pm] Programming Perl, 4th edition In-Reply-To: References: Message-ID: On Mon, Feb 20, 2012 at 12:36 PM, Jay Hannah wrote: > http://shop.oreilly.com/product/9780596004927.do > > Ebook now ($20), print book ($55) soon. > > Woot! ?:) Awesome! I've had mine pre-ordered at Amazon for like 6 months now (currently listing there for $29.19). Amazon is listing the "publication date" as March 5, 2012, so maybe we'll see it ship by then. After waiting over a decade for a new edition, this is exciting. ;-) > j -- Christopher From jay at jays.net Mon Feb 20 11:38:40 2012 From: jay at jays.net (Jay Hannah) Date: Mon, 20 Feb 2012 13:38:40 -0600 Subject: [Omaha.pm] Programming Perl, 4th edition In-Reply-To: References: Message-ID: On Feb 20, 2012, at 12:48 PM, Christopher Cashell wrote: > Awesome! I've had mine pre-ordered at Amazon for like 6 months now > (currently listing there for $29.19). Amazon is listing the > "publication date" as March 5, 2012, so maybe we'll see it ship by > then. > > After waiting over a decade for a new edition, this is exciting. ;-) Wow. Amazon is half price compared to the publisher itself? Interesting. I would think that the ebook being on the shelves would mean the book is set in stone...? Weird that the dead trees aren't available yet, unless they're taking the first round of errata from the ebook to correct before inking up lots of paper? -ponder- j From andy at petdance.com Mon Feb 20 11:40:35 2012 From: andy at petdance.com (Andy Lester) Date: Mon, 20 Feb 2012 13:40:35 -0600 Subject: [Omaha.pm] Programming Perl, 4th edition In-Reply-To: References: Message-ID: <8484768D-88D2-45A0-A10E-157C90CE1CD8@petdance.com> On Feb 20, 2012, at 1:38 PM, Jay Hannah wrote: > I would think that the ebook being on the shelves would mean the book is set in stone...? Weird that the dead trees aren't available yet, unless they're taking the first round of errata from the ebook to correct before inking up lots of paper? -ponder- ebook weeks before paper is standard. They can publish the ebook literally as soon as it's done. Then it takes weeks to get onto paper and into the sales channels. xoa -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay at jays.net Tue Feb 21 13:50:55 2012 From: jay at jays.net (Jay Hannah) Date: Tue, 21 Feb 2012 15:50:55 -0600 Subject: [Omaha.pm] Net::LDAP References: Message-ID: <6A028FE8-CF43-4A90-A1CB-FCE967345B48@jays.net> Hi Bill, Sorry, I was in a meeting so wasn't staring at IRC. :) my $ad = Net::LDAP->new("ad.wjgilmore.com"); Yes, that creates a new object, $ad, of the class Net::LDAP. The author of that class, apparently, allows a single argument to be passed in -- the server you want to connect to. Class authors can do whatever they want to arguments passed into new(). $ad->bind("ad-web\@ad.wjgilmore.com", password=>"secret"); In OO programming bind() is called an object method. (method, function... in perl it's all just a sub {} under the hood :) Many people doing OO in perl5 use Moose nowadays. Check it out!: https://metacpan.org/module/Moose I saw you just joined this mailing list! Welcome! j /me runs off to pick up his dogs at the vet :) 20:24 < jhannah> hi Bill :) 20:24 < BillBrush> I'm on the OLUG list 20:25 < jhannah> I'm sorry. ;) 20:25 < BillBrush> :-) No worries, I mainly lurk (for about 10) years 20:25 < jhannah> ya, me too 20:26 < jhannah> you might want to /join #OmahaLUG 20:26 < BillBrush> I'm toying with the idea of using my novice perl skills to write an LDAP query script. Can I ask some realy basic questions? 20:26 < jhannah> absolutely. :) you might want to join the omaha.pm.org mailing list 20:27 < BillBrush> Just to give some idea, I've been programming at various basic levels since 84, but I'm not a "dev" and object oriented came long after I was out of school. 20:28 < BillBrush> So I'm looking at this statement: 20:28 < BillBrush> my $ad = Net::LDAP->new("ad.wjgilmore.com") 20:28 < BillBrush> or die "Could not connect!"; 20:28 < BillBrush> That creates an object ($ad) and sets the object property to (ad.blah.com) 20:28 < BillBrush> Am I reading that right? 20:29 < BillBrush> Assuming than I am, this statement then uses the bind function of the object to open the connection to the LDAP. 20:29 < BillBrush> $ad->bind("ad-web\@ad.wjgilmore.com", password=>"secret"); 20:30 < BillBrush> Am I on track or out in left field? 20:41 * BillBrush thinks he scared Jay off 21:23 -!- BillBrush [~bbrush at netv-net3674.unl.edu] has quit [Remote host closed the connection] 21:43 < jhannah> haha, was in a meeting From bbrush at gmail.com Tue Feb 21 16:18:18 2012 From: bbrush at gmail.com (Bill Brush) Date: Tue, 21 Feb 2012 18:18:18 -0600 Subject: [Omaha.pm] Net::LDAP In-Reply-To: <6A028FE8-CF43-4A90-A1CB-FCE967345B48@jays.net> References: <6A028FE8-CF43-4A90-A1CB-FCE967345B48@jays.net> Message-ID: Hey no problem Jay, I've been around IRC long enough to know how things work. I've done my share of walk-aways, believe me. I'm going to be spamming the list over the next few days with questions while I get up to speed with this. Thanks! Bill On Tue, Feb 21, 2012 at 3:50 PM, Jay Hannah wrote: > Hi Bill, > > Sorry, I was in a meeting so wasn't staring at IRC. ? :) > > ? my $ad = Net::LDAP->new("ad.wjgilmore.com"); > > Yes, that creates a new object, $ad, of the class Net::LDAP. > > The author of that class, apparently, allows a single argument to be passed in -- the server you want to connect to. Class authors can do whatever they want to arguments passed into new(). > > ? $ad->bind("ad-web\@ad.wjgilmore.com", password=>"secret"); > > In OO programming bind() is called an object method. (method, function... in perl it's all just a sub {} under the hood :) > > Many people doing OO in perl5 use Moose nowadays. Check it out!: ? https://metacpan.org/module/Moose > > I saw you just joined this mailing list! Welcome! > > j > /me runs off to pick up his dogs at the vet ? :) > > > > > > > > 20:24 < jhannah> hi Bill ?:) > 20:24 < BillBrush> I'm on the OLUG list > 20:25 < jhannah> I'm sorry. ?;) > 20:25 < BillBrush> :-) ?No worries, I mainly lurk (for about 10) years > 20:25 < jhannah> ya, me too > 20:26 < jhannah> you might want to /join #OmahaLUG > 20:26 < BillBrush> I'm toying with the idea of using my novice perl skills to write an LDAP > ? ? ? ? ? ? ? ? ? query script. ?Can I ask some realy basic questions? > 20:26 < jhannah> absolutely. ?:) ? you might want to join the omaha.pm.org mailing list > 20:27 < BillBrush> Just to give some idea, I've been programming at various basic levels since > ? ? ? ? ? ? ? ? ? 84, but I'm not a "dev" and object oriented came long after I was out of > ? ? ? ? ? ? ? ? ? school. > 20:28 < BillBrush> So I'm looking at this statement: > 20:28 < BillBrush> my $ad = Net::LDAP->new("ad.wjgilmore.com") > 20:28 < BillBrush> ? ? ? ? ?or die "Could not connect!"; > 20:28 < BillBrush> That creates an object ($ad) and sets the object property to (ad.blah.com) > 20:28 < BillBrush> Am I reading that right? > 20:29 < BillBrush> Assuming than I am, this statement then uses the bind function of the object > ? ? ? ? ? ? ? ? ? to open the connection to the LDAP. > 20:29 < BillBrush> $ad->bind("ad-web\@ad.wjgilmore.com", password=>"secret"); > 20:30 < BillBrush> Am I on track or out in left field? > 20:41 ?* BillBrush thinks he scared Jay off > 21:23 -!- BillBrush [~bbrush at netv-net3674.unl.edu] has quit [Remote host closed the connection] > 21:43 < jhannah> haha, was in a meeting > > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm From jay at jays.net Wed Feb 22 09:34:32 2012 From: jay at jays.net (Jay Hannah) Date: Wed, 22 Feb 2012 11:34:32 -0600 Subject: [Omaha.pm] Net::LDAP In-Reply-To: References: <6A028FE8-CF43-4A90-A1CB-FCE967345B48@jays.net> Message-ID: ... this conversation continues on IRC. http://webchat.freenode.net/?channels=omaha.dev More Omaha IT folk should hang out in IRC. :) Freenode: #OmahaLUG #omaha.dev #omahamaker j On Feb 21, 2012, at 6:18 PM, Bill Brush wrote: > Hey no problem Jay, I've been around IRC long enough to know how > things work. I've done my share of walk-aways, believe me. > > I'm going to be spamming the list over the next few days with > questions while I get up to speed with this. > > Thanks! > Bill > > On Tue, Feb 21, 2012 at 3:50 PM, Jay Hannah wrote: >> Hi Bill, >> >> Sorry, I was in a meeting so wasn't staring at IRC. :) >> >> my $ad = Net::LDAP->new("ad.wjgilmore.com"); >> >> Yes, that creates a new object, $ad, of the class Net::LDAP. >> >> The author of that class, apparently, allows a single argument to be passed in -- the server you want to connect to. Class authors can do whatever they want to arguments passed into new(). >> >> $ad->bind("ad-web\@ad.wjgilmore.com", password=>"secret"); >> >> In OO programming bind() is called an object method. (method, function... in perl it's all just a sub {} under the hood :) >> >> Many people doing OO in perl5 use Moose nowadays. Check it out!: https://metacpan.org/module/Moose >> >> I saw you just joined this mailing list! Welcome! >> >> j >> /me runs off to pick up his dogs at the vet :) >> >> >> >> >> >> >> >> 20:24 < jhannah> hi Bill :) >> 20:24 < BillBrush> I'm on the OLUG list >> 20:25 < jhannah> I'm sorry. ;) >> 20:25 < BillBrush> :-) No worries, I mainly lurk (for about 10) years >> 20:25 < jhannah> ya, me too >> 20:26 < jhannah> you might want to /join #OmahaLUG >> 20:26 < BillBrush> I'm toying with the idea of using my novice perl skills to write an LDAP >> query script. Can I ask some realy basic questions? >> 20:26 < jhannah> absolutely. :) you might want to join the omaha.pm.org mailing list >> 20:27 < BillBrush> Just to give some idea, I've been programming at various basic levels since >> 84, but I'm not a "dev" and object oriented came long after I was out of >> school. >> 20:28 < BillBrush> So I'm looking at this statement: >> 20:28 < BillBrush> my $ad = Net::LDAP->new("ad.wjgilmore.com") >> 20:28 < BillBrush> or die "Could not connect!"; >> 20:28 < BillBrush> That creates an object ($ad) and sets the object property to (ad.blah.com) >> 20:28 < BillBrush> Am I reading that right? >> 20:29 < BillBrush> Assuming than I am, this statement then uses the bind function of the object >> to open the connection to the LDAP. >> 20:29 < BillBrush> $ad->bind("ad-web\@ad.wjgilmore.com", password=>"secret"); >> 20:30 < BillBrush> Am I on track or out in left field? >> 20:41 * BillBrush thinks he scared Jay off >> 21:23 -!- BillBrush [~bbrush at netv-net3674.unl.edu] has quit [Remote host closed the connection] >> 21:43 < jhannah> haha, was in a meeting >> >> >> _______________________________________________ >> Omaha-pm mailing list >> Omaha-pm at pm.org >> http://mail.pm.org/mailman/listinfo/omaha-pm > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm From jay at jays.net Fri Feb 24 07:26:14 2012 From: jay at jays.net (Jay Hannah) Date: Fri, 24 Feb 2012 09:26:14 -0600 Subject: [Omaha.pm] HTTP 1.1 activity diagram Message-ID: Oh, very cool: http://wiki.basho.com/images/http-headers-status-v3.png HTTP 1.1 - An activity diagram to describe the resolution of the response status code, given various headers. j From bbrush at gmail.com Fri Feb 24 08:36:00 2012 From: bbrush at gmail.com (Bill Brush) Date: Fri, 24 Feb 2012 10:36:00 -0600 Subject: [Omaha.pm] Learning perl - working with LDAP Message-ID: Hello everyone. I just recently started down the path of learning Perl, and I'm working on my first script (program? which is the correct term for Perl?). Anyway, I'm basing it on the example here: http://www.developer.com/open/article.php/10930_3106601_3/Searching-Active-Directory-with-Perl.htm Getting down to the details of the code, I want to throw out some lines and how I interpret them to make sure I'm reading them right. This line seems to be the money line of the example: my $results = $ad->search(base=>$base,filter=>$filter,attrs=>$attrs); The way I read that is: my $results = (the output of this command will be stored in $results) $ad->search (Use the search method in the previously created object $ad) (base=>$base,filter=>$filter,attrs=>$attrs) (The search method has 3 inputs required [base,filter, attrs] which are stored in the 3 variables. Base corresponds to the LDAP context where the search will be performed, filter gives the criteria of the objects selected, and attrs gives the attributes to be returned. Presumably these could have been written out explicitly rather than stored in variables, but this is infinitely more readable and flexible.) So am I reading that command correctly? Another question about the example script is minor, but I haven't found the answer elsewhere. The author uses the operator .= (dot equal). What does that do? A final question is more of a code style and efficiency question. The author uses a FOR-NEXT loop to cycle through the alphabet. Wouldn't a While (letter References: Message-ID: On Fri, Feb 24, 2012 at 10:36 AM, Bill Brush wrote: > Hello everyone. I just recently started down the path of learning > Perl, and I'm working on my first script (program? which is the > correct term for Perl?). > > Anyway, I'm basing it on the example here: > > http://www.developer.com/open/article.php/10930_3106601_3/Searching-Active-Directory-with-Perl.htm > > Getting down to the details of the code, I want to throw out some > lines and how I interpret them to make sure I'm reading them right. > > This line seems to be the money line of the example: > > my $results = $ad->search(base=>$base,filter=>$filter,attrs=>$attrs); > > The way I read that is: > > my $results = (the output of this command will be stored in $results) > > $ad->search (Use the search method in the previously created object $ad) > > (base=>$base,filter=>$filter,attrs=>$attrs) (The search method has 3 > inputs required [base,filter, attrs] which are stored in the 3 > variables. Base corresponds to the LDAP context where the search will > be performed, filter gives the criteria of the objects selected, and > attrs gives the attributes to be returned. Presumably these could > have been written out explicitly rather than stored in variables, but > this is infinitely more readable and flexible.) > > So am I reading that command correctly? > Yes. > Another question about the example script is minor, but I haven't > found the answer elsewhere. The author uses the operator .= (dot > equal). What does that do? > $x = 'x'; $x .= 'X'; is short had for $x = $x . 'X'; both store 'xX' after execution. > A final question is more of a code style and efficiency question. The > author uses a FOR-NEXT loop to cycle through the alphabet. Wouldn't a > While (letter I'm trying to understand if there's an advantage to the author's > method that I'm not grasping. > I would propose rather than incrementing a letter index you could just use 'a'..'z' range operator. This is how I would code the example. #!/usr/bin/perl use Modern::Perl; use Net::LDAP; # Connect and bind my $ad = Net::LDAP->new("ad.wjgilmore.com") || die "Could not connect!"; $ad->bind( 'ad-web at ad.wjgilmore.com', password => 'secret' ); # build the alphabetical toc my $toc = "\n\n" . join( ' ', a .. z ) . " \n"; # Perform LDAP queries, build directory pages my $base = 'OU=People,OU=staff,DC=ad,DC=wjgilmore,DC=com'; for my $letter ( a .. z ) { # Filter on the staff membership and # first letter of samaccountname attribute my $filter = "(&(memberof=CN=staff,OU=groups,DC=ad,DC=wjgilmore,DC=com)(samaccountname=$letter*))"; # Which attributes should be returned? my $attrs = "sn, givenname, mail"; # Execute the search my $results = $ad->search( base => $base, filter => $filter, attrs => $attrs ); # Check for errors! $results->code && die $results->error; # Build the directory my $directory; for my $entry ( $results->entries ) { $directory .= sprintf '%s %s (%s)%s', $entry->get_value('givenname'), $entry->get_value('sn'), $entry->get_value('mail'), "\n"; } # Write the file open( FILE, '>', "/www/wjgilmore/directory/$letter.html" ); say FILE $toc, $directory; close FILE; } # Unbind from the server $ad->unbind; # END -- Ted Katseres ||=O=|| -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay at jays.net Fri Feb 24 09:53:01 2012 From: jay at jays.net (Jay Hannah) Date: Fri, 24 Feb 2012 11:53:01 -0600 Subject: [Omaha.pm] Learning perl - working with LDAP In-Reply-To: References: Message-ID: On Fri, Feb 24, 2012 at 10:36 AM, Bill Brush wrote: > I'm working on my first script (program? which is the correct term for Perl?) I say "script" for tiny things and "program" for more serious things. Some people spend lots of energy arguing this topic. I don't recommend you spend any energy caring about it. :) On Feb 24, 2012, at 11:19 AM, Theodore Katseres wrote: > use Modern::Perl; Theodore++ I'm still doing what that does manually. I have no good reason to do so. :) > for my $letter ( a .. z ) { > # Filter on the staff membership and > # first letter of samaccountname attribute > my $filter = "(&(memberof=CN=staff,OU=groups,DC=ad,DC=wjgilmore,DC=com)(samaccountname=$letter*))"; Code looks good to me if you want to make 26 LDAP queries. If 1 LDAP query would be better for some reason you could pull everything into memory and write each letter to disk later. Note a..z isn't gonna work worth a damn if you have any Japanese employees. My good friend ?? will feel very left out of your directory. :) > open( FILE, '>', "/www/wjgilmore/directory/$letter.html" ); > say FILE $toc, $directory; > close FILE; I believe the preferred modern form of this is: my $filename = "/www/wjgilmore/directory/$letter.html"; open my $fh, '>', $filename or die "Can't write to '$filename'"; say $fh $toc, $directory; close $fh; http://www.modernperlbooks.com/mt/2011/07/why-the-modern-perl-book-avoids-bareword-filehandles.html ? Hope that helps, j