From jay at jays.net Sun Jan 9 08:36:09 2005 From: jay at jays.net (Jay Hannah) Date: Sun Jan 9 09:45:13 2005 Subject: [Omaha.pm] Test - New pm.org server Message-ID: <90D9CF96-625C-11D9-AD50-000A95E317B8@jays.net> pm.org has moved to a new server. This is a test of the Omaha Perl emergency broadcast system. This is only a test. beeeeeeeeeeeeeeeeep!! j From dan at linder.org Tue Jan 11 12:58:36 2005 From: dan at linder.org (Daniel Linder) Date: Tue Jan 11 12:51:14 2005 Subject: [Omaha.pm] Using a perl module without installing it... Message-ID: <3927.12.160.138.79.1105477116.squirrel@12.160.138.79> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm doing some development on a customers system. I am using Perl scripts to do some quick-and-dirty data manipulation. I need to use a module but I can't install it on this system. The packge itself (Statistics-LineFit) is very simple -- the whole inteligence of the package is contained in a single file (lib/Statistics/LineFit.pm). To use this package normally, you would "use Statistics::LineFit;", but that will look in the system library directories. Questions: 1: Can anyone give me pointers so that I can replace the "use XXX::YYY;" syntax and do something like "include /full/path/to/YYY.pm" or other such trick? 2: Or, can someone give me hints as to how to write my script to modify the @INC variable (??) to use ~/lib rather than the systems default "/usr/lib/perl5/..." directories? Dan - - - - - "I do not fear computer, I fear the lack of them." -- Isaac Asimov GPG fingerprint:9EE8 ABAE 10D3 0B55 C536 E17A 3620 4DCA A533 19BF -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFB5D38NiBNyqUzGb8RAphpAKCJvgjjh8QVSwzDxZRvtsxPt2tISgCcD4OX a0ZBLiniAHzoza26Pjc9Wbc= =rxtD -----END PGP SIGNATURE----- From scott.l.miller at hp.com Tue Jan 11 13:43:12 2005 From: scott.l.miller at hp.com (Miller, Scott L (Omaha Networks)) Date: Tue Jan 11 13:43:24 2005 Subject: [Omaha.pm] Using a perl module without installing it... Message-ID: <1F7C0C8F4BD7C54A8BC55012FEF3DF6D0302E7C9@omaexc11.americas.cpqcorp.net> Dan, I use a custom set of routines that I place in my personal ~/bin/PM directory. Here is the header of one perl program that includes two of my "libraries". -------------------------- #!/usr/bin/perl use Getopt::Std; use IO::Tee; use Net::Ping::External qw(ping); use lib "$ENV{HOME}/bin/PM"; use Utils qw(SetTimeVars ip2val $mday $mon $yr I_Am_Interactive); use SendMail; -------------------------- The libraries "Utils" and "SendMail" are files called Utils.pm and SendMail.pm under the ~/bin/PM directory. HTH, -Scott -----Original Message----- From: omaha-pm-bounces@pm.org [mailto:omaha-pm-bounces@pm.org]On Behalf Of Daniel Linder Sent: Tuesday, January 11, 2005 2:59 PM To: omaha-pm@mail.pm.org Subject: [Omaha.pm] Using a perl module without installing it... -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm doing some development on a customers system. I am using Perl scripts to do some quick-and-dirty data manipulation. I need to use a module but I can't install it on this system. The packge itself (Statistics-LineFit) is very simple -- the whole inteligence of the package is contained in a single file (lib/Statistics/LineFit.pm). To use this package normally, you would "use Statistics::LineFit;", but that will look in the system library directories. Questions: 1: Can anyone give me pointers so that I can replace the "use XXX::YYY;" syntax and do something like "include /full/path/to/YYY.pm" or other such trick? 2: Or, can someone give me hints as to how to write my script to modify the @INC variable (??) to use ~/lib rather than the systems default "/usr/lib/perl5/..." directories? Dan - - - - - "I do not fear computer, I fear the lack of them." -- Isaac Asimov GPG fingerprint:9EE8 ABAE 10D3 0B55 C536 E17A 3620 4DCA A533 19BF -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFB5D38NiBNyqUzGb8RAphpAKCJvgjjh8QVSwzDxZRvtsxPt2tISgCcD4OX a0ZBLiniAHzoza26Pjc9Wbc= =rxtD -----END PGP SIGNATURE----- _______________________________________________ Omaha-pm mailing list Omaha-pm@pm.org http://mail.pm.org/mailman/listinfo/omaha-pm From scott.l.miller at hp.com Tue Jan 11 13:43:12 2005 From: scott.l.miller at hp.com (Miller, Scott L (Omaha Networks)) Date: Tue Jan 11 13:43:24 2005 Subject: [Omaha.pm] Using a perl module without installing it... Message-ID: <1F7C0C8F4BD7C54A8BC55012FEF3DF6D0302E7C9@omaexc11.americas.cpqcorp.net> Dan, I use a custom set of routines that I place in my personal ~/bin/PM directory. Here is the header of one perl program that includes two of my "libraries". -------------------------- #!/usr/bin/perl use Getopt::Std; use IO::Tee; use Net::Ping::External qw(ping); use lib "$ENV{HOME}/bin/PM"; use Utils qw(SetTimeVars ip2val $mday $mon $yr I_Am_Interactive); use SendMail; -------------------------- The libraries "Utils" and "SendMail" are files called Utils.pm and SendMail.pm under the ~/bin/PM directory. HTH, -Scott -----Original Message----- From: omaha-pm-bounces@pm.org [mailto:omaha-pm-bounces@pm.org]On Behalf Of Daniel Linder Sent: Tuesday, January 11, 2005 2:59 PM To: omaha-pm@mail.pm.org Subject: [Omaha.pm] Using a perl module without installing it... -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm doing some development on a customers system. I am using Perl scripts to do some quick-and-dirty data manipulation. I need to use a module but I can't install it on this system. The packge itself (Statistics-LineFit) is very simple -- the whole inteligence of the package is contained in a single file (lib/Statistics/LineFit.pm). To use this package normally, you would "use Statistics::LineFit;", but that will look in the system library directories. Questions: 1: Can anyone give me pointers so that I can replace the "use XXX::YYY;" syntax and do something like "include /full/path/to/YYY.pm" or other such trick? 2: Or, can someone give me hints as to how to write my script to modify the @INC variable (??) to use ~/lib rather than the systems default "/usr/lib/perl5/..." directories? Dan - - - - - "I do not fear computer, I fear the lack of them." -- Isaac Asimov GPG fingerprint:9EE8 ABAE 10D3 0B55 C536 E17A 3620 4DCA A533 19BF -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFB5D38NiBNyqUzGb8RAphpAKCJvgjjh8QVSwzDxZRvtsxPt2tISgCcD4OX a0ZBLiniAHzoza26Pjc9Wbc= =rxtD -----END PGP SIGNATURE----- _______________________________________________ Omaha-pm mailing list Omaha-pm@pm.org http://mail.pm.org/mailman/listinfo/omaha-pm From jay at jays.net Fri Jan 14 11:52:07 2005 From: jay at jays.net (Jay Hannah) Date: Fri Jan 14 11:52:36 2005 Subject: [Omaha.pm] rrdtool rulez Message-ID: Wow. rrdtool is cooler than I thought. I've been messing with it for a week and now I have 25 different things I'm monitoring by minute, week, year, and biannually (approx.). I was introduced to RRD via MRTG and Big Brother, but I didn't realize how cool and customizable it was for your own arbitrary stuff. http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/ Using a Perl library to talk to RRD makes things even quicker to set up: http://search.cpan.org/~mschilli/RRDTool-OO-0.11/lib/RRDTool/OO.pm (Thanks Mike!!) I wrote a little (Perl) CGI wrapper around it and now I can RRD, graph, and trend any new datapoint I want in about 10 minutes. I also didn't realize how sweet the RRD built-in graphing stuff is. Mix and match (stack, multi-line, whatever) all your different RRD datasets. Run calculations, summaries, whatever. Graphs pop out instantly in gobs of different styles, formats, etc. Don't like the look? Tweak the config and the graph changes -- the data is completely stand-alone. Much quicker than GD::Graph'ing stuff myself!! -grin- j From jay at jays.net Fri Jan 14 12:13:20 2005 From: jay at jays.net (Jay Hannah) Date: Fri Jan 14 12:13:47 2005 Subject: [Omaha.pm] Data::Diff rulez Message-ID: Wow. Hey programmers: How many times have you had to lock-step between two different variable/object structures to find the differences (or similarities)? How many weird complex nested data structures have you tried to compare against each other using gobs of your own buggy code? ... what? I'm the only one? Oh well, I'll continue anyway. Hey sys admins: How many times have you looked at "ps -ef" output, waited a few seconds, then looked at "ps -ef" output again to see what changed? Ever run "diff" on two files? Ever want to see what changed in your "ps -ef" output every few seconds w/o having to work for it? I wrote the script below this week. If you run it with no parameters it runs "ps -ef" every 60 seconds (change that to however many seconds you want) and kicks out the differences from the last "ps -ef" run. So, let the program run and watch your screen and the program reports in every 60 seconds listing every program that just started and every program that just finished. It ignores the other 800 process running on the server that haven't moved. Neat, huh? ... what? I'm the only one that thinks so? Oh well, I'll continue anyway. Or, perhaps you want to see the differences between what "ps -ef" reported at 2pm today vs. 8am this morning? Set up cron to dump "ps -ef" to a file every minute or hour or whatever, then just hand my script the two filenames as arguments and it'll tell you what changed. Neat. The BEAUTIFUL thing is all the code I didn't have to write to make the thing work. Data::Diff takes any two nested complex data structures and tells you all the differences (wow, I didn't have to write my own lock-step crap?!? thank heavens!!). As you probably know you can go totally nuts w/ complex nested data structures in Perl. No matter how ugly, if you've got two of 'em, Data::Diff can tell you the differences. Sampling has never been lazier. http://search.cpan.org/~gcampbell/Data-Diff-0.01/Diff.pm (Thanks George!!) j (my script could be a lot prettier -- it's just a hack) yes, I realize there's probably other ps diff'ing utils out there but I couldn't find em w/ 5 mins on Google... Begin forwarded message: > #!/usr/bin/perl > > use strict; > use Data::Diff; > use Date::Calc qw( Today_and_Now ); > use FileHandle; > STDOUT->autoflush(); > > if ($ARGV[0] and $ARGV[1]) { > my $first = memorize($ARGV[0]); > my $second = memorize($ARGV[1]); > my $diff = Data::Diff->new($first, $second); > print_diff($diff); > exit; > } > > print "Ok. Running forever, reporing in every 60 sec.\n"; > > my $old = memorize(); > while (sleep 60) { > printf("%04d-%02d-%02d %02d:%02d:%02d\n", Today_and_Now()); > my $new = memorize(); > my $diff = Data::Diff->new($old, $new); > print_diff($diff); > $old = $new; > } > > > sub memorize { > # Memorize a list of processes... > my ($file) = @_; > $file ||= 'ps -ef |'; > > my %ret; > open (IN, $file); > while () { > chomp; > s/.*\d+:\d\d //; > s/ +$//; > $ret{$_}++; > } > return \%ret; > } > > sub print_diff { > my ($diff_obj) = @_; > > my (%diff, %uniq_a, %uniq_b); > if ($diff_obj->{out}->{diff}) { > %diff = %{$diff_obj->{out}->{diff}}; > } > if ($diff_obj->{out}->{uniq_a}) { > %uniq_a = %{$diff_obj->{out}->{uniq_a}}; > } > if ($diff_obj->{out}->{uniq_b}) { > %uniq_b = %{$diff_obj->{out}->{uniq_b}}; > } > > foreach (keys %diff) { > printf( > "%4s -> %4s %s\n", > $diff{$_}->{diff_a}, > $diff{$_}->{diff_b}, > $_ > ); > } > foreach (keys %uniq_a) { > printf( > "%4s -> 0 %s\n", > $uniq_a{$_}, > $_ > ); > } > foreach (keys %uniq_b) { > printf( > " 0 -> %4s %s\n", > $uniq_b{$_}, > $_ > ); > } > > } > > > exit; > > > __END__ > > ps -ef looks like this on my system: > root 5486 9848 0 02:30:59 - 0:00 /usr/sbin/syslogd > root 5688 1 0 02:29:25 - 0:00 > /usr/lib/methods/ssa_daemon -l ssa0 > root 5992 9848 0 02:31:03 - 0:01 sendmail: accepting > connections > > the guts of Date::Diff objects look like this: > 'out' => HASH(0x304a781c) > 'diff' => HASH(0x304ae960) > '-bash' => HASH(0x304ae918) > 'diff_a' => 16 > 'diff_b' => 15 > 'type' => '' > > 'uniq_a' => HASH(0x304ac480) > ' - 106798 - - - ' > => 1 > '/oexec/__obin/allres.4ge dreeves' => 1 > '/oexec/__obin/rcvlbmn.4ge CHIDTN' => 1 > '/oexec/__obin/rcvlbmn.4ge NYCBER' => 1 > '[prcavai.]' => 1 > 'sshd: dthacker@pts/29' => 1 > 'uniq_b' => HASH(0x304c0264) > '/oexec/__obin/allres.4ge ccasarru' => 1 > '/oexec/__obin/rcvlbmn.4ge CRPBFT' => 1 > '/usr/bin/perl /home/jhannah/src/jhannah/rrd/omni-res.pl' => 1 > '/usr/bin/perl /oexec/__obin/bkpgmex.pl' => 1 From mat at phpconsulting.com Fri Jan 14 12:34:56 2005 From: mat at phpconsulting.com (Mat Caughron) Date: Fri Jan 14 12:32:58 2005 Subject: [Omaha.pm] rrdtool rulez, I second that thought In-Reply-To: References: Message-ID: Jay et al: Yes, rrdtool rrulez. There's a sweet little php front-end to it too: http://www.cacti.net/ I installed this in like 2002 and it still works like a charm. Amazing how compact the time data storage and that they built it to not have to change in 3+ years. Looks like now they've got scripts for monitoring pretty much every solid daemon; bind, sendmail, qmail, pluls snmp traps, mysql table rows, iptables bandwidth usage, yada yada http://www.cacti.net/additional_scripts.php Full of delicious and chewy *nix goodness and so, so right for the price. :) Mat Caughron, CISSP PHP Consulting On Fri, 14 Jan 2005, Jay Hannah wrote: > > Wow. rrdtool is cooler than I thought. I've been messing with it for a > week and now I have 25 different things I'm monitoring by minute, week, > year, and biannually (approx.). > > I was introduced to RRD via MRTG and Big Brother, but I didn't realize > how cool and customizable it was for your own arbitrary stuff. > > http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/ > > Using a Perl library to talk to RRD makes things even quicker to set up: > > http://search.cpan.org/~mschilli/RRDTool-OO-0.11/lib/RRDTool/OO.pm > (Thanks Mike!!) > > I wrote a little (Perl) CGI wrapper around it and now I can RRD, graph, > and trend any new datapoint I want in about 10 minutes. > > I also didn't realize how sweet the RRD built-in graphing stuff is. Mix > and match (stack, multi-line, whatever) all your different RRD > datasets. Run calculations, summaries, whatever. Graphs pop out > instantly in gobs of different styles, formats, etc. Don't like the > look? Tweak the config and the graph changes -- the data is completely > stand-alone. > > Much quicker than GD::Graph'ing stuff myself!! -grin- > > j > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm@pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm > From jay at jays.net Fri Jan 14 12:53:36 2005 From: jay at jays.net (Jay Hannah) Date: Fri Jan 14 12:53:47 2005 Subject: [Omaha.pm] Using a perl module without installing it... In-Reply-To: <3927.12.160.138.79.1105477116.squirrel@12.160.138.79> References: <3927.12.160.138.79.1105477116.squirrel@12.160.138.79> Message-ID: <5C44A9F4-666E-11D9-B03C-000A95E317B8@jays.net> On Jan 11, 2005, at 2:58 PM, Daniel Linder wrote: > Questions: > 1: Can anyone give me pointers so that I can replace the "use > XXX::YYY;" > syntax and do something like "include /full/path/to/YYY.pm" or other > such > trick? > > 2: Or, can someone give me hints as to how to write my script to modify > the @INC variable (??) to use ~/lib rather than the systems default > "/usr/lib/perl5/..." directories? So I have a package "Jay" in a weird location: $ pwd /Users/jhannah/weird_location $ cat Jay.pm package Jay; sub hello { print "Hi!\n"; } 1; If I'm in /Users/jhannah and I try to use it it doesn't work: $ perl -e 'use Jay; Jay::hello()' Can't locate Jay.pm in @INC (@INC contains: /sw/lib/perl5 /System/Library/Perl/5.8.1/darwin-thread-multi-2level /System/Library/Perl/5.8.1 /Library/Perl/5.8.1/darwin-thread-multi-2level /Library/Perl/5.8.1 /Library/Perl /Network/Library/Perl/5.8.1/darwin-thread-multi-2level /Network/Library/Perl/5.8.1 /Network/Library/Perl .) at -e line 1. BEGIN failed--compilation aborted at -e line 1. (Solution 1) Use -I when invoking perl from "perldoc perlrun" -Idirectory Directories specified by -I are prepended to the search path for modules (@INC), and also tells the C preprocessor where to search for include files. The C preprocessor is invoked with -P; by default it searches /usr/include and /usr/lib/perl. $ perl -I "/Users/jhannah/weird_location" -e 'use Jay; Jay::hello()' Hi! (Solution 2) Set your $PERL5LIB environmental variable. from "perldoc perlrun" PERL5LIB A list of directories in which to look for Perl library files before looking in the standard library and the cur- rent directory. Any architecture-specific directories -snip!- $ setenv PERL5LIB /Users/jhannah/weird_location ( That was MAC OSX. Linux would be 'export PERL5LIB=/Users/jhannah/weird_location' ) $ perl -e 'use Jay; Jay::hello()' Hi! (Solution 3) 'use lib' in your script. see "perldoc lib" $ perl -e 'use lib "/Users/jhannah/weird_location"; use Jay; Jay::hello()' HTH, j From jay at jays.net Fri Jan 14 12:59:21 2005 From: jay at jays.net (Jay Hannah) Date: Fri Jan 14 12:59:33 2005 Subject: [Omaha.pm] rrdtool rulez, I second that thought In-Reply-To: References: Message-ID: <2A287D15-666F-11D9-B03C-000A95E317B8@jays.net> On Jan 14, 2005, at 2:34 PM, Mat Caughron wrote: > Yes, rrdtool rrulez. There's a sweet little php front-end to it too: > http://www.cacti.net/ > > I installed this in like 2002 and it still works like a charm. > Amazing how compact the time data storage and that they built it to not > have to change in 3+ years. > > Looks like now they've got scripts for monitoring pretty much every > solid > daemon; bind, sendmail, qmail, pluls snmp traps, mysql table rows, > iptables bandwidth usage, yada yada > http://www.cacti.net/additional_scripts.php Lots of plug ins. Very neat. If it did email notifications, paging and escalation it might compete w/ Big Brother? j From dan at linder.org Fri Jan 14 13:32:06 2005 From: dan at linder.org (Daniel Linder) Date: Fri Jan 14 13:24:37 2005 Subject: [Omaha.pm] Using a perl module without installing it... In-Reply-To: <5C44A9F4-666E-11D9-B03C-000A95E317B8@jays.net> References: <3927.12.160.138.79.1105477116.squirrel@12.160.138.79> <5C44A9F4-666E-11D9-B03C-000A95E317B8@jays.net> Message-ID: <61916.68.227.169.49.1105738326.squirrel@68.227.169.49> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jay and Mike, Thanks for the hints -- when I get back around to the project I'll use one of your hints (probably the "use lib" variant). Thanks! Dan - - - - - "I do not fear computer, I fear the lack of them." -- Isaac Asimov GPG fingerprint:9EE8 ABAE 10D3 0B55 C536 E17A 3620 4DCA A533 19BF -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFB6DpWNiBNyqUzGb8RAuG8AJwNowf3r8L9i6sNZgv2au/MO6+xcQCggw9V uCisFPLSbL8CabMF+S+THMw= =5aYo -----END PGP SIGNATURE----- From jay at jays.net Fri Jan 14 13:38:43 2005 From: jay at jays.net (Jay Hannah) Date: Fri Jan 14 13:38:54 2005 Subject: [Omaha.pm] Using a perl module without installing it... In-Reply-To: <61916.68.227.169.49.1105738326.squirrel@68.227.169.49> References: <3927.12.160.138.79.1105477116.squirrel@12.160.138.79> <5C44A9F4-666E-11D9-B03C-000A95E317B8@jays.net> <61916.68.227.169.49.1105738326.squirrel@68.227.169.49> Message-ID: On Jan 14, 2005, at 3:32 PM, Daniel Linder wrote: > Thanks for the hints -- when I get back around to the project I'll use > one > of your hints (probably the "use lib" variant). Thanks! What? There's life outside of Perl? Who knew? Grin, j oh... you must be working on a *different* Perl project... -grin- From jay at jays.net Fri Jan 14 15:09:03 2005 From: jay at jays.net (Jay Hannah) Date: Fri Jan 14 15:09:13 2005 Subject: [Omaha.pm] Re: Data::Diff rulez In-Reply-To: References: Message-ID: <481BAD9C-6681-11D9-B03C-000A95E317B8@jays.net> On Jan 14, 2005, at 4:17 PM, Campbell, George wrote: > Thanks a lot your email. Its great to know someone has benefited from > my > work. I originally wrote it to diff the data structures that I got > from two > XML files. Let me know if you have any problems with it there is a > lot of > exceeding mind bending recursion going on in that module that I > wouldn't > wish on my worst enemy. I'm amazed whenever a package is capable of walking arbitrary complex nested data structures. Vamsi blew my mind with this one: http://omaha.pm.org/puzzlin1.txt I'm not worthy of you Perl geniuses. -grin- Thanks again!! j (You might want to tweak Data::Diff on CPAN -- in the POD under AUTHOR your email address is dead.) From jay at jays.net Fri Jan 14 15:21:03 2005 From: jay at jays.net (Jay Hannah) Date: Fri Jan 14 15:21:17 2005 Subject: [Omaha.pm] Re: rrdtool rulez In-Reply-To: <20050114141643.L91669@spiral.corp.yahoo.com> References: <20050114141643.L91669@spiral.corp.yahoo.com> Message-ID: On Jan 14, 2005, at 4:17 PM, Mike Schilli wrote: > On Fri, 14 Jan 2005, Jay Hannah wrote: >> Using a Perl library to talk to RRD makes things even quicker to set >> up: >> http://search.cpan.org/~mschilli/RRDTool-OO-0.11/lib/RRDTool/OO.pm >> (Thanks Mike!!) > > You're very welcome, glad you like it :). :) Are you the helpdesk too? -grin- If you have a minute maybe you could help. If not don't worry about it. Below is a snippet I'm using to create 4 graphs. Questions: 1) You'll notice I used color 'FFFFFF' on the first 4 datasets. That's because I didn't really want to graph those (for these graphs), I just wanted to get them defined so I could calculate the 5th dataset. In pure rdtool I could have used DEF to define but not graph those, but under RRDToool::OO it looks like I'm always automatically CDEF'ing so I always end up graphing. Am I missing something? Is there some way I could have used 'cnt' in the final 'cdef' w/o graphing it? 2) You'll notice my super-ugly @args hackery at the bottom to get my historical graphs done. Anything obvious I should be doing instead? 3) Is RPN a total pain or is it just me? -grin- Thanks again! j my $rrd = RRDTool::OO->new( file => "$dir/rrds/USW-cnt.rrd" ); my $image = "$dir/pngs/capacity_level1.png"; my @args = ( image => $image, #lazy => undef, vertical_label => 'Capacity', start => time() - (60*60*16), end => time(), width => 960, draw => { type => "area", file => "$dir/rrds/USW-cnt.rrd", color => 'FFFFFF', legend => 'USW-cnt', name => 'cnt', }, draw => { type => "stack", file => "$dir/rrds/perseus1.rrd", color => 'FFFFFF', legend => 'perseus1', name => 'perseus1', }, draw => { type => "stack", file => "$dir/rrds/perseus2.rrd", color => 'FFFFFF', legend => 'perseus2', name => 'perseus2', }, draw => { type => "area", file => "$dir/rrds/USW-drops.rrd", color => 'FFFFFF', legend => 'USW-drops', thickness => 1, name => 'drops', }, draw => { type => "line", file => "$dir/rrds/USW-drops.rrd", color => 'FF00FF', legend => 'capacity', cdef => "drops,0,GT,perseus1,perseus2,+,cnt,+,drops,-,NAN,IF", thickness => 1, }, ); $rrd->graph(@args); $args[1] = "$dir/pngs/capacity_level2.png"; $args[5] = time() - (60*30*960); $args[11]{cfunc} = 'AVERAGE'; $args[13]{cfunc} = 'AVERAGE'; $args[15]{cfunc} = 'AVERAGE'; $args[17]{cfunc} = 'AVERAGE'; $rrd->graph(@args); $args[1] = "$dir/pngs/capacity_level3.png"; $args[5] = time() - (60*60*2*960); $rrd->graph(@args); $args[1] = "$dir/pngs/capacity_level4.png"; $args[5] = time() - (60*60*24*960); $rrd->graph(@args); From topher at zyp.org Sat Jan 15 05:18:23 2005 From: topher at zyp.org (Christopher Cashell) Date: Sat Jan 15 05:18:33 2005 Subject: [Omaha.pm] rrdtool rulez, I second that thought In-Reply-To: <2A287D15-666F-11D9-B03C-000A95E317B8@jays.net> References: <2A287D15-666F-11D9-B03C-000A95E317B8@jays.net> Message-ID: <20050115131822.GA27842@zyp.org> At Fri, 14 Jan 05, Unidentified Flying Banana Jay Hannah, said: > Lots of plug ins. Very neat. If it did email notifications, paging and > escalation it might compete w/ Big Brother? If you like Big Brother, you should check out Nagios[0]. A quick overview of it's features[1] is available, too. > j [0] http://www.nagios.org [1] http://www.nagios.org/about.php -- | Christopher +------------------------------------------------+ | Here I stand. I can do no other. | +------------------------------------------------+ From noel at metc.net Mon Jan 17 09:59:30 2005 From: noel at metc.net (Noel Leistad) Date: Mon Jan 17 09:57:05 2005 Subject: [Omaha.pm] Re: Data::Diff rulez In-Reply-To: <481BAD9C-6681-11D9-B03C-000A95E317B8@jays.net> Message-ID: looks like a cool tool. I've done the compare ps -ef thing way too much. executing the script gives me the following: Can't load '/usr/local/lib/perl5/site_perl/5.8.6/i686-linux/auto/Date/Calc/Calc.so' for module Date::Calc: /usr/local/lib/perl5/site_perl/5.8.6/i686-linux/auto/Date/Calc/Calc.so: undefined symbol: PL_stack_max at /usr/lib/perl5/5.8.3/i386-linux-thread-multi/DynaLoader.pm line 229. at ./tdiff line 5 Compilation failed in require at ./tdiff line 5. BEGIN failed--compilation aborted at ./tdiff line 5. yet, # ll /usr/local/lib/perl5/site_perl/5.8.6/i686-linux/auto/Date/Calc/Calc.so gives: -r-xr-xr-x 1 root root 81674 Jan 17 11:50 /usr/local/lib/perl5/site_perl/5.8.6/i686-linux/auto/Date/Calc/Calc.so Suggestions?? Copied this from DynaLoader.pm: # Many dynamic extension loading problems will appear to come from # this section of code: XYZ failed at line 123 of DynaLoader.pm. # Often these errors are actually occurring in the initialisation # C code of the extension XS file. Perl reports the error as being # in this perl code simply because this was the last perl code # it executed. my response is: huh?, OK, so now where do I go?? TIA Noel Leistad Internet System Administrator Marne & Elk Horn Telephone Co 4242 Main Street Elk Horn IA 51531 noel@metc.net 888-764-6141 Toll-Free 712-764-2773 FAX From jay at jays.net Mon Jan 17 13:06:01 2005 From: jay at jays.net (Jay Hannah) Date: Mon Jan 17 13:06:21 2005 Subject: [Omaha.pm] Re: rrdtool rulez Message-ID: <9780AC6A-68CB-11D9-96D2-000A95E317B8@jays.net> From m@perlmeister.com Sat Jan 15 20:28:07 2005 From: Mike Schilli To: Jay Hannah Cc: Mike Schilli , Omaha Perl Mongers Mongers Subject: Re: rrdtool rulez Date: Sat, 15 Jan 2005 20:15:46 -0800 (PST) On Fri, 14 Jan 2005, Jay Hannah wrote: > Are you the helpdesk too? -grin- Ha! :) Sure. > 1) You'll notice I used color 'FFFFFF' on the first 4 datasets. That's > because I didn't really want to graph those (for these graphs), I just > wanted to get them defined so I could calculate the 5th dataset. In > pure rdtool I could have used DEF to define but not graph those, but > under RRDToool::OO it looks like I'm always automatically CDEF'ing so I > always end up graphing. Am I missing something? Is there some way I > could have used 'cnt' in the final 'cdef' w/o graphing it? RRDTool:OO 0.11 introduced "type => 'hidden'" for graphs which you don't want to draw. > 2) You'll notice my super-ugly @args hackery at the bottom to get my > historical graphs done. Anything obvious I should be doing instead? Hmm, relying on array indices for the different draws could bite you at some point :). How about encapsulating the call to ->draw() in a function like sub drawgraph { my($rrd, %options) = @_; $options{start} ||= time() - (60*60*16); $options{cfunc} ||= 'MAX'; $rrd->graph( image => $image, vertical_label => 'Capacity', start => $options{start}, ###### !!!! end => time(), width => 960, draw => { type => "area", file => "$dir/rrds/USW-cnt.rrd", color => 'FFFFFF', legend => 'USW-cnt', name => 'cnt', cfunc => $options{cfunc}, ###### !!!! }, # ... } which uses optional parameters and defaults to sensible defaults if they're omitted? > 3) Is RPN a total pain or is it just me? -grin- It helps if you have spent considerable time programming HP-41CV's in the 80ies :). But of course, today it makes things unnecessarily complex. When I wrote RRDTool::OO, I was very close to adding a 'normal' arithmetic parser, transforming everything into RPN before handing it over to RRDTool. Hey, maybe I'll take it on now :). -- Mike Mike Schilli m@perlmeister.com From jhannah at omnihotels.com Wed Jan 19 08:01:10 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Wed Jan 19 08:01:50 2005 Subject: [Omaha.pm] DBI /(Raise|Print)Error/ trick... Message-ID: <200501191601.j0JG1Wvh013399@omares-email.omnihotels.com> Interesting. I don't think I've used this trick before. My program has DBI's RaiseError and PrintError on globally, but for this one SQL statement I really don't care if it works or not. (If it fails it'll work next time. No biggie.) This is suggested in "perldoc DBI"... { local ($dbh->{RaiseError}, $dbh->{PrintError}); $dbh->do("delete from $test where property_id = 'TEST'"); } I never use local, but here it seems pretty handy. { } is a new block, and local sets up a copy of those variables just for the scope of my { }. As soon as it exists that block, those variables go back to whatever they were before. Pretty neat, huh? j From jay at jays.net Wed Jan 19 14:35:56 2005 From: jay at jays.net (Jay Hannah) Date: Wed Jan 19 14:36:08 2005 Subject: [Omaha.pm] Re: Item Reservation [User Group Library at Reboot The User.] In-Reply-To: <20050119163800.6127.qmail@vr.reboottheuser.com> References: <20050119163800.6127.qmail@vr.reboottheuser.com> Message-ID: <7C29413E-6A6A-11D9-92DA-000A95E317B8@jays.net> On Jan 19, 2005, at 10:38 AM, Ronald D. Gerdes wrote: > Hi Jay Hannah, > > The following item(s) have been reserved: > * "Advanced DBI (OSCON 2003 Presentation)" > > ----------------------------------------------------------------------- > ------- > User Group Library at Reboot The User. 0.62p6 - Open Lending Database > Project. > http://library.reboottheuser.com/ > ----------------------------------------------------------------------- > ------- Hey, the library thing works? Cool! Hi Ronald. Did you pick up that book @ Reboot The User? Cheers, j (Jay Hannah) Jay Hannah = Perl Mongers group leader Jay Swackhamer = Reboot The User proprietor From jay at jays.net Thu Jan 20 07:06:56 2005 From: jay at jays.net (Jay Hannah) Date: Thu Jan 20 07:07:07 2005 Subject: [Omaha.pm] No mtg tonight Message-ID: In case anyone remembered that our mtgs are usually the 3rd Thr of every month, and in case said persons were not disuaded by the very broken state of the "Next meeting:" indicator on our homepage, please know that I won't be able to come tonight (I have family stuff to attend to). Which isn't to say y'all can't have a mtg without me, you're certainly free to do so. I'm going to be moving omaha.pm.org off of the Perl Mongers server and onto my own, I just haven't had enough time yet. See you next month! Perl on! j From jhannah at omnihotels.com Thu Jan 20 08:56:45 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Thu Jan 20 08:57:19 2005 Subject: [Omaha.pm] if ($a > $b) { $b = $a } Message-ID: <200501201657.j0KGv6vh018750@omares-email.omnihotels.com> I seem to write this pattern in my code a lot when I'm trying to find the maximum value of something: if ($a > $b) { $b = $a; } Is there some slick Perl operator that does that cleaner? That pattern gets pretty ugly in my real code. e.g.: if ($running_simul{$type} > $stats{$type}{'max simul'}{$time}) { $stats{$type}{'max simul'}{$time} = $running_simul{$type}; } j From andy at petdance.com Thu Jan 20 09:23:11 2005 From: andy at petdance.com (Andy Lester) Date: Thu Jan 20 09:23:26 2005 Subject: [Omaha.pm] if ($a > $b) { $b = $a } In-Reply-To: <200501201657.j0KGv6vh018750@omares-email.omnihotels.com> References: <200501201657.j0KGv6vh018750@omares-email.omnihotels.com> Message-ID: <20050120172311.GC14651@petdance.com> On Thu, Jan 20, 2005 at 10:56:45AM -0600, Jay Hannah (jhannah@omnihotels.com) wrote: > > I seem to write this pattern in my code a lot when I'm trying to find the maximum value of something: > > if ($a > $b) { > $b = $a; > } First, you can write it as $b=$a if $a>$b, which takes up less visual space. > Is there some slick Perl operator that does that cleaner? You can write yourself a max() function: $b = max($b,$a); There's one in List::Util that, I believe, comes by default these days. > if ($running_simul{$type} > $stats{$type}{'max simul'}{$time}) { > $stats{$type}{'max simul'}{$time} = $running_simul{$type}; > } You could do something like an update_if_larger() function: update_if_larger( $stats{$type}{'max simul'}{$time}, $running_simul{$type} ); sub update_if_larger { $_[0] = $_[1] if $_[1] > $_[0] ); xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From Kent.Tegels at hdrinc.com Thu Jan 20 09:30:42 2005 From: Kent.Tegels at hdrinc.com (Tegels, Kent) Date: Thu Jan 20 09:30:53 2005 Subject: [Omaha.pm] if ($a > $b) { $b = $a } Message-ID: <8046479841F5F84C9BD1F5CF4AD4379E027F90C2@OMA-G-L.intranet.hdr> Well, there's the dreaded: $b = ($a > b$ ? $a : $b); But that's less readable than what you have. Optionally, you could roll your own max sub if you like. Helpful? kt -----Original Message----- From: omaha-pm-bounces@pm.org [mailto:omaha-pm-bounces@pm.org] On Behalf Of Jay Hannah Sent: Thursday, January 20, 2005 10:57 AM To: omaha-pm@pm.org Subject: [Omaha.pm] if ($a > $b) { $b = $a } I seem to write this pattern in my code a lot when I'm trying to find the maximum value of something: if ($a > $b) { $b = $a; } Is there some slick Perl operator that does that cleaner? That pattern gets pretty ugly in my real code. e.g.: if ($running_simul{$type} > $stats{$type}{'max simul'}{$time}) { $stats{$type}{'max simul'}{$time} = $running_simul{$type}; } j _______________________________________________ Omaha-pm mailing list Omaha-pm@pm.org http://mail.pm.org/mailman/listinfo/omaha-pm From jay at jays.net Thu Jan 20 21:23:33 2005 From: jay at jays.net (Jay Hannah) Date: Thu Jan 20 21:23:43 2005 Subject: [Omaha.pm] Re: Data::Diff rulez In-Reply-To: References: Message-ID: <97D05C5E-6B6C-11D9-AA81-000A95E317B8@jays.net> On Jan 17, 2005, at 11:59 AM, Noel Leistad wrote: > Can't load > '/usr/local/lib/perl5/site_perl/5.8.6/i686-linux/auto/Date/Calc/ > Calc.so' for > module Date::Calc: > /usr/local/lib/perl5/site_perl/5.8.6/i686-linux/auto/Date/Calc/Calc.so: > undefined symbol: PL_stack_max at > /usr/lib/perl5/5.8.3/i386-linux-thread-multi/DynaLoader.pm line 229. > at ./tdiff line 5 > Compilation failed in require at ./tdiff line 5. > BEGIN failed--compilation aborted at ./tdiff line 5. I'd try re-installing Dave::Calc. Below is a Usenet thread I found on Google complaining about the same C thing, only in a different package... I assume you can't 'use Date::Calc' in any Perl script w/o it blowing up? j -------------------------------------- > >> /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Tk/Event/Event.so: > >> undefined symbol: PL_stack_max at This is the C compilation error in your distribution. > >> /usr/lib/perl5/site_perl/5.005/i386-linux/Tk.pm line 15 This is your clue that the use lib worked, and it found Tk.pm. Perl is dying at line 15 of Tk.pm - presumably, where it tries and fails to load the Event.so extention. So it found your distribution fine - the distribution is bad. > >> BEGIN failed--compilitation aborted at > >> /usr/lib/perl5/site_perl/5.005/i386-linux/Tk.pm line 15. > I was unable to find a perl/Tk distro at CPAN. Well, if by distro you mean 'rpm', you're right. No comments there. But if by distro you mean 'installable package,' you'll find it at: http://www.cpan.org/modules/by-module/Tk/Tk800.018.tar.gz From jay at jays.net Thu Jan 20 21:28:45 2005 From: jay at jays.net (Jay Hannah) Date: Thu Jan 20 21:28:55 2005 Subject: [Omaha.pm] Re: Data::Diff rulez In-Reply-To: <97D05C5E-6B6C-11D9-AA81-000A95E317B8@jays.net> References: <97D05C5E-6B6C-11D9-AA81-000A95E317B8@jays.net> Message-ID: <51F05708-6B6D-11D9-AA81-000A95E317B8@jays.net> On Jan 20, 2005, at 11:23 PM, Jay Hannah wrote: > I'd try re-installing Dave::Calc. Sheesh. Of course I meant Date::Calc there. j From jay at jays.net Thu Jan 20 22:31:08 2005 From: jay at jays.net (Jay Hannah) Date: Thu Jan 20 22:31:31 2005 Subject: [Omaha.pm] Fwd: Newsletter from O'Reilly UG Program, January 20 Message-ID: <08B5300C-6B76-11D9-AA81-000A95E317B8@jays.net> Here's the Perl highlights: Anyone want to fly to Europe for these? > ***Allison Randal ("Perl 6 and Parrot Essentials") at UKUUG's 2005 > LISA/Winter Conference, Birmingham, UK--Feb 24-25 > Author and editor Allison Randal presents a Perl 6 Workshop at this > event. > http://www.ukuug.org/events/winter2005/ > > ***FOSDEM, Brussels, Belgium--Feb 26-27 > O'Reilly is a Cornerstone sponsor of the fifth Free and Open Source > Software Developers' European Meeting, a 2 day event organized by > volunteers. Stop by our stand to check out our latest books and chat > with > editor and author Allison Randal (Perl 6 and Parrot Essentials), who > will > also be there. > http://www.fosdem.org/2005 If so, take me with you! -grin- > ***An Introduction to Quality Assurance > The libraries and syntax for automated testing are easy to find. The > mindset of quality and testability is harder to adopt. Tom McTighe > reviews > the basic principles of quality assurance that can make the difference > between a "working" application and a high-quality application. > http://www.perl.com/pub/a/2005/01/13/quality_assurance.html Cheers, j And below, the entire newsletter in case you're interested... Begin forwarded message: > From: Marsee Henon > Date: January 20, 2005 7:27:36 PM CST > To: jay@jays.net > Subject: Newsletter from O'Reilly UG Program, January 20 > > ================================================================ > O'Reilly UG Program News--Just for User Group Leaders > January 20, 2005 > ================================================================ > -LinuxWorld Boston Expo Passes, Photoshop World Expo Passes, MySQL > Users > Conference Brochures, and ETech Brochures all available for your > members > -Put Up an Emerging Technology Conference Banner, Get a Free Book > ---------------------------------------------------------------- > Book Info > ---------------------------------------------------------------- > ***Review books are available > Copies of our books are available for your members to review-- > send me an email and please include the book's ISBN number on > your request. Let me know if you need your book by a certain date. > Allow at least four weeks for shipping. > > > ***Please send copies of your book reviews > Email me a copy of your newsletters or book reviews. > For tips and suggestions on writing book reviews, go to: > http://ug.oreilly.com/bookreviews.html > > > ***Discount information > Don't forget to remind your members about our 20% discount on O'Reilly, > No Starch, Paraglyph, Pragmatic Bookshelf, SitePoint, and Syngress > books and O'Reilly conferences. > Just use code DSUG. > > > ***Group purchases with better discounts are available > Please let me know if you are interested and I can put you in > touch with our sales department. > > ---------------------------------------------------------------- > General News > ---------------------------------------------------------------- > -LinuxWorld Boston Expo Passes, Photoshop World Expo Passes, MySQL > Users > Conference Brochures, and ETech Brochures all available for your > members > > Here is a list of the events, locations, and dates to peruse. Please > let > me know which event and how many passes or brochures you would like. > (I have a limited number of each, so don't wait too long!) > > LinuxWorld, Boston, MA--February 15-17 > Expo Passes > > Photoshop World, Las Vegas, NV--March 9, > Expo Passes > > O'Reilly Emerging Technology Conference (ETech), San Diego, CA > --March 14-17 > Brochures > > MySQL Users Conference, Santa Clara, CA--April 18-21 > Brochures > > > ***Put Up an Emerging Technology Conference Banner, Get a Free Book > We are looking for user groups to display our conference banner on > their > web sites. If you send me the link to your user group site with our > banner, I will send you the book of your choice. > > Emerging Technology Conference Banners: > http://ug.oreilly.com/banners/etech2005/ > > ================================================================ > O'Reilly News for User Group Members > January 20, 2005 > ================================================================ > ---------------------------------------------------------------- > Book News > ---------------------------------------------------------------- > -QuickTime for Java: A Developer's Notebook > -Excel: The Missing Manual > -Learning Windows Server 2003 > -Excel Annoyances > -Degunking eBay > -Google Hacks, 2nd Edition > -AspectJ Cookbook > -The Book of Postfix > -Home Hacking Projects for Geeks > -Windows XP Home Edition: The Missing Manual, 2nd Edition > -Illustrations with Photoshop: A Designer's Notebook > -Small Web Sites, Great Results > -Learning GNU Emacs, 3rd Edition > ---------------------------------------------------------------- > Upcoming Events > ---------------------------------------------------------------- > -O'Reilly at LinuxWorld, Boston, MA--Feb 15-17 > -Mark Lutz ("Programming Python") at Python Bootcamp, > Atlanta, GA--Feb 21-25 > -Allison Randal ("Perl 6 and Parrot Essentials") at UKUUG's 2005 > LISA/Winter Conference, Birmingham, UK--Feb 24-25 > -FOSDEM, Brussels, Belgium--Feb 26-27 > ---------------------------------------------------------------- > Conference News > ---------------------------------------------------------------- > -OSCON Call For Proposals now open > -Early Registration ends January 31 for the 2005 O'Reilly > Emerging Technology Conference San Diego, CA--March 14-17 > -Registration Is Open for the 2005 MySQL Users Conference, > Santa Clara, CA--April 18-21 > ---------------------------------------------------------------- > News > ---------------------------------------------------------------- > -Race for the Ultimate Car Hacks > -"Make" subscriptions now available--Just in Case you Missed > This Last Time > -Color for Coders--Color and Design for the Non-Designer > -Designing for Clients Made Easy > -Printing XML: Why CSS Is Better than XSL > -A Review of PalmOne???s Zire 72 and 31 > -BoundCast interview with Andy Hertzfeld, author of "Revolution in > the Valley" > -A Podcast With Wallace Wang, author of "Steal This File Sharing Book" > -Network Installation of Windows Printers from Samba > -An Introduction to Quality Assurance > -Macworld 1984 > -A RAW Look at iPhoto 5 > -How to Use mutt, FastMail, and Mail.app Together on Your Mac > -Disk Cleanup Hacks > -Using SQL Cache Dependency > -Run Mac OS X on a PC > -Parsing an XML Document with XPath > -Mock Objects in Unit Tests > -Time-Saving Digital GEM Plug-Ins for Photoshop > -Frank Serafine: Turning Elephants into Explosions > > ================================================ > Book News > ================================================ > Did you know you can request a free book to review for your > group? Ask your group leader for more information. > > For book review writing tips and suggestions, go to: > http://ug.oreilly.com/bookreviews.html > > Don't forget, you can receive 20% off any O'Reilly, No Starch, > Paraglyph, Pragmatic Bookshelf, SitePoint, or Syngress book you > purchase directly from O'Reilly. > Just use code DSUG when ordering online or by phone 800-998-9938. > http://www.oreilly.com/ > > ***Free ground shipping is available for online orders of at > least $29.95 that go to a single U.S. address. This offer > applies to U.S. delivery addresses in the 50 states and Puerto Rico. > For more details, go to: > http://www.oreilly.com/news/freeshipping_0703.html > > ---------------------------------------------------------------- > New Releases > ---------------------------------------------------------------- > ***QuickTime for Java: A Developer's Notebook > Publisher: O'Reilly > ISBN:0596008228 > Java developers who need to add audio, video, or interactive media > creation and playback to their applications find that QuickTime Java > is a > powerful toolkit, but one that's not easy to get into. This book offers > the first real look at this important software with an informal, > code-intensive style that lets impatient early adopters focus on > learning > by doing. You get just the functionality you need. > http://www.oreilly.com/catalog/quicktimejvaadn/ > > Chapter 5, "Working with QuickDraw," is available online: > http://www.oreilly.com/catalog/quicktimejvaadn/chapter/index.html > > > ***Excel: The Missing Manual > Publisher: O'Reilly > ISBN: 0596006640 > Whether you're an Excel neophyte, a sophisticate who knows the program > inside out, or an intermediate-level plodder, this "Missing Manual" > will > become your go-to resource for all things Excel. Covering all the > features > of Excel 2002 and 2003, this easy-to-read, thorough, and downright > enjoyable book is an indispensable guide to one of the most popular and > complicated computer programs. It has all you need to excel at Excel. > http://www.oreilly.com/catalog/exceltmm/ > > Chapter 4, "Formatting Worksheets," is available online: > http://www.oreilly.com/catalog/exceltmm/chapter/index.html > > > ***Learning Windows Server 2003 > Publisher: O'Reilly > ISBN: 0596006241 > "Windows Server 2003" is the right server for a world dominated by > enterprise networks and web-based server applications, but getting this > server up and running is a formidable task. This no-fluff guide gives > you > exactly what you need for installing, configuring, securing, and > managing > Server 2003, and offers hands-on advice for planning, implementing, and > growing Windows networks without trying to teach you how to be a system > administrator. > > Chapter 10, "Windows Terminal Services," is available online: > http://www.oreilly.com/catalog/lwinsvr2003/chapter/index.html > > > ***Excel Annoyances > Publisher: O'Reilly > ISBN: 0596007280 > At last, Excel users have some relief. This book addresses all of the > quirks, bugs, inconsistencies, and hidden features found in the various > versions of Excel. Broken into easy-to-follow categories, such as > Entering > Data, Formatting, Charting, and Printing, "Excel Annoyances" reveals a > goldmine of helpful nuggets you can use to maximize Excel's seemingly > limitless potential. If you've found anything about Excel confusing, > you'll learn how to address it here. > http://www.oreilly.com/catalog/excelannoyances/ > > Chapter 3, "Formula Annoyances," is available online: > http://www.oreilly.com/catalog/excelannoyances/chapter/index.html > > > ***Degunking eBay > Publisher: Paraglyph Press > ISBN: 1932111999 > "Degunking eBay" will show you how to maximize your buying and selling > opportunities, how to clean up and optimize your strategies, how to get > organized and save valuable time and money, and how to protect yourself > from scams and rip-offs--in short, how to clean up and speed up your > transactions on eBay so you run an efficient and profitable business. > http://www.oreilly.com/catalog/1932111999/ > > > ***Google Hacks, 2nd Edition > Publisher: O'Reilly > ISBN: 0596008570 > Featuring dozens of refreshed hacks, plus 25 completely new ones, this > updated edition of "Google Hacks" is a collection of real-world > solutions > to practical Google research problems. Thanks to these > industrial-strength > tips, now you can easily save hours of research time mining Google. > Best > of all, each of the book's 100 hacks is easy to read and digest; > there's > no confusing terminology or extraneous information to hamper your > understanding. > http://www.oreilly.com/catalog/googlehks2/ > > Sample hacks are available online: > http://www.oreilly.com/catalog/googlehks2/chapter/index.html > > > ***AspectJ Cookbook > Publisher: O'Reilly > ISBN: 0596006543 > This hands-on book shows readers why and how common Java development > problems can be solved by using new Aspect-oriented programming (AOP) > techniques. With a wide variety of code recipes for solving day-to-day > design and coding problems using AOP's unique approach, "AspectJ > Cookbook" > demonstrates that AOP is more than just a concept: it's a development > process that will benefit users in an immediate and visible manner. > http://www.oreilly.com/catalog/aspectjckbk/ > > Sample excerpts are available online: > http://www.oreilly.com/catalog/aspectjckbk/chapter/index.html > > > ***The Book of Postfix > Publisher: No Starch Press > ISBN: 1593270011 > Developed with security and speed in mind, Postfix has become a popular > alternative to sendmail and comes preinstalled in many Linux > distributions > as the default mailer. "The Book of Postfix" is a complete guide to > Postfix whether used at home, as a mailrelay or virus-scanning > gateway, or > as a company mailserver. Practical examples show how to deal with daily > challenges like protecting mail users from spam and viruses, managing > multiple domains, and offering roaming access. > http://www.oreilly.com/catalog/1593270011/ > > > ***Home Hacking Projects for Geeks > Publisher: O'Reilly > ISBN: 0596004052 > "Home Hacking Projects for Geeks" presents a wide range of projects, > from > automating light switches to building home theaters using Windows or > Linux-based PCs to building home security systems that rival those > offered > by professional security consultants. The thirteen projects in the book > are divided into three categories: Home Automation, Home Entertainment > Systems, and Security. Designed for hackers of all skill levels, this > fun, > new guide combines creativity with electricity and power tools to > achieve > cool, and sometimes even practical-home automation projects. > http://www.oreilly.com/catalog/homehpfg/ > > Sample excerpts are available online: > http://www.oreilly.com/catalog/homehpfg/chapter/index.html > > > ***Windows XP Home Edition: The Missing Manual, 2nd Edition > Publisher: O'Reilly > ISBN: 059600897X > This comprehensive guide offers a wealth of tips, instructions, and > expert > advice dedicated to making your time with Windows XP safer, easier, and > more fun. It's perfectly suited for both first-time PC fans and budding > power users. Best of all, it's been updated to include Service Pack 2 > (SP2), so you can better defend yourself against viruses, worms, and > hackers. Fill the void in XP documentation with the technical insight, > crystal-clear objectivity, and humor that define the Missing Manuals > series. > http://www.oreilly.com/catalog/windowsxptmm2/ > > > ***Illustrations with Photoshop: A Designer's Notebook > Publisher: O'Reilly > ISBN: 0596008597 > World-renowned French artists share their exciting and innovative > digital > creations in this first-time English translation of their cutting-edge > work. The images in this book will energize image professionals, > graphic > artists, photographers, and computer graphics designers--all creators > of > images, whether still or animated--and will forever change the way you > see > and perform your design work. This visually stunning book will give you > the creative license and technical knowledge needed to create > one-of-a-kind digital illustrations with Photoshop. You are limited > only > by your imagination. > http://www.oreilly.com/catalog/illustphotoadn/ > > > ***Small Web Sites, Great Results > Publisher: Paraglyph Press > ISBN: 1932111905 > Simplicity leads to great results. This book offers design guidelines > to > make websites look professional even on a small scale, techniques to > get > more hits from search engines, and much more that will help readers > construct a holistic web presence that garners real results. The simple > website system described in the book includes a series of pages and > scripts that users can download and instantly put to use on their own > sites. > http://www.oreilly.com/catalog/1932111905/ > > > ***Learning GNU Emacs, 3rd Edition > Publisher: O'Reilly > ISBN: 0596006489 > "Learning GNU Emacs, 3rd Edition" shows readers how to get started with > the GNU Emacs editor. This thorough guide grows with you: as you become > more proficient, it teaches you how to use Emacs more effectively. The > new > edition describes Emacs 21.3 from the ground up, including new > user-interface features such as an icon-based toolbar and an > interactive > interface to Emacs customization. There's also a new chapter that > details > how to install, run, and use Emacs on Mac OS X, Windows, and Linux. > http://www.oreilly.com/catalog/gnu3/ > > Chapter 6, "Writing Macros," is available online: > http://www.oreilly.com/catalog/gnu3/chapter/index.html > > ================================================ > Upcoming Events > ================================================ > ***For more events, please see: > http://events.oreilly.com/ > > ***O'Reilly at LinuxWorld, Boston, MA--Feb 15-17 > Stop by our booth (#509) to check out our latest Linux and open source > titles and listen to our authors including Jonathan Corbet ("Linux > Device > Drivers, 3rd Ed."), Kyle D. Dent ("Postfix: The Definitive Guide"), Jay > Beale "Snort 2.1 Intrusion Detection, 2nd Ed.", Sam Hiser and Tom > Adelstein ("Exploring the JDS Linux Desktop"), and Adam Trachtenberg > ("PHP > Cookbook"). > http://www.linuxworldexpo.com/live/12/events/12BOS05A > > > ***Mark Lutz ("Programming Python") at Python Bootcamp, > Atlanta, GA--Feb 21-25 > Mark will be teaching a week-long Python Bootcamp retreat for Big Nerd > Ranch, based on his books. > http://www.bignerdranch.com/about/python0205pr.shtml > > > ***Allison Randal ("Perl 6 and Parrot Essentials") at UKUUG's 2005 > LISA/Winter Conference, Birmingham, UK--Feb 24-25 > Author and editor Allison Randal presents a Perl 6 Workshop at this > event. > http://www.ukuug.org/events/winter2005/ > > > ***FOSDEM, Brussels, Belgium--Feb 26-27 > O'Reilly is a Cornerstone sponsor of the fifth Free and Open Source > Software Developers' European Meeting, a 2 day event organized by > volunteers. Stop by our stand to check out our latest books and chat > with > editor and author Allison Randal (Perl 6 and Parrot Essentials), who > will > also be there. > http://www.fosdem.org/2005 > > ================================================ > Conference News > ================================================ > ***OSCON Call For Proposals Now Open > Circle August 1-5 on your calendar and join us at the O'Reilly Open > Source > Convention in beautiful Portland, Oregon. OSCON 2005 will be at the > Oregon > Convention Center, where we'll have tutorials, sessions, parties, BOFs, > and a huge exhibit hall. > http://conferences.oreillynet.com/os2005/ > > The call for participation is open, and you're invited to submit a > proposal to lead tutorials and sessions. Visit the submissions page for > all the details on tracks and proposal guidelines. Proposals are due no > later than February 13, 2005. > http://conferences.oreillynet.com/cs/os2005/create/e_sess > > > ***Early Registration ends January 31 for the 2005 O'Reilly Emerging > Technology Conference San Diego, CA--March 14-17 > Early Bird registration for ETech has just opened. This year's > conference > theme is "Remix," which infuses ETech's roll-up-your-sleeves tutorials, > to-the-point plenary presentations, and real world focused breakout > sessions. Come to ETech and discover how applications and hardware are > being deconstructed and recombined in unexpected ways. Learn how users > and > customers are influencing new interfaces, devices, business models, and > services. For all the scoop on tutorials, featured speakers, and > conference events, check out: > http://conferences.oreillynet.com/etech/ > > User Group members who register before January 31, 2005 get a double > discount. Use code DSUG when you register, and receive 20% off the > early registration price. > > To register for the conference, go to: > http://conferences.oreillynet.com/cs/et2005/create/ord_et05 > > > ***Registration Is Open for the 2005 MySQL Users Conference, > Santa Clara, CA--April 18-21 > The MySQL Users Conference, co-presented by O'Reilly Media and MySQL > AB, > brings together experts, users, and industry leaders with unique MySQL > insights, offering attendees a detailed look into new features in MySQL > 5.0, sessions and workshops designed to teach best practices, and > exposure > to new open source technologies. > For more information, go to: > http://www.mysqluc.com/ > > User Group members who register before Febuary 28, 2005 get a double > discount. Use code DSUG when you register, and receive 20% off the > early registration price. > > To register for the conference, go to: > http://conferences.oreillynet.com/cs/mysqluc2005/create/ord_mysql05 > > ================================================ > News From O'Reilly & Beyond > ================================================ > --------------------- > General News > --------------------- > ***Race for the Ultimate Car Hacks > "People have been tinkering with their cars since the first horseless > buggy hit the road. Now, thanks to onboard computerized systems that > control everything from engine management systems to radios, hackers > can > customize their rides in ways that are likely to have Henry Ford doing > back flips in his grave." TechnologyReview.com writer Michelle Delio > speaks with Damien Stolarz, CEO of Carbot, and Raffi Krikorian, > director > of Synthesis Studios. > http://www.technologyreview.com/articles/04/12/wo_delio121604.asp? > trk=nl > > Join Damien and Raffi at O'Reilly's upcoming ETech for their tutorial, > "Hack Sci-Fi Features into Your Car." > http://conferences.oreillynet.com/cs/et2005/view/e_sess/6242 > > > ***"Make" subscriptions now available--Just in Case you Missed > this Last Time > The annual subscription price for four issues is $34.95. When you > subscribe with this link, you'll get a free issue--the first one plus > four > more for $34.95. So subscribe for yourself or friends with this great > offer for charter subscribers: five volumes for the cost of four. > Subscribe at: > https://www.pubservice.com/MK/Subnew.aspx?PC=MK&PK=M5ZUGLA > > > ***Color for Coders--Color and Design for the Non-Designer > Programmers do have to work with color sometimes, but even the least > artistic coder can choose snappy color combinations with Jason Beaird's > handy how-to. This tutorial cuts through the artsy hyperbole to provide > the nuts and bolts of color theory--and its practical application. > http://www.sitepoint.com/article/color-for-coders > > > ***Designing for Clients Made Easy > Clients can be among the biggest hurdles to a web design project's > success. Astute designers use a number of tactics to ensure they keep > the > project in control, on time, and on budget...and have some creative fun > along the way. > http://www.sitepoint.com/article/designing-for-clients-made-easy > > > ***Printing XML: Why CSS Is Better than XSL > One of the old school debates among XML developers is "CSS versus > XSLT." > Hakun Wium Lie and Michael Day revive that debate with a shot across > XSL's bow. > http://www.xml.com/pub/a/2005/01/19/print.html > > > ***A Review of PalmOne???s Zire 72 and 31 > Wei-Meng Lee takes a look at a couple of PalmOne devices, and is > pleased > by what he finds. > http://www.oreillynet.com/pub/a/wireless/2005/01/17/zire.html > > --------------------- > Audio Webcasts > --------------------- > ***BoundCast interview with Andy Hertzfeld, author of "Revolution > in the Valley" > This is the first of a two part series interview with Andy Hertzfield > that > covers his book "Revolution in the Valley," Apple, and the future. > http://www.boundcast.com/ > > > ***A Podcast With Wallace Wang, author of "Steal This File Sharing > Book" > Wallace and Denise Howell discuss the future of P2P networks, nefarious > knitters, macchiato moms, the Ninth Circuit's Grokster decision, the > economics of digital media, and other topics. > http://www.thestandard.com/movabletype/denisehowell/archives/000825.php > > --------------------- > Open Source > --------------------- > ***Network Installation of Windows Printers from Samba > The combination of Samba and CUPS makes network printing on a mixed > Linux/Windows LAN easier than ever. You can share Linux printers with > Windows clients, and Windows printers with Linux clients. A > Linux/Samba/CUPS printer server is reliable and reasonably simple to > set > up and maintain. Carla Schroder, author of "Linux Cookbook," shows > you how. > http://www.linuxdevcenter.com/pub/a/linux/2005/01/13/lnxckbk_samba.html > > > ***An Introduction to Quality Assurance > The libraries and syntax for automated testing are easy to find. The > mindset of quality and testability is harder to adopt. Tom McTighe > reviews > the basic principles of quality assurance that can make the difference > between a "working" application and a high-quality application. > http://www.perl.com/pub/a/2005/01/13/quality_assurance.html > > --------------------- > Mac > --------------------- > ***Macworld 1984 Animation > As seen at Macworld Live! with David Pogue at the recent Macworld Expo > San > Francisco 2005. > http://www.macboy.com/macworld/index.html > > > ***A RAW Look at iPhoto 5 > Apple overhauled much of iPhoto in version 5 and presented > photographers > with a more robust tool for managing their media files. Derrick Story > looks at importing existing iPhoto libraries, using the new editing > tools, > and working with RAW and QuickTime files. Image samples of RAW > comparisons > are included. > http://www.macdevcenter.com/pub/a/mac/2005/01/19/iphoto5.html > > > ***How to Use mutt, FastMail, and Mail.app Together on Your Mac > Many Linux users who are adding Mac OS X to their computing life look > to > combine the control of command line with the convenience of GUI. In > this > article, Philip Hollenback, a seasoned Linux user himself, shows how to > bring these worlds together on Mac OS X using mutt, FastMail, and > Mail.app. > http://www.macdevcenter.com/pub/a/mac/2005/01/18/fastmail.html > > --------------------- > Windows/.NET > --------------------- > ***Disk Cleanup Hacks > No matter how much space you have on your hard disk, it's never enough. > Mitch Tulloch, author of "Windows Server Hacks," shows you better ways > to > clean your hard disk quickly. > http://www.windowsdevcenter.com/pub/a/windows/2005/01/18/ > disk_cleanup.html > > > ***Using SQL Cache Dependency > Caching has long been recognized as one of the more effective ways to > improve your ASP.NET web applications. One particular caching feature > missing in ASP.NET 1.x was SQL cache dependency: the ability to > invalidate > a database cache if data in a table is changed. In ASP.NET 2.0, > Microsoft > has added the new SQL cache dependency feature. Wei-Meng Lee discusses > the > SQL cache dependency in ASP.NET 2.0, and how you can manually > implement it > in ASP.NET 1.x. > http://www.ondotnet.com/pub/a/dotnet/2005/01/17/sqlcachedependency.html > > > ***Run Mac OS X on a PC > You can get the best of both worlds--you can run the real Mac OS X on > your > own PC. Wei-Meng Lee shows you how to run the Mac operating system on > an > emulator called PearPC. > http://www.windowsdevcenter.com/pub/a/windows/2005/01/18/PearPC.html > > --------------------- > Java > --------------------- > ***Parsing an XML Document with XPath > Pulling just a single node value or attribute from an XML document can > be > inefficient if you have to parse over a whole list of nodes you don't > want, just to get to one you do. XPath can be much more efficient, by > letting you specify the path to the desired node up front. J2SE adds > XPath > support, and the JDOM API also offers support through an XPath class. > Deepak Vohra looks at both approaches. > http://www.onjava.com/pub/a/onjava/2005/01/12/xpath.html > > > ***Mock Objects in Unit Tests > Unit testing your code against a service or process that's either too > expensive (commercial databases) or just not done yet is something you > can > deal with by simulating the other piece with a mock object. EasyMock > can > suffice in some cases, but it can only create mock objects for > interfaces. > Mocquer, based on the Dunamis project, can create mocks for classes, > too. > Lu Jian shows how it works. > http://www.onjava.com/pub/a/onjava/2005/01/12/mocquer.html > > --------------------- > Digital Media > --------------------- > ***Time-Saving Digital GEM Plug-Ins for Photoshop > Removing noise from images or trying to retouch facial blemishes is > time-consuming work. Fortunately these Photoshop plug-ins from Kodak's > Austin Development Center can help photographers work more efficiently. > Derrick Story takes them for a spin. > http://digitalmedia.oreilly.com/2005/01/05/kodak_plugins.html > > > ***Frank Serafine: Turning Elephants into Explosions > Academy Award-winning sound designer Frank Serafine discusses the art > and > science of sound effects, tape-baking, and why selling all his analog > gear > on eBay made him happier musically. > http://digitalmedia.oreilly.com/2005/01/12/serafine_0105.html > > ================================================ >> From Your Peers > =============================================== > Don't forget to check out the O'Reilly UG wiki to see what user groups > across the globe are up to: > http://wiki.oreillynet.com/usergroups/index.cgi > > > Until next time-- > > Marsee From jhannah at omnihotels.com Fri Jan 21 09:04:28 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri Jan 21 09:05:00 2005 Subject: [Omaha.pm] Beaten to the typo fix punch once again... Message-ID: <200501211704.j0LH4mPQ013550@omares-email.omnihotels.com> http://public.activestate.com/cgi-bin/perlbrowse?patch=23002 + * "Canadian Dollar" was mis-spelled as "Candian Dollar" + - noted by Nick Cabatoff, patch from Michael Hennecke j From dthacker9 at cox.net Fri Jan 21 12:10:11 2005 From: dthacker9 at cox.net (Dave Thacker) Date: Fri Jan 21 12:07:39 2005 Subject: [Omaha.pm] Re: Data::Diff rulez In-Reply-To: <51F05708-6B6D-11D9-AA81-000A95E317B8@jays.net> References: <97D05C5E-6B6C-11D9-AA81-000A95E317B8@jays.net> <51F05708-6B6D-11D9-AA81-000A95E317B8@jays.net> Message-ID: <200501211410.11856.dthacker9@cox.net> On Thursday 20 January 2005 23:28, Jay Hannah wrote: > On Jan 20, 2005, at 11:23 PM, Jay Hannah wrote: > > I'd try re-installing Dave::Calc. > > Sheesh. Of course I meant Date::Calc there. > > j > Darn. For a minute there, I thought I'd had a module named after me. Dave Thacker From jay at jays.net Fri Jan 21 14:12:21 2005 From: jay at jays.net (Jay Hannah) Date: Fri Jan 21 14:12:46 2005 Subject: [Omaha.pm] Re: Data::Diff rulez In-Reply-To: <200501211410.11856.dthacker9@cox.net> References: <97D05C5E-6B6C-11D9-AA81-000A95E317B8@jays.net> <51F05708-6B6D-11D9-AA81-000A95E317B8@jays.net> <200501211410.11856.dthacker9@cox.net> Message-ID: <85C7E883-6BF9-11D9-9705-000A95E317B8@jays.net> On Jan 21, 2005, at 2:10 PM, Dave Thacker wrote: > On Thursday 20 January 2005 23:28, Jay Hannah wrote: >> On Jan 20, 2005, at 11:23 PM, Jay Hannah wrote: >>> I'd try re-installing Dave::Calc. >> >> Sheesh. Of course I meant Date::Calc there. > > Darn. For a minute there, I thought I'd had a module named after me. > > Dave Thacker What would Dave calc? j From jay at jays.net Fri Jan 21 14:36:10 2005 From: jay at jays.net (Jay Hannah) Date: Fri Jan 21 14:36:21 2005 Subject: [Omaha.pm] Dec 16 mtg notes Message-ID: Ooops, I never did post this. These were my notes from Ron and I messing w/ Tie::STDERR and Handler during our Dec 16 mtg. j ----------------------------- use Tie::STDERR \&func; warn "Ack!"; sub func { print "Trapped: [@_]\n"; } ------------------------------------ use Tie::STDERR \&func; warn "Ack!"; sub func { print "Trapped: [@_]\n"; } use Net::FTP; $ftp = Net::FTP->new("ftp.microsoft.com", Debug => 0) or die "Cannot connect to some.host.name: $@"; $ftp->login("anonymous",'blah@jays.net') or die "Cannot login ", $ftp->message; $ftp->put("that.file") ; # or die "put failed ", $ftp->message; ------------------------------- package Handler; sub TIEHANDLE { print "\n"; my $i; bless \$i, shift } sub PRINT { print "Handled: [", shift, "]\n" } package main; tie(*STDOUT, 'Handler'); tie(*STDERR, 'Handler'); print "boo!"; #warn "BOO!"; From jhannah at omnihotels.com Fri Jan 21 14:47:03 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri Jan 21 14:47:32 2005 Subject: [Omaha.pm] RE: logger In-Reply-To: <200501211811.j0LIB7PQ018236@omares-email.omnihotels.com> Message-ID: <200501212247.j0LMlNPQ002539@omares-email.omnihotels.com> > Hmmm... I must've been doing it wrong then. I ended using Sys::syslog > instead- Sean said you weren't encouraging Control::Logger anymore. Well, I wrote Omni's Control::Logger from scratch and added all kinds of cool features to it. Then I went to a Perl Mongers meeting and Ron said "that sounds a lot like what I'm using: log4perl". The mind boggles. At a glance it appears that log4perl does all the cool stuff I programmed, and probably more. The biggest bonus being that I wouldn't have had to write it myself. http://log4perl.sourceforge.net/ So it's not that I'm not anti- Control::Logger now, I'm just wondering whether or not I/we should port to the "industry standard" that I didn't even know existed until that fateful Perl Mongers meeting... j Ron, ex-Java guy, trumping my code I was all proud of... -sigh- -grin- From glim at mycybernet.net Mon Jan 24 19:08:00 2005 From: glim at mycybernet.net (glim@mycybernet.net) Date: Mon Jan 24 19:07:14 2005 Subject: [Omaha.pm] Yet Another Perl Conference North America 2005 announces call-for-papers Message-ID: YAPC::NA 2005 (Yet Another Perl Conference, North America) has just released its call-for-papers; potential and aspiring speakers can submit a presentation proposal via: http://yapc.org/America/cfp-2005.shtml The dates of the conference are Monday - Wednesday 27-29 June 2005. The location will be in downtown Toronto, Ontario, Canada. (Note that a different date block was previously announced, but has been moved to accomodate venue availability.) The close of the call-for-papers is April 18, 2005 at 11:59 pm. If you have any questions regarding the call-for-papers or speaking at YAPC::NA 2005 please email na-author@yapc.org We would love to hear from potential sponsors. Please contact the organizers at na-sponsor@yapc.org to learn about the benefits of sponsorship. Other information regarding the conference (e.g. venue, registration specifics) will be announced soon. We look forward to your submissions and a great conference! From jhannah at omnihotels.com Fri Jan 28 12:38:12 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Sun Jan 30 18:44:11 2005 Subject: [Omaha.pm] Quiz: select * Message-ID: <200501282038.j0SKcUPQ009535@omares-email.omnihotels.com> Quiz: What's wrong with doing "select *" followed by fetchrow_array? j --- sub fill_airline_codes() { my ($dbh,$typ)=@_; my %ret; my $sqlstr=<prepare($sqlstr) or fatal_error_handler("[$sqlstr][$DBI::errstr]\n"); $sth->execute($typ)or fatal_error_handler("Execute of [$sqlstr][[$DBI::errstr]\n"); my @t; while (@t = $sth->fetchrow_array) { for (@t) { s/[^ -~]//g; s/\s+$//; } $ret{$t[1]} = $t[3]; } return \%ret; } From dan at linder.org Fri Jan 28 14:49:19 2005 From: dan at linder.org (Daniel Linder) Date: Sun Jan 30 18:44:15 2005 Subject: [Omaha.pm] Perl-golf -- zero-pad an IP address. Message-ID: <41065.12.160.138.85.1106952559.squirrel@12.160.138.85> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 It's Perl Golf (note 1) time! I recently wrote a quick script that took a standard IP address format of 12.34.56.78 and reformat it to zero-padded numbers (012.034.056.078). Here is the smallest subroutine I could come up with: sub zeropad { my $IN = shift; $IN =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; return (sprintf("%03d.%03d.%03d.%03d", $1, $2, $3, $4)); } Is there any way to get rid of the "$IN" variable? I tried this but it didn't work: sub zeropad { shift; /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; return (sprintf("%03d.%03d.%03d.%03d", $1, $2, $3, $4)); } Dan Note 1: "Perl Golf" defintion: http://perlgolf.sourceforge.net/ - - - - - "I do not fear computer, I fear the lack of them." -- Isaac Asimov GPG fingerprint:9EE8 ABAE 10D3 0B55 C536 E17A 3620 4DCA A533 19BF -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFB+sFvNiBNyqUzGb8RAhlQAKCKrlm4C1fozXImOo26+40Q51bovgCdHOoH Lm9godPyEJjTjQi5XGmjMhw= =0zGB -----END PGP SIGNATURE----- From andy at petdance.com Sun Jan 30 18:55:51 2005 From: andy at petdance.com (Andy Lester) Date: Sun Jan 30 18:56:00 2005 Subject: [Omaha.pm] Quiz: select * In-Reply-To: <200501282038.j0SKcUPQ009535@omares-email.omnihotels.com> References: <200501282038.j0SKcUPQ009535@omares-email.omnihotels.com> Message-ID: <20050131025551.GA18344@petdance.com> On Fri, Jan 28, 2005 at 02:38:12PM -0600, Jay Hannah (jhannah@omnihotels.com) wrote: > > Quiz: What's wrong with doing "select *" followed by fetchrow_array? Wrong in which sense? In the sense that the column order may change in the future and break your code? -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From jay at jays.net Sun Jan 30 19:29:07 2005 From: jay at jays.net (Jay Hannah) Date: Sun Jan 30 19:29:15 2005 Subject: [Omaha.pm] Perl-golf -- zero-pad an IP address. In-Reply-To: <41065.12.160.138.85.1106952559.squirrel@12.160.138.85> References: <41065.12.160.138.85.1106952559.squirrel@12.160.138.85> Message-ID: <43A267AB-7338-11D9-8988-000A95E317B8@jays.net> On Jan 28, 2005, at 4:49 PM, Daniel Linder wrote: > I recently wrote a quick script that took a standard IP address format > of > 12.34.56.78 and reformat it to zero-padded numbers (012.034.056.078). > Here is the smallest subroutine I could come up with: > > sub zeropad { > my $IN = shift; > $IN =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; > return (sprintf("%03d.%03d.%03d.%03d", $1, $2, $3, $4)); > } sub zeropad { return sprintf("%03d.%03d.%03d.%03d", split /\./, $_[0]); } Cheers, j From jay at jays.net Sun Jan 30 19:31:11 2005 From: jay at jays.net (Jay Hannah) Date: Sun Jan 30 19:31:24 2005 Subject: [Omaha.pm] Quiz: select * In-Reply-To: <20050131025551.GA18344@petdance.com> References: <200501282038.j0SKcUPQ009535@omares-email.omnihotels.com> <20050131025551.GA18344@petdance.com> Message-ID: <8D78166A-7338-11D9-8988-000A95E317B8@jays.net> On Jan 30, 2005, at 8:55 PM, Andy Lester wrote: > On Fri, Jan 28, 2005 at 02:38:12PM -0600, Jay Hannah > (jhannah@omnihotels.com) wrote: >> Quiz: What's wrong with doing "select *" followed by fetchrow_array? > > Wrong in which sense? In the sense that the column order may change in > the future and break your code? Yes. That was exactly the sense I was looking for. -grin- Our code lives a long time. Our tables tend to change. (Plus the less concerning fact that it's wasting CPU cycles on the columns that aren't used.) j From dan at linder.org Sun Jan 30 20:46:46 2005 From: dan at linder.org (Daniel Linder) Date: Sun Jan 30 20:38:52 2005 Subject: [Omaha.pm] Perl-golf -- zero-pad an IP address. In-Reply-To: <43A267AB-7338-11D9-8988-000A95E317B8@jays.net> References: <41065.12.160.138.85.1106952559.squirrel@12.160.138.85> <43A267AB-7338-11D9-8988-000A95E317B8@jays.net> Message-ID: <19250.24.252.28.203.1107146806.squirrel@24.252.28.203> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > sub zeropad { > return sprintf("%03d.%03d.%03d.%03d", split /\./, $_[0]); > } And that is just why I love Perl -- compactness when needed, or verboseness when warranted... Dan - - - - - "I do not fear computer, I fear the lack of them." -- Isaac Asimov GPG fingerprint:9EE8 ABAE 10D3 0B55 C536 E17A 3620 4DCA A533 19BF -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFB/bg1NiBNyqUzGb8RAnPLAJ9PGIhzCOfsGHlqWHNmFv01dtf7gACfUXZa uIRfzHuzbxLnDdWcQPUcA4A= =mSxz -----END PGP SIGNATURE----- From jay at jays.net Sun Jan 30 21:14:10 2005 From: jay at jays.net (Jay Hannah) Date: Sun Jan 30 21:14:22 2005 Subject: [Omaha.pm] Perl-golf -- zero-pad an IP address. In-Reply-To: <19250.24.252.28.203.1107146806.squirrel@24.252.28.203> References: <41065.12.160.138.85.1106952559.squirrel@12.160.138.85> <43A267AB-7338-11D9-8988-000A95E317B8@jays.net> <19250.24.252.28.203.1107146806.squirrel@24.252.28.203> Message-ID: On Jan 30, 2005, at 10:46 PM, Daniel Linder wrote: > And that is just why I love Perl -- compactness when needed, or > verboseness when warranted... Ya. Here's Damian pointing out how much overhead "hello world" has in Java: http://www.builderau.com.au/program/0,39024614,39160082,00.htm j From jhannah at omnihotels.com Mon Jan 31 18:58:27 2005 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon Jan 31 18:58:55 2005 Subject: [Omaha.pm] RE: Hotels In-Reply-To: <200501281536.j0SFaXPQ008388@omares-email.omnihotels.com> Message-ID: <200502010258.j112whPQ031210@omares-email.omnihotels.com> Ya know, that sort of in-breeding is illegal in most states... j (heavily snipped) use Control::Globals; use Control::Hotels; my $Globals = new Control::Globals; $Globals->add('dbh',$dbh); my $h = new Control::Hotels(Globals=>$Globals); $Globals->add('Hotels',$h);