From jay at jays.net Sat Sep 2 01:27:56 2006 From: jay at jays.net (Jay Hannah) Date: Sat, 2 Sep 2006 03:27:56 -0500 Subject: [Omaha.pm] PM shirts: Launch!! Message-ID: Excellent. Everything is looking great. Just a couple of loose ends I'm still circling. Looks like I won't have to cancel ANY of our order. 399 shirts ($2810.25 USD + shipping, paypal). Wow. I am turning the order over to the printing company ASAP. I'll call them this morning, but I assume they don't work weekends, and Monday is a holiday (Labor Day) here in the US, so I assume Tuesday morning will be the hand-over. This is your last chance to find any typos in your shipping address: http://omaha.pm.org/shirts.shtml -grin- Thanks, j (why am I doing this at 3am? -laugh-) GRAND TOTALS Price $ 2810.25 Shipping est. $ 434.00 PayPal est. $ 102.48 Total paid $ -3154.72 Total due $ 192.01 (PayPal actual $ 98.68) From jhannah at omnihotels.com Tue Sep 12 08:10:11 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Tue, 12 Sep 2006 10:10:11 -0500 Subject: [Omaha.pm] code redux Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C56@exchange2k3.omnihotels.net> Uhh... Before $prt{'reversal_flag'} = " "; $prt{'reversal_flag'} = sprintf("%-3s",$prt{'reversal_flag'}); $prt{'reversal_period'} = " "; $prt{'reversal_period'} = sprintf("%-8s",$prt{'reversal_period'}); After $prt{'reversal_flag'} = " "; $prt{'reversal_period'} = " "; Right? j From dave.nerd at gmail.com Tue Sep 12 08:31:12 2006 From: dave.nerd at gmail.com (Dave M) Date: Tue, 12 Sep 2006 10:31:12 -0500 Subject: [Omaha.pm] code redux In-Reply-To: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C56@exchange2k3.omnihotels.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C56@exchange2k3.omnihotels.net> Message-ID: <9ac12b1c0609120831r66715215t258c710e65fd481a@mail.gmail.com> Looks like it to me. It's not like $prt{'blah'} will keep the justification properties, right? Although, I would write things like this: $prt{'reversal_flag'} = (" ") x 3; $prt{'reversal_period'} = (" ") x 5; I hate counting spaces.... :) On 9/12/06, Jay Hannah wrote: > Uhh... > > Before > > $prt{'reversal_flag'} = " "; > $prt{'reversal_flag'} = sprintf("%-3s",$prt{'reversal_flag'}); > $prt{'reversal_period'} = " "; > $prt{'reversal_period'} = sprintf("%-8s",$prt{'reversal_period'}); > > After > > $prt{'reversal_flag'} = " "; > $prt{'reversal_period'} = " "; > > Right? > > j > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm > From jay at jays.net Tue Sep 12 11:21:14 2006 From: jay at jays.net (Jay Hannah) Date: Tue, 12 Sep 2006 13:21:14 -0500 (CDT) Subject: [Omaha.pm] code redux In-Reply-To: <9ac12b1c0609120831r66715215t258c710e65fd481a@mail.gmail.com> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C56@exchange2k3.omnihotels.net> <9ac12b1c0609120831r66715215t258c710e65fd481a@mail.gmail.com> Message-ID: On Tue, 12 Sep 2006, Dave M wrote: > Looks like it to me. It's not like $prt{'blah'} will keep the > justification properties, right? > > Although, I would write things like this: > > $prt{'reversal_flag'} = (" ") x 3; > $prt{'reversal_period'} = (" ") x 5; > > I hate counting spaces.... :) I wrote a class a couple years back that we call Model::FixedWidth. It makes fixed width files a breeze. Unfortunately there are a lot of fixed width formats in our lives so we use the heck out of it. No more counting columns of *anything*. :) The code I posted earlier does everything the hard way, and I can't be bothered to port it today... lazy, lazy boy. j NAME Model::FixedWidth - Easy objects for fixed width text files. One object per line. SYNOPSIS my $fw = new Model::FixedWidth, "new()"); $fw->set_attributes(qw( fname undef %10s lname undef %-10s points 0 %04d ); $fw->parse(message => " JayHannah 0003"); print $fw->get_fname; # Jay print $fw->get_lname; # Hannah print $fw->get_points; # 0003 $fw->set_fname('Chuck'); $fw->set_lname('Norris'); $fw->set_points(17); print $fw->string; # ' ChuckNorris 0017' DESCRIPTION If you're familiar with printf formats, then this class should make processing fixed width files trivial. Just define your attributes and then you can get_* and set_* all day long. When you're happy w/ your values envoke string() to spit out your object in your defined fixed width format. When reading a fixed width file, simply pass each line of the file into parse(), and then you can use the get_ meth- ods to retrieve the value of whatever attributes you care about. See Model/Rewards/* for gobs of real-world uses of this class. METHODS set_attributes Pass in arguments in sets of 3 and we'll set up attributes for you. The first argument is the attribute name. The second argu- ment is the default value we should use until told other- wise. The third is the printf format we should use to read or write this attribute from/to a string. $fw->set_attributes(qw( fname undef %10s lname undef %-10s points 0 %04d ); parse Parse a string. Set each attribute to the value listed in the string. $fw->parse(message => " JayHannah 0003"); string Dump the object to a string. Walks each attribute in order and outputs each in the format that was specified during set_attributes. print $fw->string; # ' ChuckNorris 0017' From jhannah at omnihotels.com Tue Sep 12 13:05:27 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Tue, 12 Sep 2006 15:05:27 -0500 Subject: [Omaha.pm] Moving library paths around... what did I break? Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C5D@exchange2k3.omnihotels.net> I just moved a bunch of library paths around on one of our ancient servers. How do I know what Perl programs I broke? Maybe I'll run "perl -c" on all my programs? If the "use X::Y::Z;" statements can't find X/Y/Z.pm then perl -c should bark at me... $ find ./ -name "*.pl" | xargs -l1 perl -c ./reports/importer.pl syntax OK ./reports/nightly.pl syntax OK ./reports/permission_denied.pl syntax OK ./reports/unknown_report_lister.pl syntax OK ./eWin/eod.pl syntax OK ./eWin/run_eod2.pl syntax OK ./eWin/j.pl syntax OK ./eWin/check_eod.pl syntax OK ./supplier_upload/index.pl syntax OK ./supplier_upload/oracle_supplier_upload.pl syntax OK Oooo... Cool. Looks like I'm OK. :) Just to make sure that works I moved my paths to known bad locations. Yup, every one of those blew up big time. And knowing is half the battle. -grin- j http://www.joeheadquarters.com/joeendings.shtml From dave.nerd at gmail.com Tue Sep 12 13:36:17 2006 From: dave.nerd at gmail.com (Dave M) Date: Tue, 12 Sep 2006 15:36:17 -0500 Subject: [Omaha.pm] Moving library paths around... what did I break? In-Reply-To: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C5D@exchange2k3.omnihotels.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C5D@exchange2k3.omnihotels.net> Message-ID: <9ac12b1c0609121336xb3dd53eo84a42e7a2aa78525@mail.gmail.com> On 9/12/06, Jay Hannah wrote: > > I just moved a bunch of library paths around on one of our ancient > servers. How do I know what Perl programs I broke? > > Maybe I'll run "perl -c" on all my programs? If the "use X::Y::Z;" > statements can't find X/Y/Z.pm then perl -c should bark at me... > > $ find ./ -name "*.pl" | xargs -l1 perl -c > ./reports/importer.pl syntax OK > ./reports/nightly.pl syntax OK > ./reports/permission_denied.pl syntax OK > ./reports/unknown_report_lister.pl syntax OK > ./eWin/eod.pl syntax OK > ./eWin/run_eod2.pl syntax OK > ./eWin/j.pl syntax OK > ./eWin/check_eod.pl syntax OK > ./supplier_upload/index.pl syntax OK > ./supplier_upload/oracle_supplier_upload.pl syntax OK > > Oooo... Cool. Looks like I'm OK. :) > > Just to make sure that works I moved my paths to known bad locations. > Yup, every one of those blew up big time. > > And knowing is half the battle. -grin- > > j Nice! Glad to see you motivated just hours before the Sept Perl Mongers meeting... :) Been dying to get that shirt! #!/usr/bin/perl use strict; use warnings; $|++; our @speakers = "Jay"; our @omaha_pm_topics; for my $speaker (@speakers) { for my $topic (@omaha_pm_topics) { print $speaker, " will be discussing $topic.\n"; } } From jay at jays.net Tue Sep 12 15:37:36 2006 From: jay at jays.net (Jay Hannah) Date: Tue, 12 Sep 2006 17:37:36 -0500 Subject: [Omaha.pm] secret meeting tonight @ 7pm In-Reply-To: <9ac12b1c0609121336xb3dd53eo84a42e7a2aa78525@mail.gmail.com> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C5D@exchange2k3.omnihotels.net> <9ac12b1c0609121336xb3dd53eo84a42e7a2aa78525@mail.gmail.com> Message-ID: <450736B0.5090009@jays.net> Dave M wrote: > Nice! Glad to see you motivated just hours before the Sept Perl > Mongers meeting... :) sssshhh!! I don't want to have to share any pizza! (T minus 84 minutes and counting) http://omaha.pm.org/ > Been dying to get that shirt! Ya. I ordered you a few hundred extra for ya. :) http://omaha.pm.org/shirts.shtml > our @speakers = "Jay"; > our @omaha_pm_topics; > > for my $speaker (@speakers) { > for my $topic (@omaha_pm_topics) { > print $speaker, " will be discussing $topic.\n"; > } > } push @speakers, "DaveM"; push @omaha_pm_topics, "Recent BioPerl exploits (OpenLab vs. ensembl!?)", "How to sell 400 shirts w/ Perl and XML", "The Perl Foundation --- Committees", "PM tickets", "anyone been to the dynamic languages UG?", "Devel::Timer is back in black. SVN those patches!"; j flavor: sneaky geekery From jay at jays.net Tue Sep 12 16:59:55 2006 From: jay at jays.net (Jay Hannah) Date: Tue, 12 Sep 2006 18:59:55 -0500 Subject: [Omaha.pm] [Fwd: Shirts printed and at shipper by 9/22] Message-ID: <450749FB.9090802@jays.net> FYI The shipper hopes to have the 400 shirts in their hands by 9/22. At that point they'll start shipping. j -------- Original Message -------- Subject: RE: Perl Mongers shirts Date: Tue, 12 Sep 2006 08:37:21 -0400 From: Mike Balcom - ASIM Inc. To: 'Jay Hannah' dear jay, we have requested a 9/22 or sooner if possible in our hands date from our production facility. We will hope for the best, as it is a busy time right now. Regards, mike balcom -----Original Message----- From: Jay Hannah [mailto:jay at jays.net] Sent: Monday, September 11, 2006 7:49 PM To: Mike Balcom - ASIM Inc. Subject: Perl Mongers shirts Hi Mike -- Any idea roughly what date you might start shipping? Thanks, j From ryan at cfwebtools.com Wed Sep 13 05:53:00 2006 From: ryan at cfwebtools.com (Ryan Stille) Date: Wed, 13 Sep 2006 07:53:00 -0500 Subject: [Omaha.pm] secret meeting tonight @ 7pm In-Reply-To: <450736B0.5090009@jays.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C5D@exchange2k3.omnihotels.net> <9ac12b1c0609121336xb3dd53eo84a42e7a2aa78525@mail.gmail.com> <450736B0.5090009@jays.net> Message-ID: <4507FF2C.5050603@cfwebtools.com> Doh! I didn't get the notice until this morning. Wish I could have made it. -Ryan From jay at jays.net Wed Sep 13 19:58:33 2006 From: jay at jays.net (Jay Hannah) Date: Wed, 13 Sep 2006 21:58:33 -0500 Subject: [Omaha.pm] secret meeting tonight @ 7pm In-Reply-To: <4507FF2C.5050603@cfwebtools.com> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C5D@exchange2k3.omnihotels.net> <9ac12b1c0609121336xb3dd53eo84a42e7a2aa78525@mail.gmail.com> <450736B0.5090009@jays.net> <4507FF2C.5050603@cfwebtools.com> Message-ID: <4508C559.7010607@jays.net> Ryan Stille wrote: > Doh! I didn't get the notice until this morning. Wish I could have > made it. There's always next month. :) http://omaha.pm.org/ Tue, 10 Oct 2006 @ 7pm! By request, Jay Hannah will be giving the following presentations: 1) Intro to Perl OO programming 2) Fun with fork. Demos of forking and %SIG handling. It'll be a humdinger. Plus the food is to die for. Or maybe booze instead. :) j P.S. Whatever happened to Sidney and Ron? They used to come all the time. What, you guys don't love me any more? Is it the mustache? Should I shave? -grin- "Nobody makes me bleed my own blood. NOBODY." - White Goodman, Dodgeball From dave.nerd at gmail.com Thu Sep 14 04:03:34 2006 From: dave.nerd at gmail.com (Dave M) Date: Thu, 14 Sep 2006 06:03:34 -0500 Subject: [Omaha.pm] secret meeting tonight @ 7pm In-Reply-To: <4508C559.7010607@jays.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C5D@exchange2k3.omnihotels.net> <9ac12b1c0609121336xb3dd53eo84a42e7a2aa78525@mail.gmail.com> <450736B0.5090009@jays.net> <4507FF2C.5050603@cfwebtools.com> <4508C559.7010607@jays.net> Message-ID: <9ac12b1c0609140403i398b0ddla7444385a9901ca0@mail.gmail.com> On 9/13/06, Jay Hannah wrote: > Ryan Stille wrote: > > Doh! I didn't get the notice until this morning. Wish I could have > > made it. > > There's always next month. :) > > http://omaha.pm.org/ > Tue, 10 Oct 2006 @ 7pm! > > By request, Jay Hannah will be giving the following presentations: > > 1) Intro to Perl OO programming Ah HA! I knew you didn't like my 1738 line program!! :) > 2) Fun with fork. Demos of forking and %SIG handling. > > It'll be a humdinger. Plus the food is to die for. Or maybe booze instead. :) > > j > From hostetlerm at gmail.com Tue Sep 19 12:52:36 2006 From: hostetlerm at gmail.com (Mike Hostetler) Date: Tue, 19 Sep 2006 14:52:36 -0500 Subject: [Omaha.pm] DBH statement isn't closing Message-ID: I'm mucking around with DBI stuff for the first time. I thought I did everything right, but I guess I didn't. Here is my code: =============== #!/usr/bin/perl -w use DBI; my $cacheDB = DBI->connect("dbi:SQLite:waypoint.db","","") or die "Couldn't fin\ d cache database"; my $stmt = $cacheDB->prepare("Select lat,lon from waypoint where name=?"); $stmt->execute( ("Home") ); my ($lat,$lon); $stmt->bind_columns(undef,\$lat,\$lon); while ($stmt->fetch() ) { print "$lat\t$lon\n"; } $stmt->finish(); $cacheDB->disconnect(); ========== I get the correct output, but I also get this warning: closing dbh with active statement handles at dberror.pl line 19. I thought I did close it with the finish method. Maybe I didn't. Anyone got an idea? -- Mike Hostetler http://mike.hostetlerhome.com/ From jay at jays.net Wed Sep 20 06:13:22 2006 From: jay at jays.net (Jay Hannah) Date: Wed, 20 Sep 2006 08:13:22 -0500 Subject: [Omaha.pm] [olug] OLUG - Omaha Linux User Group: Third Thursday (fwd) In-Reply-To: References: Message-ID: Date: Sun, 17 Sep 2006 20:42:41 -0500 From: Stan Coleman > Anybody in your group ever successfully write a cron job that only > executes one week before the third thursday of each month? I'm > attempting to write the cron job to post our Amateur Radio Club > meetings over a digital radio. I've seen a few scripts on the web > but so far none of them work. The Distro I'm writing the cron job > on is MEPHIS (Debian) Distro. Perhaps run a Perl script every Thursday (or every day) and have perl execute your script.whatever if it happens to be the 3rd Thursday? ----- #!/usr/bin/perl use strict; use Date::Calc qw( Today Nth_Weekday_of_Month_Year ); my ($y, $m, $d) = Today(); my @third_thursday = Nth_Weekday_of_Month_Year($y, $m, 4, 3); if ($third_thursday[2] == $d) { # Today is the 3rd Thursday of this month. Run! exec '/path/to/notify/script.whatever'; } else { # Today is not the 3rd Thursday of this month. Do nothing. } ----- http://search.cpan.org/~stbey/Date-Calc-5.4/Calc.pod HTH, j Omaha Perl Mongers: http://omaha.pm.org From jay at jays.net Wed Sep 20 06:22:30 2006 From: jay at jays.net (Jay Hannah) Date: Wed, 20 Sep 2006 08:22:30 -0500 Subject: [Omaha.pm] DBH statement isn't closing In-Reply-To: References: Message-ID: On Sep 19, 2006, at 2:52 PM, Mike Hostetler wrote: > I'm mucking around with DBI stuff for the first time. Welcome to the fray! -laugh- > I thought I did everything right, but I guess I didn't. > > Here is my code: > =============== > #!/usr/bin/perl -w > > use DBI; Huh. I'm surprised DBD::SQLite docs say to 'use DBI;'. I would have thought they would say to 'use SQLite;'. Oh well, no matter. > my $cacheDB = DBI->connect("dbi:SQLite:waypoint.db","","") or die > "Couldn't fin\ > d cache database"; > > my $stmt = $cacheDB->prepare("Select lat,lon from waypoint where > name=?"); > > $stmt->execute( ("Home") ); > my ($lat,$lon); > > $stmt->bind_columns(undef,\$lat,\$lon); What does that undef do? Try removing that. > while ($stmt->fetch() ) { > print "$lat\t$lon\n"; > } > > $stmt->finish(); > $cacheDB->disconnect(); > ========== > > I get the correct output, but I also get this warning: > > closing dbh with active statement handles at dberror.pl line 19. > > I thought I did close it with the finish method. Maybe I didn't. I agree with you. Maybe that undef is doing something weird? Many, many, many DBI gurus hang out here: http://lists.cpan.org/showlist.cgi?name=dbi-users They might know. Are your versions of DBD::SQLite and DBI current? perl -MDBI -e 'DBI->installed_versions' j From hostetlerm at gmail.com Wed Sep 20 08:32:50 2006 From: hostetlerm at gmail.com (Mike Hostetler) Date: Wed, 20 Sep 2006 10:32:50 -0500 Subject: [Omaha.pm] DBH statement isn't closing In-Reply-To: References: Message-ID: On 9/20/06, Jay Hannah wrote: > > Huh. I'm surprised DBD::SQLite docs say to 'use DBI;'. I would have > thought they would say to 'use SQLite;'. Oh well, no matter. Just following the docs, man, just following the docs. > > $stmt->bind_columns(undef,\$lat,\$lon); > > What does that undef do? Try removing that. > See my comment above. :) Okay, took it out but no change -- things still worked, but still complainin'. > Are your versions of DBD::SQLite and DBI current? > > perl -MDBI -e 'DBI->installed_versions' > My DBD::SQLite was current (because I just installed it. :) but DBI did not. Upgrading took care of it. Glad it was just that easy. Thanks! -- Mike Hostetler http://mike.hostetlerhome.com/ From jay at jays.net Thu Sep 21 04:46:36 2006 From: jay at jays.net (Jay Hannah) Date: Thu, 21 Sep 2006 06:46:36 -0500 Subject: [Omaha.pm] DBH statement isn't closing In-Reply-To: References: Message-ID: On Sep 20, 2006, at 10:32 AM, Mike Hostetler wrote: > On 9/20/06, Jay Hannah wrote: >> Huh. I'm surprised DBD::SQLite docs say to 'use DBI;'. I would have >> thought they would say to 'use SQLite;'. Oh well, no matter. > > Just following the docs, man, just following the docs. Ya. I meant "use DBD::SQLite;". I believe the DBI docs say to "use" your individual DBD drivers, not DBI itself. Yet the author of DBD::SQLite apparently doesn't care about that (or I am mistaken). Oh well. Whatever works. :) >>> $stmt->bind_columns(undef,\$lat,\$lon); >> >> What does that undef do? Try removing that. >> > See my comment above. :) Okay, took it out but no change -- things > still worked, but still complainin'. Huh. 'bind_columns(undef,' is in the DBD::SQLite docs? >> Are your versions of DBD::SQLite and DBI current? >> >> perl -MDBI -e 'DBI->installed_versions' > > My DBD::SQLite was current (because I just installed it. :) but DBI > did not. Upgrading took care of it. > > Glad it was just that easy. Thanks! No sweat. What are you using SQLite for? Just curious. j From jay at jays.net Thu Sep 21 04:52:47 2006 From: jay at jays.net (Jay Hannah) Date: Thu, 21 Sep 2006 06:52:47 -0500 Subject: [Omaha.pm] secret meeting tonight @ 7pm In-Reply-To: <9ac12b1c0609140403i398b0ddla7444385a9901ca0@mail.gmail.com> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C5D@exchange2k3.omnihotels.net> <9ac12b1c0609121336xb3dd53eo84a42e7a2aa78525@mail.gmail.com> <450736B0.5090009@jays.net> <4507FF2C.5050603@cfwebtools.com> <4508C559.7010607@jays.net> <9ac12b1c0609140403i398b0ddla7444385a9901ca0@mail.gmail.com> Message-ID: <82DC21EB-9C21-43C5-B2CC-32E2200DB545@jays.net> On Sep 14, 2006, at 6:03 AM, Dave M wrote: >> By request, Jay Hannah will be giving the following presentations: >> >> 1) Intro to Perl OO programming > > Ah HA! I knew you didn't like my 1738 line program!! :) -laugh- I believe you requested that I give that talk, not me. I'm very diplomatic when I stare at other peoples code. And any code I wrote more than 2 weeks ago, for that matter. :) For anyone that hasn't seen it, Dave is doing some really cool stuff with Perl/Tk. He's written a largish event-driven app: http://clamtk.sourceforge.net/ I've never done event-driven programming in Perl. "Fat clients" / GUIs. A whole other world. Slick. j From dave.nerd at gmail.com Thu Sep 21 05:16:45 2006 From: dave.nerd at gmail.com (Dave M) Date: Thu, 21 Sep 2006 07:16:45 -0500 Subject: [Omaha.pm] secret meeting tonight @ 7pm In-Reply-To: <82DC21EB-9C21-43C5-B2CC-32E2200DB545@jays.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37C5D@exchange2k3.omnihotels.net> <9ac12b1c0609121336xb3dd53eo84a42e7a2aa78525@mail.gmail.com> <450736B0.5090009@jays.net> <4507FF2C.5050603@cfwebtools.com> <4508C559.7010607@jays.net> <9ac12b1c0609140403i398b0ddla7444385a9901ca0@mail.gmail.com> <82DC21EB-9C21-43C5-B2CC-32E2200DB545@jays.net> Message-ID: <9ac12b1c0609210516j18fbee58qe1d06050f634a8fb@mail.gmail.com> On 9/21/06, Jay Hannah wrote: > On Sep 14, 2006, at 6:03 AM, Dave M wrote: > >> By request, Jay Hannah will be giving the following presentations: > >> > >> 1) Intro to Perl OO programming > > > > Ah HA! I knew you didn't like my 1738 line program!! :) > > -laugh- > > I believe you requested that I give that talk, not me. I'm very > diplomatic when I stare at other peoples code. And any code I wrote > more than 2 weeks ago, for that matter. :) > > For anyone that hasn't seen it, Dave is doing some really cool stuff > with Perl/Tk. He's written a largish event-driven app: > > http://clamtk.sourceforge.net/ > > I've never done event-driven programming in Perl. "Fat clients" / > GUIs. A whole other world. Slick. > The gtk2-perl stuff is neat - check it out here: http://gtk2-perl.sourceforge.net/ There's a good, responsive mailing list and links to some very good tutorials as well, for anyone that's interested in giving it a whirl. Maybe I'll give a lightning talk on beginning gtk2 one of these meetings... a more generic intro talk or something. From hostetlerm at gmail.com Thu Sep 21 06:52:51 2006 From: hostetlerm at gmail.com (Mike Hostetler) Date: Thu, 21 Sep 2006 08:52:51 -0500 Subject: [Omaha.pm] Geo::Distance (Was: DBH statement isn't closing) Message-ID: > No sweat. What are you using SQLite for? Just curious. Something you may be interested in. :) The Geo::Distance module has a method called "closest" in which you can give it a DBI handle, a latitude, longtude, and a distance and return the points in the database that are within that distance. This is very cool stuff -- I was doing it with shell scripts, gpsbabel, and a huge XML file. Doing it with Perl not only makes it easier, it makes it faster, too. Check out the details: http://search.cpan.org/~bluefeet/Geo-Distance-0.11/Distance.pm#closest The error I was getting wasn't from the Geo::Distance call, but from a script I wrote that looks up a waypoint name in my SQLite database, gets it's lat and lon, and then runs Distance->closest. Why SQLite? It's portable, fast, and easy to setup. -- Mike Hostetler http://mike.hostetlerhome.com/ From pbaker at omnihotels.com Thu Sep 21 07:04:04 2006 From: pbaker at omnihotels.com (Sean Baker) Date: Thu, 21 Sep 2006 09:04:04 -0500 Subject: [Omaha.pm] Geo::Distance (Was: DBH statement isn't closing) Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B0679DD5D@exchange2k3.omnihotels.net> Very cool stuff! I used the gcd algorithm quite a while ago to do zone billing for a telecom company. It worked well if the city long/lats didn't cross the equator. It didn't account for the bulge in the Earth. c = 2 * asin( sqrt( ( sin(( lat1 - lat2 )/2) )^2 + cos( lat1 ) * cos( lat2 ) * ( sin(( lon1 - lon2 )/2) )^2 ) ) Too bad I didn't know Perl then, it would have been much easier. Sean Baker -----Original Message----- From: omaha-pm-bounces+pbaker=omnihotels.com at pm.org [mailto:omaha-pm-bounces+pbaker=omnihotels.com at pm.org] On Behalf Of Mike Hostetler Sent: Thursday, September 21, 2006 8:53 AM To: Perl Mongers of Omaha, Nebraska USA Subject: Re: [Omaha.pm] Geo::Distance (Was: DBH statement isn't closing) > No sweat. What are you using SQLite for? Just curious. Something you may be interested in. :) The Geo::Distance module has a method called "closest" in which you can give it a DBI handle, a latitude, longtude, and a distance and return the points in the database that are within that distance. This is very cool stuff -- I was doing it with shell scripts, gpsbabel, and a huge XML file. Doing it with Perl not only makes it easier, it makes it faster, too. Check out the details: http://search.cpan.org/~bluefeet/Geo-Distance-0.11/Distance.pm#closest The error I was getting wasn't from the Geo::Distance call, but from a script I wrote that looks up a waypoint name in my SQLite database, gets it's lat and lon, and then runs Distance->closest. Why SQLite? It's portable, fast, and easy to setup. -- Mike Hostetler http://mike.hostetlerhome.com/ _______________________________________________ Omaha-pm mailing list Omaha-pm at pm.org http://mail.pm.org/mailman/listinfo/omaha-pm From hostetlerm at gmail.com Thu Sep 21 07:25:18 2006 From: hostetlerm at gmail.com (Mike Hostetler) Date: Thu, 21 Sep 2006 09:25:18 -0500 Subject: [Omaha.pm] Geo::Distance (Was: DBH statement isn't closing) In-Reply-To: <29AB736ABCE5C745ABF9C93B02F2C27B0679DD5D@exchange2k3.omnihotels.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B0679DD5D@exchange2k3.omnihotels.net> Message-ID: On 9/21/06, Sean Baker wrote: > Very cool stuff! I used the gcd algorithm quite a while ago to do zone > billing for a telecom company. It worked well if the city long/lats > didn't cross the equator. It didn't account for the bulge in the Earth. [snip] That's a big problem with any such equation -- they all assume the Earth is a perfect sphere, in which it is not. But trying to figure out the *actual* distance . . . well, down that road lies madness. Geo::Distance has a lot of different equations you can use. By default, it uses the Haversine Formula which seems to work pretty well. Jay and I are both into geocaching . . .which is why I'm mucking with this and why I thought Jay would be interested. > Too bad I didn't know Perl then, it would have been much easier. :) Perl has a lot of cool GIS stuff . . . anything under the Geo:: can be very handy. -- Mike Hostetler http://mike.hostetlerhome.com/ From jay at jays.net Mon Sep 25 05:59:56 2006 From: jay at jays.net (Jay Hannah) Date: Mon, 25 Sep 2006 07:59:56 -0500 Subject: [Omaha.pm] Fwd: Quality of CPAN modules, CPAN::Reporter References: Message-ID: <939EEFAB-8CBF-456E-8067-48D7BF615BE8@jays.net> I'm broadly familiar with rt.cpan.org, but I'm not up to speed on all the other quality / smoke / ratings systems. Is anyone else? j Begin forwarded message: > From: "Gabor Szabo" > Date: September 25, 2006 6:41:12 AM CDT > To: "PM Groups" > Subject: [pm_groups] Quality of CPAN modules, CPAN::Reporter > > Hi, > I am not sure if all the pm lists are suitable for advancing specific > Perl and CPAN realted issues. On Israel.pm this seems to be > acceptable. > (I accept it anyway :-) I have justs sent the following to our > mailing list. > If you feel it suitable, plase forward to your mailing list. > Gabor > ----------------------------------------- cut here > --------------------------------------- > > Hi, > > In my Perl courses people always ask me about the quality of the > CPAN modules. One of the key things I am pointing at is CPAN Testers > http://testers.cpan.org/ > > It's a great resource for both module authors and module users. > > The biggest problem with it was so far that relatively few people > sent in > reports, partially because CPANPLUS was required for that. > > Recently I started to use CPAN::Reporter > http://search.cpan.org/dist/CPAN-Reporter/ > that works with the regular CPAN.pm module. Once installed it > will send success and failure report on each one of the modules you > install. > > That is with an initial minor work - installing CPAN::Reporter - > you will be > sending test reports and help the effort of making CPAN a better > place. > > You can watch the queue of the incoming test reports here: > http://www.nntp.perl.org/group/perl.cpan.testers/ > and check that your test reports are showing up a few minutes > after you sent them. > > If anyone needs help setting it up, just post a note here or here > http://www.cpanforum.com/dist/CPAN-Reporter > > Gabor From jay at jays.net Mon Sep 25 06:01:47 2006 From: jay at jays.net (Jay Hannah) Date: Mon, 25 Sep 2006 08:01:47 -0500 Subject: [Omaha.pm] The State of the Onion 10 Message-ID: Sean and I only missed attending this one by about 2 hours (OSCON 2006 in Portland, OR)... http://www.perl.com/pub/a/2006/09/21/onion.html?page=1 j From jay at jays.net Mon Sep 25 19:22:35 2006 From: jay at jays.net (Jay Hannah) Date: Mon, 25 Sep 2006 21:22:35 -0500 Subject: [Omaha.pm] opendir, readdir vs. glob Message-ID: <7E553AD6-1664-4778-B3E1-3C1716406BF0@jays.net> Ok, when glob is this easy to use why have I been using opendir and readdir for years? my @files = glob "/home/jhannah/*"; What could be simpler than that? Anyone out there using Perl on Windows? Does glob work there? http://perldoc.perl.org/functions/glob.html j From andy at petdance.com Mon Sep 25 19:29:35 2006 From: andy at petdance.com (Andy Lester) Date: Mon, 25 Sep 2006 21:29:35 -0500 Subject: [Omaha.pm] opendir, readdir vs. glob In-Reply-To: <7E553AD6-1664-4778-B3E1-3C1716406BF0@jays.net> References: <7E553AD6-1664-4778-B3E1-3C1716406BF0@jays.net> Message-ID: <94EABD21-840E-4F50-9369-22F704C0588E@petdance.com> On Sep 25, 2006, at 9:22 PM, Jay Hannah wrote: > Ok, when glob is this easy to use why have I been using opendir and > readdir for years? Because you didn't know better. > Anyone out there using Perl on > Windows? Does glob work there? Yes, it does. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From dave.nerd at gmail.com Tue Sep 26 04:13:10 2006 From: dave.nerd at gmail.com (Dave M) Date: Tue, 26 Sep 2006 06:13:10 -0500 Subject: [Omaha.pm] opendir, readdir vs. glob In-Reply-To: <94EABD21-840E-4F50-9369-22F704C0588E@petdance.com> References: <7E553AD6-1664-4778-B3E1-3C1716406BF0@jays.net> <94EABD21-840E-4F50-9369-22F704C0588E@petdance.com> Message-ID: <9ac12b1c0609260413m741ffb73u31ea101d2636788e@mail.gmail.com> On 9/25/06, Andy Lester wrote: > > On Sep 25, 2006, at 9:22 PM, Jay Hannah wrote: > > > Ok, when glob is this easy to use why have I been using opendir and > > readdir for years? > > Because you didn't know better. > > > > Anyone out there using Perl on > > Windows? Does glob work there? > > Yes, it does. > glob is nice and easy. I think the only time I end up using readdir is when I want to be specific about what I'm globbing, in which case I mix it with grep. From jay at jays.net Tue Sep 26 06:08:04 2006 From: jay at jays.net (Jay Hannah) Date: Tue, 26 Sep 2006 08:08:04 -0500 Subject: [Omaha.pm] opendir, readdir vs. glob In-Reply-To: <9ac12b1c0609260413m741ffb73u31ea101d2636788e@mail.gmail.com> References: <7E553AD6-1664-4778-B3E1-3C1716406BF0@jays.net> <94EABD21-840E-4F50-9369-22F704C0588E@petdance.com> <9ac12b1c0609260413m741ffb73u31ea101d2636788e@mail.gmail.com> Message-ID: <965E5FE7-2B43-48EF-9B6A-34C9214C3795@jays.net> On 9/25/06, Andy Lester wrote: > On Sep 25, 2006, at 9:22 PM, Jay Hannah wrote: >> Ok, when glob is this easy to use why have I been using opendir and >> readdir for years? > > Because you didn't know better. Why does anyone ever use opendir and readdir? Why aren't they deprecated and removed? >> Anyone out there using Perl on >> Windows? Does glob work there? > > Yes, it does. Cool. Not that I own a Windows machine, or do any Real Work on Windows. Just curious. :) On Sep 26, 2006, at 6:13 AM, Dave M wrote: > glob is nice and easy. I think the only time I end up using readdir is > when I want to be specific about what I'm globbing, in which case I > mix it with grep. Why use readdir? Why not just grep your glob? j (Please don't tell my mother I suggested you grep your glob. -grin-) From dave.nerd at gmail.com Tue Sep 26 06:23:22 2006 From: dave.nerd at gmail.com (Dave M) Date: Tue, 26 Sep 2006 08:23:22 -0500 Subject: [Omaha.pm] opendir, readdir vs. glob In-Reply-To: <965E5FE7-2B43-48EF-9B6A-34C9214C3795@jays.net> References: <7E553AD6-1664-4778-B3E1-3C1716406BF0@jays.net> <94EABD21-840E-4F50-9369-22F704C0588E@petdance.com> <9ac12b1c0609260413m741ffb73u31ea101d2636788e@mail.gmail.com> <965E5FE7-2B43-48EF-9B6A-34C9214C3795@jays.net> Message-ID: <9ac12b1c0609260623k7da8da35sbe6a66fffc74cd22@mail.gmail.com> On 9/26/06, Jay Hannah wrote: > On 9/25/06, Andy Lester wrote: > > On Sep 25, 2006, at 9:22 PM, Jay Hannah wrote: > >> Ok, when glob is this easy to use why have I been using opendir and > >> readdir for years? > > > > Because you didn't know better. > > Why does anyone ever use opendir and readdir? Why aren't they > deprecated and removed? > > >> Anyone out there using Perl on > >> Windows? Does glob work there? > > > > Yes, it does. > > Cool. Not that I own a Windows machine, or do any Real Work on > Windows. Just curious. :) > > On Sep 26, 2006, at 6:13 AM, Dave M wrote: > > glob is nice and easy. I think the only time I end up using readdir is > > when I want to be specific about what I'm globbing, in which case I > > mix it with grep. > > Why use readdir? Why not just grep your glob? Purely habit. The first time I was trying to figure out how to do that, that was the example I saw. From andy at petdance.com Tue Sep 26 06:27:21 2006 From: andy at petdance.com (Andy Lester) Date: Tue, 26 Sep 2006 08:27:21 -0500 Subject: [Omaha.pm] opendir, readdir vs. glob In-Reply-To: <965E5FE7-2B43-48EF-9B6A-34C9214C3795@jays.net> References: <7E553AD6-1664-4778-B3E1-3C1716406BF0@jays.net> <94EABD21-840E-4F50-9369-22F704C0588E@petdance.com> <9ac12b1c0609260413m741ffb73u31ea101d2636788e@mail.gmail.com> <965E5FE7-2B43-48EF-9B6A-34C9214C3795@jays.net> Message-ID: > Why does anyone ever use opendir and readdir? Why aren't they > deprecated and removed? Because they're used all over the place. Removing them would break tons of code unnecessarily. > Why use readdir? Why not just grep your glob? Because there are often cases where you want to step over the contents of a directory one file at a time. What if the directory has 1000 files in it? You want to iterate one file at a time. Now, glob DOES iterate if you call it in scalar context, as in: while ( my $file = glob( '*.txt' ) ) { # do something } You also may have multiple directory handles because you're processing top/ and then find a subdirectory you need to delve into and so you go into top/middle/ and iterate for a while, and now you have to go into top/middle/bottom/ and now top/middle/bottom/ is done, and you go back up and finish in top/middle/, etc etc etc. Take a look at Mark Jason Dominus' excellent "Higher Order Perl" for a lot of discussion of this. For a module that does file iteration for you, in handy little objects, see File::Next: http://search.cpan.org/dist/File-Next/ It's stolen heavily from MJD's book, and made it a simple little interface: use File::Next; my $iter = File::Next->files( '/tmp' ); while ( my $file = $iter->() ) { print $file, "\n"; } # Prints... /tmp/foo.txt /tmp/bar.pl /tmp/baz/1 /tmp/baz/2.txt /tmp/baz/wango/tango/purple.txt Note that it descends into subdirectories by default, but you can change that behavior with the descend_filter, and you can decide files get returned with the file_filter. So you could set up an iterator to find all .txt files in an entire tree, skipping the .svn directories: my $iter = File::Next->files( { file_filter => sub { /\.txt$/ }, descend_filter => sub { $_ ne ".svn" }, }, '.' ); It's really flexible, and easier than messing with File::Find, but is probably overkill if you just want *.txt in a single directory. xoxo, Andy -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jhannah at omnihotels.com Tue Sep 26 11:55:06 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Tue, 26 Sep 2006 13:55:06 -0500 Subject: [Omaha.pm] FW: Template Toolkit INCLUDE that won't die Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37D3D@exchange2k3.omnihotels.net> A neat Template Toolkit trick... j ________________________________ From: Sean Baker Sent: Tuesday, September 26, 2006 1:03 PM I needed to [% INCLUDE %] a template that could or could not exist. It was dying ungracefully in TT, and using [% PERL %] to check to see if the directory and/or file exists was quite ugly. Presto: [% TRY %] [% INCLUDE "$rateInclude" %] [% CATCH %] [% END %] -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20060926/ad049bc5/attachment.html From jay at jays.net Tue Sep 26 19:38:59 2006 From: jay at jays.net (Jay Hannah) Date: Tue, 26 Sep 2006 21:38:59 -0500 Subject: [Omaha.pm] PM T-shirts arrive this week Message-ID: <4519E443.1020401@jays.net> 4 or 5 groups have received their shipments so far, so I assume we're next. When they land I'll drop them off at Reboot the User. Yay! j ----------- http://omaha.pm.org/shirts.shtml ----------- Omaha Shirt Pickup (once the order comes in) Reboot the User (RTU) Jay Swackhamer, proprietor 13416 A Street Omaha, NE 68144 (402) 933-6449 Store hours (from his website): Tuesday through Friday 6:00pm to 11:00pm Saturday 4:00pm to 9:00pm Sunday, Monday Closed. From jhannah at omnihotels.com Wed Sep 27 10:32:55 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Wed, 27 Sep 2006 12:32:55 -0500 Subject: [Omaha.pm] Shirts are in! Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37D4D@exchange2k3.omnihotels.net> I'll drop them off at Reboot The User tonight. http://omaha.pm.org http://omaha.pm.org/shirts.shtml j From jhannah at omnihotels.com Wed Sep 27 14:04:34 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Wed, 27 Sep 2006 16:04:34 -0500 Subject: [Omaha.pm] Binary stuff in my logs Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37D55@exchange2k3.omnihotels.net> A vendor is sending me a few random bytes of binary data in an ASCII stream. When I'm debugging my logs are hard/impossible to read because all that crap is in the way. Here's a little loop to make my logs ugly but readable, and archiving WHAT binary crap they sent me in a way that I can review it later... Not bad for a 10m job? :) j $ cat j.pl my $str = "blah\nand\rstuff\t\t\nline3\cXjunk..."; my $binary_char; while (($binary_char) = ($str =~ /([^ -~])/)) { my $ord = "[ASCII:" . ord($binary_char) . "]"; $str =~ s/\Q$binary_char\E/$ord/gs; print "$str\n"; } print "$str\n"; $ perl j.pl stuffASCII:10]an[ASCII:10]line3junk... blah[ASCII:10]and[ASCII:13]stuff [ASCII:10]line3junk... blah[ASCII:10]and[ASCII:13]stuff[ASCII:9][ASCII:9][ASCII:10]line3junk... blah[ASCII:10]and[ASCII:13]stuff[ASCII:9][ASCII:9][ASCII:10]line3[ASCII: 24]junk... blah[ASCII:10]and[ASCII:13]stuff[ASCII:9][ASCII:9][ASCII:10]line3[ASCII: 24]junk... From jhannah at omnihotels.com Wed Sep 27 14:13:15 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Wed, 27 Sep 2006 16:13:15 -0500 Subject: [Omaha.pm] Binary stuff in my logs (Log::Log4perl) Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37D56@exchange2k3.omnihotels.net> Log::Log4perl follow-up... Hmmm... Now I'm wishing there was a way to ask a Log::Log4perl object if there are any debug level listeners active.... What a waste of CPU if debug() is being ignored... j # ----- # Send this to the debugger in case someone is listening... # If there's binary crap in here don't write that to my logs. # Instead, throw [ASCII:24] and the like to the logs. # Wow... This is a terrible loop if we ever send more than a # few bytes of binary data through the engine!! # -jhannah 2006-09-27 # ----- my $logable_buffer = $self->{buffer}; my $binary_char; while (($binary_char) = ($logable_buffer =~ /([^ -~])/)) { my $ord = "[ASCII:" . ord($binary_char) . "]"; $logable_buffer =~ s/\Q$binary_char\E/$ord/gs; } $logger->debug("My buffer is now $logable_buffer"); From pbaker at omnihotels.com Wed Sep 27 14:37:12 2006 From: pbaker at omnihotels.com (Sean Baker) Date: Wed, 27 Sep 2006 16:37:12 -0500 Subject: [Omaha.pm] Binary stuff in my logs (Log::Log4perl) Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B0689C385@exchange2k3.omnihotels.net> Maybe you can tweak this somehow: $current_level = $logger->level(); ? Sean Baker -----Original Message----- From: omaha-pm-bounces+pbaker=omnihotels.com at pm.org [mailto:omaha-pm-bounces+pbaker=omnihotels.com at pm.org] On Behalf Of Jay Hannah Sent: Wednesday, September 27, 2006 4:13 PM To: Perl Mongers of Omaha, Nebraska USA Subject: Re: [Omaha.pm] Binary stuff in my logs (Log::Log4perl) Log::Log4perl follow-up... Hmmm... Now I'm wishing there was a way to ask a Log::Log4perl object if there are any debug level listeners active.... What a waste of CPU if debug() is being ignored... j # ----- # Send this to the debugger in case someone is listening... # If there's binary crap in here don't write that to my logs. # Instead, throw [ASCII:24] and the like to the logs. # Wow... This is a terrible loop if we ever send more than a # few bytes of binary data through the engine!! # -jhannah 2006-09-27 # ----- my $logable_buffer = $self->{buffer}; my $binary_char; while (($binary_char) = ($logable_buffer =~ /([^ -~])/)) { my $ord = "[ASCII:" . ord($binary_char) . "]"; $logable_buffer =~ s/\Q$binary_char\E/$ord/gs; } $logger->debug("My buffer is now $logable_buffer"); _______________________________________________ Omaha-pm mailing list Omaha-pm at pm.org http://mail.pm.org/mailman/listinfo/omaha-pm From pbaker at omnihotels.com Wed Sep 27 14:39:46 2006 From: pbaker at omnihotels.com (Sean Baker) Date: Wed, 27 Sep 2006 16:39:46 -0500 Subject: [Omaha.pm] Binary stuff in my logs (Log::Log4perl) Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B0689C38D@exchange2k3.omnihotels.net> Or maybe any of this: If you need to find out if the currently configured logging level would allow a logger's logging statement to go through, use the logger's is_level() methods: $logger->is_debug() # True if debug messages would go through $logger->is_info() # True if info messages would go through $logger->is_warn() # True if warn messages would go through $logger->is_error() # True if error messages would go through $logger->is_fatal() # True if fatal messages would go through http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4 perl.html#d12d5 Sean Baker -----Original Message----- From: omaha-pm-bounces+pbaker=omnihotels.com at pm.org [mailto:omaha-pm-bounces+pbaker=omnihotels.com at pm.org] On Behalf Of Jay Hannah Sent: Wednesday, September 27, 2006 4:13 PM To: Perl Mongers of Omaha, Nebraska USA Subject: Re: [Omaha.pm] Binary stuff in my logs (Log::Log4perl) Log::Log4perl follow-up... Hmmm... Now I'm wishing there was a way to ask a Log::Log4perl object if there are any debug level listeners active.... What a waste of CPU if debug() is being ignored... j # ----- # Send this to the debugger in case someone is listening... # If there's binary crap in here don't write that to my logs. # Instead, throw [ASCII:24] and the like to the logs. # Wow... This is a terrible loop if we ever send more than a # few bytes of binary data through the engine!! # -jhannah 2006-09-27 # ----- my $logable_buffer = $self->{buffer}; my $binary_char; while (($binary_char) = ($logable_buffer =~ /([^ -~])/)) { my $ord = "[ASCII:" . ord($binary_char) . "]"; $logable_buffer =~ s/\Q$binary_char\E/$ord/gs; } $logger->debug("My buffer is now $logable_buffer"); _______________________________________________ Omaha-pm mailing list Omaha-pm at pm.org http://mail.pm.org/mailman/listinfo/omaha-pm From Andrew.Hadenfeldt at alltel.com Wed Sep 27 14:40:05 2006 From: Andrew.Hadenfeldt at alltel.com (Andrew.Hadenfeldt at alltel.com) Date: Wed, 27 Sep 2006 16:40:05 -0500 Subject: [Omaha.pm] Binary stuff in my logs (Log::Log4perl) Message-ID: if($logger->is_debug()) {...} ??? -----Original Message----- From: omaha-pm-bounces+andrew.hadenfeldt=alltel.com at pm.org [mailto:omaha-pm-bounces+andrew.hadenfeldt=alltel.com at pm.org]On Behalf Of Jay Hannah Sent: Wednesday, September 27, 2006 4:13 PM To: Perl Mongers of Omaha, Nebraska USA Subject: Re: [Omaha.pm] Binary stuff in my logs (Log::Log4perl) Log::Log4perl follow-up... Hmmm... Now I'm wishing there was a way to ask a Log::Log4perl object if there are any debug level listeners active.... What a waste of CPU if debug() is being ignored... j # ----- # Send this to the debugger in case someone is listening... # If there's binary crap in here don't write that to my logs. # Instead, throw [ASCII:24] and the like to the logs. # Wow... This is a terrible loop if we ever send more than a # few bytes of binary data through the engine!! # -jhannah 2006-09-27 # ----- my $logable_buffer = $self->{buffer}; my $binary_char; while (($binary_char) = ($logable_buffer =~ /([^ -~])/)) { my $ord = "[ASCII:" . ord($binary_char) . "]"; $logable_buffer =~ s/\Q$binary_char\E/$ord/gs; } $logger->debug("My buffer is now $logable_buffer"); _______________________________________________ Omaha-pm mailing list Omaha-pm at pm.org http://mail.pm.org/mailman/listinfo/omaha-pm ****************************************************************************************** The information contained in this message, including attachments, may contain privileged or confidential information that is intended to be delivered only to the person identified above. If you are not the intended recipient, or the person responsible for delivering this message to the intended recipient, Alltel requests that you immediately notify the sender and asks that you do not read the message or its attachments, and that you delete them without copying or sending them to anyone else. From jay at jays.net Wed Sep 27 15:14:57 2006 From: jay at jays.net (Jay Hannah) Date: Wed, 27 Sep 2006 17:14:57 -0500 Subject: [Omaha.pm] Binary stuff in my logs (Log::Log4perl) In-Reply-To: <29AB736ABCE5C745ABF9C93B02F2C27B0689C38D@exchange2k3.omnihotels.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B0689C38D@exchange2k3.omnihotels.net> Message-ID: <451AF7E1.2090606@jays.net> Sean Baker wrote: > Or maybe any of this: > > If you need to find out if the currently configured logging level would > allow a logger's logging statement to go through, use the logger's > is_level() methods: > > $logger->is_debug() # True if debug messages would go through Yup. Thanks Sean, Andrew! I look hard for this about a year ago and didn't see it, so I didn't even look this time...? Thanks, j From jhannah at omnihotels.com Thu Sep 28 11:05:06 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Thu, 28 Sep 2006 13:05:06 -0500 Subject: [Omaha.pm] and not and not and not and not... Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37D6A@exchange2k3.omnihotels.net> Project: Add "VRMCH" to this list: if ((not $row[0] =~ /RMCHG/) and (not $row[0] =~ /RMCHRG/) and (not $row[0] =~ /REUN/)) { Solution: if ($row[0] !~ /^(RMCHG|RMCHRG|REUN|VRMCH)$/) { j From andy at petdance.com Thu Sep 28 11:19:23 2006 From: andy at petdance.com (Andy Lester) Date: Thu, 28 Sep 2006 13:19:23 -0500 Subject: [Omaha.pm] and not and not and not and not... In-Reply-To: <29AB736ABCE5C745ABF9C93B02F2C27B05A37D6A@exchange2k3.omnihotels.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B05A37D6A@exchange2k3.omnihotels.net> Message-ID: <3523126A-03BE-4FFD-87AD-8FCD430B4531@petdance.com> On Sep 28, 2006, at 1:05 PM, Jay Hannah wrote: > if ((not $row[0] =~ /RMCHG/) and (not $row[0] =~ /RMCHRG/) > and (not $row[0] =~ /REUN/)) { > > Solution: > > if ($row[0] !~ /^(RMCHG|RMCHRG|REUN|VRMCH)$/) { Or: my @skips = qw( RMCHG RMCHRG REUN VMRCH ); my %skips = map {($_,1)} @skips; if ( not exists $skips{$row[0] ) {... -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jay at jays.net Fri Sep 29 04:11:34 2006 From: jay at jays.net (Jay Hannah) Date: Fri, 29 Sep 2006 06:11:34 -0500 Subject: [Omaha.pm] Fwd: [ensembl-dev] The future of EnsJ References: <2ad884250609290002n455bb472t413ef0b76b7b66d3@mail.gmail.com> Message-ID: <5C953720-8D1F-486F-91FB-74935D7E1513@jays.net> Ensembl is a massive European open-source bioinformatics project: http://en.wikipedia.org/wiki/Ensembl Looks like their Java in interface is being shut down. Power to the Perlers! j Begin forwarded message: > From: "Glenn Proctor" > Date: September 29, 2006 2:02:36 AM CDT > To: ensembl-dev at ebi.ac.uk > Subject: [ensembl-dev] The future of EnsJ > Reply-To: ensembl-dev at ebi.ac.uk > > Dear Ensembl Developers > > Some of you may recall that I announced that we are scaling down our > ability to continue to develop and support the Ensj, the Java API > to Ensembl. > > While several people kindly volunteered to help maintain parts of > Ensj, > no-one was able to commit to the kind of effort that would maintain > it as > a viable long-term solution. > > So it is with a great deal of regret that I have to announce that > Ensj will > no longer be publically available as of the December release of > Ensembl, > release 42. > > We will do our best to support it until then, however internally we > need to > focus our efforts on the Perl API and tools, so any Ensj-support > will be > provided on a best-efforts basis only. > > We have taken the decision to withdraw Ensj completely rather than > keeping > it in hibernation as the latter option would quickly result in > increasing > incompatibilities between Ensj and future changes to the Ensembl > schema, > which would cause headaches for everyone involved. > > We are doing this with great regret. It has not been an easy > decision to make. > > I would like to extend my thanks to Craig Melsopp, the lead > developer of > Ensj, as well as to all of you who have used, supported and > contributed to > it over the last few years. > > The Ensembl Perl API will be unaffected by these changes, and we have > a complete commitment to its maintenance as this is the main access > route in-house. I would encourage those of you who are still using > Ensj to > consider switching to the Perl API - you will find that much of the > Perl API > structure is similar to what you're used to with Ensj. > > Information, documentation, and a tutorial on the Perl API can be > found at > > http://www.ensembl.org/info/software/core/index.html > > Regards > > Glenn Proctor > Core team leader > Ensembl From jay at jays.net Fri Sep 29 04:50:27 2006 From: jay at jays.net (Jay Hannah) Date: Fri, 29 Sep 2006 06:50:27 -0500 Subject: [Omaha.pm] Fwd: [ensembl-dev] The future of EnsJ In-Reply-To: <5C953720-8D1F-486F-91FB-74935D7E1513@jays.net> References: <2ad884250609290002n455bb472t413ef0b76b7b66d3@mail.gmail.com> <5C953720-8D1F-486F-91FB-74935D7E1513@jays.net> Message-ID: <5C3E2DD7-D440-4ECA-BD53-E98E657DB381@jays.net> On Sep 29, 2006, at 6:11 AM, Jay Hannah wrote: > Looks like their Java in interface is being shut down. s/in interface/interface/ Sorry. Yikes, j From jay at jays.net Fri Sep 29 05:57:49 2006 From: jay at jays.net (Jay Hannah) Date: Fri, 29 Sep 2006 07:57:49 -0500 Subject: [Omaha.pm] Fwd: [Bioperl-l] Bio::SeqIO -- add an ugly but fast grep hack? References: Message-ID: <0C6EC8D6-00BF-4678-A3B3-9BDD01D08790@jays.net> It's humbling when people reduce 18 lines of my code down to a command-line one liner. :) j Begin forwarded message: > From: Jay Hannah > Date: September 29, 2006 7:49:53 AM CDT > To: bioperl-l at bioperl.org > Cc: kiran bina > Subject: Re: [Bioperl-l] Bio::SeqIO -- add an ugly but fast grep hack? > > On Sep 14, 2006, at 10:58 AM, Amir Karger wrote: >> From: Chris Fields [mailto:cjfields at uiuc.edu] >>> { >>> local $/ = "//\n"; >>> while (my $gb = <>) { >>> print $gb if $gb =~ m/Staphylococcus\sepidermidis/im; >>> } >>> } >> >> Perl Golf! (Untested, as all good Perl Golf should be.) >> >> perl -wne 'BEGIN {$/="//\n"} print if /Staphylococcus\sepidermidis/ >> im/' >> blah.gb > filtered.gb > > Wow. You guys are amazing. > > My version was a lot longer (Reverse Perl Golf!!): > > my @files = @{$self->{files}}; > my $file; > foreach $file (@files) { > open (IN, $file); > my $locus; > while () { > if (/^LOCUS/) { > # A locus has begun. > $locus = $_; > } elsif (/^\/\//) { > # A locus ends. > $locus .= $_; > if ($locus =~ /$args{grep}/s) { > print OUT $locus; > } > } else { > # A row inside a locus. > $locus .= $_; > } > } > } > > I'm playing with an abstraction layer I'm calling "OpenLab". Here > the grep() method does the work: > > my $ol = OpenLab->new(); > # Load up just the "ATCC 12228" sequences from a directory... > my $ss1 = $ol->new_SequenceSet(name => "Organism1"); > $ss1->load(files => "$data_dir/*"); > $ss1->grep( > grep => "ATCC 12228", > storage => $data_tmp > ); > > I'll be replacing the implementation inside my class with your > wizardry. > > Thanks! > > j > 12 years of Perl later, still learning new tricks. :) > > From jhannah at omnihotels.com Fri Sep 29 06:15:11 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri, 29 Sep 2006 08:15:11 -0500 Subject: [Omaha.pm] Perl: datetime stamps (2006-09-28T18:38:07.97-05:00) In-Reply-To: Message-ID: Can anyone one up me? J ------ Forwarded Message From: Jay Hannah Date: Fri, 29 Sep 2006 08:13:07 -0500 To: "OTA-Impl-Forum at googlegroups.com" Subject: Perl: datetime stamps (2006-09-28T18:38:07.97-05:00) Here's a little Perl routine to kick out datetime stamps in the OTA format. If anyone has a better/tighter/faster Perl routine, do tell. :) (And/or share your solutions in other languages just for fun.) Cheers, j $ cat j.pl use strict; use Date::Calc; use Time::HiRes; my ($s, $usec) = Time::HiRes::gettimeofday(); my @offset = Date::Calc::Timezone(); my ($Dh, $Dm) = @offset[3..4]; my $direction = $Dh > 0 ? "+" : "-"; $Dh = abs $Dh; my $now = sprintf( "%04d-%02d-%02dT%02d:%02d:%02d.%02d%s%02d:%02d", Date::Calc::Today_and_Now(), substr($usec / 1000000, 2, 2), $direction, $Dh, $Dm ); print "$now\n"; $ perl j.pl 2006-09-28T18:38:07.97-05:00 ------ End of Forwarded Message From pbaker at omnihotels.com Fri Sep 29 06:44:20 2006 From: pbaker at omnihotels.com (Sean Baker) Date: Fri, 29 Sep 2006 08:44:20 -0500 Subject: [Omaha.pm] Perl: datetime stamps (2006-09-28T18:38:07.97-05:00) Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B06908777@exchange2k3.omnihotels.net> #!/usr/bin/perl Sean Baker Software Architect Omni Hotels (402) 952-6508 pbaker at omnihotels.com -----Original Message----- From: omaha-pm-bounces+pbaker=omnihotels.com at pm.org [mailto:omaha-pm-bounces+pbaker=omnihotels.com at pm.org] On Behalf Of Jay Hannah Sent: Friday, September 29, 2006 8:15 AM To: omaha-pm at pm.org Subject: [Omaha.pm] Perl: datetime stamps (2006-09-28T18:38:07.97-05:00) Can anyone one up me? J ------ Forwarded Message From: Jay Hannah Date: Fri, 29 Sep 2006 08:13:07 -0500 To: "OTA-Impl-Forum at googlegroups.com" Subject: Perl: datetime stamps (2006-09-28T18:38:07.97-05:00) Here's a little Perl routine to kick out datetime stamps in the OTA format. If anyone has a better/tighter/faster Perl routine, do tell. :) (And/or share your solutions in other languages just for fun.) Cheers, j $ cat j.pl use strict; use Date::Calc; use Time::HiRes; my ($s, $usec) = Time::HiRes::gettimeofday(); my @offset = Date::Calc::Timezone(); my ($Dh, $Dm) = @offset[3..4]; my $direction = $Dh > 0 ? "+" : "-"; $Dh = abs $Dh; my $now = sprintf( "%04d-%02d-%02dT%02d:%02d:%02d.%02d%s%02d:%02d", Date::Calc::Today_and_Now(), substr($usec / 1000000, 2, 2), $direction, $Dh, $Dm ); print "$now\n"; $ perl j.pl 2006-09-28T18:38:07.97-05:00 ------ End of Forwarded Message _______________________________________________ Omaha-pm mailing list Omaha-pm at pm.org http://mail.pm.org/mailman/listinfo/omaha-pm From pbaker at omnihotels.com Fri Sep 29 06:48:19 2006 From: pbaker at omnihotels.com (Sean Baker) Date: Fri, 29 Sep 2006 08:48:19 -0500 Subject: [Omaha.pm] Perl: datetime stamps (2006-09-28T18:38:07.97-05:00) Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B0690878E@exchange2k3.omnihotels.net> > Here's a little Perl routine to kick out datetime stamps in the OTA format. If anyone has a better/tighter/faster Perl routine, do tell. :) The OTA uses xs:dateTime. So any one-upness just needs to conform to this: http://www.w3.org/TR/NOTE-datetime Class::Date and Gmtime perhaps? Hmmm..... Sean Baker From KThompson at heiskell.com Fri Sep 29 06:53:31 2006 From: KThompson at heiskell.com (Thompson, Kenn) Date: Fri, 29 Sep 2006 06:53:31 -0700 Subject: [Omaha.pm] Perl: datetime stamps (2006-09-28T18:38:07.97-05:0 0) Message-ID: <16F8D15756891C4EA961565331A3B350056D402F@JDHEXC01.heiskell.com> >-----Original Message----- >Class::Date and Gmtime perhaps? Hmmm..... Seems I remember a wrapper being written for Class::Date that did nothing but format the output of Class::Date into various local application formats. Why wouldn't that approach apply here, unless you were trying to improve on performance?