From tigerpeng2001 at yahoo.com Mon Sep 3 17:23:02 2007 From: tigerpeng2001 at yahoo.com (tiger peng) Date: Mon, 3 Sep 2007 17:23:02 -0700 (PDT) Subject: [Chicago-talk] XMLout hash key that was not a legal XML element name Message-ID: <882137.24691.qm@web58707.mail.re1.yahoo.com> Hello, I am trying to use XML::Simple to dump data in XML format. However, as the data are dynamically created, the hash keys may contain illegal XML element names and the result files may be not well-formated XML files. Also, the data structures may vary, so it is not easy to traverse the data to check and handle the illegal keys. Are there any modules and/or approaches are good for handling this kind of requirement? Any suggestions are appreciated, Tiger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20070903/a891e5f5/attachment.html From frag at ripco.com Mon Sep 3 19:55:37 2007 From: frag at ripco.com (Mike Fragassi) Date: Mon, 3 Sep 2007 21:55:37 -0500 (CDT) Subject: [Chicago-talk] XMLout hash key that was not a legal XML element name In-Reply-To: <882137.24691.qm@web58707.mail.re1.yahoo.com> References: <882137.24691.qm@web58707.mail.re1.yahoo.com> Message-ID: Try XML::LibXML (see documentation under XML::LibXML::Document for is_valid() and validate()) or maybe XML::Checker. On Mon, 3 Sep 2007, tiger peng wrote: > Hello, I am trying to use XML::Simple to dump data in XML format. However, as the data are dynamically created, the hash keys may contain illegal XML element names and the result files may be not well-formated XML files. Also, the data structures may vary, so it is not easy to traverse the data to check and handle the illegal keys. Are there any modules and/or approaches are good for handling this kind of requirement? Any suggestions are appreciated, Tiger From briank at kappacs.com Tue Sep 4 07:50:15 2007 From: briank at kappacs.com (Brian Katzung) Date: Tue, 04 Sep 2007 09:50:15 -0500 Subject: [Chicago-talk] XMLout hash key that was not a legal XML element name In-Reply-To: <882137.24691.qm@web58707.mail.re1.yahoo.com> References: <882137.24691.qm@web58707.mail.re1.yahoo.com> Message-ID: <46DD70A7.4000400@kappacs.com> Tiger et al, I don't know if it will help, but I have a light-weight, unpublished module called Parse::XMLLite that may be more forgiving and can easily be made to be even more forgiving if needed. It creates a DOM-like parse tree using maybe half a dozen regexs for parsing and it's only dependency is Exporter. If you (or anybody else) would like a copy, let me know and I'll be happy to send it along. - Brian tiger peng wrote: > Hello, > > I am trying to use XML::Simple to dump data in XML format. However, as > the data are dynamically created, the hash keys may contain illegal XML > element names and the result files may be not well-formated XML files. > Also, the data structures may vary, so it is not easy to traverse the > data to check and handle the illegal keys. Are there any modules and/or > approaches are good for handling this kind of requirement? > > Any suggestions are appreciated, > > Tiger -- Brian Katzung, Kappa Computer Solutions, LLC Leveraging UNIX, Linux, open source, and custom software solutions for business and beyond Phone: 877.367.8837 x1 http://www.kappacs.com From mongers at bsod.net Tue Sep 4 08:57:28 2007 From: mongers at bsod.net (Pete Krawczyk) Date: Tue, 4 Sep 2007 10:57:28 -0500 (CDT) Subject: [Chicago-talk] September 11th, 2007: Development Process Lessons From Open Source Message-ID: -------------------------------------------------------------------------- Chicago Perl Mongers / UniForum Meeting Announcement -------------------------------------------------------------------------- Topic: Development Process Lessons From Open Source Presenter: Andy Lester Date/Time: Tuesday, September 11th, 2007, 7:00 PM Location: IIT-Rice Campus, 201 East Loop Rd, Wheaton, IL Afterward: Dinner at CozyMel's -------------------------------------------------------------------------- Open source projects are development projects just as much as any company's internal development projects. Successful projects like Linux, Apache, Subversion, Perl, Ruby on Rails and thousands more still have development methodologies, and have lessons for non-open development shops. Andy Lester will be presenting what he sees as the lessons for managers from open source projects, and then leading a discussion with the group. If you lead a team or manage a department, this meeting is for you. As with all Chicago Perl Mongers meetings, everyone is welcome, whether or not you consider yourself a member. We look forward to seeing you there! Questions about this meeting? Ask on the chicago-talk at pm.org mailing list, or send email to andy at petdance dot com. You can also see a list of past and upcoming meetings at http://chicago.pm.org/meetings/. -Pete K -- Pete Krawczyk Chicago Perl Mongers mongers at bsod dot net From mongers at bsod.net Tue Sep 4 08:57:38 2007 From: mongers at bsod.net (Pete Krawczyk) Date: Tue, 4 Sep 2007 10:57:38 -0500 (CDT) Subject: [Chicago-talk] September 25, 2007: Perl Unit and Functional Testing Message-ID: -------------------------------------------------------------------------- Chicago Perl Mongers Meeting Announcement -------------------------------------------------------------------------- Topic: Perl Unit and Functional Testing Presenter: Kent Cowgill Date/Time: Tuesday, September 25th, 2007, 7:00 PM Location: Performics, 12th Floor, 180 N. LaSalle, Chicago, IL RSVP: By noon on Sept. 25th to "pkrawczyk" with "doubleclick.com" -------------------------------------------------------------------------- Kent will be talking about getting started with unit and functional testing using everyone's favorite language, Perl. Additionally, he will talk about code quality, test coverage, and making things a lot easier on the person doing the testing using a Makefile. Finally, Kent will talk about how he used Test::Builder::Module to create a custom test module in order to be able to unit test the code in use at his job, which is a template framework that combines Perl code with HTML, making traditional unit testing rather difficult. Kent Cowgill has been a Perl programmer and system administrator for over a dozen years. Recently, he's written a large test suite for a legacy system, using reverse engineering, namespace manipulation and several Perl modules (such as Test::MockObject, Devel::Cover and HTML::Lint). As with all Chicago Perl Mongers meetings, everyone is welcome, whether or not you consider yourself a member. We look forward to seeing you there! Questions about this meeting? Ask on the chicago-talk at pm.org mailing list, or send email to andy at petdance dot com. You can also see a list of past and upcoming meetings at http://chicago.pm.org/meetings/. -Pete K -- Pete Krawczyk Chicago Perl Mongers mongers at bsod dot net From autarch at urth.org Tue Sep 11 09:33:22 2007 From: autarch at urth.org (Dave Rolsky) Date: Tue, 11 Sep 2007 11:33:22 -0500 (CDT) Subject: [Chicago-talk] Frozen Perl 2008 Workshop Announcement & CFS Message-ID: <83AEEFFD-7607-4557-AF68-C8B21E9A13D5@urth.org> Hi, folks, We're having a one-day Perl workshop in Minneapolis on February 16, 2008, and I hope some of you can attend. We're also working on a hackathon the day after and an Intro to Perl class taught by brian d foy on the day before, which will be announced on our website once we have more details. Our site is at http://www.frozen-perl.org/ We've also opened our call for speakers, and we'd love to have your submissions. You can view the CFS at http://www.frozen-perl.org/mpw2008/cfs.html Thanks, Dave Rolsky Minneapolis Perl Mongers _______________________________________________ yapc mailing list yapc at pm.org http://mail.pm.org/mailman/listinfo/yapc From davidy at nationalcycle.com Mon Sep 17 13:12:26 2007 From: davidy at nationalcycle.com (David Young) Date: Mon, 17 Sep 2007 15:12:26 -0500 Subject: [Chicago-talk] Server side forms submission module Message-ID: Hi. I'm new to the list, so be gentle. ;-) I'm writing a relatively simple CGI app that uses LWP/WWW::Mechanize to get a TSV file, and then will present a form to the user for edit and then submission. What perl module would you recommend using for the forms generation and packaging of the form params back to the CGI application? I've heard CGI::Application would be good for this, any other recommendations? TIA. ydy From andy at petdance.com Mon Sep 17 13:24:13 2007 From: andy at petdance.com (Andy Lester) Date: Mon, 17 Sep 2007 15:24:13 -0500 Subject: [Chicago-talk] Server side forms submission module In-Reply-To: References: Message-ID: On Sep 17, 2007, at 3:12 PM, David Young wrote: > Hi. I'm new to the list, so be gentle. ;-) > I'm writing a relatively simple CGI app that uses LWP/ > WWW::Mechanize to get a TSV file, and then will present a form to > the user for edit and then submission. > > What perl module would you recommend using for the forms generation > and packaging of the form params back to the CGI application? I've > heard CGI::Application would be good for this, any other > recommendations? TIA. From what I'm seeing here, the fact that you're getting stuff out of a file fetched w/Mech doesn't matter, does it? You're just building a screen that you can present to your user? CGI::Application might be overkill, but it's hard to tell specifics of your app. Can you give more details on what the flow would look like? User does X, your program does Y, presents user with Z, user enters.... xoa -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From davidy at nationalcycle.com Mon Sep 17 13:41:47 2007 From: davidy at nationalcycle.com (David Young) Date: Mon, 17 Sep 2007 15:41:47 -0500 Subject: [Chicago-talk] Server side forms submission module Message-ID: Sure. The application is pretty simple. One of our vendors wants us to print barcode labels and apply them to the products we ship. They have a "vendor portal" that we can query and get a copy of the order by entering a PO number. Rather than go to their site and download the TSV to the local drive, just to load it into our web app, the general idea is this: 1. Invoke web app from local server. The first screen asks the user for the vendor's PO number. 2. web app goes to vendor website and gets PO in TSV format using LWP or WWW::Mechanize 3. web app creates a table showing the vendor item number, supplier item number, description, qty ordered and qty to print, etc. The qty to print is initially just a copy of the qty ordered. but is in a text field so that the user can override the qty. If no changes are needed, he can just press the "Print Lables" option. 4. The web app creates a specially formatted file that is then dumped onto the barcode printing machine. A program that is running over there reads the data, uses the information to print the barcode labels. I could use CGI.pm for everything, but thought I'd branch out a little and try a new module that might make creating the information and sending it back to the web app for label printing. ydy >>> andy at petdance.com 09/17/07 03:24PM >>> On Sep 17, 2007, at 3:12 PM, David Young wrote: > Hi. I'm new to the list, so be gentle. ;-) > I'm writing a relatively simple CGI app that uses LWP/ > WWW::Mechanize to get a TSV file, and then will present a form to > the user for edit and then submission. > > What perl module would you recommend using for the forms generation > and packaging of the form params back to the CGI application? I've > heard CGI::Application would be good for this, any other > recommendations? TIA. From what I'm seeing here, the fact that you're getting stuff out of a file fetched w/Mech doesn't matter, does it? You're just building a screen that you can present to your user? CGI::Application might be overkill, but it's hard to tell specifics of your app. Can you give more details on what the flow would look like? User does X, your program does Y, presents user with Z, user enters.... xoa -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk From fasteliteprogrammer at yahoo.com Tue Sep 18 06:00:52 2007 From: fasteliteprogrammer at yahoo.com (Craig Petty) Date: Tue, 18 Sep 2007 06:00:52 -0700 (PDT) Subject: [Chicago-talk] Wireless Modules Question Message-ID: <377228.73409.qm@web36502.mail.mud.yahoo.com> Does anyone know any good perl Modules for a wireless sniffer?i try to make a wireless perl Modules. ____________________________________________________________________________________ Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545469 From richard at rushlogistics.com Wed Sep 19 06:18:03 2007 From: richard at rushlogistics.com (Richard Reina) Date: Wed, 19 Sep 2007 06:18:03 -0700 (PDT) Subject: [Chicago-talk] humbling question Message-ID: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> I am trying to write a simple program like the one below that lets users at a console select an active employee. However, because they are not supposed to see the employee's employee number I can't figure out a way to let them make the selection. I thought I could do it with a counter ($i) but don't know of a way to associate the date with the count. Any ideas would be greatfully appreciated. Thanks, Richard #!/usr/bin/perl -w my $q = "SELECT emp_no, first_name, last_name, mobile_ph FROM employee WHERE end_date IS NULL" my $sth->prepare($q); my ($emp_no, $f_name, $l_name, $ph); $sth->execute(); $sth->bind_columns(\($emp_no, $f_name, $l_name, $ph); my $i; while($sth->fetch) { $i++; print $i . " " . $name . " " $f_name . " " . $l_name . " " . $ph ."\n"; } print "Somehow make a selection based on what you're allowed to view\n"; my ($sel = ); Your beliefs become your thoughts. Your thoughts become your words. Your words become your actions. Your actions become your habits. Your habits become your values. Your values become your destiny. -- Mahatma Gandhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20070919/f25c791e/attachment.html From crap at mooresystems.com Wed Sep 19 06:53:33 2007 From: crap at mooresystems.com (crap at mooresystems.com) Date: Wed, 19 Sep 2007 08:53:33 -0500 Subject: [Chicago-talk] humbling question In-Reply-To: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> References: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> <20070919134418.GA13558@mooresystems.com> Message-ID: <20070919135333.GB13788@mooresystems.com> On Wed, Sep 19, 2007 at 06:18:03AM -0700, Richard Reina wrote: > I am trying to write a simple program like the one below that lets > users at a console select an active employee. However, because they > are not supposed to see the employee's employee number I can't > figure out a way to let them make the selection. I thought I could > do it with a counter ($i) but don't know of a way to associate the > date with the count. Any ideas would be greatfully appreciated. Hi Richard - In a situation like this, I often use Damian Conway's IO::Prompt module. You can pass it a data structure full of the possible options and it will ask the user to choose one. The documentation is not so hot, but check the examples directory in the distribution, like examples/menu.pl. Hope it helps! -Andy PS - I hope it's OK for out-of-towners to chime in occasionally. I tend to lurk on the YAPC host town's list and haven't unsubscribed since 2006. Now I don't have to! From tzz at lifelogs.com Wed Sep 19 07:04:53 2007 From: tzz at lifelogs.com (Ted Zlatanov) Date: Wed, 19 Sep 2007 09:04:53 -0500 Subject: [Chicago-talk] humbling question In-Reply-To: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> (Richard Reina's message of "Wed, 19 Sep 2007 06:18:03 -0700 (PDT)") References: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> Message-ID: On Wed, 19 Sep 2007 06:18:03 -0700 (PDT) Richard Reina wrote: RR> I am trying to write a simple program like the one below that lets RR> users at a console select an active employee. However, because they RR> are not supposed to see the employee's employee number I can't RR> figure out a way to let them make the selection. I thought I could RR> do it with a counter ($i) but don't know of a way to associate the RR> date with the count. Any ideas would be greatfully appreciated. If you can get your choices into an array, the pick_one function below will let your users pick with A through Z. Larger lists won't work (it's easy to add a "...more" choice activated by SPACE, for instance). Any key that's not a valid choice exits the menu. I wrote this for myself, so let me know if it's useful to you. The nice thing about it is that you can pass any list of values, as long as you define a suitable formatting function ($info_sub). Ted # info_sub can be undefined, in which case each choice will be printed # as itself; otherwise it is a subroutine that will be passed each # choice and needs to print it as desired by you my $choice = pick_one("Menu header", \@list_of_choices, $info_sub); if (defined $choice) { my $position = $choice->[0]; # the position in the list my $item = $choice->[1]; # the item that was picked } else { # no choice was made } sub get_key { require Term::ReadKey; Term::ReadKey::ReadMode(3); my $key = Term::ReadKey::ReadKey(0); chomp $key; Term::ReadKey::ReadMode(0); undef $key if $key eq ''; if (defined $key) { print "[$key]"; } print "\n"; return $key; } sub pick_one { my $header = shift @_; my $list = shift @_; my $info_sub = shift @_; $info_sub = sub { "@_" } unless defined $info_sub; my %keys; my $i = 'A'; my $pos = 0; return unless scalar @$list; print "$header\n"; foreach my $entry (@$list) { $keys{$i} = [$pos, $entry]; print "($i) ", $info_sub->($entry), "\n"; $i++; } print "RETURN: abort\n"; my $key = uc get_key(); if (defined $key && exists $keys{$key}) { return $keys{$key}; } return; } From briank at kappacs.com Wed Sep 19 07:15:31 2007 From: briank at kappacs.com (Brian Katzung) Date: Wed, 19 Sep 2007 09:15:31 -0500 Subject: [Chicago-talk] humbling question In-Reply-To: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> References: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> Message-ID: <46F12F03.2010008@kappacs.com> Hi Richard. I've suggested some changes and additions below. - Brian Richard Reina wrote: > I am trying to write a simple program like the one below that lets users > at a console select an active employee. However, because they are not > supposed to see the employee's employee number I can't figure out a way > to let them make the selection. I thought I could do it with a counter > ($i) but don't know of a way to associate the date with the count. Any > ideas would be greatfully appreciated. > > Thanks, > > Richard > > #!/usr/bin/perl -w > > my $q = "SELECT emp_no, first_name, last_name, mobile_ph > FROM employee > WHERE end_date IS NULL" > my $sth->prepare($q); > > my ($emp_no, $f_name, $l_name, $ph); > $sth->execute(); $sth->bind_columns(\$emp_no, \$f_name, \$l_name, \$ph); > my $i = 0; my @emp_no; > while($sth->fetch) { $emp_no[$i++] = $emp_no; > print $i . " " . $name . " " $f_name . " " . $l_name . " " . $ph ."\n"; > } > > print "Somehow make a selection based on what you're allowed to view\n"; > my ($sel = ); my $selected_emp_no = $emp_no[$sel - 1]; You'll want to add error checking, use DBI, etc, but that should get you started. -- Brian Katzung, Kappa Computer Solutions, LLC Leveraging UNIX, Linux, open source, and custom software solutions for business and beyond Phone: 877.367.8837 x1 http://www.kappacs.com From tzz at lifelogs.com Wed Sep 19 07:45:57 2007 From: tzz at lifelogs.com (Ted Zlatanov) Date: Wed, 19 Sep 2007 09:45:57 -0500 Subject: [Chicago-talk] humbling question In-Reply-To: (Ted Zlatanov's message of "Wed, 19 Sep 2007 09:04:53 -0500") References: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> Message-ID: On Wed, 19 Sep 2007 09:04:53 -0500 Ted Zlatanov wrote: TZ> On Wed, 19 Sep 2007 06:18:03 -0700 (PDT) Richard Reina wrote: RR> I am trying to write a simple program like the one below that lets RR> users at a console select an active employee. However, because they RR> are not supposed to see the employee's employee number I can't RR> figure out a way to let them make the selection. I thought I could RR> do it with a counter ($i) but don't know of a way to associate the RR> date with the count. Any ideas would be greatfully appreciated. TZ> If you can get your choices into an array, the pick_one function below TZ> will let your users pick with A through Z. Larger lists won't work TZ> (it's easy to add a "...more" choice activated by SPACE, for instance). TZ> Any key that's not a valid choice exits the menu. I wrote this for TZ> myself, so let me know if it's useful to you. TZ> The nice thing about it is that you can pass any list of values, as long TZ> as you define a suitable formatting function ($info_sub). Andy's suggestion of IO::Prompt is much better. I haven't used it, but it seems the -menu option will do a lot more than my pick_one function, with two exceptions: it doesn't have the option of passing in a formatter subroutine like my $info_sub parameter, so you have to pre-format your options. Also, it doesn't return the position of the choice, since it accepts much more than a list of options. Thanks Ted From merlyn at stonehenge.com Wed Sep 19 08:50:26 2007 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed, 19 Sep 2007 08:50:26 -0700 Subject: [Chicago-talk] humbling question In-Reply-To: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> (Richard Reina's message of "Wed, 19 Sep 2007 06:18:03 -0700 (PDT)") References: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> Message-ID: <864phqslh9.fsf@blue.stonehenge.com> >>>>> "Richard" == Richard Reina writes: Richard> my ($emp_no, $f_name, $l_name, $ph); Richard> $sth->execute(); Richard> $sth->bind_columns(\($emp_no, $f_name, $l_name, $ph); As shown in one of my columns, I prefer not saying the same thing twice, resulting in: $sth->bind_columns(\my($when, $wall, $bytes, $cpu)) Consider me lazy. Consider me trying to be nice to the maintenance programmer. See http://www.stonehenge.com/merlyn/LinuxMag/col36.html -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From jim at jimandkoka.com Wed Sep 19 09:18:07 2007 From: jim at jimandkoka.com (Jim Thomason) Date: Wed, 19 Sep 2007 11:18:07 -0500 Subject: [Chicago-talk] humbling question In-Reply-To: <864phqslh9.fsf@blue.stonehenge.com> References: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> <864phqslh9.fsf@blue.stonehenge.com> Message-ID: <5cfdfaf70709190918k12f59cc8mc68c33c2fb004149@mail.gmail.com> > As shown in one of my columns, I prefer not saying the same > thing twice, resulting in: > > $sth->bind_columns(\my($when, $wall, $bytes, $cpu)) > > Consider me lazy. Consider me trying to be nice to the maintenance programmer. That's a peculiar looking construct to me, and I've been around perl for an awfully awfully long time. So I'd probably end up looking around, figuring out what it means, thinking about it, and then finally saying, "WTF didn't he just declare the variables on a separate line?" Then I'd change it to read that way. Terseness != clarity. I think this'd add work for the maintenance programmer. Less time to add a new variable in two places than figure out what this is, if they don't know. -Jim.... From merlyn at stonehenge.com Wed Sep 19 09:32:15 2007 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed, 19 Sep 2007 09:32:15 -0700 Subject: [Chicago-talk] humbling question In-Reply-To: <5cfdfaf70709190918k12f59cc8mc68c33c2fb004149@mail.gmail.com> (Jim Thomason's message of "Wed, 19 Sep 2007 11:18:07 -0500") References: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> <864phqslh9.fsf@blue.stonehenge.com> <5cfdfaf70709190918k12f59cc8mc68c33c2fb004149@mail.gmail.com> Message-ID: <86zlzir4z4.fsf@blue.stonehenge.com> >>>>> "Jim" == Jim Thomason writes: Jim> Terseness != clarity. I think this'd add work for the maintenance Jim> programmer. Less time to add a new variable in two places than figure Jim> out what this is, if they don't know. Well, what you're up against is "repetition != clarity" either. If I saw nine variable names, then repeated two lines later, I'd not be sure without close scrutiny that those are the same names. But with my construct, it's "don't repeat yourself", and it's very clear that I'm creating these specific variables. I might also put a comment there that says "declare and use the variables". -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From richard at rushlogistics.com Wed Sep 19 09:49:10 2007 From: richard at rushlogistics.com (Richard Reina) Date: Wed, 19 Sep 2007 09:49:10 -0700 (PDT) Subject: [Chicago-talk] humbling question In-Reply-To: <86zlzir4z4.fsf@blue.stonehenge.com> Message-ID: <93397.50747.qm@web615.biz.mail.mud.yahoo.com> Thank you very much for all the great suggestions. I fixed the program with Brian's suggestion as it seemed to be the simplest solution. However, I am playing around with Ted's code, seems interesting. Thanks again. Richard "Randal L. Schwartz" wrote: >>>>> "Jim" == Jim Thomason writes: Jim> Terseness != clarity. I think this'd add work for the maintenance Jim> programmer. Less time to add a new variable in two places than figure Jim> out what this is, if they don't know. Well, what you're up against is "repetition != clarity" either. If I saw nine variable names, then repeated two lines later, I'd not be sure without close scrutiny that those are the same names. But with my construct, it's "don't repeat yourself", and it's very clear that I'm creating these specific variables. I might also put a comment there that says "declare and use the variables". -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20070919/be45f4e8/attachment-0001.html From richard at rushlogistics.com Wed Sep 19 09:49:10 2007 From: richard at rushlogistics.com (Richard Reina) Date: Wed, 19 Sep 2007 09:49:10 -0700 (PDT) Subject: [Chicago-talk] humbling question In-Reply-To: <86zlzir4z4.fsf@blue.stonehenge.com> Message-ID: <93397.50747.qm@web615.biz.mail.mud.yahoo.com> Thank you very much for all the great suggestions. I fixed the program with Brian's suggestion as it seemed to be the simplest solution. However, I am playing around with Ted's code, seems interesting. Thanks again. Richard "Randal L. Schwartz" wrote: >>>>> "Jim" == Jim Thomason writes: Jim> Terseness != clarity. I think this'd add work for the maintenance Jim> programmer. Less time to add a new variable in two places than figure Jim> out what this is, if they don't know. Well, what you're up against is "repetition != clarity" either. If I saw nine variable names, then repeated two lines later, I'd not be sure without close scrutiny that those are the same names. But with my construct, it's "don't repeat yourself", and it's very clear that I'm creating these specific variables. I might also put a comment there that says "declare and use the variables". -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20070919/be45f4e8/attachment-0002.html From jon at jrock.us Thu Sep 20 11:52:38 2007 From: jon at jrock.us (Jonathan Rockway) Date: Thu, 20 Sep 2007 13:52:38 -0500 Subject: [Chicago-talk] humbling question In-Reply-To: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> References: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> Message-ID: <1190314358.13863.49.camel@tire> On Wed, 2007-09-19 at 06:18 -0700, Richard Reina wrote: > print $i . " " . $name . " " $f_name . " " . $l_name . " " . > $ph ."\n"; One minor nit: perl will interpolate inside of double-quoted strings, so you could save yourself a lot of typing by writing: print "$i $name $f_name $l_name $ph\n"; Much cleaner, eh? (And BTW, in Perl 5.10, you won't need the "\n" either. You can just say: 'say "$i $name $f_name $l_name $ph"'. Nice.) Regards, Jonathan Rockway From tzz at lifelogs.com Thu Sep 20 12:30:23 2007 From: tzz at lifelogs.com (Ted Zlatanov) Date: Thu, 20 Sep 2007 14:30:23 -0500 Subject: [Chicago-talk] humbling question In-Reply-To: <1190314358.13863.49.camel@tire> (Jonathan Rockway's message of "Thu, 20 Sep 2007 13:52:38 -0500") References: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> <1190314358.13863.49.camel@tire> Message-ID: On Thu, 20 Sep 2007 13:52:38 -0500 Jonathan Rockway wrote: JR> On Wed, 2007-09-19 at 06:18 -0700, Richard Reina wrote: >> print $i . " " . $name . " " $f_name . " " . $l_name . " " . $ph ."\n"; JR> One minor nit: perl will interpolate inside of double-quoted strings, so JR> you could save yourself a lot of typing by writing: JR> print "$i $name $f_name $l_name $ph\n"; JR> Much cleaner, eh? I always prefer printf/sprintf for printing repetitive data, personally. It separates formatting from data nicely (I know Perl has formats built in, but printf is a universal skill :) The columns will line up nicely too, if you specify the widths. # just an example... printf ("%05d %20s %20s %20s %-12s\n", $i, $name, $f_name, $l_name, $ph); Ted From tzz at lifelogs.com Thu Sep 20 12:56:29 2007 From: tzz at lifelogs.com (Ted Zlatanov) Date: Thu, 20 Sep 2007 14:56:29 -0500 Subject: [Chicago-talk] humbling question In-Reply-To: (Ted Zlatanov's message of "Thu, 20 Sep 2007 14:30:23 -0500") References: <914089.85409.qm@web601.biz.mail.mud.yahoo.com> <1190314358.13863.49.camel@tire> Message-ID: On Thu, 20 Sep 2007 14:30:23 -0500 Ted Zlatanov wrote: TZ> # just an example... TZ> printf ("%05d %20s %20s %20s %-12s\n", $i, $name, $f_name, $l_name, $ph); I meant this for lining up columns: printf ("%05d %20.20s %20.20s %20.20s %-12.12s\n", $i, $name, $f_name, $l_name, $ph); Sorry Ted From schwern at pobox.com Sat Sep 22 07:54:07 2007 From: schwern at pobox.com (Michael G Schwern) Date: Sat, 22 Sep 2007 07:54:07 -0700 Subject: [Chicago-talk] Help Schwern get to Pittsburgh Message-ID: <50AEFB71-52D7-43CF-B6AF-4629E6A286B3@pobox.com> [I'm sending this on behalf of Michael Schwern, Perl dude and all- around swell guy. -- Andy] Hi, all. Apologies for the cross-PM post but I'm in a bit of a bind. I'm scheduled to give two talks and a keynote at the Pittsburgh Perl Workshop next month. [1] I was hoping on contract work in Pittsburgh to pay for my flight to PPW and also the bills, but that work has been postponed until November. :( Now I have no flight for PPW and no work to pay for it. I'd rather work my way there then have PPW sponsors pay for me. So I'm asking nearby PM groups if they or their work would like to hire me in October for local work. I would charge travel but my normal fees would be substantially reduced and your company/group will get thanked in my PPW talks. Suggested work and training includes... * Improving your company's test suite * Improving how your company uses CPAN * Improved developer coordination through better version control (SVK) * Performance optimization * Simple Ways To Be A Better Programmer (very popular OSCON tutorial) http://www.slideshare.net/schwern/simple-ways-to-be-a-better- programmer-oscon-2007 * Geeks Communicating Better * Beginning Refactoring * Learning Interface Design To Improve Your Programming http://pghpw.org/ppw2007/talk/748 * Easing The Pain Of Transitioning From Class::DBI to DBIx::Class Or suggest something from the pile: http://schwern.org/~schwern/talks/ Thank you, Schwern [1] "Improving geek2geek Communications" http://pghpw.org/ppw2007/ talk/746 "The Many Faces of SVK" http://pghpw.org/ppw2007/ talk/747 The keynote is about the results of the Perl Survey (perlsurvey.org) -- There will be snacks. From andy at petdance.com Tue Sep 25 13:01:08 2007 From: andy at petdance.com (Andy Lester) Date: Tue, 25 Sep 2007 15:01:08 -0500 Subject: [Chicago-talk] REMINDER: September 25, 2007: Perl Unit and Functional Testing (fwd) Message-ID: <20070925200108.GA6037@petdance.com> -------------------------------------------------------------------------- Chicago Perl Mongers Meeting Announcement -------------------------------------------------------------------------- Topic: Perl Unit and Functional Testing Presenter: Kent Cowgill Date/Time: Tuesday, September 25th, 2007, 7:00 PM Location: Performics, 12th Floor, 180 N. LaSalle, Chicago, IL RSVP: By noon on Sept. 25th to "pkrawczyk" with "doubleclick.com" -------------------------------------------------------------------------- Kent will be talking about getting started with unit and functional testing using everyone's favorite language, Perl. Additionally, he will talk about code quality, test coverage, and making things a lot easier on the person doing the testing using a Makefile. Finally, Kent will talk about how he used Test::Builder::Module to create a custom test module in order to be able to unit test the code in use at his job, which is a template framework that combines Perl code with HTML, making traditional unit testing rather difficult. Kent Cowgill has been a Perl programmer and system administrator for over a dozen years. Recently, he's written a large test suite for a legacy system, using reverse engineering, namespace manipulation and several Perl modules (such as Test::MockObject, Devel::Cover and HTML::Lint). As with all Chicago Perl Mongers meetings, everyone is welcome, whether or not you consider yourself a member. We look forward to seeing you there! Questions about this meeting? Ask on the chicago-talk at pm.org mailing list, or send email to andy at petdance dot com. You can also see a list of past and upcoming meetings at http://chicago.pm.org/meetings/. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Tue Sep 25 13:01:57 2007 From: andy at petdance.com (Andy Lester) Date: Tue, 25 Sep 2007 15:01:57 -0500 Subject: [Chicago-talk] October 9, 2007: Chicago Perl Mongers Tool Expo - You! Message-ID: <20070925200157.GB6037@petdance.com> -------------------------------------------------------------------------- Chicago Perl Mongers / UniForum Meeting Announcement -------------------------------------------------------------------------- Topic: Chicago Perl Mongers Tool Expo Presenter: You! Moderator: Andy Lester Date/Time: Tuesday, October 9th, 2007, 7:00 PM Location: IIT-Rice Campus, 201 East Loop Rd, Wheaton, IL Afterward: Dinner at CozyMel's -------------------------------------------------------------------------- We'll be sharing the tools that we use for Perl programming. Anything that helps you do your job is worth mentioning, and we'd like you to talk about it. Andy Lester will be talking about ack, his grep replacement, and OpenKomodo, which just got release as open source. Now we need YOUR help. What tools do you use? vim? emacs? TextMate? BBEdit? Eclipse? What about other tools, like Ant? CruiseControl? We want to hear from you. A 10-15 minute demo is all you need to do to help spread the love. We especially want to hear from the UniForum people! If you'd like to talk about your favorite tool, let Andy Lester know at andy at petdance.com. Even if you don't have a laptop to do a presentation on, we can work something out. As with all Chicago Perl Mongers meetings, everyone is welcome, whether or not you consider yourself a member. We look forward to seeing you there! Questions about this meeting? Ask on the chicago-talk at pm.org mailing list, or send email to andy at petdance dot com. You can also see a list of past and upcoming meetings at http://chicago.pm.org/meetings/. -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From mrnicksgirl at gmail.com Wed Sep 26 17:38:05 2007 From: mrnicksgirl at gmail.com (Nola Stowe) Date: Wed, 26 Sep 2007 19:38:05 -0500 Subject: [Chicago-talk] BarCamp Milwaukee 2, October 13-14, 2007 Message-ID: <43e95380709261738y77c890e2pa4e59695dc869aba@mail.gmail.com> BarCamp Milwaukee 2, Saturday, October 13 through Sunday, October 14, 2007 http://barcampmilwaukee.com/ Last year's event was great fun and we think this year will be even better. We would love to have you come and spend time with us if you're available! Where is it? ---------- BarCamp is happening at the Schlitz Park Center, 1555 Rivercenter Drive in downtown Milwaukee, on the river's edge. I was in the meeting space the other day and the whole Schlitz Park and 3rd Street areas are getting revitalized. There's a great energy down there. Here's a map to where BarCamp will take place: http://tinyurl.com/37udgp What is BarCamp all about? ------------------------ It's a space and a place where people interested in learning and sharing can hang out, and learn with others who want to learn and share. BarCamp is a free event but there are also no passive attendees -- we encourage everyone to share something with the group -- whether expertise, knowledge, passion about a topic or simply helping out during the event. http://barcampmilwaukee.com/getting-started How Much is it? -------------- It's totally free! There will be food and camping space provided for attendees who need a place to crash on Saturday night, though you can drive home, or attend just Saturday, or just Sunday, whatever suits your schedule. If you decide to camp, just bring a pillow and a sleeping bag. :-) Free T-Shirt with Registration! -------------------------- Register, and you'll get a cool t-shirt for free: http://www.flickr.com/photo_zoom.gne?id=1403125149&size=l IMPORTANT: It's critical that you sign up by Wednesday, September 26th, and be sure to include your shirt size! Once we take the art and shirt info to the printer on the 26th, there's no guarantee of getting a t-shirt! I would love to have you come to BarCamp Milwaukee 2. It's going to be a great time of learning, sharing and getting to know all kinds of different, interesting people from Milwaukee and the Midwest. Sign up here: http://barcampmilwaukee.com/user/register If you have any questions about the event, send me a note. I'm happy to provide answers. -- http://rubygeek.com - my blog featuring: Ruby, PHP and Perl http://DevChix.com - boys can't have all the fun -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20070926/e23d5a06/attachment.html From mrnicksgirl at gmail.com Wed Sep 26 20:05:37 2007 From: mrnicksgirl at gmail.com (Nola Stowe) Date: Wed, 26 Sep 2007 22:05:37 -0500 Subject: [Chicago-talk] apology to Andy Lester Message-ID: <43e95380709262005w3eaedadata87cb5ab31a7b931@mail.gmail.com> Andy -- Since I said some unkind stuff to you 3-4 months ago regarding leading chicago pm group, I would like to publicly apologize for being unkind and not really helping the community with my griping. -- http://rubygeek.com - my blog featuring: Ruby, PHP and Perl http://DevChix.com - boys can't have all the fun -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20070926/14d2c26a/attachment.html From orders at siraim.com Wed Sep 26 20:16:58 2007 From: orders at siraim.com (Sam Grover) Date: Wed, 26 Sep 2007 22:16:58 -0500 Subject: [Chicago-talk] apology to Andy Lester In-Reply-To: <43e95380709262005w3eaedadata87cb5ab31a7b931@mail.gmail.com> References: <43e95380709262005w3eaedadata87cb5ab31a7b931@mail.gmail.com> Message-ID: <30D356BC-5347-4EEF-8C28-6B74FC7B990B@siraim.com> Wow. having lurked on this mailing list for years, we definitely don't know each other but I wanted to pass along an attaboy. Public accountability is huge and this definitely counts as that. Not many people would see the hubris on holding this in and the amount of humility that is required to send your email. Again, not knowing each other, accept this as a random email of praise for the strength and humility your email showed. Sam On Sep 26, 2007, at 10:05 PM, Nola Stowe wrote: > Andy -- Since I said some unkind stuff to you 3-4 months ago > regarding leading chicago pm group, I would like to publicly > apologize for being unkind and not really helping the community > with my griping. > > > -- > http://rubygeek.com - my blog featuring: Ruby, PHP and Perl > http://DevChix.com - boys can't have all the fun > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20070926/f544f4ac/attachment.html From mrnicksgirl at gmail.com Wed Sep 26 20:23:55 2007 From: mrnicksgirl at gmail.com (Nola Stowe) Date: Wed, 26 Sep 2007 22:23:55 -0500 Subject: [Chicago-talk] apology to Andy Lester In-Reply-To: <30D356BC-5347-4EEF-8C28-6B74FC7B990B@siraim.com> References: <43e95380709262005w3eaedadata87cb5ab31a7b931@mail.gmail.com> <30D356BC-5347-4EEF-8C28-6B74FC7B990B@siraim.com> Message-ID: <43e95380709262023w6070923dye34c6676c86fbdaf@mail.gmail.com> Better to save your attaboys to those who don't make a fool of themselves in the first place... On 9/26/07, Sam Grover wrote: > > Wow. having lurked on this mailing list for years, we definitely don't > know each other but I wanted to pass along an attaboy. Public > accountability is huge and this definitely counts as that. Not many people > would see the hubris on holding this in and the amount of humility that is > required to send your email. Again, not knowing each other, accept this as > a random email of praise for the strength and humility your email showed. > Sam > > > On Sep 26, 2007, at 10:05 PM, Nola Stowe wrote: > > Andy -- Since I said some unkind stuff to you 3-4 months ago regarding > leading chicago pm group, I would like to publicly apologize for being > unkind and not really helping the community with my griping. > > > -- > http://rubygeek.com - my blog featuring: Ruby, PHP and Perl > http://DevChix.com - boys can't have all the fun > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -- http://rubygeek.com - my blog featuring: Ruby, PHP and Perl http://DevChix.com - boys can't have all the fun -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20070926/c02a06a8/attachment.html From a.wong2.nu at gmail.com Wed Sep 26 21:15:40 2007 From: a.wong2.nu at gmail.com (Tony Wong) Date: Wed, 26 Sep 2007 23:15:40 -0500 Subject: [Chicago-talk] Thanks for a great windycity.pm meeting Message-ID: <334a3ab20709262115l785e3730x8355c668561c548@mail.gmail.com> Just wanted to say, "Thanks" for the windycity.pm meeting last night. In particular, thanks to Kent for his talk and Josh for putting the meeting together. It was my first meeting and I'll definitely be coming out again. Kent, will you be making your slides available? Tony From kent at c2group.net Thu Sep 27 05:15:03 2007 From: kent at c2group.net (Kent Cowgill) Date: Thu, 27 Sep 2007 07:15:03 -0500 Subject: [Chicago-talk] Thanks for a great windycity.pm meeting In-Reply-To: <334a3ab20709262115l785e3730x8355c668561c548@mail.gmail.com> References: <334a3ab20709262115l785e3730x8355c668561c548@mail.gmail.com> Message-ID: <01FD9137-7A4F-43F8-B669-35D3B670A756@c2group.net> Yes - I just need to edit them a bit and figure out what I'm going to do about the screencasts, since they don't survive the transformation to PDF very well... -Kent Cowgill C2 Group, Inc. kent at c2group.net http://www.c2group.net 312.804.0160 On Sep 26, 2007, at 11:15 PM, Tony Wong wrote: > Just wanted to say, "Thanks" for the windycity.pm meeting last night. > In particular, thanks to Kent for his talk and Josh for putting the > meeting together. It was my first meeting and I'll definitely be > coming out again. > > Kent, will you be making your slides available? > > Tony > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From richard at rushlogistics.com Thu Sep 27 05:20:26 2007 From: richard at rushlogistics.com (Richard Reina) Date: Thu, 27 Sep 2007 05:20:26 -0700 (PDT) Subject: [Chicago-talk] apology to Andy Lester In-Reply-To: <30D356BC-5347-4EEF-8C28-6B74FC7B990B@siraim.com> Message-ID: <847618.39852.qm@web601.biz.mail.mud.yahoo.com> Amen to that. Humility, Love and Moderation are the Three Great Treasures elucidated by Lau Tzu in the Tao te Ching. Too many associate humility with being a pushover, however, nothing could be farther from the truth: The humbleness of a warrior is not the humbleness of the beggar. The warrior lowers his head to no one, but at the same time, he doesn???t permit anyone to lower his head to him. The beggar, on the other hand, falls to his knees at the drop of a hat and scrapes the floor to anyone he deems to be higher; but at the same time, he demands that someone lower than him scrape the floor for him. ???Don Juan Matus - Tales of Power by Carlos Castaneda Sam Grover wrote: Wow. ???having lurked on this mailing list for years, we definitely don't know each other but I wanted to pass along an attaboy. ???Public accountability is huge and this definitely counts as that. ???Not many people would see the hubris on holding this in and the amount of humility that is required to send your email. ???Again, not knowing each other, accept this as a random email of praise for the strength and humility your email showed. Sam On Sep 26, 2007, at 10:05 PM, Nola Stowe wrote: Andy -- Since I said some unkind stuff to you 3-4 months ago regarding leading chicago pm group, I would like to publicly apologize for being unkind and not really helping the community with my griping. -- http://rubygeek.com - my blog featuring: Ruby, PHP and Perl http://DevChix.com - boys can't have all the fun _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk _______________________________________________ Chicago-talk mailing list Chicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20070927/4c242e56/attachment-0001.html From Andy_Bach at wiwb.uscourts.gov Thu Sep 27 12:16:42 2007 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach at wiwb.uscourts.gov) Date: Thu, 27 Sep 2007 14:16:42 -0500 Subject: [Chicago-talk] -i, -n and print - removing the top x lines w/ each run Message-ID: Hey. Background: Trying to fool the 'watch' utility into displaying a log file in it's --difference mode. So I wanted to write a script that'd display the first X lines of a file and remove them, saving the rest of the file, so each call of the script and file name shortens the data file from the top down. I came up w/ #!/usr/bin/perl -i -n if ( 1 .. /End/ ) { s/$/\f/ if $. == 1 ; warn($_); } else { print; } so (the "\f" is for watche: watch -n2 -d watch_ao_stats.pl /tmp/vmstats.txt works it's way through the (copy) of the vmstats.txt file which has vmstats data, something like: --- Start 09/27/07 13:15:08 CDT ------ --- vmstat procs memory swap io system cpu r b swpd free buff cache si so bi bo in cs us sy id wa 2 0 5616 266224 169100 1296832 0 0 0 0 2 1 1 0 1 0 --- End 09/27/07 13:15:21 CDT ------ --- Start 09/27/07 13:15:21 CDT ------ --- vmstat (5 runs) procs memory swap io system cpu r b swpd free buff cache si so bi bo in cs us sy id wa 1 0 5616 269444 169104 1296940 0 0 0 0 2 1 1 0 1 0 --- End 09/27/07 13:15:35 CDT ------ It all sort of works, but using 'warn' there to get user output (and 'print' to rewrite the in-place edited file) doesn't work w/ 'watch' - it mangles the output. Is there a way I can do the "truncate from the top w/ each run" trick? a Andy Bach Systems Mangler Internet: andy_bach at wiwb.uscourts.gov VOICE: (608) 261-5738 FAX 264-5932 Nothing in life is certain except death, taxes and the second law of thermodynamics. All three are processes in which useful or accessible forms of some quantity, such as energy or money, are transformed into useless, inaccessible forms of the same quantity. That is not to say that these three processes don't have fringe benefits: taxes pay for roads and schools; the second law of thermodynamics drives cars, computers and metabolism; and death, at the very least, opens up tenured faculty positions. Seth Lloyd From Andy_Bach at wiwb.uscourts.gov Thu Sep 27 13:20:32 2007 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach at wiwb.uscourts.gov) Date: Thu, 27 Sep 2007 15:20:32 -0500 Subject: [Chicago-talk] -i, -n and print - removing the top x lines w/ each run In-Reply-To: Message-ID: Got it - perldoc perlrun and the -i switch showed me: use warnings; use strict; my $oldargv = ''; my $argvout ; while (<>) { if ($ARGV ne $oldargv) { my $backup = sprintf("%s_%d", $ARGV, $$); rename($ARGV, $backup); open($argvout, ">$ARGV"); $oldargv = $ARGV; } select($argvout); if ( 1 .. /--- End/ ) { select(STDOUT); next unless /\S/; } print; # this prints to original filename } a Andy Bach Systems Mangler Internet: andy_bach at wiwb.uscourts.gov VOICE: (608) 261-5738 FAX 264-5932 Nothing in life is certain except death, taxes and the second law of thermodynamics. All three are processes in which useful or accessible forms of some quantity, such as energy or money, are transformed into useless, inaccessible forms of the same quantity. That is not to say that these three processes don't have fringe benefits: taxes pay for roads and schools; the second law of thermodynamics drives cars, computers and metabolism; and death, at the very least, opens up tenured faculty positions. Seth Lloyd From tzz at lifelogs.com Thu Sep 27 18:09:28 2007 From: tzz at lifelogs.com (Ted Zlatanov) Date: Thu, 27 Sep 2007 20:09:28 -0500 Subject: [Chicago-talk] -i, -n and print - removing the top x lines w/ each run In-Reply-To: (Andy Bach's message of "Thu, 27 Sep 2007 15:20:32 -0500") References: Message-ID: On Thu, 27 Sep 2007 15:20:32 -0500 Andy_Bach at wiwb.uscourts.gov wrote: AB> Got it - perldoc perlrun and the -i switch showed me: AB> use warnings; AB> use strict; AB> my $oldargv = ''; AB> my $argvout ; AB> while (<>) { AB> if ($ARGV ne $oldargv) { AB> my $backup = sprintf("%s_%d", $ARGV, $$); AB> rename($ARGV, $backup); AB> open($argvout, ">$ARGV"); AB> $oldargv = $ARGV; AB> } AB> select($argvout); AB> if ( 1 .. /--- End/ ) { AB> select(STDOUT); AB> next unless /\S/; AB> } AB> print; # this prints to original filename AB> } I think you can get by with the standard `head' utility to print the first X lines, and this Perl code will print all but the first 20 lines: perl -ne 'print if $. > 20' file_to_print The combination of those two is probably the simplest and fastest solution. You could also use the `split' utility to split the original file into N chunks of X lines each, then cat all but the first chunk back into the original file; the first chunk is that first piece you needed. In pure Perl, to avoid `head' and get inline editing, you can just say (untested code) perl -nie ' BEGIN { open F, "out.txt"; } if ($. <= 20) { print F $_; } else { print }; ' which would rewrite the original file without the first 20 lines and save them to out.txt. I haven't tested it, but if you can't figure it out I'll be glad to help further. Basically, $. is your friend. Ted From warren.lindsey at gmail.com Fri Sep 28 07:13:19 2007 From: warren.lindsey at gmail.com (Warren Lindsey) Date: Fri, 28 Sep 2007 09:13:19 -0500 Subject: [Chicago-talk] advanced perl training in chicagoland Message-ID: <841e880a0709280713r7e4b5c5auaf30390e8c4e04f2@mail.gmail.com> Does anyone have suggestions for Perl training around the chicagoland area? Something more advanced than an intro, but not specializing on a topic like web frameworks. tia, Warren From joshua.mcadams at gmail.com Fri Sep 28 21:53:14 2007 From: joshua.mcadams at gmail.com (Joshua McAdams) Date: Fri, 28 Sep 2007 23:53:14 -0500 Subject: [Chicago-talk] advanced perl training in chicagoland In-Reply-To: <841e880a0709280713r7e4b5c5auaf30390e8c4e04f2@mail.gmail.com> References: <841e880a0709280713r7e4b5c5auaf30390e8c4e04f2@mail.gmail.com> Message-ID: <49d805d70709282153l6ec656eak6ab02a60e66d063d@mail.gmail.com> > Does anyone have suggestions for Perl training around the chicagoland > area? Something more advanced than an intro, but not specializing on a > topic like web frameworks. Of course, there is Stonehenge (http://www.stonehenge.com) training due to brian's home-base being Chicago. Are you wanting to join in on a pre-existing class or do you want to bring someone into your company? From JJacobus at PonyX.com Sun Sep 30 16:11:43 2007 From: JJacobus at PonyX.com (Jim Jacobus) Date: Sun, 30 Sep 2007 18:11:43 -0500 Subject: [Chicago-talk] Off Topic: Laptop Recommendation Message-ID: <6.2.5.6.2.20070930174311.03192e00@SurplusRecord.com> I know this is off topic, so please don't beat me up. I've been looking for a replacement for my much loved Micron GX3 laptop which I've used daily since June 2002! I'm frustrated with the way laptops are classified by manufacturers (what if I want an "all-purpose, power, ultraportable, desktop replacement"?) The search is getting pretty time-consuming. I figured since you're all s/w developers like me, I could ask what machines you prefer. One of my most important criteria is the keyboard. When you spend hours pounding out code you need a good keyboard with sculpted keys, nice tactile response, properly spaced and somewhat long travel to the keyclick. I've tried those flat keys on Macs and Sony and have thus ruled those machines out--just can't touch type accurately for any length of time. Dell's seem a little cramped to me. HP's keyboard seems to be good. Not sure about Gateways or Toshibas. I've never had the opportunity to even see an Asus. Another concern I have is with those 'glassy' screens. Don't you get a lot of glare off them especially under office florescent lights? For what it's worth my other criteria are: XP-pro; 15.4 (or so) inch screen with resolution of at least 1400 x 1050; Intel Core 2 Duo; 1-2 GB memory; 60+GB drive; ATI or nVidia dedicated graphics card. I'm finding it really difficult to narrow my search down using the selection criteria at websites like notebookreview.com So, if you care to respond, could you comment on what machines you use (or prefer)? A couple grand or more is a big purchase, so I'm casting wide net for opinions. Thanks in advance.