From perl.abe at rjbs.manxome.org Fri Nov 2 14:57:56 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Fri, 2 Nov 2007 17:57:56 -0400 Subject: [ABE.pm] dinner wednesday; location? future hacking? Message-ID: <20071102215756.GA29839@zodiac.codesimply.com> Okay, I will see you guys at 18:00 on Wednesday... but where? I'd think without Ted (and, therefore, insanely hot wings), my vote swings to Gute. So, unless I am wrong in thinking that Faber and Tom prefer Gute (?) that's the plan. As promised, I'll run through some of the slides stuff I did at PPW. All my slides are at slideshare.net. I was tickled, today, to see that my Perl 5.10 slides were "featured," meaning that they got put on the front page. I'm not sure how much of an honor this is: the previous featured slideshow is Condom Fashion, a fashion show based on condoms. SlidesShare is a weird place. I get a huge number of views, but no comments. It makes me wonder if the views are humans. I might also want to talk about some stuff I've been poking at lately, especially data validation. I have hard feelings toward just about every data validator I've used in Perl, and I've been sort of brewing one of my own in my head for a long time. I'd like to bounce my ideas off of some of you. Then again, I might just STFU, eat a ham sandwich, and listen to everyone else's banter. -- rjbs From tfreedman at iqep.com Mon Nov 5 12:46:53 2007 From: tfreedman at iqep.com (Tom Freedman) Date: Mon, 5 Nov 2007 15:46:53 -0500 Subject: [ABE.pm] dinner wednesday; location? future hacking? In-Reply-To: <20071102215756.GA29839@zodiac.codesimply.com> References: <20071102215756.GA29839@zodiac.codesimply.com> Message-ID: > -----Original Message----- > From: Ricardo SIGNES > Sent: Friday, November 02, 2007 5:58 PM > To: abe-pm at mail.pm.org > Subject: [ABE.pm] dinner wednesday; location? future hacking? > > Okay, I will see you guys at 18:00 on Wednesday... but where? I'd think > without Ted (and, therefore, insanely hot wings), my vote swings to Gute. > So, > unless I am wrong in thinking that Faber and Tom prefer Gute (?) that's > the plan. I won't be there until late, if at all. I've got to put the kids to bed which, these days, means I won't be free until ~8:30. I'll call Rik when I'm available, though, and see if you guys are still drinking... er, talking. :-) -Tom Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. From perl.abe at rjbs.manxome.org Tue Nov 6 18:10:08 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Tue, 6 Nov 2007 21:10:08 -0500 Subject: [ABE.pm] dinner tomorrow, gute; faber: coming? Message-ID: <20071107021008.GA24064@zodiac.codesimply.com> Okay, I'll be there tomorrow, but I wanted to make sure that at least Faber would be there... otherwise it sounds like me, sitting alone, drinking beer, waiting for Tom. Faber: see you around six? Maybe we'll talk Catalyst. -- rjbs From faber at linuxnj.com Tue Nov 6 20:19:59 2007 From: faber at linuxnj.com (Faber J. Fedor) Date: Tue, 6 Nov 2007 23:19:59 -0500 Subject: [ABE.pm] dinner tomorrow, gute; faber: coming? In-Reply-To: <20071107021008.GA24064@zodiac.codesimply.com> References: <20071107021008.GA24064@zodiac.codesimply.com> Message-ID: <20071107041959.GA30651@neptune.faber.nom> On 06/11/07 21:10 -0500, Ricardo SIGNES wrote: > Okay, I'll be there tomorrow, but I wanted to make sure that at least Faber > would be there... otherwise it sounds like me, sitting alone, drinking beer, > waiting for Tom. "Waiting for Tom". Wasn't that a major Broadway play? Nah, couldn't be;, Tom shows up most of the time. > Faber: see you around six? At Gutes, right? > Maybe we'll talk Catalyst. Catalyst is the least of my concerns these days. However, I do have a question about style that I want to bounce off of someone... And I'm bringing cigars. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From perl.abe at rjbs.manxome.org Wed Nov 7 04:36:44 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Wed, 7 Nov 2007 07:36:44 -0500 Subject: [ABE.pm] dinner tomorrow, gute; faber: coming? In-Reply-To: <20071107041959.GA30651@neptune.faber.nom> References: <20071107021008.GA24064@zodiac.codesimply.com> <20071107041959.GA30651@neptune.faber.nom> Message-ID: <20071107123644.GA3869@zodiac.codesimply.com> * "Faber J. Fedor" [2007-11-06T23:19:59] > On 06/11/07 21:10 -0500, Ricardo SIGNES wrote: > > Okay, I'll be there tomorrow, but I wanted to make sure that at least Faber > > would be there... otherwise it sounds like me, sitting alone, drinking beer, > > waiting for Tom. > > "Waiting for Tom". Wasn't that a major Broadway play? Nah, couldn't be;, > Tom shows up most of the time. Maybe it's a very, very short play. > > Faber: see you around six? > At Gutes, right? Right. > > Maybe we'll talk Catalyst. > > Catalyst is the least of my concerns these days. However, I do have a > question about style that I want to bounce off of someone... No problem. I *am* rather stylish. -- rjbs From faber at linuxnj.com Wed Nov 7 10:16:20 2007 From: faber at linuxnj.com (Faber J. Fedor) Date: Wed, 7 Nov 2007 13:16:20 -0500 Subject: [ABE.pm] My first enclosure doesn't work. :-( In-Reply-To: <20071027125321.GA461@knight.cable.rcn.com> References: <20071026173050.GA30227@neptune.faber.nom> <20071026221307.GA6101@knight> <20071026234506.GB31935@neptune.faber.nom> <20071027125321.GA461@knight.cable.rcn.com> Message-ID: <20071107181620.GA1171@neptune.faber.nom> On 27/10/07 08:53 -0400, Ricardo SIGNES wrote: > * "Faber J. Fedor" [2007-10-26T19:45:06] > > Can you explain the concept of "code writing code" or "programs writing > > programs" then cuz I'm WAY off base. > > You could use the phrase "code writing code" to mean "code that builds a string > and then turns it into a sub," I suppose, but it's not what's really meant. Here's an example of what I had in mind: http://www.netalive.org/tinkering/serious-perl/#import_extend -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From perl.abe at rjbs.manxome.org Thu Nov 8 11:04:40 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Thu, 8 Nov 2007 14:04:40 -0500 Subject: [ABE.pm] perl mongers group on linkedin Message-ID: <20071108190438.GA10162@zodiac.codesimply.com> http://use.perl.org/~cog/journal/34859?from=rss That is all. -- rjbs From faber at linuxnj.com Thu Nov 8 19:24:50 2007 From: faber at linuxnj.com (Faber J. Fedor) Date: Thu, 8 Nov 2007 22:24:50 -0500 Subject: [ABE.pm] OT: Macbook HD upgrade Message-ID: <20071109032450.GA6720@neptune.faber.nom> Last night at dinner, I mentioned I was going to upgrade the HD in my Macbook. Rick asked me to let him know how it turned out. I know the rest of you are dying to know as well. Well, the hardware came in today and I did the upgrade. What can I say? It's a Mac; the upgrade Just Worked. The Toshiba 160G HD and AZIO external enlcosure arrived today from Newegg. The enclosure is very nice as it include the enclosure, a carry case, a USB cable, an E-SATA(?) cable and a power supply; all for $20! I slapped it all together and starting backing everything up with an unregistered copy of SuperDuper!. Two point five hours later, it was done. Swapped hard drives and booted the machine. Done. The hardest part of the whole process was finding a Torx T9 screwdriver; I had to go the three stores for that and even then I had to buy several other (gaudy) screwdrivers because the T9 came in a set and not indivually (nor even in a Torx-only set). Easiest hardware upgrade I've *ever* done. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From perl.abe at rjbs.manxome.org Fri Nov 9 07:32:33 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Fri, 9 Nov 2007 10:32:33 -0500 Subject: [ABE.pm] OT: Macbook HD upgrade In-Reply-To: <20071109032450.GA6720@neptune.faber.nom> References: <20071109032450.GA6720@neptune.faber.nom> Message-ID: <20071109153231.GA25678@zodiac.codesimply.com> * "Faber J. Fedor" [2007-11-08T22:24:50] > Last night at dinner, I mentioned I was going to upgrade the HD in my > Macbook. Rick asked me to let him know how it turned out. I know the > rest of you are dying to know as well. Thanks! I'm now even more tempted to try to get a bigger hard drive. I very boldly ran an aggressive Monolingual.app session against my laptop, removing all PPC binaries and most non-English localizations. It freed up about four gigs of storage, so I'm tidied over for a while. -- rjbs From perl.abe at rjbs.manxome.org Fri Nov 9 07:45:21 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Fri, 9 Nov 2007 10:45:21 -0500 Subject: [ABE.pm] My first enclosure doesn't work. :-( In-Reply-To: <20071107181620.GA1171@neptune.faber.nom> References: <20071026173050.GA30227@neptune.faber.nom> <20071026221307.GA6101@knight> <20071026234506.GB31935@neptune.faber.nom> <20071027125321.GA461@knight.cable.rcn.com> <20071107181620.GA1171@neptune.faber.nom> Message-ID: <20071109154521.GB25678@zodiac.codesimply.com> * "Faber J. Fedor" [2007-11-07T13:16:20] > Here's an example of what I had in mind: > > http://www.netalive.org/tinkering/serious-perl/#import_extend This tutorial either has been or soon will be added to the Perl 5 Tutorial Hall of Shame. http://www.perlfoundation.org/perl5/index.cgi?hall_of_shame First of all, it recommends using fields.pm, which is basically dead. That's not the real issue, though. It does importing by using stringy eval, which is Totally Insane. How insane is that? Well, I'd say it's way, way worse than Exporter.pm, and my feelings about Exporter are well-known. The code as shown is: sub import { my($class, @fields) = @_; return unless @fields; my $caller = caller(); # Build the code we're going to eval for the caller # Do the fields call for the calling package my $eval = "package $caller;\n" . "use fields qw( " . join(' ', @fields) . ");\n"; # Generate convenient accessor methods foreach my $field (@fields) { $eval .= "sub $field : lvalue { \$_[0]->{$field} }\n"; } # Eval the code we prepared eval $eval; # $@ holds possible eval errors $@ and die "Error setting members for $caller: $@"; } It should instead be written: sub import { my($class, @fields) = @_; return unless @fields; my $caller = caller(); # This can't be done without a string eval, and is one of the reasons that # the fields pragma ("use fields") is a bad idea.... but the use of join # was gratuitous, and I've fixed it. my $eval = "package $caller;" . "use fields qw(@fields)"; # Generate convenient accessor methods foreach my $field (@fields) { # We need to turn off strict references so that we can alter a subroutine # based on its name as a string. This is one of the few cases where # turning off strict makes perfect sense. no strict 'refs'; *{ $caller . '::$field' } = sub : lvalue { $_[0]->{ $field } }; } } This code is significantly shorter, less prone to weird bugs, and can fail nicely at compile time if there's a typo. My gut also tells me that it would be a tiny bit faster, but that's not a tested belief. -- rjbs From faber at linuxnj.com Fri Nov 9 17:35:46 2007 From: faber at linuxnj.com (Faber J. Fedor) Date: Fri, 9 Nov 2007 20:35:46 -0500 Subject: [ABE.pm] Reference fun Message-ID: <20071110013546.GA13417@neptune.faber.nom> In some code I have, I do something like this: use YAML::Tiny; my $simparms; $simparms->{name} = 'foo'; my $yaml->[0] = $simparms; $yaml->write('myfile.yml'); and it does exactly what you would expect, which is creates a file like -- name: foo However, this code: use YAML::Tiny; use Config::IniFiles; my $inFile = 'foo.ini' ; my %fndVars ; tie %fndVars, 'Config::IniFiles', ( -file => $inFile); my $ref = \%fndVars; my $yaml = YAML::Tiny->new; $yaml->[0] = $ref; $yaml->write("foo.yml"); produces a file like this: --- {} If I replace '$yaml->[0] = $ref;' with '$yaml->[0] = %fndVars;' I get this: --- 0 WTF? And yes, there is data in %fndVars. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From perl.abe at rjbs.manxome.org Fri Nov 9 18:06:55 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Fri, 9 Nov 2007 21:06:55 -0500 Subject: [ABE.pm] Reference fun In-Reply-To: <20071110013546.GA13417@neptune.faber.nom> References: <20071110013546.GA13417@neptune.faber.nom> Message-ID: <20071110020655.GA21759@zodiac.codesimply.com> * "Faber J. Fedor" [2007-11-09T20:35:46] > However, this code: > > use YAML::Tiny; > use Config::IniFiles; > > my $inFile = 'foo.ini' ; > my %fndVars ; > > tie %fndVars, 'Config::IniFiles', ( -file => $inFile); > > my $ref = \%fndVars; > > my $yaml = YAML::Tiny->new; > $yaml->[0] = $ref; > $yaml->write("foo.yml"); > > produces a file like this: > > --- {} You have a HUGE difference here: > tie %fndVars, 'Config::IniFiles', ( -file => $inFile); Once you're using a tied variable, all bets are off. I would be happy to take a commission to make it work, though. :-) > If I replace '$yaml->[0] = $ref;' with '$yaml->[0] = %fndVars;' I get > this: > > --- 0 You can't put a hash directly into an array element, only a reference to it. Otherwise, you're using the hash in scalar context. Normally, that gives you a fairly useles string describing hash bucket usage, like "3/8." With a tied hash, all bets are off. Usually you get false. For .ini files, I use Config::INI (and ::Reader and ::Writer). -- rjbs From faber at linuxnj.com Sat Nov 10 11:12:53 2007 From: faber at linuxnj.com (Faber J. Fedor) Date: Sat, 10 Nov 2007 14:12:53 -0500 Subject: [ABE.pm] Reference fun In-Reply-To: <20071110020655.GA21759@zodiac.codesimply.com> References: <20071110013546.GA13417@neptune.faber.nom> <20071110020655.GA21759@zodiac.codesimply.com> Message-ID: <20071110191253.GA16401@neptune.faber.nom> On 09/11/07 21:06 -0500, Ricardo SIGNES wrote: > * "Faber J. Fedor" [2007-11-09T20:35:46] > You have a HUGE difference here: > > > tie %fndVars, 'Config::IniFiles', ( -file => $inFile); > > Once you're using a tied variable, all bets are off. Ohhh-kaaay. Why? Isn't a hash a hash, even if it's tied? > I would be happy to take a commission to make it work, though. :-) :-) > > If I replace '$yaml->[0] = $ref;' with '$yaml->[0] = %fndVars;' I get > > this: > > > > --- 0 > > You can't put a hash directly into an array element, only a reference to it. Yeah, well the reference didn't work, so I tried the has h itself. > Otherwise, you're using the hash in scalar context. Normally, that gives you a > fairly useles string describing hash bucket usage, like "3/8." I did see a fraction in one iteration of what I was doing. > With a tied > hash, all bets are off. Usually you get false. > > For .ini files, I use Config::INI (and ::Reader and ::Writer). After thinking through my project (how to edit an ini file via a webform), I won't be needing the YAML stuff anyway. And I think I'll stay away from tie-d vairables (except for Tie::File) from now on. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From perl.abe at rjbs.manxome.org Sat Nov 10 17:52:37 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Sat, 10 Nov 2007 20:52:37 -0500 Subject: [ABE.pm] Reference fun In-Reply-To: <20071110191253.GA16401@neptune.faber.nom> References: <20071110013546.GA13417@neptune.faber.nom> <20071110020655.GA21759@zodiac.codesimply.com> <20071110191253.GA16401@neptune.faber.nom> Message-ID: <20071111015237.GA3821@zodiac.codesimply.com> * "Faber J. Fedor" [2007-11-10T14:12:53] > On 09/11/07 21:06 -0500, Ricardo SIGNES wrote: > > Once you're using a tied variable, all bets are off. > > Ohhh-kaaay. Why? Isn't a hash a hash, even if it's tied? A tied variable is only sorta kinda like the thing it's supposed to be. They should generally be used only as a novelty. > > You can't put a hash directly into an array element, only a reference to it. > > Yeah, well the reference didn't work, so I tried the has h itself. My point is that this will never, ever work, and is never work trying. :) > After thinking through my project (how to edit an ini file via a > webform), I won't be needing the YAML stuff anyway. And I think I'll > stay away from tie-d vairables (except for Tie::File) from now on. Good idea. (Tie::File does seem to be a pretty righteous use of tying.) -- rjbs From faber at linuxnj.com Wed Nov 14 07:43:08 2007 From: faber at linuxnj.com (Faber J. Fedor) Date: Wed, 14 Nov 2007 10:43:08 -0500 Subject: [ABE.pm] Great pun Message-ID: <20071114154308.GA23476@neptune.faber.nom> Yes, it's Perl related. Start here: http://www.xkcd.com/341/ and read all three pages (well, there are three as of 20071114). -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From waltman at pobox.com Wed Nov 14 07:51:12 2007 From: waltman at pobox.com (Walt Mankowski) Date: Wed, 14 Nov 2007 10:51:12 -0500 Subject: [ABE.pm] Great pun In-Reply-To: <20071114154308.GA23476@neptune.faber.nom> References: <20071114154308.GA23476@neptune.faber.nom> Message-ID: <20071114155112.GA3200@mawode.com> I love xkcd, but sadly there's a glaring error in the last panel of yesterday's strip. It really doesn't make sense to talk about the lower bound of anything being O(n log n). Big-O notation refers to *upper* bounds, not lower bounds. I know that lots of CS people tend to toss around big-O to mean all sorts of stuff, but that doesn't strike me as a mistake that Knuth would make. Walt On Wed, Nov 14, 2007 at 10:43:08AM -0500, Faber J. Fedor wrote: > > Yes, it's Perl related. > > Start here: http://www.xkcd.com/341/ and read all three pages (well, > there are three as of 20071114). > > > -- > > Regards, > > Faber Fedor > President > Linux New Jersey, Inc. > 908-320-0357 > 800-706-0701 > > http://www.linuxnj.com > > > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > _______________________________________________ > ABE-pm mailing list > ABE-pm at pm.org > http://mail.pm.org/mailman/listinfo/abe-pm From perl.abe at rjbs.manxome.org Sun Nov 18 06:23:24 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Sun, 18 Nov 2007 09:23:24 -0500 Subject: [ABE.pm] next meeting: dec 5 Message-ID: <20071118142324.GA42749@knight.cable.rcn.com> I'm giving a lot of notice, since I keep forgetting to give notice about stuff, lately. December 5th! That's two weeks after this Wednesday. McGrady's? I need hot wings, even if SOMEBODY isn't going to come and save me from half of them. In other news, did you see that Perl 5.10 is at RC1? The full release should be any day now... actually, there's some talk that it may be scheduled for Dec 18, which will be Perl's 20th birthday! -- rjbs From perl.abe at rjbs.manxome.org Sun Nov 18 06:52:06 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Sun, 18 Nov 2007 09:52:06 -0500 Subject: [ABE.pm] technical meeting venue Message-ID: <20071118145206.GA30080@zodiac.codesimply.com> For our future reference, the Bethlehem Area Public Library rents a public meeting room for Darn Cheap: http://bapl.org/bapl_info/bapl_info11.htm It's $20 for four hours, $5 per additional hour. The down side is that they close at 21:00. I actually think this is a *good* thing. See, BAPL is located downtown. It's about one block from Penn Pizza, two blocks from Bethlehem Brew Works, and five or six blocks from both McGrady's and Gute. If we meet at six or six thirty, we have plenty of time for a full technical presentation, plus questions and answers, and can then stroll up the street for some dinner and chatter. If nobody has any objections to the venue, how about we do a January meeting there? -- rjbs From perl.abe at rjbs.manxome.org Sun Nov 18 06:58:40 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Sun, 18 Nov 2007 09:58:40 -0500 Subject: [ABE.pm] let's hack Message-ID: <20071118145840.GA7528@zodiac.codesimply.com> Boy, I'm a posting roll today. So, in light of finding the excellent, cheap, and conveniently located meeting room at BAPL, I am feeling pretty ready to do some hanging out and coding in the near future... too bad we're entering the worst time of the year for it! I had hoped we could do something like this on a Saturday, but the venue closes at 16:45 on Saturdays, which isn't so great. (Alternate equally convenient venue suggestions welcome.) Failing that, what about some non-Friday evening from 17:xx to 21:00? I will try to produce a list of possible things to hack on in a future post, but how would that sort of time suit people? -- rjbs From fiedlert at gmail.com Mon Nov 19 05:44:47 2007 From: fiedlert at gmail.com (Ted Fiedler) Date: Mon, 19 Nov 2007 08:44:47 -0500 Subject: [ABE.pm] technical meeting venue In-Reply-To: <20071118145206.GA30080@zodiac.codesimply.com> References: <20071118145206.GA30080@zodiac.codesimply.com> Message-ID: <814422ce0711190544m4640b1cal3e044ebffa29144b@mail.gmail.com> > > > If we meet at six or six thirty, we have plenty of time for a full > technical > presentation, plus questions and answers, and can then stroll up the > street for > some dinner and chatter. > > If nobody has any objections to the venue, how about we do a January > meeting > there? > Whats the opposite of objection? er... Count me in. > > -- > rjbs > _______________________________________________ > ABE-pm mailing list > ABE-pm at pm.org > http://mail.pm.org/mailman/listinfo/abe-pm > -- If you mess with a thing long enough, it'll break. -- Schmidt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/abe-pm/attachments/20071119/1cdc5f94/attachment.html From fiedlert at gmail.com Mon Nov 19 08:58:27 2007 From: fiedlert at gmail.com (Ted Fiedler) Date: Mon, 19 Nov 2007 11:58:27 -0500 Subject: [ABE.pm] time processing Message-ID: <814422ce0711190858r5fde9b89qc858adc3ce0691cf@mail.gmail.com> Im working on some programs to help me w/ running, producing graphs etc... I need to convert time to seconds, do some simple math, then convert back to a hh::mm::ss format. Im using DateTime::Precise to convert back, im just curious and have been unable to find a way myself if there is a better way? ie pure Perl. This just *seems* clunky. #!/usr/bin/perl use strict; use warnings; use DateTime::Precise ; my ( $hour, $min, $sec, undef ) = split/:/, $ARGV[0]; $hour = $hour * 3600; $min = $min * 60; my $seconds = $hour + $min + $sec; my $distance = $ARGV[1]; print "seconds = $seconds\n"; my $t1 = DateTime::Precise->new($seconds / $distance); my $pace = $t1->strftime('%T'); $pace =~ s/^00://; print "Pace is $pace\n"; sub usage { print "$0 time dist\n"; print " eg $0 01:54:18 13.1\n"; exit 1; } Ted -- If you mess with a thing long enough, it'll break. -- Schmidt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/abe-pm/attachments/20071119/916f4adb/attachment.html From perl.abe at rjbs.manxome.org Mon Nov 19 09:31:36 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Mon, 19 Nov 2007 12:31:36 -0500 Subject: [ABE.pm] time processing In-Reply-To: <814422ce0711190858r5fde9b89qc858adc3ce0691cf@mail.gmail.com> References: <814422ce0711190858r5fde9b89qc858adc3ce0691cf@mail.gmail.com> Message-ID: <20071119173136.GA46835@knight.office.icgroup.com> * Ted Fiedler [2007-11-19T11:58:27] > Im working on some programs to help me w/ running, producing graphs etc... I > need to convert time to seconds, do some simple math, then convert back to a > hh::mm::ss format. Im using DateTime::Precise to convert back, im just > curious and have been unable to find a way myself if there is a better way? > ie pure Perl. This just *seems* clunky. Why Precise? That seems like overkill. > my ( $hour, $min, $sec, undef ) = split/:/, $ARGV[0]; > > $hour = $hour * 3600; > $min = $min * 60; > > my $seconds = $hour + $min + $sec; > > my $distance = $ARGV[1]; > > print "seconds = $seconds\n"; > > my $t1 = DateTime::Precise->new($seconds / $distance); Ugh! my $hms = DateTime::Format::Strptime->new(pattern => '%T'); my $datetime = $hms->parse_datetime('12:23:34'); -- rjbs From waltman at pobox.com Mon Nov 19 09:51:05 2007 From: waltman at pobox.com (Walt Mankowski) Date: Mon, 19 Nov 2007 12:51:05 -0500 Subject: [ABE.pm] time processing In-Reply-To: <20071119173136.GA46835@knight.office.icgroup.com> References: <814422ce0711190858r5fde9b89qc858adc3ce0691cf@mail.gmail.com> <20071119173136.GA46835@knight.office.icgroup.com> Message-ID: <20071119175105.GM15280@mawode.com> On Mon, Nov 19, 2007 at 12:31:36PM -0500, Ricardo SIGNES wrote: > * Ted Fiedler [2007-11-19T11:58:27] > > Im working on some programs to help me w/ running, producing graphs etc... I > > need to convert time to seconds, do some simple math, then convert back to a > > hh::mm::ss format. Im using DateTime::Precise to convert back, im just > > curious and have been unable to find a way myself if there is a better way? > > ie pure Perl. This just *seems* clunky. > > Why Precise? That seems like overkill. My module Geo::Coordinates::DecimalDegrees is useful for things like this: #!/usr/bin/perl use strict; use warnings; use Geo::Coordinates::DecimalDegrees; my ( $hour, $min, $sec, undef ) = split/:/, $ARGV[0]; my $distance = $ARGV[1]; my $t = dms2decimal($hour, $min, $sec); ($hour, $min, $sec) = decimal2dms($t / $distance); my $pace = sprintf "%02d:%02d", $min, $sec; print "Pace is $pace\n"; sub usage { print "$0 time dist\n"; print " eg $0 01:54:18 13.1\n"; exit 1; } I really need to repackage that module sometime. It's useful for time calculations as well as gps stuff, since hour/minute/second calculations are the same as degree/minute/second calculations. Also, its name is way too long. Oh well. Walt From fiedlert at gmail.com Mon Nov 19 10:13:52 2007 From: fiedlert at gmail.com (Ted Fiedler) Date: Mon, 19 Nov 2007 13:13:52 -0500 Subject: [ABE.pm] time processing In-Reply-To: <20071119173136.GA46835@knight.office.icgroup.com> References: <814422ce0711190858r5fde9b89qc858adc3ce0691cf@mail.gmail.com> <20071119173136.GA46835@knight.office.icgroup.com> Message-ID: <814422ce0711191013t33833197ydfd6a8d931692c9d@mail.gmail.com> > > > > Ugh! > This is why I ask the questions :) > > my $hms = DateTime::Format::Strptime->new(pattern => '%T'); > my $datetime = $hms->parse_datetime('12:23:34'); That returns '00001-01-01T12:23:34' This doesn't seem to do what I need. I need a time not a datetime such as 1 hour 54 minues 18 seconds (01:54:18) to be converted to seconds, divided by a distance (13.1) , and turnd back into a time ( pace ) such as 8 minutes 44 seconds, but formatted as 8:44. Precise may be overkill, but so far the only module, that Ive found to do this. Or am I missing the boat here? Ted -- If you mess with a thing long enough, it'll break. -- Schmidt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/abe-pm/attachments/20071119/4d55529a/attachment.html From perl.abe at rjbs.manxome.org Mon Nov 19 10:27:16 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Mon, 19 Nov 2007 13:27:16 -0500 Subject: [ABE.pm] time processing In-Reply-To: <814422ce0711191013t33833197ydfd6a8d931692c9d@mail.gmail.com> References: <814422ce0711190858r5fde9b89qc858adc3ce0691cf@mail.gmail.com> <20071119173136.GA46835@knight.office.icgroup.com> <814422ce0711191013t33833197ydfd6a8d931692c9d@mail.gmail.com> Message-ID: <20071119182716.GA46948@knight.office.icgroup.com> * Ted Fiedler [2007-11-19T13:13:52] > > my $hms = DateTime::Format::Strptime->new(pattern => '%T'); > > my $datetime = $hms->parse_datetime('12:23:34'); > > That returns '00001-01-01T12:23:34' > > This doesn't seem to do what I need. I need a time not a datetime such as 1 > hour 54 minues 18 seconds (01:54:18) to be converted to seconds, divided by > a distance (13.1) , and turnd back into a time ( pace ) such as 8 minutes 44 > seconds, but formatted as 8:44. Precise may be overkill, but so far the only > module, that Ive found to do this. Or am I missing the boat here? Can't you get an absolute difference between that time and 0001-01-01 00:00:00 in seconds? -- rjbs From waltman at pobox.com Mon Nov 19 11:17:12 2007 From: waltman at pobox.com (Walt Mankowski) Date: Mon, 19 Nov 2007 14:17:12 -0500 Subject: [ABE.pm] time processing In-Reply-To: <814422ce0711191013t33833197ydfd6a8d931692c9d@mail.gmail.com> References: <814422ce0711190858r5fde9b89qc858adc3ce0691cf@mail.gmail.com> <20071119173136.GA46835@knight.office.icgroup.com> <814422ce0711191013t33833197ydfd6a8d931692c9d@mail.gmail.com> Message-ID: <20071119191712.GP15280@mawode.com> On Mon, Nov 19, 2007 at 01:13:52PM -0500, Ted Fiedler wrote: > Or am I missing the boat here? I think so. It's not really rocket science to do these sorts of calculations by hand. Here's another version without any external modules, just so you can see that it's not magic: #!/usr/bin/perl use strict; use warnings; usage() unless @ARGV == 2; my ( $hour, $min, $sec, undef ) = split/:/, $ARGV[0]; my $distance = $ARGV[1]; my $pace = ($hour * 3600 + $min * 60 + $sec) / $distance; printf "Pace is %02d:%02d\n", int($pace / 60), $pace % 60; sub usage { print "$0 time dist\n"; print " eg $0 01:54:18 13.1\n"; exit 1; } The conversion to seconds is simple -- there are 60 seconds in a minute, and 60*60=3600 seconds in an hour. So you just multiply it out, and divide by the distance to get the pace. The conversion back to minutes and seconds is maybe a bit trickier. If you divide the total seconds by 60, you get minutes. But we don't care about the fractional part, so I used int() to trim it off. The number of seconds in that minute is the remainder when we divide the total seconds by 60. That's what the % operator does. (For some reason people always seem to forget about the % operator. It's very useful.) The formatting is simple with printf. %02d formats the argument as a 2-digit number with leading 0's. Hope this helps. Walt From fiedlert at gmail.com Mon Nov 19 11:54:31 2007 From: fiedlert at gmail.com (Ted Fiedler) Date: Mon, 19 Nov 2007 14:54:31 -0500 Subject: [ABE.pm] time processing In-Reply-To: <20071119191712.GP15280@mawode.com> References: <814422ce0711190858r5fde9b89qc858adc3ce0691cf@mail.gmail.com> <20071119173136.GA46835@knight.office.icgroup.com> <814422ce0711191013t33833197ydfd6a8d931692c9d@mail.gmail.com> <20071119191712.GP15280@mawode.com> Message-ID: <814422ce0711191154v3879d38bgab4e11d2c654f4fb@mail.gmail.com> > > > > The conversion to seconds is simple -- there are 60 seconds in a > minute, and 60*60=3600 seconds in an hour. So you just multiply it > out, and divide by the distance to get the pace. > > The conversion back to minutes and seconds is maybe a bit trickier. > If you divide the total seconds by 60, you get minutes. But we don't > care about the fractional part, so I used int() to trim it off. The > number of seconds in that minute is the remainder when we divide the > total seconds by 60. That's what the % operator does. (For some > reason people always seem to forget about the % operator. It's very > useful.) > > The formatting is simple with printf. %02d formats the argument as a > 2-digit number with leading 0's. > > Hope this helps. > Yes. the modulus is what I was missing and what led me down the path of external modules. Thanks guys! Ted -- If you mess with a thing long enough, it'll break. -- Schmidt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/abe-pm/attachments/20071119/ee106e52/attachment-0001.html From perl.abe at rjbs.manxome.org Tue Nov 20 17:01:18 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Tue, 20 Nov 2007 20:01:18 -0500 Subject: [ABE.pm] topics for future meetings / hacking Message-ID: <20071121010118.GA92330@knight> I've put two new pages on the wiki, and it's up to you (and me) to add some more stuff to them, and to talk (here) about what we want to do. They are: * http://www.perlfoundation.org/abe-pm/index.cgi?technical_meetings What do we want presentations on? Special requests? Existing topics? Other ideas? Tom, what's your lead time on talking about PDF for thirty to ninety minutes? * http://www.perlfoundation.org/abe-pm/index.cgi?hanging_out_and_hacking I'll add more specific stuff I could bring for people to hack on. I bet other people have some stuff. Heck, maybe a good first HOAH would be hacking pot luck: everybody bring something small and cool to talk about and poke at. I don't know... -- rjbs From perl.abe at rjbs.manxome.org Tue Nov 20 18:09:53 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Tue, 20 Nov 2007 21:09:53 -0500 Subject: [ABE.pm] topics for future meetings / hacking In-Reply-To: <20071121010118.GA92330@knight> References: <20071121010118.GA92330@knight> Message-ID: <20071121020953.GB92475@knight.cable.rcn.com> * Ricardo SIGNES [2007-11-20T20:01:18] > * http://www.perlfoundation.org/abe-pm/index.cgi?technical_meetings > > What do we want presentations on? Special requests? Existing topics? > Other ideas? Tom, what's your lead time on talking about PDF for thirty to > ninety minutes? ...by the way, I took the liberty of moving the January meeting, which will, I hope, be a technical meeting, ot January 9. Having a meeting the day after New Year's Day seemed a bit like tempting fate, to me. -- rjbs From faber at linuxnj.com Sun Nov 25 09:31:24 2007 From: faber at linuxnj.com (Faber J. Fedor) Date: Sun, 25 Nov 2007 12:31:24 -0500 Subject: [ABE.pm] let's hack In-Reply-To: <20071118145840.GA7528@zodiac.codesimply.com> References: <20071118145840.GA7528@zodiac.codesimply.com> Message-ID: <20071125173124.GA2217@neptune.faber.nom> On 18/11/07 09:58 -0500, Ricardo SIGNES wrote: > So, in light of finding the excellent, cheap, and conveniently located meeting > room at BAPL, I am feeling pretty ready to do some hanging out and coding in > the near future... too bad we're entering the worst time of the year for it! > > I had hoped we could do something like this on a Saturday, but the venue closes > at 16:45 on Saturdays, which isn't so great. (Alternate equally convenient > venue suggestions welcome.) I would vote for the Saturday time, even if the venue closes early. > Failing that, what about some non-Friday evening from 17:xx to 21:00? I will > try to produce a list of possible things to hack on in a future post, but how > would that sort of time suit people? Wouldn't starting at 1700 hours be a little difficult for people with real jobs? Unfortunately, 1800 hours implies rush-hour for me. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From faber at linuxnj.com Sun Nov 25 09:38:36 2007 From: faber at linuxnj.com (Faber J. Fedor) Date: Sun, 25 Nov 2007 12:38:36 -0500 Subject: [ABE.pm] technical meeting venue In-Reply-To: <20071118145206.GA30080@zodiac.codesimply.com> References: <20071118145206.GA30080@zodiac.codesimply.com> Message-ID: <20071125173836.GB2217@neptune.faber.nom> On 18/11/07 09:52 -0500, Ricardo SIGNES wrote: > > For our future reference, the Bethlehem Area Public Library rents a public > meeting room for Darn Cheap: Which branch? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From perl.abe at rjbs.manxome.org Sun Nov 25 13:10:30 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Sun, 25 Nov 2007 16:10:30 -0500 Subject: [ABE.pm] technical meeting venue In-Reply-To: <20071125173836.GB2217@neptune.faber.nom> References: <20071118145206.GA30080@zodiac.codesimply.com> <20071125173836.GB2217@neptune.faber.nom> Message-ID: <20071125211030.GA18336@zodiac.codesimply.com> * "Faber J. Fedor" [2007-11-25T12:38:36] > On 18/11/07 09:52 -0500, Ricardo SIGNES wrote: > > For our future reference, the Bethlehem Area Public Library rents a public > > meeting room for Darn Cheap: > > Which branch? The main one, on Church St. -- rjbs From phil at five-lawrences.com Thu Nov 29 14:23:45 2007 From: phil at five-lawrences.com (Phil Lawrence) Date: Thu, 29 Nov 2007 16:23:45 -0600 Subject: [ABE.pm] scripting against Exchange 2007 OWA? Message-ID: Hello, Has anyone done or seen anything related to scripting against Exchange 2007 OWA? Our exchange upgrade broke my MS Entourage, and I want to write something LWP-ish to alert me when there's new mail. Thanks! Phil From john-abe at apt202.net Thu Nov 29 16:03:03 2007 From: john-abe at apt202.net (John Cappiello) Date: Thu, 29 Nov 2007 19:03:03 -0500 Subject: [ABE.pm] scripting against Exchange 2007 OWA? In-Reply-To: References: Message-ID: <20071130000303.GA26179@apt202.net> On Thu, Nov 29, 2007 at 04:23:45PM -0600, Phil Lawrence wrote: > Has anyone done or seen anything related to scripting against Exchange > 2007 OWA? Our exchange upgrade broke my MS Entourage, and I want to > write something LWP-ish to alert me when there's new mail. Haven't used it, but a quick check on cpan returned this which seems to do exactly what you're attempting using OWA. http://search.cpan.org/~wsmith/Email-Folder-Exchange/ -- jcap From perl.abe at rjbs.manxome.org Fri Nov 30 10:52:35 2007 From: perl.abe at rjbs.manxome.org (Ricardo SIGNES) Date: Fri, 30 Nov 2007 13:52:35 -0500 Subject: [ABE.pm] see you people Wednesday Message-ID: <20071130185235.GA6026@knight.office.icgroup.com> So, I'll see you people on Wednesday at McGrady's. I'll probably get there around 18:00. Ted, if you're going to show up early, I can show up early too, but let me know. We'll pick a topic for our tech meeting in January and I will eat wings. -- rjbs From phil at five-lawrences.com Fri Nov 30 07:06:24 2007 From: phil at five-lawrences.com (Phil Lawrence) Date: Fri, 30 Nov 2007 09:06:24 -0600 Subject: [ABE.pm] scripting against Exchange 2007 OWA? In-Reply-To: <20071130000303.GA26179@apt202.net> References: <20071130000303.GA26179@apt202.net> Message-ID: On 11/29/07, John Cappiello wrote: > On Thu, Nov 29, 2007 at 04:23:45PM -0600, Phil Lawrence wrote: > > Has anyone done or seen anything related to scripting against Exchange > > 2007 OWA? Our exchange upgrade broke my MS Entourage, and I want to > > write something LWP-ish to alert me when there's new mail. > > Haven't used it, but a quick check on cpan returned this which seems to > do exactly what you're attempting using OWA. > > http://search.cpan.org/~wsmith/Email-Folder-Exchange/ Thanks. I downloaded it last night and will report back after I give it a try. :-) Phil