From jhannah at omnihotels.com Mon Apr 2 14:09:43 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon, 2 Apr 2007 16:09:43 -0500 Subject: [Omaha.pm] File migration quicky Message-ID: Wrote this quick and dirty thing today. *nix gods probably have a command-line way? I suppose I could Perl golf it just for fun... j #!/usr/bin/perl # staging_migrate.pl # # Recursively move all .XLS files in # /oracle/reports/archive-staging # to # /oracle/reports/archive # keeping the relative path the same. my $dir1 = "/oracle/reports/archive-staging"; my $dir2 = "/oracle/reports/archive"; open (IN, "find $dir1 -name '*.XLS' |"); while () { my $old = $_; my $new = $old; $new =~ s/$dir1/$dir2/; rename $old, $new or die "Can't rename '$old' to 'new'"; } close IN; From jay at jays.net Wed Apr 4 04:28:17 2007 From: jay at jays.net (Jay Hannah) Date: Wed, 4 Apr 2007 06:28:17 -0500 Subject: [Omaha.pm] GroovyQuiz.com is live, and has a Quiz for you! In-Reply-To: References: Message-ID: <8E9BF784-93DD-4040-BF97-2B6ECE11D30A@jays.net> This is an interesting site: http://codegolf.com/conways-game-of-life The winner? 155 bytes of Perl. :) j On Mar 30, 2007, at 1:02 AM, Matt Secoske wrote: > Hello Everyone, > > Just wanted to let you know that GroovyQuiz is live! Its first > quiz is also up, and ready to be used as fodder for this weekends > coding spree. > > Go to http://groovyquiz.com to see what it is :) > > An rss feed is available at http://groovyquiz.com/groovyquiz/main/rss > > The rules are very simple: accept the challenge and code away! > > Also, the site allows for comments on each quiz... please do not > spoil the quiz with solutions... just questions and clarifications > please. > > I will be working this weekend to allow for solution posting. In > the meantime, once you've solved it, go ahead and email your > solution to me... I will gladly post it once I've got the solutions > section working. > > And, I would love to hear comments on what you would like to see > from the site, quiz suggestions, etc. > > Thanks! > - Matt > > -- > Matt Secoske > http://blog.secosoft.net From jhannah at omnihotels.com Wed Apr 4 10:31:41 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Wed, 4 Apr 2007 12:31:41 -0500 Subject: [Omaha.pm] I broke my hip Message-ID: I always feel ancient when I stumble into my source code from over 5 years ago... j # ------------------ # Configure these if you want... -jhannah 8/30/01 my $start = '7/15/01'; # ------------------ From jhannah at omnihotels.com Fri Apr 6 07:42:31 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri, 6 Apr 2007 09:42:31 -0500 Subject: [Omaha.pm] Big PMP'n In-Reply-To: <29AB736ABCE5C745ABF9C93B02F2C27B081E8B35@exchange2k3.omnihotels.net> References: <29AB736ABCE5C745ABF9C93B02F2C27B081E8B35@exchange2k3.omnihotels.net> Message-ID: Over the last couple of months I've been seeing a bunch of people throw PMP after their name. Apparently some people think this stands for Project Management Professional, but I too want to be a PMP. (Yes, I know its hard out there for a PMP.) I hereby declare PMP is an acronym for Perl Master Programmer. I hereby certify all Omaha Perl Mongers as PMPs, so y'all can feel free to join me in my big PMP'n lifestyle. :) j, PMP ________________________________ From: Kenerley, Stephen E [CK] Sent: Friday, April 06, 2007 9:21 AM Dylan, Sorry we do not yet have an ETR. -snip!- Steve Kenerley, PMP Sprint Customer Care and Service Assurance Implementation Project Manager From trey-b at cox.net Fri Apr 6 11:03:02 2007 From: trey-b at cox.net (trey-b at cox.net) Date: Fri, 6 Apr 2007 13:03:02 -0500 Subject: [Omaha.pm] Big PMP'n Message-ID: <23695077.1175882582393.JavaMail.root@centrmwml07.mgt.cox.net> Thanks...I'm into Big PMP'n fer sure... ---- Jay Hannah wrote: > > Over the last couple of months I've been seeing a bunch of people throw > PMP after their name. Apparently some people think this stands for > Project Management Professional, but I too want to be a PMP. (Yes, I > know its hard out there for a PMP.) > > I hereby declare PMP is an acronym for Perl Master Programmer. I hereby > certify all Omaha Perl Mongers as PMPs, so y'all can feel free to join > me in my big PMP'n lifestyle. > > :) > > j, PMP > > > > ________________________________ > From: Kenerley, Stephen E [CK] > Sent: Friday, April 06, 2007 9:21 AM > > Dylan, > > Sorry we do not yet have an ETR. > -snip!- > > Steve Kenerley, PMP > Sprint > Customer Care and Service Assurance > Implementation Project Manager > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm From sjedwards at omnihotels.com Fri Apr 6 11:33:49 2007 From: sjedwards at omnihotels.com (Sean J. Edwards) Date: Fri, 06 Apr 2007 13:33:49 -0500 Subject: [Omaha.pm] Big PMP'n In-Reply-To: <23695077.1175882582393.JavaMail.root@centrmwml07.mgt.cox.net> References: <23695077.1175882582393.JavaMail.root@centrmwml07.mgt.cox.net> Message-ID: <1175884429.6392.40.camel@sjedwards.omnihotels.com> I think I will get PUNC'd by a Perl Unicode Network Certification. On Fri, 2007-04-06 at 13:03 -0500, trey-b at cox.net wrote: > Thanks...I'm into Big PMP'n fer sure... > > > > ---- Jay Hannah wrote: > > > > Over the last couple of months I've been seeing a bunch of people throw > > PMP after their name. Apparently some people think this stands for > > Project Management Professional, but I too want to be a PMP. (Yes, I > > know its hard out there for a PMP.) > > > > I hereby declare PMP is an acronym for Perl Master Programmer. I hereby > > certify all Omaha Perl Mongers as PMPs, so y'all can feel free to join > > me in my big PMP'n lifestyle. > > > > :) > > > > j, PMP > > > > > > > > ________________________________ > > From: Kenerley, Stephen E [CK] > > Sent: Friday, April 06, 2007 9:21 AM > > > > Dylan, > > > > Sorry we do not yet have an ETR. > > -snip!- > > > > Steve Kenerley, PMP > > Sprint > > Customer Care and Service Assurance > > Implementation Project Manager > > _______________________________________________ > > Omaha-pm mailing list > > Omaha-pm at pm.org > > http://mail.pm.org/mailman/listinfo/omaha-pm > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm > --
Sean Edwards
Omni Hotels Reservation Center
11819 Miami Street
Omaha, NE
(402) 952-6528
sjedwards at omnihotels.com

Learn more about Omni's Sensational Wednesdays program that thanks our loyal guest in unique, sensory ways
-------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20070406/1a3b6617/attachment.html From jhannah at omnihotels.com Mon Apr 9 10:36:37 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon, 9 Apr 2007 12:36:37 -0500 Subject: [Omaha.pm] (1) mtg tomorrow! (2) what? Message-ID: (1) Meeting tomorrow night @ 7pm! http://omaha.pm.org/ Any topic requests? Anyone doing anything cool w/ Perl? You can read my new Hype section: http://www.bioperl.org/wiki/User:Jhannah (2) What is this? $rmchg_var = $gl_acct{'RMCHG'|'RMUP'}; Am I drunk and/or does that ALWAYS assign the value of $gl_acct{'RMCHG'} into $rmchg_var? j From jhannah at omnihotels.com Mon Apr 9 11:34:00 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon, 9 Apr 2007 13:34:00 -0500 Subject: [Omaha.pm] find "000" in position 70-72 in text files Message-ID: Another Perl quicky... j my @files = glob "*dly"; foreach my $file (@files) { open (IN, $file); while () { if (/^.{69}000/) { print "$file: $_"; } } close IN; } From andy at petdance.com Mon Apr 9 11:39:53 2007 From: andy at petdance.com (Andy Lester) Date: Mon, 9 Apr 2007 13:39:53 -0500 Subject: [Omaha.pm] find "000" in position 70-72 in text files In-Reply-To: References: Message-ID: <3D678CD5-5CB8-4217-9E47-43C92B6D1C78@petdance.com> > my @files = glob "*dly"; > foreach my $file (@files) { > open (IN, $file); > while () { > if (/^.{69}000/) { > print "$file: $_"; > } > } > close IN; > } Jay, please start usin' the lexical handles! So you can say open( my $IN, $file ) or die "Can't open $file: $!\n"; Using the old-style handles is dangerous. You can also shorten it reaaaally short like so: $ perl -lne'print "$ARGV: $_" if /^.{69}000/' *dly That "open the file, read it and loop over it" is very common, and command line flags make it even easier. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From ryan at cfwebtools.com Mon Apr 9 12:36:09 2007 From: ryan at cfwebtools.com (Ryan Stille) Date: Mon, 09 Apr 2007 14:36:09 -0500 Subject: [Omaha.pm] good mirror script? Message-ID: <461A95A9.7020302@cfwebtools.com> Anyone know of a good tool to mirror a website, while changing the links to its accessible locally? I need to pull down the content of a site thats written in ASP. I'd like to change all the links so the site is accessible locally via the disk. I tried wget but its not working very well, it gives me a lot of broken links. If I don't come up with something, maybe this could be a project for tomorrow night? :-) -Ryan From andy at petdance.com Mon Apr 9 12:37:17 2007 From: andy at petdance.com (Andy Lester) Date: Mon, 9 Apr 2007 14:37:17 -0500 Subject: [Omaha.pm] good mirror script? In-Reply-To: <461A95A9.7020302@cfwebtools.com> References: <461A95A9.7020302@cfwebtools.com> Message-ID: <9942C523-48FB-4002-9E81-CA2881C380B2@petdance.com> On Apr 9, 2007, at 2:36 PM, Ryan Stille wrote: > I tried wget but its not working very well, it gives me a lot of > broken links. I suspect that you're not going to roll your own mirroring program any better than wget. I would bet a nickel that you're not calling wget properly. Andy -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From ryan at cfwebtools.com Mon Apr 9 12:48:14 2007 From: ryan at cfwebtools.com (Ryan Stille) Date: Mon, 09 Apr 2007 14:48:14 -0500 Subject: [Omaha.pm] good mirror script? In-Reply-To: <9942C523-48FB-4002-9E81-CA2881C380B2@petdance.com> References: <461A95A9.7020302@cfwebtools.com> <9942C523-48FB-4002-9E81-CA2881C380B2@petdance.com> Message-ID: <461A987E.8030809@cfwebtools.com> I think what I need to do would be a fairly simple script. Fetch the main page, which is a list of makes of cars. Follow those links, and save the content as the name of the link ("Toyota"), not the actual link ("Diagrammodels.asp?MakeID=17&link=BULLDOG"). The follow those links ("1991-1995", "1996-2001"), etc. etc. BUT - back to wget, here's what I'm doing, if you have any suggestions I'm open to them. wget --convert-links -E -r -H http://64.85.6.118/diagrams/diagrams.asp Thanks Andy Lester wrote: > On Apr 9, 2007, at 2:36 PM, Ryan Stille wrote: > > >> I tried wget but its not working very well, it gives me a lot of >> broken links. >> > > I suspect that you're not going to roll your own mirroring program > any better than wget. I would bet a nickel that you're not calling > wget properly. > > Andy > > -- > Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance > > > > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm > > From omaha.pm.knitter at recursor.net Mon Apr 9 13:15:48 2007 From: omaha.pm.knitter at recursor.net (omaha.pm.knitter at recursor.net) Date: Mon, 09 Apr 2007 15:15:48 -0500 Subject: [Omaha.pm] good mirror script? In-Reply-To: <461A987E.8030809@cfwebtools.com> References: <9942C523-48FB-4002-9E81-CA2881C380B2@petdance.com> <461A95A9.7020302@cfwebtools.com> <9942C523-48FB-4002-9E81-CA2881C380B2@petdance.com> Message-ID: <3.0.6.32.20070409151548.0114d750@pop.radiks.net> http://www.httrack.com/ Quote/ HTTrack is a free (GPL, libre/free software) and easy-to-use offline browser utility. It allows you to download a World Wide Web site from the Internet to a local directory, building recursively all directories, getting HTML, images, and other files from the server to your computer. HTTrack arranges the original site's relative link-structure. Simply open a page of the "mirrored" website in your browser, and you can browse the site from link to link, as if you were viewing it online. HTTrack can also update an existing mirrored site, and resume interrupted downloads. HTTrack is fully configurable, and has an integrated help system. WinHTTrack is the Windows 9x/NT/2000/XP release of HTTrack, and WebHTTrack the Linux/Unix/BSD release. /Quote From jay at jays.net Mon Apr 9 18:48:01 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 9 Apr 2007 20:48:01 -0500 Subject: [Omaha.pm] find "000" in position 70-72 in text files In-Reply-To: <3D678CD5-5CB8-4217-9E47-43C92B6D1C78@petdance.com> References: <3D678CD5-5CB8-4217-9E47-43C92B6D1C78@petdance.com> Message-ID: <8B3F77C2-7A59-4B8A-A2C2-D7978244FE35@jays.net> On Apr 9, 2007, at 1:39 PM, Andy Lester wrote: > Jay, please start usin' the lexical handles! So you can say > > open( my $IN, $file ) or die "Can't open $file: $!\n"; > > Using the old-style handles is dangerous. -ponder- I've always used open(IN, $file) or gone full OO w/ use FileHandle; my $fh = FileHandle->new; I'm not hep to your voodoo. "perldoc -f open" still seems to use my "old-style" too. I must be old if my Perl 5 methods are outdated before Perl 5 is. :) > You can also shorten it reaaaally short like so: > > $ perl -lne'print "$ARGV: $_" if /^.{69}000/' *dly Ah, $ARGV is very cool! I knew the rest of that but hadn't learned $ARGV. Thanks! j From jay at jays.net Mon Apr 9 18:52:19 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 9 Apr 2007 20:52:19 -0500 Subject: [Omaha.pm] good mirror script? In-Reply-To: <461A987E.8030809@cfwebtools.com> References: <461A95A9.7020302@cfwebtools.com> <9942C523-48FB-4002-9E81-CA2881C380B2@petdance.com> <461A987E.8030809@cfwebtools.com> Message-ID: On Apr 9, 2007, at 2:48 PM, Ryan Stille wrote: > wget --convert-links -E -r -H http://64.85.6.118/diagrams/diagrams.asp Seems to work for me? I aborted it after a while: http://jays.net/tmp/wstille/64.85.6.118/diagrams/diagrams.asp.html Then you want to convert the filenames for some reason? Oh well, we'll figure it out tomorrow night. :) j From ryan at cfwebtools.com Mon Apr 9 18:57:34 2007 From: ryan at cfwebtools.com (Ryan Stille) Date: Mon, 09 Apr 2007 20:57:34 -0500 Subject: [Omaha.pm] good mirror script? In-Reply-To: References: <461A95A9.7020302@cfwebtools.com> <9942C523-48FB-4002-9E81-CA2881C380B2@petdance.com> <461A987E.8030809@cfwebtools.com> Message-ID: <461AEF0E.8070105@cfwebtools.com> Yes it works, in that it is downloading a bunch of content. But if you try to browse the files, you don't get very far before you encounter broken links. Maybe I need to let the whole thing finish, maybe thats when it goes back and fixes the links? I tried the suggested httrack program, and that seemed to work pretty good. -Ryan Jay Hannah wrote: > On Apr 9, 2007, at 2:48 PM, Ryan Stille wrote: > >> wget --convert-links -E -r -H http://64.85.6.118/diagrams/diagrams.asp >> > > Seems to work for me? I aborted it after a while: > > http://jays.net/tmp/wstille/64.85.6.118/diagrams/diagrams.asp.html > > Then you want to convert the filenames for some reason? > > Oh well, we'll figure it out tomorrow night. :) > > j > > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm > > From andy at petdance.com Mon Apr 9 18:56:29 2007 From: andy at petdance.com (Andy Lester) Date: Mon, 9 Apr 2007 20:56:29 -0500 Subject: [Omaha.pm] find "000" in position 70-72 in text files In-Reply-To: <8B3F77C2-7A59-4B8A-A2C2-D7978244FE35@jays.net> References: <3D678CD5-5CB8-4217-9E47-43C92B6D1C78@petdance.com> <8B3F77C2-7A59-4B8A-A2C2-D7978244FE35@jays.net> Message-ID: On Apr 9, 2007, at 8:48 PM, Jay Hannah wrote: > -ponder- I've always used > > open(IN, $file) open( my $fh, $file ) is identical to open(IN,$file) except that $fh is a lexical variable, and IN is a global. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jhannah at omnihotels.com Tue Apr 10 08:15:56 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Tue, 10 Apr 2007 10:15:56 -0500 Subject: [Omaha.pm] Mastering Perl Message-ID: Wow. Lots of stuff for real world large business Perl: http://www252.pair.com/comdog/mastering_perl/Chapters/ Wow. About writing the book: "I'm running the entire project "transparently", meaning just about anyone is free to take part, review the intermediate drafts, or make comments. You get to see how a book goes from the idea to the final product, and I get a better book as a result." http://perlcast.com/ "brian d foy on Benchmarking" j From andy at petdance.com Tue Apr 10 09:07:39 2007 From: andy at petdance.com (Andy Lester) Date: Tue, 10 Apr 2007 11:07:39 -0500 Subject: [Omaha.pm] Mastering Perl In-Reply-To: References: Message-ID: On Apr 10, 2007, at 10:15 AM, Jay Hannah wrote: > "I'm running the entire project "transparently", meaning just about > anyone is free to take part, review the intermediate drafts, or make > comments. You get to see how a book goes from the idea to the final > product, and I get a better book as a result." That's exactly how I'm writing Pragmatic Job Hunting (http:// petdance.com/pjh), and how MJD did Higher Order Perl. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From dthacker9 at cox.net Tue Apr 10 18:29:39 2007 From: dthacker9 at cox.net (Dave Thacker) Date: Tue, 10 Apr 2007 20:29:39 -0500 Subject: [Omaha.pm] Mastering Perl In-Reply-To: References: Message-ID: <200704102029.39235.dthacker9@cox.net> On Tuesday 10 April 2007 10:15, Jay Hannah wrote: > Wow. Lots of stuff for real world large business Perl: > > http://www252.pair.com/comdog/mastering_perl/Chapters/ > > Wow. About writing the book: > > "I'm running the entire project "transparently", meaning just about > anyone is free to take part, review the intermediate drafts, or make > comments. You get to see how a book goes from the idea to the final > product, and I get a better book as a result." > > http://perlcast.com/ > "brian d foy on Benchmarking" One of my personal favorites, I think I saw it previously on Perlmonks: http://www252.pair.com/comdog/mastering_perl/Chapters/A2.brians_guide.html > > j > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm From dan at linder.org Tue Apr 10 21:53:34 2007 From: dan at linder.org (Daniel Linder) Date: Tue, 10 Apr 2007 23:53:34 -0500 (CDT) Subject: [Omaha.pm] good mirror script? In-Reply-To: <461A987E.8030809@cfwebtools.com> References: <461A95A9.7020302@cfwebtools.com> <9942C523-48FB-4002-9E81-CA2881C380B2@petdance.com> <461A987E.8030809@cfwebtools.com> Message-ID: <1286.70.165.110.36.1176267214.squirrel@www.linder.org> On Mon, April 9, 2007 14:48, Ryan Stille wrote: > BUT - back to wget, here's what I'm doing, if you have any suggestions > I'm open to them. > > wget --convert-links -E -r -H http://64.85.6.118/diagrams/diagrams.asp When I ran the wget on my website I got the files with the URLs stripped out. I tried your exact example, but didn't wait for it to finish. When I ran wget pointed to a smaller website and used "-K" (to save the files the --convert-links modifies) I can see it removing the "http://xxxx" bits. If you run the wget on a smaller site, does it work as you expect it to there? In my case, the wget had to completely traverse the entire site tree, then at the end it reported multiple lines like "Converting www.site.tld/file1.htm..." Dan - - - - "Wait for that wisest of all counselors, time." -- Pericles "I do not fear computers, I fear the lack of them." -- Isaac Asimov From dan at linder.org Tue Apr 10 22:03:49 2007 From: dan at linder.org (Daniel Linder) Date: Wed, 11 Apr 2007 00:03:49 -0500 (CDT) Subject: [Omaha.pm] good mirror script? In-Reply-To: <1286.70.165.110.36.1176267214.squirrel@www.linder.org> References: <461A95A9.7020302@cfwebtools.com> <9942C523-48FB-4002-9E81-CA2881C380B2@petdance.com> <461A987E.8030809@cfwebtools.com> <1286.70.165.110.36.1176267214.squirrel@www.linder.org> Message-ID: <1337.70.165.110.36.1176267829.squirrel@www.linder.org> Just a follow-up. I ran this: wget --convert-links -E -r -K -l 1 http://www.directwholesale.net/diagrams/diagrams.asp The big change here from yours were the "-K"(keep original files) and "-l 1" (limit to one depth of recursion). When this ran _AND_COMPLETED_, it printed the lines: FINISHED --00:36:50-- Downloaded: 12,675 bytes in 3 files Converting www.directwholesale.net/diagrams/diagrams.asp.html... 2-0 Converting www.directwholesale.net/diagrams/diagrammodels.asp?link=.html... 0-2 Converting www.directwholesale.net/diagrams/DiagramMake.asp?link=.html... 0-100 Converted 3 files in 0.005 seconds. Checking the differences between "diagrams.asp.html" and "diagrams.asp.html.orig" shows that it has cleaned up some of the URLs to make them local-filesystem friendly. Looks like you have to wait for it to complete before it does the cleanup... Dan On Tue, April 10, 2007 23:53, Daniel Linder wrote: > On Mon, April 9, 2007 14:48, Ryan Stille wrote: >> BUT - back to wget, here's what I'm doing, if you have any suggestions >> I'm open to them. >> >> wget --convert-links -E -r -H http://64.85.6.118/diagrams/diagrams.asp > > When I ran the wget on my website I got the files with the URLs stripped > out. I tried your exact example, but didn't wait for it to finish. When > I ran wget pointed to a smaller website and used "-K" (to save the files > the --convert-links modifies) I can see it removing the "http://xxxx" > bits. > > If you run the wget on a smaller site, does it work as you expect it to > there? > > In my case, the wget had to completely traverse the entire site tree, then > at the end it reported multiple lines like "Converting > www.site.tld/file1.htm..." > > Dan > > - - - - > "Wait for that wisest of all counselors, time." -- Pericles > "I do not fear computers, I fear the lack of them." -- Isaac Asimov > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm > - - - - "Wait for that wisest of all counselors, time." -- Pericles "I do not fear computers, I fear the lack of them." -- Isaac Asimov From ryan at cfwebtools.com Wed Apr 11 06:34:53 2007 From: ryan at cfwebtools.com (Ryan Stille) Date: Wed, 11 Apr 2007 08:34:53 -0500 Subject: [Omaha.pm] good mirror script? In-Reply-To: <1337.70.165.110.36.1176267829.squirrel@www.linder.org> References: <461A95A9.7020302@cfwebtools.com> <9942C523-48FB-4002-9E81-CA2881C380B2@petdance.com> <461A987E.8030809@cfwebtools.com> <1286.70.165.110.36.1176267214.squirrel@www.linder.org> <1337.70.165.110.36.1176267829.squirrel@www.linder.org> Message-ID: <461CE3FD.8090604@cfwebtools.com> Good to know, thanks. What I with httrack turned out pretty good though. -Ryan Daniel Linder wrote: > Just a follow-up. > > I ran this: > wget --convert-links -E -r -K -l 1 > http://www.directwholesale.net/diagrams/diagrams.asp > > The big change here from yours were the "-K"(keep original files) and "-l > 1" (limit to one depth of recursion). > > When this ran _AND_COMPLETED_, it printed the lines: > FINISHED --00:36:50-- > Downloaded: 12,675 bytes in 3 files > Converting www.directwholesale.net/diagrams/diagrams.asp.html... 2-0 > Converting > www.directwholesale.net/diagrams/diagrammodels.asp?link=.html... 0-2 > Converting www.directwholesale.net/diagrams/DiagramMake.asp?link=.html... > 0-100 > Converted 3 files in 0.005 seconds. > > Checking the differences between "diagrams.asp.html" and > "diagrams.asp.html.orig" shows that it has cleaned up some of the URLs to > make them local-filesystem friendly. > > Looks like you have to wait for it to complete before it does the cleanup... > > Dan > > On Tue, April 10, 2007 23:53, Daniel Linder wrote: > >> On Mon, April 9, 2007 14:48, Ryan Stille wrote: >> >>> BUT - back to wget, here's what I'm doing, if you have any suggestions >>> I'm open to them. >>> >>> wget --convert-links -E -r -H http://64.85.6.118/diagrams/diagrams.asp >>> >> When I ran the wget on my website I got the files with the URLs stripped >> out. I tried your exact example, but didn't wait for it to finish. When >> I ran wget pointed to a smaller website and used "-K" (to save the files >> the --convert-links modifies) I can see it removing the "http://xxxx" >> bits. >> >> If you run the wget on a smaller site, does it work as you expect it to >> there? >> >> In my case, the wget had to completely traverse the entire site tree, then >> at the end it reported multiple lines like "Converting >> www.site.tld/file1.htm..." >> >> Dan >> >> - - - - >> "Wait for that wisest of all counselors, time." -- Pericles >> "I do not fear computers, I fear the lack of them." -- Isaac Asimov >> >> _______________________________________________ >> Omaha-pm mailing list >> Omaha-pm at pm.org >> http://mail.pm.org/mailman/listinfo/omaha-pm >> >> > > > - - - - > "Wait for that wisest of all counselors, time." -- Pericles > "I do not fear computers, I fear the lack of them." -- Isaac Asimov > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm > > From jhannah at omnihotels.com Wed Apr 11 14:19:54 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Wed, 11 Apr 2007 16:19:54 -0500 Subject: [Omaha.pm] Database -> XML Message-ID: Hmm... I wrote this this afternoon. Your thoughts? Good? Bad? I think I like this idiom. Tight code, readable, maintainable. It's a one-way extract. From here I just map a bajillion more tables/columns from our database and I'm done. If/when the subs get to bulky I'll throw them to .pm files... Ponder, j =========================================== #!/usr/bin/perl use strict; use XML::Twig; use Omni::DB; use Date::Calc qw(Today_and_Now); my $dbh = Omni::DB::connect_prod_with_pw; my $prop = "ATLCNN"; my $asof = sprintf("%04d%02d%02d%02d%02d%02d", Today_and_Now()); my $t = XML::Twig->new(); $t->set_pretty_print('indented'); $t->parse(""); my $root = $t->root; add_roominfo($root); $t->print; $dbh->disconnect; sub add_roominfo { my ($root) = @_; my $roominfo = XML::Twig::Elt->new('roominfo'); $roominfo->paste(last_child => $root) or die; my $sth = $dbh->prepare("select room_type, to_sell_qty from rooms where prop = '$prop'"); $sth->execute; while (my $href = $sth->fetchrow_hashref) { foreach (keys %$href) { $href->{$_} =~ s/\s+$//; } my $elt = XML::Twig::Elt->new( rmtype => { rt => $href->{room_type}, physcap => $href->{to_sell_qty}, }); $elt->paste(last_child => $roominfo) or die; } $sth->finish; } =========================================== ...snip!... =========================================== From netarttodd at gmail.com Wed Apr 11 17:59:42 2007 From: netarttodd at gmail.com (Todd Christopher Hamilton) Date: Wed, 11 Apr 2007 19:59:42 -0500 Subject: [Omaha.pm] Perl Developer Needed Message-ID: <1fdb7d920704111759s4d1a2a04s18206e6ea35b0625@mail.gmail.com> My small healthcare technology consulting company needs a Perl Developer. W2 or 1099. Possibly up to 20 hours per week. Flexible work hours. If you are a perl programmer and have (or would like to have) healthcare technology experience, and would like to make a few bucks, please contact me at NetArtTodd at gmail dot com. Put "Perl Developer" in the subject line. Todd Christopher Hamilton From robert.fulkerson at gmail.com Sun Apr 15 21:39:41 2007 From: robert.fulkerson at gmail.com (Robert Fulkerson) Date: Sun, 15 Apr 2007 23:39:41 -0500 Subject: [Omaha.pm] Lightning Talks, mostly Perl-related: Tuesday, April 24th Message-ID: <6cb6eebc0704152139k666bd188j3831493148656d04@mail.gmail.com> Hello all, It's time to invite everyone to the UNO CSCI 2850 (Perl) class's semester-ending lightning talks. The talks this semester will be on Tuesday, April 24th, 2007, starting at 5:45 PM and lasting most likely until around 8:00 PM. There weren't enough talks to split them into two meaningful evenings, so we're going to have a super-long night of talks. If all goes well, there will be pizza available on a first-come, first-served basis. I'm not sure how much pizza we can get, so maybe it'll just be enough for three or four people. :) I've attached the flier for this semester's talk topics. I've only received brief overviews of most of the topics, so I can't give you much insight into what a topic like "web scraping tools" will cover. You'll just have to come and find out, I guess. :) This semester's talks are in room 359 at the Peter Kiewit Institute at 67th & Pacific. Here's a link to Google Maps for the Peter Kiewit Institute: http://tinyurl.com/v5f9s On an unrelated note, awhile back I mentioned to the list that UNO was in the process of standardizing on one language for a sequence of internet-related programming courses. The final verdict is in and starting in the fall, there will be a one-two punch of Perl courses, CIST 1300 (intro) and CSCI 2850 (not intro). Additionally, a bioinformatics programming course that has yet to be developed will build off of the Perl programming foundation found in 1300/2850. Thanks to everyone who provided input when I queried the list a few months ago. -- raf For those who don't like to look at PDF files, here's a copy-and-pasted list of topics: Expect.pm BigRedKeno.com scraper and analyzer Password cracking with Perl Cool Firefox Extensions Web scraping tools Regex Coach DotNetNuke Authenticating Local Machine Users from the Web / UNIX passwd w/PHP and Perl POE Module / Framework (Acme::POE::Knee) Encryption algorithms in Perl Perl Golf SVG Perl MP3::Tag / Scraping for Lyrics Net::OSCAR Perl Roleplaying Dice Thingy GMapper (GPS Coordinates for Photography) e-bruno registration with Perl Server-side vs. Client-side Scripting Apache2::ExplorerDestroyer Web Browser Comparison Python vs. Perl Perl at the UNO Gateway Perl and Bluetooth Perl and Facebook Perl/Tk Restaurant Reservation System (10 minute dual talk) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20070415/5d9ef86c/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: 2850 - Talks - 07 - Sp - Lightning Talks Flier.pdf Type: application/pdf Size: 10083 bytes Desc: not available Url : http://mail.pm.org/pipermail/omaha-pm/attachments/20070415/5d9ef86c/attachment-0001.pdf From georgen at neillnet.com Sun Apr 15 23:20:59 2007 From: georgen at neillnet.com (George Neill) Date: Mon, 16 Apr 2007 01:20:59 -0500 Subject: [Omaha.pm] Database -> XML In-Reply-To: References: Message-ID: <20070416012059.fpza9900u8c4w0oo@www.neillnet.com> Hi Jay, Quoting Jay Hannah : > Hmm... I wrote this this afternoon. Your thoughts? Good? Bad? Does Omni::DB take care of cleansing $prop from injections and such? I think your code below is simple enough and would be easy to maintain for a handful of tables. While I have never used it, DBIx::XML_RDB or XML::Dumper might be worth a look ... Later, George. From georgen at neillnet.com Sun Apr 15 23:58:14 2007 From: georgen at neillnet.com (George Neill) Date: Mon, 16 Apr 2007 01:58:14 -0500 Subject: [Omaha.pm] File migration quicky In-Reply-To: References: Message-ID: <20070416015814.erzq9rxf4so84k0w@www.neillnet.com> Jay, Quoting Jay Hannah : > Wrote this quick and dirty thing today. > > *nix gods probably have a command-line way? I suppose I could Perl golf > it just for fun... host:~ george$ cat move.sh #!/bin/bash if [ $# -ne 2 ]; then echo "Usage $0 " exit fi for entry in $1 do mv ${entry} ${entry/$1/$2} done host:~ george$ ls -ld /tmp/gg drwxr-xr-x 4 george wheel 136 Apr 16 01:40 /tmp/gg host:~ george$ ./move.sh /tmp/gg/ /tmp/george/ host:~ george$ ls -ld /tmp/gg ls: /tmp/gg: No such file or directory host:~ george$ ls -ld /tmp/george drwxr-xr-x 4 george wheel 136 Apr 16 01:40 /tmp/george ... of course this script by itself doesn't do exactly what yours does, but it does show how nifty bash can be. I am sure you could 'find ... | xargs -n2 mv ...' to do the work of your .pl Also, you might want to do a mkdir(dirname($new)) before your rename. Just incase your $dir2 doesn't have the same directory structure as $dir1 (unless, rename does that for you?) Later, George. From jhannah at omnihotels.com Mon Apr 16 09:55:15 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Mon, 16 Apr 2007 11:55:15 -0500 Subject: [Omaha.pm] =?iso-8859-1?q?garbage_in_perldoc_=28dashes_become_=E2?= =?iso-8859-1?q?_characters=2C_etc=2E=29?= Message-ID: Looks like the default LANG environment variable in SuSE 10 Enterprise LANG=en_US.UTF-8 Makes perldoc unreadable... ------------ perldoc perl NAME perl ? Practical Extraction and Report Language SYNOPSIS perl [ ?sTuU ] [ ?hv ] [ ?V[:configvar] ] [ ?cw ] [ ?d[:debugger] ] [ ?D[number/list] ] [ ?pna ] [ ?Fpattern ] [ ?l[octal] ] [ ?0[octal] ] [ ?Idir ] [ ?m[?]module ] [ ?M[?]?module...? ] [ ?P ] [ ?S ] [ ?x[dir] ] ------------ If you export LANG=en_US (or "unset LANG") then everything is fine. $0.02, j From jhannah at omnihotels.com Tue Apr 17 15:53:23 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Tue, 17 Apr 2007 17:53:23 -0500 Subject: [Omaha.pm] Precedence && vs or Message-ID: Huh. This was dying when $last_elt wasn't defined: $last_elt->paste(last_child => $controls) or die; So I changed it to this: $last_elt && $last_elt->paste(last_child => $controls) or die; Thinking the && would short-circuit the rest if $last_elt wasn't defined. It doesn't. Here's a demo: -------- $ cat j.pl my $j; $j && $j->what or die; $ perl j.pl Died at j.pl line 4. -------- Oops. Adding parens gets me to the behaviour I expected: -------- $ cat j.pl my $j; $j && ($j->what or die); $ perl j.pl $ -------- Live and learn. :) j From jhannah at omnihotels.com Fri Apr 20 11:49:30 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri, 20 Apr 2007 13:49:30 -0500 Subject: [Omaha.pm] # TEMP PATCH FIX LATER Message-ID: -bash-2.05b$ cvs annotate allres_10.4gl | grep 'TEMP PATC' Annotations for allres_10.4gl *************** 8.15 (pbaker 12-Apr-02): LET lr_res_transact.rate_cat = g_rate_cat_250 # TEMP PATCH FIX LATER -laugh!- April 2002... I wonder when that pbaker guy is going to fix that temp patch...? Poke, j From hostetlerm at gmail.com Fri Apr 20 11:53:39 2007 From: hostetlerm at gmail.com (Mike Hostetler) Date: Fri, 20 Apr 2007 13:53:39 -0500 Subject: [Omaha.pm] # TEMP PATCH FIX LATER In-Reply-To: References: Message-ID: >On 4/20/07, Jay Hannah wrote: > -bash-2.05b$ cvs annotate allres_10.4gl | grep 'TEMP PATC' > Annotations for allres_10.4gl > *************** > 8.15 (pbaker 12-Apr-02): LET lr_res_transact.rate_cat = > g_rate_cat_250 # TEMP PATCH FIX LATER > > April 2002... I wonder when that pbaker guy is going to fix that temp > patch...? > One of the laws of IT I have seen proven correct again and again: Nothing is more permanent than a temporary solution. It goes back to the "if it ain't broke, don't fix it." -- Mike Hostetler http://mike.hostetlerhome.com/ From jhannah at omnihotels.com Fri Apr 20 13:26:35 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri, 20 Apr 2007 15:26:35 -0500 Subject: [Omaha.pm] database -> XML Message-ID: Wow. It's amazing to me how tight this code is. I'm getting the job done with almost zero overhead! Thanks Perl and CPAN!! (and especially XML::Twig and Class::Date in this snippet) j (Yes, I know a couple globals float magically into the sub. Yes I know that's bad.) ------------------------------------------------------ =head2 add_lostbiz Add the lostbiz section to the XML document. =cut sub add_lostbiz { my ($root) = @_; my $lostbiz = XML::Twig::Elt->new('lostbiz'); $lostbiz->paste(last_child => $root) or die; # res_transact.room_cat is actually storing adult_qty. See our data dictionary. my $strsql = <= 199 and wrap_up_reason < 599 EOT my $sth = $dbh->prepare($strsql); $sth->execute; my @row; while (@row = $sth->fetchrow) { for (@row) { s/\s+$// } my ($time, $type, $src, $doa, $depart_date, $rt, $seg, $gcnt, $exprrev) = @row; $time =~ s/[- :]//g; $doa = Control::DateTime->new($doa); $depart_date = Control::DateTime->new($depart_date); my $los = ($depart_date - $doa)->day; $rt = $xref->roomcat_xref( prop => $prop, crs_roomcat => $rt, ); $seg = $xref->ratecat_xref( crs_ratecat => $seg, ); my $elt = XML::Twig::Elt->new( loss => { time => $time, type => $xref->wrap_up_reason($type), src => $src, doa => $doa->format("%Y%m%d"), los => $los, rt => $rt, seg => $seg, cas => "N", gcnt => $gcnt, exprrev => sprintf("%0.2f", $exprrev * $los), }); $elt->paste(last_child => $lostbiz) or die; } $sth->finish; } ------------------------------------------------------ ------------------------------------------------------ From jay at jays.net Fri Apr 20 14:15:58 2007 From: jay at jays.net (Jay Hannah) Date: Fri, 20 Apr 2007 16:15:58 -0500 Subject: [Omaha.pm] Database -> XML In-Reply-To: <20070416012059.fpza9900u8c4w0oo@www.neillnet.com> References: <20070416012059.fpza9900u8c4w0oo@www.neillnet.com> Message-ID: <3c7efdcf89f93b46c5755b21e14e820f@jays.net> On Apr 16, 2007, at 1:20 AM, George Neill wrote: > Does Omni::DB take care of cleansing $prop from injections and such? No, it doesn't. But that's an excellent concern to raise. $prop (aka property aka hotel) is just hard-coded in my program source code for now. Later it will be in a loop controlled by the database (our "hotels" table has one row per hotel and prop is a key). If I was ever going to accept $prop as input from the outside I'd (1) sanitize it with a regex, (2) make sure it was in a DBI placeholder, not just running loose in an SQL string, and (3) use Perl's taint mode. ... err: confession: I never use Perl's taint mode. But at least I'm aware that I probably should. Does that count? :) > I think your code below is simple enough and would be easy to maintain > for a handful of tables. Ya. I like it. Obviously it gets uglier as the table joins get uglier and/or the mapping needs to be nested/regrouped/etc, but I think the final result is as pretty as its going to be in any language. :) j From dan at linder.org Fri Apr 20 14:24:09 2007 From: dan at linder.org (Daniel Linder) Date: Fri, 20 Apr 2007 16:24:09 -0500 (CDT) Subject: [Omaha.pm] # TEMP PATCH FIX LATER In-Reply-To: References: Message-ID: <26169.12.160.138.58.1177104249.squirrel@www.linder.org> On 4/20/07, Jay Hannah wrote: > 8.15 (pbaker 12-Apr-02): LET lr_res_transact.rate_cat = > g_rate_cat_250 # TEMP PATCH FIX LATER > > April 2002... I wonder when that pbaker guy is going to fix that temp > patch...? On Fri, April 20, 2007 13:53, Mike Hostetler wrote: > One of the laws of IT I have seen proven correct again and again: > Nothing is more permanent than a temporary solution. > > It goes back to the "if it ain't broke, don't fix it." On that note here is your patch: - LET lr_res_transact.rate_cat = g_rate_cat_250 # TEMP PATCH FIX LATER + LET lr_res_transact.rate_cat = g_rate_cat_250 # Elegant solution by pbaker Dan - - - - "Wait for that wisest of all counselors, time." -- Pericles "I do not fear computers, I fear the lack of them." -- Isaac Asimov From jay at jays.net Fri Apr 20 16:01:34 2007 From: jay at jays.net (Jay Hannah) Date: Fri, 20 Apr 2007 18:01:34 -0500 Subject: [Omaha.pm] Lightning Talks, mostly Perl-related: Tuesday, April 24th In-Reply-To: <6cb6eebc0704152139k666bd188j3831493148656d04@mail.gmail.com> References: <6cb6eebc0704152139k666bd188j3831493148656d04@mail.gmail.com> Message-ID: On Apr 15, 2007, at 11:39 PM, Robert Fulkerson wrote: > Additionally, a bioinformatics programming course that has yet to be > developed will build off of the Perl programming foundation found in > 1300/2850. Ooo! I'll enroll @ UNO and get my transcripts from 1995 just to take that one! :) Who do I talk to to sign up? (... and/or can I teach/TA/audit it? -grin-) Thanks, j seqlab.net http://www.bioperl.org/wiki/User:Jhannah From georgen at neillnet.com Sun Apr 22 20:40:44 2007 From: georgen at neillnet.com (George Neill) Date: Sun, 22 Apr 2007 22:40:44 -0500 Subject: [Omaha.pm] database -> XML In-Reply-To: References: Message-ID: <20070422224044.lmhzzqzyo0wgk0gk@www.neillnet.com> Hi j, I am curious as to why you chose to use xml attributes over elements? i.e. vs. N 20070523 338.00 2 2 DELUXE 07 TUSNTL-PH RR Later, George. From georgen at neillnet.com Sun Apr 22 20:58:48 2007 From: georgen at neillnet.com (George Neill) Date: Sun, 22 Apr 2007 22:58:48 -0500 Subject: [Omaha.pm] Database -> XML In-Reply-To: <3c7efdcf89f93b46c5755b21e14e820f@jays.net> References: <20070416012059.fpza9900u8c4w0oo@www.neillnet.com> <3c7efdcf89f93b46c5755b21e14e820f@jays.net> Message-ID: <20070422225848.y6p0xqr1s00ggcw4@www.neillnet.com> Quoting Jay Hannah : > If I was ever going to accept $prop as input from the outside I'd (1) > sanitize it with a regex, (2) make sure it was in a DBI placeholder, > not just running loose in an SQL string, and (3) use Perl's taint mode. What about the monger -not- named Jay who makes it available to the outside! :) Later, George. From pbaker at omnihotels.com Mon Apr 23 05:38:11 2007 From: pbaker at omnihotels.com (Sean Baker) Date: Mon, 23 Apr 2007 07:38:11 -0500 Subject: [Omaha.pm] # TEMP PATCH FIX LATER In-Reply-To: <26169.12.160.138.58.1177104249.squirrel@www.linder.org> References: <26169.12.160.138.58.1177104249.squirrel@www.linder.org> Message-ID: >+ LET lr_res_transact.rate_cat = g_rate_cat_250 # Elegant solution by pbaker Thanks for fixing that for me! ;) Sean Baker From jay at jays.net Mon Apr 23 17:06:25 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 23 Apr 2007 19:06:25 -0500 Subject: [Omaha.pm] database -> XML In-Reply-To: <20070422224044.lmhzzqzyo0wgk0gk@www.neillnet.com> References: <20070422224044.lmhzzqzyo0wgk0gk@www.neillnet.com> Message-ID: <2303e0d768d6b1acce58aecfa9f11e31@jays.net> On Apr 22, 2007, at 10:40 PM, George Neill wrote: > I am curious as to why you chose to use xml attributes over elements? Huh. I'm not sure. It's not my spec, I'm just writing to it. Uche has some thoughts on your question: http://www-128.ibm.com/developerworks/xml/library/x-eleatt.html >> If I was ever going to accept $prop as input from the outside I'd (1) >> sanitize it with a regex, (2) make sure it was in a DBI placeholder, >> not just running loose in an SQL string, and (3) use Perl's taint >> mode. > > What about the monger -not- named Jay who makes it available to the > outside! :) Well, a rogue programmer has always been able to destroy everything where I work, so I stopped worrying about that a while ago. :) j From georgen at neillnet.com Mon Apr 23 18:35:31 2007 From: georgen at neillnet.com (George Neill) Date: Mon, 23 Apr 2007 20:35:31 -0500 Subject: [Omaha.pm] database -> XML In-Reply-To: <2303e0d768d6b1acce58aecfa9f11e31@jays.net> References: <20070422224044.lmhzzqzyo0wgk0gk@www.neillnet.com> <2303e0d768d6b1acce58aecfa9f11e31@jays.net> Message-ID: <20070423203531.pp1ssomeqs044sgk@www.neillnet.com> Quoting Jay Hannah : > Huh. I'm not sure. It's not my spec, I'm just writing to it. Uche has > some thoughts on your question: > http://www-128.ibm.com/developerworks/xml/library/x-eleatt.html Thanks for the link. I have always seemed to come to a middle ground when creating XML schema/DTDs ... some attributes; some elements. I thought you designed it and wanted to get your thoughts on the subject. > Well, a rogue programmer has always been able to destroy everything > where I work, so I stopped worrying about that a while ago. :) :) Later, George. From jhannah at omnihotels.com Tue Apr 24 13:42:27 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Tue, 24 Apr 2007 15:42:27 -0500 Subject: [Omaha.pm] printf("%02d", "2007") Message-ID: Ran into this code today --- unless ($a[0] =~ /^\w\w\w \d\d \d\d\d\d/) { die "Unrecognized date format from MS-SQL: '$a[0]'"; } @b=split ' ',$a[0]; $key_val = sprintf("%02d%02d%02d|%s",$mon{$b[0]},$b[1],$b[2],$a[1]); --- Does anyone else think its strange to explicitly demand that Perl ram four digits through sprintf "%02d"? I do. :) $ perl -e 'printf("%02d", "2007")' 2007 j From jhannah at omnihotels.com Tue Apr 24 13:53:29 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Tue, 24 Apr 2007 15:53:29 -0500 Subject: [Omaha.pm] evolution Message-ID: $x = $x + 1; $x += 1; $x++; Those all do the same thing. I ran into the 2nd version today and was surprised it wasn't the 3rd. :) j From KThompson at heiskell.com Tue Apr 24 14:13:36 2007 From: KThompson at heiskell.com (Thompson, Kenn) Date: Tue, 24 Apr 2007 14:13:36 -0700 Subject: [Omaha.pm] evolution Message-ID: <16F8D15756891C4EA961565331A3B350066CE28E@JDHEXC01.heiskell.com> -----Original Message----- $x = $x + 1; $x += 1; $x++; Those all do the same thing. I ran into the 2nd version today and was surprised it wasn't the 3rd. :) [Thompson, Kenn] Not so odd if the programmer was a vb.net guy trying his hand at Perl ;) From andy at petdance.com Tue Apr 24 16:32:51 2007 From: andy at petdance.com (Andy Lester) Date: Tue, 24 Apr 2007 18:32:51 -0500 Subject: [Omaha.pm] evolution In-Reply-To: <16F8D15756891C4EA961565331A3B350066CE28E@JDHEXC01.heiskell.com> References: <16F8D15756891C4EA961565331A3B350066CE28E@JDHEXC01.heiskell.com> Message-ID: <53511A8A-500F-467C-9E55-D9E44720ABB7@petdance.com> > $x = $x + 1; > > $x += 1; > > $x++; > > > Those all do the same thing. I ran into the 2nd version today and was > surprised it wasn't the 3rd. :) They're not all the same. $ cat foo.pl $a = 'x'; $a = $a + 1; $b = 'x'; $b += 1; $c = 'x'; $c++; print join ", ", ( $a, $b, $c ); $ perl -l foo.pl 1, 1, y Didn't know Perl could increment strings, didja? :-) Lots of things like this are on our new site, perl101.org xoxo, Andy -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Tue Apr 24 17:04:32 2007 From: andy at petdance.com (Andy Lester) Date: Tue, 24 Apr 2007 19:04:32 -0500 Subject: [Omaha.pm] printf("%02d", "2007") In-Reply-To: References: Message-ID: <0CF4ED49-2E0C-4BDA-8243-23F97C0F5EB1@petdance.com> On Apr 24, 2007, at 3:42 PM, Jay Hannah wrote: > unless ($a[0] =~ /^\w\w\w \d\d \d\d\d\d/) { > die "Unrecognized date format from MS-SQL: '$a[0]'"; > } > @b=split ' ',$a[0]; Funny that they match a pattern, and then do the split. Better to do: unless ( @b = ($a[0] =~ /^(\w{3}) (\d{2}) (\d{4})/ ) { die... } Then @b is populated. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From rob.townley at gmail.com Tue Apr 24 19:01:31 2007 From: rob.townley at gmail.com (Rob Townley) Date: Tue, 24 Apr 2007 21:01:31 -0500 Subject: [Omaha.pm] database -> XML In-Reply-To: <20070422224044.lmhzzqzyo0wgk0gk@www.neillnet.com> References: <20070422224044.lmhzzqzyo0wgk0gk@www.neillnet.com> Message-ID: <7e84ed60704241901l2d385c1cg771a6cfbe333aadc@mail.gmail.com> Several years ago, elements were better. Elements would render better using css as compared to attributes. Validation Schema or DTDs would have an easier time making sure a given XML document conformed when it made heavy use of elements, but had much more difficulty with attributes. Is that still the case? On 4/22/07, George Neill wrote: > Hi j, > > I am curious as to why you chose to use xml attributes over elements? > > i.e. > > rt="DELUXE" seg="07" src="TUSNTL-PH" time="20070420111725" type="RR"/> > > vs. > > > N > 20070523 > 338.00 > 2 > 2 > DELUXE > 07 > TUSNTL-PH > > RR > > > > Later, > George. > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm > From jay at jays.net Tue Apr 24 19:06:03 2007 From: jay at jays.net (Jay Hannah) Date: Tue, 24 Apr 2007 21:06:03 -0500 Subject: [Omaha.pm] evolution In-Reply-To: <53511A8A-500F-467C-9E55-D9E44720ABB7@petdance.com> References: <16F8D15756891C4EA961565331A3B350066CE28E@JDHEXC01.heiskell.com> <53511A8A-500F-467C-9E55-D9E44720ABB7@petdance.com> Message-ID: <8b1f1d062030d72d27cdb6eae9e24090@jays.net> On Apr 24, 2007, at 6:32 PM, Andy Lester wrote: > Didn't know Perl could increment strings, didja? :-) -laugh- Perl's creativity never ceases to amaze me. $ perl -lw foo.pl Argument "x" isn't numeric in addition (+) at foo.pl line 1. Argument "x" isn't numeric in addition (+) at foo.pl line 2. 1, 1, y See how annoying warnings are? :) Interesting that + warns but ++ doesn't. j From jay at jays.net Tue Apr 24 19:11:22 2007 From: jay at jays.net (Jay Hannah) Date: Tue, 24 Apr 2007 21:11:22 -0500 Subject: [Omaha.pm] printf("%02d", "2007") In-Reply-To: <0CF4ED49-2E0C-4BDA-8243-23F97C0F5EB1@petdance.com> References: <0CF4ED49-2E0C-4BDA-8243-23F97C0F5EB1@petdance.com> Message-ID: <5ed0d20f85cef38bfe1d4a81a38f7496@jays.net> On Apr 24, 2007, at 7:04 PM, Andy Lester wrote: > On Apr 24, 2007, at 3:42 PM, Jay Hannah wrote: >> unless ($a[0] =~ /^\w\w\w \d\d \d\d\d\d/) { >> die "Unrecognized date format from MS-SQL: '$a[0]'"; >> } >> @b=split ' ',$a[0]; > > Funny that they match a pattern, and then do the split. Better to do: > > unless ( @b = ($a[0] =~ /^(\w{3}) (\d{2}) (\d{4})/ ) { > die... > } > > Then @b is populated. Indeed sir. Here's one of the changes I committed today. Since the date format changed I cleaned up the other code (IMHO) while I was in there. Before: unless ($a[0] =~ /^\w\w\w \d\d \d\d\d\d/) { die "Unrecognized date format from MS-SQL: '$a[0]'"; } @b=split ' ',$a[0]; $key_val = sprintf("%02d%02d%02d|%s",$mon{$b[0]},$b[1],$b[2],$a[1]); $key_val =~ s/\s+$//; $ret_hsh{$key_val} = $a[2]; After: unless ($a[0] =~ /^(\d\d\d\d)-(\d\d)-(\d\d) \d\d:\d\d:\d\d/) { die "Unrecognized date format from $prop MS-SQL: '$a[0]'"; } my ($y, $m, $d) = ($1, $2, $3); $ret_hsh{"$m$d$y|$a[1]"} = $a[2]; j From jhannah at omnihotels.com Fri Apr 27 08:48:12 2007 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri, 27 Apr 2007 10:48:12 -0500 Subject: [Omaha.pm] Watching sendmail log in real time Message-ID: Another 1 minute Perl trick. j # tail -f mail | perl -nle '/(to=\S+).*(stat=\S+)/ && print "$2 $1"' stat=Sent to=, stat=Sent to=velocity at uic.edu, stat=Sent to=, stat=Sent to=AWSZWEZ at YAHOO.COM, stat=Sent to=, stat=Sent to=, stat=Sent to=, From georgen at neillnet.com Mon Apr 30 08:22:45 2007 From: georgen at neillnet.com (George Neill) Date: Mon, 30 Apr 2007 10:22:45 -0500 Subject: [Omaha.pm] database -> XML In-Reply-To: <7e84ed60704241901l2d385c1cg771a6cfbe333aadc@mail.gmail.com> References: <20070422224044.lmhzzqzyo0wgk0gk@www.neillnet.com> <7e84ed60704241901l2d385c1cg771a6cfbe333aadc@mail.gmail.com> Message-ID: <20070430102245.riba1ebk9w4wc800@www.neillnet.com> Quoting Rob Townley : > Several years ago, elements were better. There's no good answer, I believe it depends what you are trying to do. Elements are nice because they are extendible/readable ... but lengthy at times. Take a look at the link Jay provided, the author makes good sense. An example, 0 lastname 20 city 28 zipcode 5 I find overkill. But apparently the M$ tools ('code generators') slurp the above xml without having to write a lick of code. I would prefer something in the middle. 20 28 5 Later, George.