From tim at consultix-inc.com Mon Jul 1 19:20:58 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Free Seat Drawing #1 Wednesday Message-ID: <20020701172058.A22899@timji.consultix.wa.com> SPUGsters, I'm back from YAPC::NA in St. Louis, and full of Perl/Open-Source spirit! (This is Tim Maher speaking.) I'd be happy to tell you all about the conference during the customary beer festivals taking place before and after the next SPUG meeting, but right now, I want to remind you of a few salient points that we all need to keep in mind: 1) The Perl Foundation has done our community a fantastic service by funding The Damian, and more recently The Larry and The Dan, to entertain, enlighten, and intrigue Perl mongers, embellish Perl 5, and invent Perl 6. And we can thank the talented but humble Kevin Lenzo for making much of that happen. (NOTE: *ONE GUY* made a big difference here!) 2) The Perl community needs your support! This is like public TV; if you don't cough up some bucks during Pledge Breaks, then you're doomed to watching Ozzie Osbourne drooling on himself or Gilligan making a fool of himself on the commercial channels, and you might never see Red Dwarf, BlackAdder, Rumple of the Bailey, Are You Being Served, Keeping up Appearances, or Dr. Who again (well, granted, Iron Chef will still be worth watching on commercial TV, but little else). This is your world; how do you want it configured? You have the power to make a difference! 3) As indicated earlier, there will be a drawing on 7/3 to award some free one-day seats in Damian's upcoming "Advanced Perl Workshop" (http://teachmeperl.com/apworkshop.html) to those who've contributed through SPUG to The Perl Foundation by 5pm 7/3 (see http://teachmeperl.com/apworkshop.html#Raffle for details). What's new is that, participation permitting, there will be a second drawing for up to two more seats held on Wednesday, 7/10, for those whose contributions of at least $50 are received after 5pm on 7/3 but before 5pm on 7/10. To make it easy to get those contributions in on time, we'll accept charge-card payments as well as checks to TPF delivered by snail-mail to POB 70563, Seattle WA 98107, or courier to Consultix, 1753 NW 62nd. St., Seattle 98107. If you want to contribute by charge-card, please provide the following information via FAX to 206-784-7475 or voice-mail to 206-781-8649 (for security, we recommend against Emailing this information): Card Type (Visa, Mastercard, etc.) Cardholder Name Card Billing Address Cardholder Phone Card Number Exp. Date Thus far, we've only got *four contenders* for the two seats we'll be awarding on 7/3, who've made donations ranging from $6 to $40. The number of chances to win is directly proportional to the number of dollars donated, so that one guy is way out in the lead with superior odds. Wouldn't you like a crack at this contest? As things currently stand, by contributing a measly $40+ bucks, you'd have an excellent chance of winning a $275 seat in a class with one of the foremost Perl experts on the planet! Who might not, by the way, be such a frequent visitor to America in the near future. 4) There will be several social events surrounding the visit of The Damian, providing lots of opportunities to interact with him in a casual context. As the details are firmed up, I'll be posting the particulars to the SPUG website, seattleperl.org. 5) Damian's new conference show-stopper talk, "Time::Space::Continuum" (see http://teachmeperl.com/tsc_review.html) is another mind-blower, like Quantum Superpositions, so please be sure to reserve the 7-9pm slot on 7/16 to hear him speak! (See seattleperl.org for details.) -Tim ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Mon Jul 1 19:51:16 2002 From: tim at consultix-inc.com (SPUG-list-owner) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Free Seat Drawing #1 Wednesday In-Reply-To: <20020701172058.A22899@timji.consultix.wa.com> References: <20020701172058.A22899@timji.consultix.wa.com> Message-ID: <20020701175116.A23073@timji.consultix.wa.com> On Mon, Jul 01, 2002 at 05:20:58PM -0700, Tim Maher wrote: > > Wouldn't you like a crack at this contest? As things currently stand, > by contributing a measly $40+ bucks, you'd have an excellent chance of > winning a $275 seat in a class with one of the foremost Perl experts Sorry, that should have said *$550* seat. "My bad" (however that's meant to be parsed, which completely escapes me . . .) > on the planet! Who might not, by the way, be such a frequent visitor > to America in the near future. -- *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | |7/29:Database w/Perl 8/19:UNIX 8/26:Perl+Modules 9/18:Int Perl 9/23:Shell/Util| *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Mon Jul 1 22:44:14 2002 From: tim at consultix-inc.com (SPUG-list-owner) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Calling Former SPUG Speakers! Message-ID: <20020701204414.B23400@timji.consultix.wa.com> SPUGsters, I need to make a list of all the people who have made any kind of presentation (long talk, lightning talk, etc.) for SPUG since last July; all those who have done so, please reply (optionally, with details of what you did and when, if you can remember.) -Tim *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Mon Jul 1 23:10:07 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Loop styles: goto vs. redo References: <20020701204414.B23400@timji.consultix.wa.com> Message-ID: <012d01c2217e$60ed5e40$2488ddd1@aciwin> After some wrangling with my CPAN co-author over a trivial point of style, I'd like to throw this before the group. For production code, which is better (or suggest an alternative that is better than both): START_TESTS: my $not_done = 0; for (...) { unless (...) { ... $not_done = 1; } } goto START_TESTS if $not_done or { my $done = 1; for (....) { unless(...) { ... $done = 0; } } redo unless $done; } Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dancerboy at strangelight.com Tue Jul 2 01:04:00 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Loop styles: goto vs. redo In-Reply-To: <012d01c2217e$60ed5e40$2488ddd1@aciwin> References: <20020701204414.B23400@timji.consultix.wa.com> <012d01c2217e$60ed5e40$2488ddd1@aciwin> Message-ID: At 9:10 pm -0700 2002-07-01, Richard Anderson wrote: >After some wrangling with my CPAN co-author over a trivial point of style, >I'd like to throw this before the group. For production code, which is >better (or suggest an alternative that is better than both): > >START_TESTS: > my $not_done = 0; > for (...) { > unless (...) { > ... > $not_done = 1; > } > } > goto START_TESTS if $not_done > >or > >{ > my $done = 1; > for (....) { > unless(...) { > ... > $done = 0; > } > } > redo unless $done; >} I personally dislike goto's and their ilk, so I consider these both somewhat hideous. IMHO, a better alternative is: my $done = 1; do { for (....) { unless(...) { ... $done = 0; } } } while ( not $done ); or, better yet, I bet if you thought a little more carefully about your exit condition(s), you could simplify your flow structure and get rid of the $done flag altogether, maybe even being able to pack it into a single for statement: for ( ) { .... } Of course, it depends on exactly what you're doing -- but *usually* these sorts of deeply-nested control structures are unnecessary. Whatever you do, *please* don't use a boolean variable with negated semantics, like "$not_done". Otherwise, you end up with expressions like: unless ( $not_done ) {...} if ( ! $not_done ) {...} unless ( not $not_done ) {...} These just make my brain hurt. Even if you keep the semantics the same, name the variable something non-negated, like "$keep_going". -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Tue Jul 2 11:32:57 2002 From: tim at consultix-inc.com (SPUG-list-owner) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Re: Loop styles: goto vs. redo Message-ID: <20020702093257.A25312@timji.consultix.wa.com> > Remember people, as ridiculous as it may (and certainly does) sound, > the [s]ub word is illegal in posts to this list (thanks to Majordomo). > -Tim Why not put it in a subroutine and use recursion? Zub Tests { my $done = 0; for (...) { unless (...) { ... $done = 1; } } &Tests unless $done; } >> Ken Clarke >> Contract Web Programmer / E-commerce Technologist >> www.perlprogrammer.net :: www.modperldev.com ----- End forwarded message ----- -- *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dcd at tc.fluke.com Tue Jul 2 12:45:46 2002 From: dcd at tc.fluke.com (David Dyck) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Loop styles: goto vs. redo In-Reply-To: <012d01c2217e$60ed5e40$2488ddd1@aciwin> Message-ID: On Mon, 1 Jul 2002 at 21:10 -0700, Richard Anderson For production code, which is better... > LINE: > { > my $done = 1; > for (....) { > unless(...) { > ... > $done = 0; > } > } redo LINE unless $done; > } I'd suggest adding a label on your loop. from perldoc -f goto I'll quote "The author of Perl has never felt the need to use this form of "goto" (in Perl, that is--C is another matter). (The difference being that C does not offer named loops combined with loop control. Perl does, and this replaces most structured uses of "goto" in other languages.)" The label on the loop is a good clue that something is going on, and the change of flow is much more limited with redo than with goto, so I'd suggest using redo. If you are going to redo back more that a couple of lines I would strongly suggest using the label on the loop. Judging from your omited code "....", you could eliminate the $done variable, and have the redo action happen closer to the condition that set $done to 0, (undone) if you rewrite as: LINE: { for (....) { unless(...) { ... redo LINE; } } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dancerboy at strangelight.com Tue Jul 2 12:50:21 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Re: Loop styles: goto vs. redo In-Reply-To: <20020702093257.A25312@timji.consultix.wa.com> References: <20020702093257.A25312@timji.consultix.wa.com> Message-ID: At 9:32 am -0700 2002-07-02, SPUG-list-owner wrote: > > Remember people, as ridiculous as it may (and certainly does) sound, >> the [s]ub word is illegal in posts to this list (thanks to Majordomo). >> -Tim > >Why not put it in a subroutine and use recursion? > >Zub Tests { > my $done = 0; > for (...) { > unless (...) { > ... > $done = 1; > } > } > &Tests unless $done; >} I realize that this might have been said in jest, but there are newbies on this list who might take this suggestion seriously, so... Why not? Because if you need to make several hundred iterations of Tests, you're likely to run out of memory and end up with a core dump. Remember: every time you make a subroutine call, the interpreter has to push a bunch of stuff onto the stack, and then pop it off the stack again at the end of the subroutine. Recursion is *good* when you're implementing something like a binary search or a recursive sorting algorithm -- i.e. where all of that stack pushing and popping is actually part of the algorithm you're trying to implement. In such cases recursion is a clever way of getting the interpreter to do a lot of your work for you. But in cases like this example above, where all of that stack pushing and popping is completely superfluous, then recursion is *bad*: it's confusing to read and it's a huge waste of resources. Also, notice that if you use recursion like this, then you get a new scope for every iteration, which could cause complications if you need to access the same data each time through: you'll need to use file- or package-scoped variables (i.e. globals) or accessor functions that *act* like globals. Yes, TMTOWTDI, but some of those ways are simply wrong... ;) -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jimfl at tensegrity.net Tue Jul 2 14:23:29 2002 From: jimfl at tensegrity.net (Jim Flanagan) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Re: Loop styles: goto vs. redo In-Reply-To: References: <20020702093257.A25312@timji.consultix.wa.com> Message-ID: <2147483647.1025612609@[192.168.10.23]> --On Tuesday, July 2, 2002 10:50 AM -0700 dancerboy wrote: > Why not? Because if you need to make several hundred iterations of > Tests, you're likely to run out of memory and end up with a core > dump. > > Remember: every time you make a subroutine call, the interpreter has > to push a bunch of stuff onto the stack, and then pop it off the > stack again at the end of the subroutine. Except... this is a tail recursion (because nothing needs to happen within the subroutine after the recursive call), and many language compilers are smart enough to realize that this can be optimized not to allocate a new stack frame for the call (a so-called "tail-call elimination"). It basically becomes no less efficient than iteration. I'm not sure if perl does this automagically, but you can get close using, of all things, a goto (form 3): Zub Tests { my $done = 0; for (...) { unless (...) { ... $done = 1; } } $done and return; goto &Tests; } -- Flanagan::Jim http://jimfl.tensegrity.net mailto:jimfl%40t%65ns%65gr%69ty.n%65t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dleonard at dleonard.net Tue Jul 2 16:37:45 2002 From: dleonard at dleonard.net (dleonard@dleonard.net) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Loop styles: goto vs. redo In-Reply-To: <012d01c2217e$60ed5e40$2488ddd1@aciwin> Message-ID: On Mon, 1 Jul 2002, Richard Anderson wrote: > After some wrangling with my CPAN co-author over a trivial point of style, > I'd like to throw this before the group. For production code, which is > better (or suggest an alternative that is better than both): > > START_TESTS: > my $not_done = 0; > for (...) { > unless (...) { > ... > $not_done = 1; > } > } > goto START_TESTS if $not_done > > or > > { > my $done = 1; > for (....) { > unless(...) { > ... > $done = 0; > } > } > redo unless $done; > } Personally I'm more of a fan of while(). my $done = 0; while (!$done) { for (...) { if (...) { $done = 1; } } } Doesn't that just sound good? 'while not done' Sure it introduces another loop scope but that shouldn't be a concern unless you are looking for that last .01% performance. The problem with redo and goto is code flow. You don't know what your conditional is until you are in the middle or end of your block. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dancerboy at strangelight.com Tue Jul 2 17:13:32 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Re: Loop styles: goto vs. redo In-Reply-To: <2147483647.1025612609@[192.168.10.23]> References: <20020702093257.A25312@timji.consultix.wa.com> <2147483647.1025612609@[192.168.10.23]> Message-ID: At 12:23 pm -0700 2002-07-02, Jim Flanagan wrote: >--On Tuesday, July 2, 2002 10:50 AM -0700 dancerboy > wrote: > > > Why not? Because if you need to make several hundred iterations of > > Tests, you're likely to run out of memory and end up with a core > > dump. > > > > Remember: every time you make a subroutine call, the interpreter has > > to push a bunch of stuff onto the stack, and then pop it off the > > stack again at the end of the subroutine. > > Except... this is a tail recursion (because nothing needs to happen > within the subroutine after the recursive call), and many language > compilers are smart enough to realize that this can be optimized not to > allocate a new stack frame for the call (a so-called "tail-call > elimination"). It basically becomes no less efficient than iteration. Even if the interpreter is "smart" enough not to allocate a new stack frame, the recursion is still going to be expensive: the interpreter still needs to check the reference counts on all the variables that are local to the function, plus it's going to need to fudge the callstack somehow so that functions like caller() will return the expected results. Having a smart compiler does not justify writing stupid code. -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From pdarley at kinesis-cem.com Tue Jul 2 18:09:00 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Another stupid question, hash sorting Message-ID: Friends, I've got another stupid question that I'm hoping someone can answer for me. I want to sort a hash on two values, and have been unsuccessful in my search of the web for info on how to do it. Specifically I have a hash containing {Score} and {Name} values, and I want to primarily sort on score, and sort on name where the score is the same. I can do this with a two step sort, but I figured that Perl was probably cool enough to provide a simple way of tackling this. Thanks, Peter Darley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ben at reser.org Tue Jul 2 18:28:39 2002 From: ben at reser.org (Ben Reser) Date: Wed Aug 4 00:09:02 2004 Subject: SPUG: Another stupid question, hash sorting In-Reply-To: References: Message-ID: <20020702232839.GE15815@titanium.brain.org> On Tue, Jul 02, 2002 at 04:09:00PM -0700, Peter Darley wrote: > I've got another stupid question that I'm hoping someone can answer for me. > I want to sort a hash on two values, and have been unsuccessful in my search > of the web for info on how to do it. > Specifically I have a hash containing {Score} and {Name} values, and I want > to primarily sort on score, and sort on name where the score is the same. I > can do this with a two step sort, but I figured that Perl was probably cool > enough to provide a simple way of tackling this. You can use the sort function of perl to achieve this. Read: perldoc -f sort Pay particular attention to the block definition where you can define your own criteria for determining sort positions... At any rate this isn't a simple task that perl already has a built in to handle. You'll have to do some work on it yourself... -- Ben Reser http://ben.reser.org We tend to see all wars through the lens of the current conflict, and we mine history for lessons convenient to the present purpose. - Brian Hayes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jhmark at xenops.com Tue Jul 2 18:40:17 2002 From: jhmark at xenops.com (Jonathan Mark) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Another stupid question, hash sorting In-Reply-To: Message-ID: On Tue, 2 Jul 2002, Peter Darley wrote: > Specifically I have a hash containing {Score} and {Name} values, and I want > to primarily sort on score, and sort on name where the score is the same. yes, as Ben said ... you can provide a comparison function to sort on. An example follows. best, Jonathan sub by_score_and_name { my $score_cmp = $a->{Score} <=> $b->{Score}; return $score_cmp if $score_cmp != 0; return $a->{Name} cmp $b->{Name}; } my @a = ({Score => 5, Name => 'ann'}, {Score => 5, Name => 'the other ann'}, {Score => 2, Name => 'lars'}); my @sorted = sort by_score_and_name @a; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From whitneyt at agcs.com Tue Jul 2 18:53:47 2002 From: whitneyt at agcs.com (Thomas Whitney) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Another stupid question, hash sorting References: Message-ID: <3D223D0B.FA1E903@agcs.com> It depends how your hash is set up. is it: $score = $hash{$name} or $score = $hash{$name}{score} or $name = $array[$index]{name} $score = $array[$index]{score} etc... Thanks Tom Peter Darley wrote: > Friends, > I've got another stupid question that I'm hoping someone can answer for me. > I want to sort a hash on two values, and have been unsuccessful in my search > of the web for info on how to do it. > Specifically I have a hash containing {Score} and {Name} values, and I want > to primarily sort on score, and sort on name where the score is the same. I > can do this with a two step sort, but I figured that Perl was probably cool > enough to provide a simple way of tackling this. > Thanks, > Peter Darley > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From pdarley at kinesis-cem.com Tue Jul 2 18:56:09 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Another stupid question, hash sorting In-Reply-To: <3D223D0B.FA1E903@agcs.com> Message-ID: Tom, It's set up the third way. Thanks, Peter D. -----Original Message----- From: Thomas Whitney [mailto:whitneyt@agcs.com] Sent: Tuesday, July 02, 2002 4:54 PM To: Peter Darley Cc: SPUG Subject: Re: SPUG: Another stupid question, hash sorting It depends how your hash is set up. is it: $score = $hash{$name} or $score = $hash{$name}{score} or $name = $array[$index]{name} $score = $array[$index]{score} etc... Thanks Tom Peter Darley wrote: > Friends, > I've got another stupid question that I'm hoping someone can answer for me. > I want to sort a hash on two values, and have been unsuccessful in my search > of the web for info on how to do it. > Specifically I have a hash containing {Score} and {Name} values, and I want > to primarily sort on score, and sort on name where the score is the same. I > can do this with a two step sort, but I figured that Perl was probably cool > enough to provide a simple way of tackling this. > Thanks, > Peter Darley > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From kahn at cpan.org Tue Jul 2 19:19:05 2002 From: kahn at cpan.org (Jeremy Kahn) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Another stupid question, hash sorting In-Reply-To: Message-ID: Don't forget that you can use the || and <=> and cmp operators to shorthand a lot of this: # untested [snipped from Jonathan's code] my @a = ({Score => 5, Name => 'ann'}, {Score => 5, Name => 'the other ann'}, {Score => 2, Name => 'lars'}); # custom sort provided in block my @sorted = sort { $a->{Score} <=> $b->{Score} || $a->{Name} cmp $b->{Name} } @a; This makes the most sense usually when you're doing a simple bi-level sort, but it can be chained if you need to. --jeremy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Tue Jul 2 20:28:13 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Loop styles: goto vs. redo References: Message-ID: <01da01c22230$f8463340$2488ddd1@aciwin> I'd have to concur with David's point that "the change of flow is much more limited with redo than with goto" and his suggestion to use redo with a label for extra clarity: START_TESTS: { my $done = 1; for (....) { unless(...) { ... $done = 0; } } redo START_TESTS unless $done; } Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "David Dyck" To: "Richard Anderson" Cc: Sent: Tuesday, July 02, 2002 10:45 AM Subject: Re: SPUG: Loop styles: goto vs. redo > On Mon, 1 Jul 2002 at 21:10 -0700, Richard Anderson > > For production code, which is better... > > > > LINE: > > { > > my $done = 1; > > for (....) { > > unless(...) { > > ... > > $done = 0; > > } > > } > redo LINE unless $done; > > } > > > I'd suggest adding a label on your loop. > > from perldoc -f goto I'll quote > "The author of Perl has never felt the need to use this form of "goto" > (in Perl, that is--C is another matter). (The difference being that > C does not offer named loops combined with loop control. Perl does, > and this replaces most structured uses of "goto" in other languages.)" > > The label on the loop is a good clue that something is > going on, and the change of flow is much more limited > with redo than with goto, so I'd suggest using redo. > If you are going to redo back more that a couple of lines > I would strongly suggest using the label on the loop. > > Judging from your omited code "....", you could eliminate > the $done variable, and have the redo action happen > closer to the condition that set $done to 0, (undone) > if you rewrite as: > > LINE: > { > for (....) { > unless(...) { > ... > redo LINE; > } > } > } > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Tue Jul 2 20:27:45 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Loop styles: goto vs. redo References: <20020701204414.B23400@timji.consultix.wa.com> <012d01c2217e$60ed5e40$2488ddd1@aciwin> Message-ID: <01d901c22230$f79b4d40$2488ddd1@aciwin> ----- Original Message ----- From: "dancerboy" To: Sent: Tuesday, July 02, 2002 10:50 AM Subject: Re: SPUG: Re: Loop styles: goto vs. redo > I personally dislike goto's and their ilk, so I consider these both > somewhat hideous. IMHO, a better alternative is: > > my $done = 1; > do { > for (....) { > unless(...) { > ... > $done = 0; > } > } > } while ( not $done ); > That is either a once-only loop or an infinite loop - it's not equivalent to the original code. Good point about avoiding negatively-named variables like $not_done, which can lead to confusing constructions like if(not $not_done) {} Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Tue Jul 2 20:25:04 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Loop styles: goto vs. redo References: Message-ID: <01d801c22230$f6fc7530$2488ddd1@aciwin> ----- Original Message ----- From: To: Sent: Tuesday, July 02, 2002 2:37 PM Subject: Re: SPUG: Loop styles: goto vs. redo > > Personally I'm more of a fan of while(). > > my $done = 0; > while (!$done) { > for (...) { > if (...) { > $done = 1; > } > } > } > This repeats UNLESS the conditional evaluates true. This is not equivalent to the original loop, which repeats IF the conditional evaluates true: START_TESTS: my $not_done = 0; for (...) { unless (...) { ... $not_done = 1; } } goto START_TESTS if $not_done Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Tue Jul 2 20:45:15 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Re: Another stupid question, hash sorting References: Message-ID: <023501c22233$4d8b0c70$2488ddd1@aciwin> There are many good examples of various ways to use Perl's sort operator at http://www.raycosoft.com/rayco/support/perl_tutor.html#sort See the example "Sort using multiple keys" You can find this tutorial by going to Google and searching on "perl sort". Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "Peter Darley" To: "SPUG" Sent: Tuesday, July 02, 2002 4:09 PM Subject: SPUG: Another stupid question, hash sorting > Friends, > I've got another stupid question that I'm hoping someone can answer for me. > I want to sort a hash on two values, and have been unsuccessful in my search > of the web for info on how to do it. > Specifically I have a hash containing {Score} and {Name} values, and I want > to primarily sort on score, and sort on name where the score is the same. I > can do this with a two step sort, but I figured that Perl was probably cool > enough to provide a simple way of tackling this. > Thanks, > Peter Darley > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Tue Jul 2 22:21:42 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Another stupid question, hash sorting In-Reply-To: ; from pdarley@kinesis-cem.com on Tue, Jul 02, 2002 at 04:09:00PM -0700 References: Message-ID: <20020702202142.B13643@hobart.helvella.org> On Tue, Jul 02, 2002 at 04:09:00PM -0700, Peter Darley wrote: > I want to sort a hash on two values, and have been unsuccessful in my > search of the web for info on how to do it. Unsuccessful perhaps because you should have been searching the Perl documentation at your finger tips: perldoc -q 'sort a hash' Though, you did get more thorough answers from the SPUG list. ;-) Have fun, -Colin. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dleonard at dleonard.net Tue Jul 2 23:21:57 2002 From: dleonard at dleonard.net (dleonard@dleonard.net) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Loop styles: goto vs. redo In-Reply-To: <01d801c22230$f6fc7530$2488ddd1@aciwin> Message-ID: Umm, the concept of using while() was the point, the code snippet was an example of said point. The execution of implementing it to your exact problem was left as an exercise to the reader. However, since that point was obviously missed... my $done = 0; while (!$done) { $done = 1; for (...) { unless (...) { $done = 0; } } } -- On Tue, 2 Jul 2002, Richard Anderson wrote: > ----- Original Message ----- > From: > To: > Sent: Tuesday, July 02, 2002 2:37 PM > Subject: Re: SPUG: Loop styles: goto vs. redo > > > > Personally I'm more of a fan of while(). > > > > my $done = 0; > > while (!$done) { > > for (...) { > > if (...) { > > $done = 1; > > } > > } > > } > > > > This repeats UNLESS the conditional evaluates true. This is not equivalent > to the original loop, which repeats IF the conditional evaluates true: > > START_TESTS: > my $not_done = 0; > for (...) { > unless (...) { > ... > $not_done = 1; > } > } > goto START_TESTS if $not_done > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Wed Jul 3 16:46:22 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Loop styles: goto vs. redo References: <012d01c2217e$60ed5e40$2488ddd1@aciwin> Message-ID: In place of: { my $done = 1; for (list) { unless(condition) { body; $done = 0; } } redo unless $done; } you could say: 1 while grep { if (!condition) { # can't use unless body; 1; # needed only if last stmt of body is false or needs void context } } list; or more simply: 1 while grep !condition && do { body; 1 }, list; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Thu Jul 4 00:12:42 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Damianiacal Training Winners Message-ID: <20020703221242.A7155@timji.consultix.wa.com> SPUGsters, We now know the winners for the first free-seat drawings for Damian Conway's upcoming classes. But first, some background. We had six contestants donating to the TPF Perl Development fund, with donations ranging from $6 to $140. Each had as many chances to win as they had dollars donated. Two names were randomly drawn from a "virtual bag" containing from 6 to 140 instances of each name, using a Perl program (naturally). And the winners are: Jeremy Kahn, "Programming Perl 6" (a $71 donor) Rich Wood, "Advanced Module Implementation" (a $10 donor) Which just goes to show, having the statistical odds in your favor doesn't always pay off, nor does having them against you necessarily mean you won't win. You can get lucky. Or the reverse! We'll have one final drawing next Wednesday, which will be for one free seat for each $300 in contributions. See teachmeperl.com/apworkshop#Raffle for more details. Thanks to those who participated, and although most of you didn't win directly, keep in mind that we raised $297 for The Perl Foundation in this raffle, and *we all win* by supporting our community in this way! -Tim *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Marc.M.Adkins at Doorways.org Sun Jul 7 19:47:46 2002 From: Marc.M.Adkins at Doorways.org (Marc M. Adkins) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Perl 5.8 threads? In-Reply-To: Message-ID: Has anyone been fooling with Perl 5.8 threads? Any gut reactions? mma - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Mon Jul 8 11:58:16 2002 From: sweetsue at sweethomes.com (Sweethomes) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong In-Reply-To: Message-ID: Not sure if this went through - resending: Scratching my head over this one. All I want is to read the upper directory, list out the files names and then print the results with numbering to a file. Here is what I have: #!/usr/bin/perl open(RDIR,"./admin/data/rdir.txt"); opendir(DIR, "../"); @files = readdir(DIR); for($num = 0; $num <= 100; $num += 1) foreach $name (@files) { if(-d $name){}elsif($name eq "." || $name eq ".."){}else{ print(RDIR, "$num | $name\n");}} close(RDIR); close(DIR); exit; I've got the worst headcold in my personal history and I'm thinking that my brain just is not functioning. If anyone can clear this up for me, I'd appreciate it! Happy 4th of July to all! www.web-dev-design.com ------------------------------------ Susanne Bullo, Developer Web Dev Design 16646 SE 10th Street Bellevue, WA 98008 Telephone: 425.562.6040 Facsimile: 425.671.0571 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020708/fd67fda4/attachment.htm From david.corcoran at Boeing.COM Mon Jul 8 12:22:36 2002 From: david.corcoran at Boeing.COM (EXT-Corcoran, David) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong Message-ID: <58B6DA1B98AA9149B13B029976A48BCC088F5D23@xch-nw-31.nw.nos.boeing.com> Off the top I find this line suspect: for($num = 0; $num <= 100; $num += 1) # note there is no opening curly brace I don't know how perl treats this; very early on I learned to use braces even if I have only one statement in the conditional and have never quest the convention, so it just leaped out at me. -----Original Message----- From: Sweethomes [mailto:sweetsue@sweethomes.com] Sent: Monday, July 08, 2002 9:58 AM To: Seattle Perl User's Group Subject: SPUG: RE: Simple program - gone wrong Not sure if this went through - resending: Scratching my head over this one. All I want is to read the upper directory, list out the files names and then print the results with numbering to a file. Here is what I have: #!/usr/bin/perl open(RDIR,"./admin/data/rdir.txt"); opendir(DIR, "../"); @files = readdir(DIR); for($num = 0; $num <= 100; $num += 1) foreach $name (@files) { if(-d $name){}elsif($name eq "." || $name eq ".."){}else{ print(RDIR, "$num | $name\n");}} close(RDIR); close(DIR); exit; I've got the worst headcold in my personal history and I'm thinking that my brain just is not functioning. If anyone can clear this up for me, I'd appreciate it! Happy 4th of July to all! www.web-dev-design.com ------------------------------------ Susanne Bullo, Developer Web Dev Design 16646 SE 10th Street Bellevue, WA 98008 Telephone: 425.562.6040 Facsimile: 425.671.0571 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020708/f8fca8a6/attachment.htm From david.corcoran at Boeing.COM Mon Jul 8 12:30:51 2002 From: david.corcoran at Boeing.COM (EXT-Corcoran, David) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong Message-ID: <58B6DA1B98AA9149B13B029976A48BCC088F5D24@xch-nw-31.nw.nos.boeing.com> It also looks like you are opening RDIR for reading; again I always use ">file" or " ------------------------------------ Susanne Bullo, Developer Web Dev Design 16646 SE 10th Street Bellevue, WA 98008 Telephone: 425.562.6040 Facsimile: 425.671.0571 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020708/43ce133f/attachment.htm From cwilkes-spug at ladro.com Mon Jul 8 12:47:38 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong In-Reply-To: ; from sweetsue@sweethomes.com on Mon, Jul 08, 2002 at 09:58:16AM -0700 References: Message-ID: <20020708104738.C32369@www.ladro.com> On Mon, Jul 08, 2002 at 09:58:16AM -0700, Sweethomes wrote: > Not sure if this went through - resending: > > Scratching my head over this one. All I want is to read the upper > directory, list out the files names and then print the results with > numbering to a file. Here is what I have: > > #!/usr/bin/perl > open(RDIR,"./admin/data/rdir.txt"); ^^^ You should open the file up for output with a ">" in there. While you're at it give some warnings if it fails: my $file = "./admin/data/rdir.txt"; open (RDIR, ">$file") || die "Can't write to '$file' $!\n"; > opendir(DIR, "../"); > @files = readdir(DIR); If you want just the files, which you do based on your test below, you can do that when setting @files: my $dir = "../"; opendir(DIR, "../"); @files = grep { !/^\.{1,2}$/ && -f "$dir/$_" } readdir DIR; if you cared what directory the files were in (it appears you don't) then throw a map { "$dir/$_" } in there before the grep statement. Btw, this is all in 'perldoc -f readdir'. Note: you have to include the $dir in your file check or you'll be checking if the file in ../ is in your current directory. It probably isn't. > for($num = 0; $num <= 100; $num += 1) > foreach $name (@files) { > if(-d $name){}elsif($name eq "." || $name eq ".."){}else{ > print(RDIR, "$num | $name\n");}} > close(RDIR); > close(DIR); > exit; I'm hoping that cut-n-paste took out the indents on this as it is hardly legible. What's the point of looping with $num anyway? Now that we did the file check in setting @files we can take out the if statement: #!/usr/bin/perl -w use strict; my ($file, $dir, @files); $file = "./admin/data/rdir.txt"; $dir = "../"; open (RDIR, ">$file") || die "Can't write to '$file' $!\n"; opendir(DIR, "../") || die "Can't open dir '$dir' $!\n"; @files = grep { !/^\.{1,2}$/ && -f "$dir/$_" } readdir DIR; close DIR; for my $num (0..100) { foreach (@files) { print RDIR, "$num | $_\n"; } } close RDIR; Give that untested code a shot! > foreach $name (@files) { > if(-d $name){}elsif($name eq "." || $name eq ".."){}else{ > print(RDIR, "$num | $name\n");}} > close(RDIR); > close(DIR); > exit; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From bcundal at cundal.net Mon Jul 8 12:53:38 2002 From: bcundal at cundal.net (Brett Cundal) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong In-Reply-To: References: Message-ID: <20020708175338.GA9526@cundal.net> On Mon, Jul 08, 2002 at 09:58:16AM -0700, Sweethomes wrote: > #!/usr/bin/perl > open(RDIR,"./admin/data/rdir.txt"); > opendir(DIR, "../"); > @files = readdir(DIR); > for($num = 0; $num <= 100; $num += 1) > foreach $name (@files) { > if(-d $name){}elsif($name eq "." || $name eq ".."){}else{ > print(RDIR, "$num | $name\n");}} > close(RDIR); > close(DIR); > exit; You've got two nested loops (does this compile at all? I don't htink you can leave out the curly braces in perl like you can in C)... this will print out 100 sets of filenames, ie. each file will be listed 100 times in the results. You probably want a single loop instead: #!/usr/bin/perl open(RDIR,"./admin/data/rdir.txt"); opendir(DIR, "../"); @files = readdir(DIR); # Remove: # for($num = 0; $num <= 100; $num += 1) # Add: $num = 0; foreach $name (@files) { if(-d $name){}elsif($name eq "." || $name eq ".."){}else{ print(RDIR, "$num | $name\n"); # Add: $num++; # If you want to break at 100... I'm not sure: # last if $num >= 100; }} close(RDIR); close(DIR); exit; Is that what you're trying to do? BTW, using elsif instead of negated conditionals makes for excellent unreadability. :) -- Brett -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020708/31573a36/attachment.bin From brianmaddux at yahoo.com Mon Jul 8 12:56:15 2002 From: brianmaddux at yahoo.com (Brian Maddux) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong In-Reply-To: Message-ID: <20020708175615.34593.qmail@web40203.mail.yahoo.com> Try this: #!/usr/bin/perl open(RDIR,"./admin/data/rdir.txt"); opendir(DIR, "../"); @files = readdir(DIR); $num = 1; foreach $name (@files) { if(-d $name){ }elsif($name eq "." || $name eq ".."){ }else{ print RDIR "$num | $name\n"; $num++; } } close(RDIR); close(DIR); exit; --------- You don't need the for loop, just a counter; print was in the wrong form; and you forgot to open RDIR for write. Coding and colds do not mix well ;-) especially if you know multiple languages and start mixing them up! Hope this helps and you feel better.... Brian --- Sweethomes wrote: > Not sure if this went through - resending: > > Scratching my head over this one. All I want is > to read the upper > directory, list out the files names and then print > the results with > numbering to a file. Here is what I have: > > #!/usr/bin/perl > open(RDIR,"./admin/data/rdir.txt"); > opendir(DIR, "../"); > @files = readdir(DIR); > for($num = 0; $num <= 100; $num += 1) > foreach $name (@files) { > if(-d $name){}elsif($name eq "." || $name eq > ".."){}else{ > print(RDIR, "$num | $name\n");}} > close(RDIR); > close(DIR); > exit; > > I've got the worst headcold in my personal > history and I'm thinking that > my brain just is not functioning. If anyone can > clear this up for me, I'd > appreciate it! > Happy 4th of July to all! > > www.web-dev-design.com > ------------------------------------ > Susanne Bullo, Developer Web Dev Design > 16646 SE 10th Street Bellevue, WA > 98008 > Telephone: 425.562.6040 Facsimile: > 425.671.0571 > ===== Brian Maddux Whidbey Island, WA brianmaddux@yahoo.com ** __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cwilkes-spug at ladro.com Mon Jul 8 13:02:04 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong In-Reply-To: <20020708104738.C32369@www.ladro.com>; from cwilkes-spug@ladro.com on Mon, Jul 08, 2002 at 10:47:38AM -0700 References: <20020708104738.C32369@www.ladro.com> Message-ID: <20020708110204.D32369@www.ladro.com> On Mon, Jul 08, 2002 at 10:47:38AM -0700, Chris Wilkes wrote: > for my $num (0..100) { > foreach (@files) { > print RDIR, "$num | $_\n"; > } > } Arg there shouldn't be a comma in there. Should just be: print RDIR "$num | $_\n"; Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From brianmaddux at yahoo.com Mon Jul 8 13:18:33 2002 From: brianmaddux at yahoo.com (Brian Maddux) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong In-Reply-To: <20020708175615.34593.qmail@web40203.mail.yahoo.com> Message-ID: <20020708181833.70036.qmail@web40208.mail.yahoo.com> OOPS! I sent this before I realized it was printing directories, which were to be excluded. My code, and Sue's, forgot the "../" in front of $name in the 'if (-d $name) {' line. Replace with 'if (-d "../$name") {'. readdir returns only then names of the files, not the path. Brian --- Brian Maddux wrote: > Try this: > > #!/usr/bin/perl > open(RDIR,"./admin/data/rdir.txt"); > opendir(DIR, "../"); > @files = readdir(DIR); > $num = 1; > foreach $name (@files) { > if(-d $name){ > }elsif($name eq "." || $name eq ".."){ > }else{ > print RDIR "$num | $name\n"; > $num++; > } > } > close(RDIR); > close(DIR); > exit; > > --------- > > You don't need the for loop, just a counter; print > was > in the wrong form; and you forgot to open RDIR for > write. > > Coding and colds do not mix well ;-) especially if > you > know multiple languages and start mixing them up! > > Hope this helps and you feel better.... > > Brian > > > --- Sweethomes wrote: > > Not sure if this went through - resending: > > > > Scratching my head over this one. All I want is > > to read the upper > > directory, list out the files names and then print > > the results with > > numbering to a file. Here is what I have: > > > > #!/usr/bin/perl > > open(RDIR,"./admin/data/rdir.txt"); > > opendir(DIR, "../"); > > @files = readdir(DIR); > > for($num = 0; $num <= 100; $num += 1) > > foreach $name (@files) { > > if(-d $name){}elsif($name eq "." || $name eq > > ".."){}else{ > > print(RDIR, "$num | $name\n");}} > > close(RDIR); > > close(DIR); > > exit; > > > > I've got the worst headcold in my personal > > history and I'm thinking that > > my brain just is not functioning. If anyone can > > clear this up for me, I'd > > appreciate it! > > Happy 4th of July to all! > > > > www.web-dev-design.com > > ------------------------------------ > > Susanne Bullo, Developer Web Dev Design > > 16646 SE 10th Street Bellevue, > WA > > 98008 > > Telephone: 425.562.6040 Facsimile: > > 425.671.0571 > > > > > ===== > Brian Maddux Whidbey Island, WA > brianmaddux@yahoo.com > ** > > __________________________________________________ > Do You Yahoo!? > Sign up for SBC Yahoo! Dial - First Month Free > http://sbc.yahoo.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://seattleperl.org > ===== Brian Maddux Whidbey Island, WA brianmaddux@yahoo.com ** __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Mon Jul 8 13:44:57 2002 From: sweetsue at sweethomes.com (Sweethomes) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong In-Reply-To: <20020708110204.D32369@www.ladro.com> Message-ID: Ok, this almost works. The numbering doesn't seem right. What it's doing is listing all files as it should but the first set is all marked with "0", then it repeats the file listing each with "1" in front of it. This repeats to "100" at which point it stops. I need it to number each file like so: 1 | index.html 2 | black_line.gif 3 | counter.php 4 | counter.txt 5 | formmail.php 6 | logo.gif 7 | favicon.ico 8 | help.html 9 | main.html etc. From here I can figure out how to filter out the .txt and the .gif etal leaving the .html files only. Thanks - you guys are great! Susanne -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Chris Wilkes Sent: Monday, July 08, 2002 11:02 AM To: spug-list@pm.org Subject: Re: SPUG: RE: Simple program - gone wrong On Mon, Jul 08, 2002 at 10:47:38AM -0700, Chris Wilkes wrote: > for my $num (0..100) { > foreach (@files) { > print RDIR, "$num | $_\n"; > } > } Arg there shouldn't be a comma in there. Should just be: print RDIR "$num | $_\n"; Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From SeattlePerlFJ92 at Langenberg.Com Mon Jul 8 14:03:20 2002 From: SeattlePerlFJ92 at Langenberg.Com (Chuck Langenberg) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Intermediate Link Message-ID: <008201c226b2$2e5bd680$17020202@c172974a> Rather than just linking to http://www.Destination.Com/xyz.html, there are times when I want to embed the following hyperlink into a web page: http://www.MyDomain.Com/cgi-bin/abc.pl?http://www.Destination.Com/xyz.html When a visitor clicks on the link above, it would go to the abc.pl script on MyDomain.Com. An intermediate web page (with a modifiable message) would then display something like: --- Begin "You are leaving the xxxxxxxx web site. The privacy policy at the destination web site will differ. Click below to visit that site: http://www.Destination.Com/xyz.html" --- End Could someone please post the _short_ Perl source code, or a URL which would specialize in this type of Perl script? Regards, Chuck Langenberg http://www.Chuck.Langenberg.Com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From legrady at earthlink.net Mon Jul 8 14:28:33 2002 From: legrady at earthlink.net (Tom Legrady) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong In-Reply-To: Message-ID: $num= 0; foreach (@files) { print RDIR "$num | $_\n"; $num++; } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Mon Jul 8 16:46:28 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: July Mtg: Damian on "Time::Space::Continuum" Message-ID: <20020708144628.A12841@timji.consultix.wa.com> July 2002 Seattle Perl User's Group Meeting ------------------------------------------------------ Title: "An Evening with The Damian" Speaker: Dr. Damian Conway Time: Tuesday, July 16, 2002 7-9pm Location: SAFECO bldg, Brooklyn St. and NE 45th St. Cost: Admission is free and open to the general public. Info: http://seattleperl.org/ On Tuesday, July 16th, "The Damian" will be entertaining and enlightening us with his new show-stopping talk, "Time::Space::Continuum", which debuted on 6/28 at YAPC::NA (see http://teachmeperl.com/tsc_review.html for a review). Needless to say, it's another brain-buster, along the lines of his famous "Quantum Superpositions" talk. You won't want to miss it! I'll be selling black Perl Mongers T-shirts during the break for $20 each, so please bring correct change if you want one (mostly XL, but a few L also). TRAINING OPPORTUNITIES with DAMIAN Also of note is that Damian is teaching three seminars in Kirkland next week, on "Advanced OO Perl", "Advanced Module Implementation Techniques", and "Programming Perl 6". Some seats remain in all seminars, and details are at http://teachmeperl.com. As a special top-secret offer to SPUGsters only, those who register and pay by credit card by 5pm Wednesday, 7/10, will qualify for a tuition discount of $100/day and a free cruise and dinner with Damian on 7/14. DINING OPPORTUNITIES with DAMIAN The pre-meeting dinner will be held at the Cedars restaurant, at 50th St. and Brooklyn, in the University District, near the Safeco building where the meeting will take place. The phone number is 527-5247. Tim and Damian should be there around 5:45pm, traffic permitting. If you're planning to be there, please email tim@teachmeperl.com with your expected arrival time so we can reserve sufficient room. As usual, those wishing to socialize after the talk are invited to congregate at the Bigtime Brewery and Alehouse, for the usual debriefing session after the meeting. See the SPUG web-site for more details. ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From moonbeam at catmanor.com Mon Jul 8 18:42:03 2002 From: moonbeam at catmanor.com (William Julien) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Intermediate Link Message-ID: <200207082342.g68Ng3d15659@catmanor.com> > >Rather than just linking to http://www.Destination.Com/xyz.html, there >are times when I want to embed the following hyperlink into a web page: > >http://www.MyDomain.Com/cgi-bin/abc.pl?http://www.Destination.Com/xyz.html > >When a visitor clicks on the link above, it would go to the abc.pl >script on MyDomain.Com. An intermediate web page (with a modifiable >message) would then display something like: > >--- Begin >"You are leaving the xxxxxxxx web site. The privacy policy at the >destination web site will differ. Click below to visit that site: >http://www.Destination.Com/xyz.html" >--- End > >Could someone please post the _short_ Perl source code, or a URL which >would specialize in this type of Perl script? > >Regards, >Chuck Langenberg >http://www.Chuck.Langenberg.Com/ A minimal redirect would look something like this: #!/usr/bin/perl -w # # a minimal page redirect # ### use strict; my ($path, # redirect path $server, # local server name ); $server = defined $ENV{"SERVER_NAME"} ? $ENV{"SERVER_NAME"} : "unknown"; $path = defined $ENV{"PATH_INFO"} ? $ENV{"PATH_INFO"} : "unknown"; print < $server redirect
You are leaving the $server web site. The privacy policy at the destination web site will differ. Click below to visit that site: $path
PAGE --- William - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Ryan.Parr at wwireless.com Mon Jul 8 23:58:49 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong Message-ID: <6D6F0541E2B1D411A75B0002A513016D0280065F@wacorpml03.wwireless.com> If all you want are HTML files files from the parent directory just do this: open(RDIR,">output.txt") or die "Couldn't open output.txt for writing: $!"; my $count = 0; foreach (<../*.htm?>) { printf RDIR "% 5d | %s\n",++$count,$_; } If you just want any file: open(RDIR,">output.txt") or die "Couldn't open output.txt for writing: $!"; my $count = 0; foreach (<../*>) { printf RDIR "% 5d | %s\n",++$count,$_; } But perhaps what would be better is to do: find .. -maxdepth 1 -type f -name "*.htm?" > output.txt from the command line, but I may not be catching the full of your dilemma. -- Ryan Parr "I hate quotations." -- Ralph Waldo Emerson -----Original Message----- From: Sweethomes [mailto:sweetsue@sweethomes.com] Sent: Monday, July 08, 2002 11:45 AM To: spug-list@pm.org Subject: RE: SPUG: RE: Simple program - gone wrong Ok, this almost works. The numbering doesn't seem right. What it's doing is listing all files as it should but the first set is all marked with "0", then it repeats the file listing each with "1" in front of it. This repeats to "100" at which point it stops. I need it to number each file like so: 1 | index.html 2 | black_line.gif 3 | counter.php 4 | counter.txt 5 | formmail.php 6 | logo.gif 7 | favicon.ico 8 | help.html 9 | main.html etc. From here I can figure out how to filter out the .txt and the .gif etal leaving the .html files only. Thanks - you guys are great! Susanne -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Chris Wilkes Sent: Monday, July 08, 2002 11:02 AM To: spug-list@pm.org Subject: Re: SPUG: RE: Simple program - gone wrong On Mon, Jul 08, 2002 at 10:47:38AM -0700, Chris Wilkes wrote: > for my $num (0..100) { > foreach (@files) { > print RDIR, "$num | $_\n"; > } > } Arg there shouldn't be a comma in there. Should just be: print RDIR "$num | $_\n"; Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dcd at tc.fluke.com Tue Jul 9 07:52:30 2002 From: dcd at tc.fluke.com (David Dyck) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong In-Reply-To: <6D6F0541E2B1D411A75B0002A513016D0280065F@wacorpml03.wwireless.com> Message-ID: On Mon, 8 Jul 2002 at 21:58 -0700, Parr, Ryan wrote: > But perhaps what would be better is to do: > find .. -maxdepth 1 -type f -name "*.htm?" > output.txt Did anyone else notice that find2perl doesn't support -maxdepth (yet)? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Tue Jul 9 18:37:21 2002 From: sweetsue at sweethomes.com (Sweethomes) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Program gone wrong revisited Message-ID: My little program has grown to rather large proportions and at this time I'm having a problem with it not stepping through as it should. If anyone has a few minutes to spare to help me pinpoint my problem, please let me know (rather than me attaching a slightly large and probably confusing file here). TIA Susanne Bullo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Tue Jul 9 19:43:52 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong References: Message-ID: <00da01c227aa$e5593eb0$3188ddd1@aciwin> The find2perl program does not support the -maxdepth option because Perl was developed on Unix and -maxdepth is not a valid option for the Unix find command. The GNU/Linux, OpenBSD, NetBSD and FreeBSD find commands support -maxdepth. When in doubt about what Unix/Linux/BSD command options are supported where, check the man page multiplexer at http://www.freebsd.org/cgi/man.cgi Of course your Perl code will be more portable if you avoid running external system command. Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "David Dyck" To: "Parr, Ryan" Cc: Sent: Tuesday, July 09, 2002 5:52 AM Subject: RE: SPUG: RE: Simple program - gone wrong > On Mon, 8 Jul 2002 at 21:58 -0700, Parr, Ryan wrote: > > > But perhaps what would be better is to do: > > find .. -maxdepth 1 -type f -name "*.htm?" > output.txt > > Did anyone else notice that find2perl doesn't support -maxdepth (yet)? > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Ryan.Parr at wwireless.com Wed Jul 10 11:21:09 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong Message-ID: <6D6F0541E2B1D411A75B0002A513016D0280066C@wacorpml03.wwireless.com> No one's ever told me I make things too simple :) Instead of find -maxdepth 1 perhaps a simple ls ../*.htm? would be better? That's from the command line of course. Programatically this definitely *isn't* a good way to do it. It's so simple programatically that shelling out is just a waste. -- Ryan Parr "I hate quotations." -- Ralph Waldo Emerson -----Original Message----- From: Richard Anderson [mailto:richard@richard-anderson.org] Sent: Tuesday, July 09, 2002 5:44 PM To: David Dyck; Parr, Ryan Cc: spug-list@pm.org Subject: Re: SPUG: RE: Simple program - gone wrong The find2perl program does not support the -maxdepth option because Perl was developed on Unix and -maxdepth is not a valid option for the Unix find command. The GNU/Linux, OpenBSD, NetBSD and FreeBSD find commands support -maxdepth. When in doubt about what Unix/Linux/BSD command options are supported where, check the man page multiplexer at http://www.freebsd.org/cgi/man.cgi Of course your Perl code will be more portable if you avoid running external system command. Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "David Dyck" To: "Parr, Ryan" Cc: Sent: Tuesday, July 09, 2002 5:52 AM Subject: RE: SPUG: RE: Simple program - gone wrong > On Mon, 8 Jul 2002 at 21:58 -0700, Parr, Ryan wrote: > > > But perhaps what would be better is to do: > > find .. -maxdepth 1 -type f -name "*.htm?" > output.txt > > Did anyone else notice that find2perl doesn't support -maxdepth (yet)? > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cansubaykan at hotmail.com Wed Jul 10 12:17:52 2002 From: cansubaykan at hotmail.com (Can Subaykan) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong Message-ID: try this, to only get .htm and .html files from the upper directory: $dir = "../"; $log = "./path/to/your/list_file.txt"; opendir DIR, $dir or die "ow! $!"; @files = grep { /^[^.].*\.html?$/ and -f "$dir/$_" } readdir DIR; closedir DIR; $i = 1; # to start numbering at 1 open LOG, ">$log" or die "ow! $!"; for (@files) { print LOG "$i | $_ \n"; $i++; } close LOG; __END__ # John PS. one of you fellows' example opened a directory with opendir, and closed it with close (instead of closedir). not a big deal. just being picky ;) ----Original Message Follows---- From: "Sweethomes" To: Subject: RE: SPUG: RE: Simple program - gone wrong Date: Mon, 8 Jul 2002 11:44:57 -0700 Ok, this almost works. The numbering doesn't seem right. What it's doing is listing all files as it should but the first set is all marked with "0", then it repeats the file listing each with "1" in front of it. This repeats to "100" at which point it stops. I need it to number each file like so: 1 | index.html 2 | black_line.gif 3 | counter.php 4 | counter.txt 5 | formmail.php 6 | logo.gif 7 | favicon.ico 8 | help.html 9 | main.html etc. From here I can figure out how to filter out the .txt and the .gif etal leaving the .html files only. Thanks - you guys are great! Susanne -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Chris Wilkes Sent: Monday, July 08, 2002 11:02 AM To: spug-list@pm.org Subject: Re: SPUG: RE: Simple program - gone wrong On Mon, Jul 08, 2002 at 10:47:38AM -0700, Chris Wilkes wrote: > for my $num (0..100) { > foreach (@files) { > print RDIR, "$num | $_\n"; > } > } Arg there shouldn't be a comma in there. Should just be: print RDIR "$num | $_\n"; Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at yahoo.com Wed Jul 10 13:45:14 2002 From: asimjalis at yahoo.com (Asim Jalis) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Extreme Programming Meeting Message-ID: <20020710184514.63852.qmail@web14201.mail.yahoo.com> The next meeting of the Seattle Extreme Programming gruop will be on Thursday, July 11, 2002, so tomorrow, at our usual Lante location. Here are the details. TOPICS CHARLIE POOLE will talk about what he learned at XP2002 together with his observations on companies doing XP in Italy, France and the UK. JEFF WINCHELL will talk about his experiences in getting automated builds happening at development shops (and would love to hear others talk about the same). HOW TO GET TO THE MEETING DATE AND SCHEDULE Thursday, July 11, 2002 (second Thursday of the month). 6.30 pm - 7.00 pm : Pizza + Networking. 7.00 pm - 9.00 pm : Fishbowl on System Metaphor LOCATION Suite 100, Lante's Main Conference Room 3180 139th Avenue SE Bellevue, WA 98005 425.564.8800 (main desk) GETTING IN If the main door is locked knock on the window on the right; someone will come out and get you. DIRECTIONS - From 148th NE (going south) turn RIGHT into Eastgate Way SE. - Then turn RIGHT again into 139th Ave SE. - Drive past SE 32nd St. - 3180 will be the first building on your RIGHT. - Enter the parking entrance on your RIGHT and drive to the uncovered parking on top. - Enter the building and follow the signs to the XP meeting. To get to 148th and Eastgate Way, use this Yahoo Map link: __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From thasone at yahoo.com Thu Jul 11 22:06:15 2002 From: thasone at yahoo.com (c k) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: RE: Simple program - gone wrong In-Reply-To: Message-ID: <20020712030615.32308.qmail@web21001.mail.yahoo.com> Susanne, Have you tried, File::Find and the find function --- Can Subaykan wrote: > > try this, to only get .htm and .html files from the > upper directory: > > > $dir = "../"; > $log = "./path/to/your/list_file.txt"; > > opendir DIR, $dir or die "ow! $!"; > @files = grep { /^[^.].*\.html?$/ and -f "$dir/$_" } > readdir DIR; > closedir DIR; > > $i = 1; # to start numbering at 1 > > open LOG, ">$log" or die "ow! $!"; > > for (@files) { > > print LOG "$i | $_ \n"; > $i++; > > } > > close LOG; > > > > > __END__ > # John > > > PS. one of you fellows' example opened a directory > with opendir, and closed > it with close (instead of closedir). not a big > deal. just being picky ;) > > > > > > > > ----Original Message Follows---- > From: "Sweethomes" > To: > Subject: RE: SPUG: RE: Simple program - gone wrong > Date: Mon, 8 Jul 2002 11:44:57 -0700 > > Ok, this almost works. The numbering doesn't seem > right. What it's doing > is listing all files as it should but the first set > is all marked with "0", > then it repeats the file listing each with "1" in > front of it. This repeats > to "100" at which point it stops. I need it to > number each file like so: > > 1 | index.html > 2 | black_line.gif > 3 | counter.php > 4 | counter.txt > 5 | formmail.php > 6 | logo.gif > 7 | favicon.ico > 8 | help.html > 9 | main.html > > etc. From here I can figure out how to filter out > the .txt and the .gif > etal leaving the .html files only. > > Thanks - you guys are great! > > Susanne > > -----Original Message----- > From: owner-spug-list@pm.org > [mailto:owner-spug-list@pm.org]On Behalf Of > Chris Wilkes > Sent: Monday, July 08, 2002 11:02 AM > To: spug-list@pm.org > Subject: Re: SPUG: RE: Simple program - gone wrong > > > On Mon, Jul 08, 2002 at 10:47:38AM -0700, Chris > Wilkes wrote: > > for my $num (0..100) { > > foreach (@files) { > > print RDIR, "$num | $_\n"; > > } > > } > > Arg there shouldn't be a comma in there. Should > just be: > print RDIR "$num | $_\n"; > > Chris > > - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://seattleperl.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://seattleperl.org > > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print > your photos: > http://photos.msn.com/support/worldwide.aspx > > > - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://seattleperl.org > __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Fri Jul 12 14:27:46 2002 From: sweetsue at sweethomes.com (Sweethomes) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Odd thing happening - possibly perl/cgi related Message-ID: Hello all - and thank you for the previous help. Got it all working very spiffy. I have another question that perhaps is perl related, I'm not certain. Has anyone run across this scenario: Using browser A, filling out form A, processing through perl program A - each time, the next page shows there was a possible DNS error, so you back and press submit again and then it goes through fine. Then using browser B, filling out form A, processing through perl program A - it goes through without a hitch each time. It's the most oddball thing and I can't seem to shake the feeling that perhaps there is something going on with the perl program. Any ideas? www.web-dev-design.com ------------------------------------ Susanne Bullo, Developer Web Dev Design - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Fri Jul 12 16:34:23 2002 From: sweetsue at sweethomes.com (Sweethomes) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Existing script? Message-ID: Instead of trying to reinvent the wheel, is there a script out there that will record a visitors ip address then when say 2 ips are recorded, a pop-up contest window will no longer pop-up? I'm thinking this has to have been thought of before but my searching has been pretty worthless thus far. TIA. www.web-dev-design.com ------------------------------------ Susanne Bullo, Developer Web Dev Design -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020712/4566dbd9/attachment.htm From mathin at mathin.com Fri Jul 12 17:19:01 2002 From: mathin at mathin.com (Dan Ebert) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Existing script? In-Reply-To: References: Message-ID: <1026512341.18106.28.camel@algernon.lan.enic.cc> You might use a cookie to let the javascript know if a particular computer has seen this page (or popup) before. I don't have any sample code, but I have seen this used before. On Fri, 2002-07-12 at 14:34, Sweethomes wrote: > Instead of trying to reinvent the wheel, is there a script out there that > will record a visitors ip address then when say 2 ips are recorded, a pop-up > contest window will no longer pop-up? I'm thinking this has to have been > thought of before but my searching has been pretty worthless thus far. > > TIA. > > www.web-dev-design.com > ------------------------------------ > Susanne Bullo, Developer Web Dev Design -- Dan Ebert ---------------------------------------------------------- "If you're right 90% of the time, why quibble about the remaining 3%?" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Fri Jul 12 16:51:08 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: The Damian has Landed! Message-ID: <20020712145108.A26655@timji.consultix.wa.com> SPUGsters, Damian is now in the Seattle area, recuperating in earnest from his gruelling past few weeks, in preparation for Dam-i-a-thon 2002. The first event will be this Sunday -- a cruise of Lake Washington followed by dinner. Details follow below. After that, he'll be teaching four days of classes in Kirkland through Consultix, which is sponsoring this trip (along with The Perl Foundation). There are still seats available in all classes; see http://teachmeperl.com/apworkshop.html for details. And of course, we mustn't forget that Damian will be our guest speaker for our regular monthly SPUG meeting on the 16th. Details at http://seattleperl.org Finally, I've got some contest winners to announce. We didn't get *any* entrants for the second drawing for Perl Foundation contributors, so we decided to award those two free seats at random to individuals who made SPUG presentations during the last year. And the winners are: Jim Flanagan, "Programming Perl 6", and Colin Meyer, "Adv. Module Implementation Techniques". Just goes to show you that donating your time and talents to SPUG can pay off big time! 8-} -Tim *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Sat Jul 13 00:40:05 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: The Damian has Landed! In-Reply-To: <20020712145108.A26655@timji.consultix.wa.com> Message-ID: On Fri, 12 Jul 2002, Tim Maher wrote: > Damian is now in the Seattle area, recuperating in earnest from > his gruelling past few weeks, in preparation for Dam-i-a-thon > 2002. The first event will be this Sunday -- a cruise of Lake Washington > followed by dinner. Details follow below. I think the cruise details are missing or I'm having a very dunce day. -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Fri Jul 12 23:50:19 2002 From: tim at consultix-inc.com (SPUG-list-owner) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: The Damian has Landed! Message-ID: <20020712215019.A27515@timji.consultix.wa.com> > Damian is now in the Seattle area, recuperating in earnest from > his gruelling past few weeks, in preparation for Dam-i-a-thon > 2002. The first event will be this Sunday -- a cruise of Lake Washington > followed by dinner. Details follow below. I think the cruise details are missing or I'm having a very dunce day. -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. D'oh! The problem is I wanted to "attach" the details, but at the last minute I remembered that many SPUG subscribers bounce-back any messages that have attachments, so I decided to embed the info instead, but neglected to do that. Mea culpa! Trying again below . . . They're also available from a link at teachmeperl.com/apworkshop.html -Tim -- *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* This note provides details about a "Social Program" taking place during "Dam-i-a-thon 2002", Damian Conway's Seattle visit. Event: Lake WA Cruise and Dinner with "The Damian" Time: July 14, 3:10 - 6pm+ Price: $24 + tax for the cruise, plus your dinner bill Embarkation: Kirkland City Dock (north of the Bellevue Way/SR-520 intersection) **ACTION: Please RSVP if intending to attend! To kick off Damian's visit, interested parties are invited to socialize with him and each other on a Sunday afternoon cruise of Lake Washington. This cruise features beautiful views of Mt. Rainier, the U of W's Husky Stadium, and the waterfront homes of the rich and famous (including $Bill). But even if it rains, we'll still be cruising, so bring your umbrella, and come along! Those staying at Kirkland's La Quinta Inn, the "Offical Hotel" of Dam-i-a-thon 2002, are welcome to ride with Tim Maher as he collects Damian there at 3pm. Those driving themselves to the dock will want to check the map at http://argosycruises.com/publiccruises/lakeKirkland.htm (our cruise is called the "Lake Cruise - Kirkland"). Those wishing to participate should congregate at the Argosy Cruises kiosk at 3:10 at the dock, because if we have a group of at least 8 we'll get 15% off our ticket prices. Even those "cruising for free" (i.e., at the expense of Consultix) should meet there (the current list is Dan R., Maciej C., Kris B., Dave A., and Travis J.). After the cruise ends at 5pm, we'll go to a nearby restaurant, to be selected by a poll of the participants -- unless we can arrive at a consensus beforehand, in which case we'll announce the destination for those who want to skip the cruise but join us for dinner. Hope to see many of you at this event! And don't hesitate to let me know if you need any additional information. -Tim Maher, CEO, Consultix tim@teachmeperl.com *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Sat Jul 13 12:25:27 2002 From: sweetsue at sweethomes.com (Sweethomes) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Another program head scratcher Message-ID: If you guys are sick of me, let me know LOL (I've been learning a lot the past week or so, PHP and MySQL are more my forte, thank you for your help lately!). I have a program (see near bottom) that is supposed to open a file, read it, check to see if an ip is already entered or if the count has reached 2 and if so, print out a quick message saying they can't enter as they already have. Then, if it's a new ip and the count is less than 2, it will record the ip address, increment the count then (and this isn't in there yet) proceed to the "contest" page. It's only doing the count to 1 over and over and it's not picking up that an ip has been there before. Here are the errors I see when trying to process it: Use of uninitialized value in numeric eq (==) at test2.cgi line 15. Argument "67.40.29.147" isn't numeric in numeric eq (==) at test2.cgi line 15. Argument "0|\n" isn't numeric in numeric eq (==) at test2.cgi line 15. Use of uninitialized value in string ne at test2.cgi line 75, line 1. And here is what the ipdata.txt file records (not actual ip address obviously - and the 0| line was manually put in place to allow incrementing from 0): 0| 1|12.12.12.12 1|12.12.12.12 1|12.12.12.12 Here is the program: #!/usr/bin/perl -w require('vars.pl'); $TheWhere = $ENV{REMOTE_ADDR}; open (RDIR, "$datafile") || die "Can't open '$datafile' $!\n"; @ipx=; close (RDIR); foreach $line(@ipx) { @ipstuff = split(/.\\n/, $line); foreach $ipl (@ipstuff) { ($cnt, $ipadd) = split(/.\|./, $ipl); if ($TheWhere == $ipadd) { $BODY .= qq~ You have already been to this page - you cannot win again.

~; $BODY .= qq~

Back to main page
~; print "Content-type: text/html\n\n"; print < You've won already



Here is the problem:
$BODY
ERRORHTML exit; } elsif ($cnt == 2) { $BODY .= qq~ This prize has been won the maximum number of times.

~; $BODY .= qq~

Back to main page
~; print "Content-type: text/html\n\n"; print < Max Winners



Here is the problem:
$BODY
ERRORHTML exit; } else { open(RDIR, "$datafile"); @ipx = reverse(split (/.\|\\n/, )); if ($ipx[1] ne $TheWhere) { $cnt = $ipx[0]; $cnt++; } else { $cnt = 1; } close(RDIR); open(INF,">>$datafile"); print INF "$cnt|$TheWhere\n"; close(INF); } } } www.web-dev-design.com ------------------------------------ Susanne Bullo, Developer Web Dev Design -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020713/f152c184/attachment.htm From david.corcoran at Boeing.COM Sat Jul 13 12:28:38 2002 From: david.corcoran at Boeing.COM (EXT-Corcoran, David) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Another program head scratcher Message-ID: <58B6DA1B98AA9149B13B029976A48BCC088F5D97@xch-nw-31.nw.nos.boeing.com> Off the top, I think you need to use the eq operator rather than == in line 15. -----Original Message----- From: Sweethomes [mailto:sweetsue@sweethomes.com] Sent: Saturday, July 13, 2002 10:25 AM To: Seattle Perl User's Group Subject: SPUG: Another program head scratcher If you guys are sick of me, let me know LOL (I've been learning a lot the past week or so, PHP and MySQL are more my forte, thank you for your help lately!). I have a program (see near bottom) that is supposed to open a file, read it, check to see if an ip is already entered or if the count has reached 2 and if so, print out a quick message saying they can't enter as they already have. Then, if it's a new ip and the count is less than 2, it will record the ip address, increment the count then (and this isn't in there yet) proceed to the "contest" page. It's only doing the count to 1 over and over and it's not picking up that an ip has been there before. Here are the errors I see when trying to process it: Use of uninitialized value in numeric eq (==) at test2.cgi line 15. Argument "67.40.29.147" isn't numeric in numeric eq (==) at test2.cgi line 15. Argument "0|\n" isn't numeric in numeric eq (==) at test2.cgi line 15. Use of uninitialized value in string ne at test2.cgi line 75, line 1. And here is what the ipdata.txt file records (not actual ip address obviously - and the 0| line was manually put in place to allow incrementing from 0): 0| 1|12.12.12.12 1|12.12.12.12 1|12.12.12.12 Here is the program: #!/usr/bin/perl -w require('vars.pl'); $TheWhere = $ENV{REMOTE_ADDR}; open (RDIR, "$datafile") || die "Can't open '$datafile' $!\n"; @ipx=; close (RDIR); foreach $line(@ipx) { @ipstuff = split(/.\\n/, $line); foreach $ipl (@ipstuff) { ($cnt, $ipadd) = split(/.\|./, $ipl); if ($TheWhere == $ipadd) { $BODY .= qq~ You have already been to this page - you cannot win again.

~; $BODY .= qq~

Back to main page
~; print "Content-type: text/html\n\n"; print < You've won already



Here is the problem:
$BODY
ERRORHTML exit; } elsif ($cnt == 2) { $BODY .= qq~ This prize has been won the maximum number of times.

~; $BODY .= qq~

Back to main page
~; print "Content-type: text/html\n\n"; print < Max Winners



Here is the problem:
$BODY
ERRORHTML exit; } else { open(RDIR, "$datafile"); @ipx = reverse(split (/.\|\\n/, )); if ($ipx[1] ne $TheWhere) { $cnt = $ipx[0]; $cnt++; } else { $cnt = 1; } close(RDIR); open(INF,">>$datafile"); print INF "$cnt|$TheWhere\n"; close(INF); } } } www.web-dev-design.com ------------------------------------ Susanne Bullo, Developer Web Dev Design -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020713/1413b0c3/attachment.htm From creede at penguinsinthenight.com Sat Jul 13 12:51:33 2002 From: creede at penguinsinthenight.com (Creede Lambard) Date: Wed Aug 4 00:09:03 2004 Subject: SPUG: Another program head scratcher In-Reply-To: References: Message-ID: <1026582699.17144.16.camel@svetlana> On Sat, 2002-07-13 at 10:25, Sweethomes wrote: > If you guys are sick of me, let me know LOL (I've been learning a lot the > past week or so, PHP and MySQL are more my forte, thank you for your help > lately!). I have a program (see near bottom) that is supposed to open a > file, read it, check to see if an ip is already entered or if the count has > reached 2 and if so, print out a quick message saying they can't enter as > they already have. Then, if it's a new ip and the count is less than 2, it > will record the ip address, increment the count then (and this isn't in > there yet) proceed to the "contest" page. It's only doing the count to 1 > over and over and it's not picking up that an ip has been there before. > Here are the errors I see when trying to process it: > > Use of uninitialized value in numeric eq (==) at test2.cgi line 15. > Argument "67.40.29.147" isn't numeric in numeric eq (==) at test2.cgi line > 15. > Argument "0|\n" isn't numeric in numeric eq (==) at test2.cgi line 15. > Use of uninitialized value in string ne at test2.cgi line 75, line 1. > OK, I'll admit I didn't get any farther than this, because the "isn't numeric" is a CLUE in capital letters. :) When you're dealing with numbers, you use "==". When you're dealing with strings, you use "eq". Unless, of course, you decide to use =~ instead. If I remember right =~ is more expensive than eq, but also more flexible because of the regular expressions (as long as you don't let the "explosion in a punctuation factory" stuff scare you, of course). Just to use a trivial example, you can replace if (uc(substr($answer, 0, 1)) eq 'Y') { return 1; } with if ($answer =~ /^y/i) { return 1; } -- * .~. `( ---------------------------------------------------------------- ` / V \ . Creede Lambard : Just who is this General Failure /( )\ creede@penguinsinthenight.com : and why is he reading my disk? ^^-^^ ---------------------------------------------------------------- Perl Programmer and Linux Sysadmin, reasonable rates. Inquire within. GPG key at http://www.penguinsinthenight.com/creede_public_key.asc -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: This is a digitally signed message part Url : http://mail.pm.org/archives/spug-list/attachments/20020713/cb5036c0/attachment.bin From sweetsue at sweethomes.com Sat Jul 13 13:07:15 2002 From: sweetsue at sweethomes.com (Sweethomes) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Another program head scratcher In-Reply-To: <1026582699.17144.16.camel@svetlana> Message-ID: Super - that did part of the trick! Now, it gets as far as the first part then stops. I'll keep plugging away I guess :) Susanne -----Original Message----- From: Creede Lambard [mailto:creede@penguinsinthenight.com] Sent: Saturday, July 13, 2002 10:52 AM To: Sweethomes Cc: Seattle Perl User's Group Subject: Re: SPUG: Another program head scratcher On Sat, 2002-07-13 at 10:25, Sweethomes wrote: > If you guys are sick of me, let me know LOL (I've been learning a lot the > past week or so, PHP and MySQL are more my forte, thank you for your help > lately!). I have a program (see near bottom) that is supposed to open a > file, read it, check to see if an ip is already entered or if the count has > reached 2 and if so, print out a quick message saying they can't enter as > they already have. Then, if it's a new ip and the count is less than 2, it > will record the ip address, increment the count then (and this isn't in > there yet) proceed to the "contest" page. It's only doing the count to 1 > over and over and it's not picking up that an ip has been there before. > Here are the errors I see when trying to process it: > > Use of uninitialized value in numeric eq (==) at test2.cgi line 15. > Argument "67.40.29.147" isn't numeric in numeric eq (==) at test2.cgi line > 15. > Argument "0|\n" isn't numeric in numeric eq (==) at test2.cgi line 15. > Use of uninitialized value in string ne at test2.cgi line 75, line 1. > OK, I'll admit I didn't get any farther than this, because the "isn't numeric" is a CLUE in capital letters. :) When you're dealing with numbers, you use "==". When you're dealing with strings, you use "eq". Unless, of course, you decide to use =~ instead. If I remember right =~ is more expensive than eq, but also more flexible because of the regular expressions (as long as you don't let the "explosion in a punctuation factory" stuff scare you, of course). Just to use a trivial example, you can replace if (uc(substr($answer, 0, 1)) eq 'Y') { return 1; } with if ($answer =~ /^y/i) { return 1; } -- * .~. `( ---------------------------------------------------------------- ` / V \ . Creede Lambard : Just who is this General Failure /( )\ creede@penguinsinthenight.com : and why is he reading my disk? ^^-^^ ---------------------------------------------------------------- Perl Programmer and Linux Sysadmin, reasonable rates. Inquire within. GPG key at http://www.penguinsinthenight.com/creede_public_key.asc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From aaron at activox.com Sat Jul 13 13:15:10 2002 From: aaron at activox.com (Aaron Salo) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Another program head scratcher In-Reply-To: Message-ID: <3.0.5.32.20020713111510.017fb360@pop3.norton.antivirus> A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1704 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020713/4d7f0c76/attachment.bin From sweetsue at sweethomes.com Sat Jul 13 14:27:36 2002 From: sweetsue at sweethomes.com (Sweethomes) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Another program head scratcher In-Reply-To: <1026582699.17144.16.camel@svetlana> Message-ID: I think I pinpointed one problem anyway. The coding is: foreach $line(@ipx) { @ipstuff = split(/\\n/, $line); foreach $ipl (@ipstuff) { ($cnt, $ipadd) = split(/\|/, $ipl); The errors I get are: Argument "\n" isn't numeric in numeric ne (!=) at test2.cgi line 15. Argument "12.12.12.12" isn't numeric in numeric ne (!=) at test2.cgi line 15. Do I need to strip out the returns somehow? And it just seems like it's not splitting out the lines as it should. Susanne -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Creede Lambard Sent: Saturday, July 13, 2002 10:52 AM To: Sweethomes Cc: Seattle Perl User's Group Subject: Re: SPUG: Another program head scratcher On Sat, 2002-07-13 at 10:25, Sweethomes wrote: > If you guys are sick of me, let me know LOL (I've been learning a lot the > past week or so, PHP and MySQL are more my forte, thank you for your help > lately!). I have a program (see near bottom) that is supposed to open a > file, read it, check to see if an ip is already entered or if the count has > reached 2 and if so, print out a quick message saying they can't enter as > they already have. Then, if it's a new ip and the count is less than 2, it > will record the ip address, increment the count then (and this isn't in > there yet) proceed to the "contest" page. It's only doing the count to 1 > over and over and it's not picking up that an ip has been there before. > Here are the errors I see when trying to process it: > > Use of uninitialized value in numeric eq (==) at test2.cgi line 15. > Argument "67.40.29.147" isn't numeric in numeric eq (==) at test2.cgi line > 15. > Argument "0|\n" isn't numeric in numeric eq (==) at test2.cgi line 15. > Use of uninitialized value in string ne at test2.cgi line 75, line 1. > OK, I'll admit I didn't get any farther than this, because the "isn't numeric" is a CLUE in capital letters. :) When you're dealing with numbers, you use "==". When you're dealing with strings, you use "eq". Unless, of course, you decide to use =~ instead. If I remember right =~ is more expensive than eq, but also more flexible because of the regular expressions (as long as you don't let the "explosion in a punctuation factory" stuff scare you, of course). Just to use a trivial example, you can replace if (uc(substr($answer, 0, 1)) eq 'Y') { return 1; } with if ($answer =~ /^y/i) { return 1; } -- * .~. `( ---------------------------------------------------------------- ` / V \ . Creede Lambard : Just who is this General Failure /( )\ creede@penguinsinthenight.com : and why is he reading my disk? ^^-^^ ---------------------------------------------------------------- Perl Programmer and Linux Sysadmin, reasonable rates. Inquire within. GPG key at http://www.penguinsinthenight.com/creede_public_key.asc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Ryan.Parr at wwireless.com Sat Jul 13 15:46:54 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Another program head scratcher Message-ID: <6D6F0541E2B1D411A75B0002A513016D082E7041@wacorpml03.wwireless.com> foreach $line(@ipx) { ^^ You probably should take Aaron Salo's advice and use your MySQL capabilities, why read the whole file in and loop through each line? The database is going to do this much more efficiently than you will. @ipstuff = split(/\\n/, $line); ^^ Why are you escaping the newline? \\n will match a literal '\n', and why would you split on a newline? Since the default record seperator *is* a newline, there aren't any real newlines in your lines. Just chomp($line). Otherwise your @ipstuff array is just one value, and a split into an array then looping over that array is a lot more work than you need to do. foreach $ipl (@ipstuff) { ^^ See commment directly above ($cnt, $ipadd) = split(/\|/, $ipl); ^^ See first comment You can't do this: $ip1 = '12.12.12.12'; $ip2 = '12.12.12.13'; if($ip1 == $ip2)... Both ip's are strings, you can't do the numeric comparisons. Which is what your error messages are still stating... You can do this though: $num1 = "12\n"; $num2 = "12\n"; if($num1 == $num2)... <-- this will work The newlines aren't your issue. In short, you probably aren't going to find a better way to do this than with a database. It's just easier and more efficient, and your flatfile could become huge and weigh down your process when you read the entire thing in on every single request to this page. However, this is probably the same issue you posted about a couple days ago. Most people aren't on static IP's anyways... you'll have better luck with cookies. Than you can use a little bit of javascript and make the server side process moot. If you use IP's for determining whether or not a person has entered, than you could end up allowing the same person to enter multiple times and blocking out people who've never entered at all. -- Ryan Parr "I hate quotations." -- Ralph Waldo Emerson -----Original Message----- From: Sweethomes [mailto:sweetsue@sweethomes.com] Sent: Saturday, July 13, 2002 12:28 PM To: Seattle Perl User's Group Subject: RE: SPUG: Another program head scratcher I think I pinpointed one problem anyway. The coding is: foreach $line(@ipx) { @ipstuff = split(/\\n/, $line); foreach $ipl (@ipstuff) { ($cnt, $ipadd) = split(/\|/, $ipl); The errors I get are: Argument "\n" isn't numeric in numeric ne (!=) at test2.cgi line 15. Argument "12.12.12.12" isn't numeric in numeric ne (!=) at test2.cgi line 15. Do I need to strip out the returns somehow? And it just seems like it's not splitting out the lines as it should. Susanne -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Creede Lambard Sent: Saturday, July 13, 2002 10:52 AM To: Sweethomes Cc: Seattle Perl User's Group Subject: Re: SPUG: Another program head scratcher On Sat, 2002-07-13 at 10:25, Sweethomes wrote: > If you guys are sick of me, let me know LOL (I've been learning a lot > the past week or so, PHP and MySQL are more my forte, thank you for > your help lately!). I have a program (see near bottom) that is > supposed to open a file, read it, check to see if an ip is already > entered or if the count has > reached 2 and if so, print out a quick message saying they can't enter > as they already have. Then, if it's a new ip and the count is less > than 2, it > will record the ip address, increment the count then (and this isn't > in there yet) proceed to the "contest" page. It's only doing the > count to 1 over and over and it's not picking up that an ip has been > there before. Here are the errors I see when trying to process it: > > Use of uninitialized value in numeric eq (==) at test2.cgi line 15. > Argument "67.40.29.147" isn't numeric in numeric eq (==) at test2.cgi > line 15. Argument "0|\n" isn't numeric in numeric eq (==) at test2.cgi > line 15. Use of uninitialized value in string ne at test2.cgi line 75, > line 1. > OK, I'll admit I didn't get any farther than this, because the "isn't numeric" is a CLUE in capital letters. :) When you're dealing with numbers, you use "==". When you're dealing with strings, you use "eq". Unless, of course, you decide to use =~ instead. If I remember right =~ is more expensive than eq, but also more flexible because of the regular expressions (as long as you don't let the "explosion in a punctuation factory" stuff scare you, of course). Just to use a trivial example, you can replace if (uc(substr($answer, 0, 1)) eq 'Y') { return 1; } with if ($answer =~ /^y/i) { return 1; } -- * .~. `( ---------------------------------------------------------------- ` / V \ . Creede Lambard : Just who is this General Failure /( )\ creede@penguinsinthenight.com : and why is he reading my disk? ^^-^^ ---------------------------------------------------------------- Perl Programmer and Linux Sysadmin, reasonable rates. Inquire within. GPG key at http://www.penguinsinthenight.com/creede_public_key.asc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From legrady at earthlink.net Sat Jul 13 16:37:15 2002 From: legrady at earthlink.net (Tom Legrady) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Another program head scratcher In-Reply-To: Message-ID: In line 5, you read the file into an array. I wonder whether you are using this for a few hundred visitors or a few million. Reading in a file and doign a linear search on a file containing thousands or millions of IP numbers will take a long time. And, of course, duplicate IPs widely separated in time are probably different people. When you log on to your AOL, you get an IP number. When you log out, the number is used for some new login. Even with DSL or cable model, you only have an IP number for a period of time. Then you have a different IP number, and someone else has the number you had. While I don't claim to completely understand your problem, I would suggest storing the time, along with the IP number. If a match is found, compare the time with the current time to determine how long ago the IP was last seen: accept it if 'long ago', for some definition of 'long ago', reject it if 'recent'. Or to make things fast and simple, you could define 'long ago, as more than 24-48 hours. Once a day a cron job script could remove all entries more than a day old, and the file would only contain 'recent' entries. In line 8, you split a single @ipx entry based on new-lines, and on line 9 you process each line. However, a single @ipx entry only contains one line, so the inner loop is unneccessary, though you might want to use 'chomp' to get rid of the newline. In line 11, you do a numeric comparison on the IP numbers, but IP numbers are neither integers nor floating point numbers, but strings made up of numerals and dots. Inside the loop you have: if ( IP # matches ) { } elsif ( count == 2 ) { } else { # IP is new } Now, if the IP number matches once, the first block will tell the visitor they cannot win again. Howver, the file is not updated. If the IP numbers differ, but the current line of the file has a count of 2, the elsif block matches and tells the visitor they have won the maximum number of times. Even if this worked properly, I don't understand the concept of a disallowing a winner because they have already won, and also allowing them to win twice but not three times. In any case, this would only disallow winning three times, but then the next time they would presumably win again, assuming the count were still updated. 'elsif' should check if ( $cnt >= 2 ). But the real problem comes if the first IP number does not match the visitor's IP number. In that case, the 'else' clause kicks in and attempts (incorrectly) to add the current visitor to the file. You should not be adding the visitor until all the entries in the file have been examined and have failed .. foreach $line ( @ipx ) { chomp $line; ( $cnt, $ipadd ) = split ' ', $line; # use a space as separator, don't bother with '|' if ( IP matches ) { if ( $cnt < $macWins ) { # do something } else { # do soemthing different, or # save IP and count in a variable # for processign at end of loop } # end if ( $cnt ... } # end if ( IP ... } # end foreach ( ... # The IP wasn't found in the file, visitor hasn't been here before. # Add the IP to the file and give them a prize. In your else block, you only ever read in the first line of the file, obtain the count from the first line, and increment it. Then you append a line to the file with the same IP number and an incremented count. Perhaps what you would like to do at this point is to copy the file, line by line, until you reach the matching line, and copy an updated count. ( And continue copying the rest of the file, so you don't lose entries. ) Of course there remains the question of several threads trying to update the file at the same time. A much better solution would be to use a database for the IP numbers and counts. In that case, determining whether the IP number has been seen before takes constant time, instead of being dependent on the number of prior visitors, as does updating the count or adding new entries. At the very least, use a DBM file with a hash interface ... # Perl CookBook, Section 14.1 # use DB_File; dbmopen %ALL_IPS, $dbmFile, 066 or die( "Cannot open $dbmFile: $!" ); $cnt = 0; if ( defined $ALL_IPS{$ipadd} ) { # is IP already in file? $cnt = $ALL_IPS{$ipadd}; # get count for IP } $cnt++; $ALL_IPS{$ipadd} = $cnt # add/update IP/count entry. That will be $50. Please pay the secretary on yur way out ... Good luck Tom legrady > If you guys are sick of me, let me know LOL (I've been learning a lot > the past week or so, PHP and MySQL are more my forte, thank you for your > help lately!). I have a program (see near bottom) that is supposed to > > open a file, read it, check to see if an ip is already entered or if the > count has reached 2 and if so, print out a quick message saying they > can't enter as they already have. Then, if it's a new ip and the count > is less than 2, it will record the ip address, increment the count then > > (and this isn't in there yet) proceed to the "contest" page. It's only > doing the count to 1 over and over and it's not picking up that an ip > has been there before. Here are the errors I see when trying to process > it: > > Use of uninitialized value in numeric eq (==) at test2.cgi line 15. > Argument "67.40.29.147" isn't numeric in numeric eq (==) at test2.cgi > line 15. > Argument "0|\n" isn't numeric in numeric eq (==) at test2.cgi line 15. > Use of uninitialized value in string ne at test2.cgi line 75, > line 1. > And here is what the ipdata.txt file records (not actual ip address > obviously - and the 0| line was manually put in place to allow > incrementing from 0): > > > > 0| > 1|12.12.12.12 > > 1|12.12.12.12 > 1|12.12.12.12 > > Here is the program: > > > 1 > #!/usr/bin/perl -w 2 > require('vars.pl'); 3 > $TheWhere = $ENV{REMOTE_ADDR}; 4 > open (RDIR, "$datafile") || die "Can't open '$datafile' $!\n"; 5 > @ipx=; 6 > close (RDIR); 7 > foreach $line(@ipx) { 8 > @ipstuff = split(/.\\n/, $line); 9 > foreach $ipl (@ipstuff) { 10 > ($cnt, $ipadd) = split(/.\|./, $ipl); 11> if ($TheWhere == $ipadd) { 12> $BODY .= qq~ You have > already been to this page - you cannot win again.

~; 13> $BODY .= qq~

Back to main > page
> ~; 14> print "Content-type: text/html\n\n"; 15> print < > > You've won already > > > >



> bgcolor="#333333" align="center"> > > > > > > >
Here is the problem:
$BODY
> > > ERRORHTML > exit; > } > elsif ($cnt == 2) { > $BODY .= qq~ This prize has > been won the maximum number of times.

~; > $BODY .= qq~

Back to main > page
> ~; > print "Content-type: text/html\n\n"; > print < > > Max Winners > > > >



> bgcolor="#333333" align="center"> > > > > > > >
Here is the problem:
$BODY
> > > ERRORHTML > exit; > } > else { > open(RDIR, "$datafile"); > @ipx = reverse(split (/.\|\\n/, )); > if ($ipx[1] ne $TheWhere) { > $cnt = $ipx[0]; > $cnt++; > } else { > $cnt = 1; > } > close(RDIR); > open(INF,">>$datafile"); > print INF "$cnt|$TheWhere\n"; > close(INF); > } > } > } > www.web-dev-design.com > ------------------------------------ > Susanne Bullo, Developer Web Dev Design - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cwilkes-spug at ladro.com Sat Jul 13 16:54:43 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Another program head scratcher In-Reply-To: ; from legrady@earthlink.net on Sat, Jul 13, 2002 at 02:37:15PM -0700 References: Message-ID: <20020713145443.B73930@www.ladro.com> On Sat, Jul 13, 2002 at 02:37:15PM -0700, Tom Legrady wrote: > > And, of course, duplicate IPs widely separated in time are > probably different people. When you log on to your AOL, > you get an IP number. When you log out, the number is > used for some new login. Even with DSL or cable model, > you only have an IP number for a period of time. Then you > have a different IP number, and someone else has the > number you had. AOL's web traffic goes through their couple dozen proxy servers, which means that if you just look at IP and time you'll think that there is one AOL user hitting your site continuously when it is really tens of thousands. What's Sue's goal in this again? Is it to get a count of the number of users hitting her web page? If so then she might want to incorporate cookies on the web server or sending new users to a querystringed page, like "/index.pl?4ljkrw309ds" and counting all those unique hits. Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Sun Jul 14 10:39:08 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Damian Cruise is Today Message-ID: <20020714083908.A31700@timji.consultix.wa.com> This note provides details about a "Social Program" taking place during "Dam-i-a-thon 2002", Damian Conway's Seattle visit. Event: Lake WA Cruise and Dinner with "The Damian" Time: July 14, 3:10 - 6pm+ Price: $24 + tax for the cruise, plus your dinner bill Embarkation: Kirkland City Dock (north of the Bellevue Way/SR-520 intersection) **ACTION: RSVP is nice, or just come! To kick off Damian's visit, interested parties are invited to socialize with him and each other on a Sunday afternoon cruise of Lake Washington. This cruise features beautiful views of Mt. Rainier, the U of W's Husky Stadium, and the waterfront homes of the rich and famous (including $Bill). But even if it rains, we'll still be cruising, so bring your umbrella, and come along! Those staying at Kirkland's La Quinta Inn, the "Offical Hotel" of Dam-i-a-thon 2002, are welcome to ride with Tim Maher as he collects Damian there at 3pm. Those driving themselves to the dock will want to check the map at http://argosycruises.com/publiccruises/lakeKirkland.htm (our cruise is called the "Lake Cruise - Kirkland"). Those wishing to participate should congregate at the Argosy Cruises kiosk at 3:10 at the dock, because if we have a group of at least 8 we'll get 15% off our ticket prices. Even those "cruising for free" (i.e., at the expense of Consultix) should meet there (the current list is Dan R., Maciej C., Kris B., Dave A., and Travis J.). After the cruise ends at 5pm, we'll go to a nearby restaurant, to be selected by a poll of the participants -- unless we can arrive at a consensus beforehand, in which case we'll announce the destination for those who want to skip the cruise but join us for dinner. Hope to see many of you at this event! And don't hesitate to let me know if you need any additional information. -Tim Maher, CEO, Consultix tim@teachmeperl.com *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Sun Jul 14 22:40:40 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Cruise pictures online Message-ID: <20020714204040.A538@timji.consultix.wa.com> SPUGsters, For those interested in seeing who cruised and dined with 'The Damian' today, you can see some photos at http://teachmeperl.com/apworkshop.html#Cruise. Luckily for us, the sun came out mid-way through the cruise, which made the views almost as stunning as the brochure had claimed! 8-} -Tim *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From mkorb at versuslaw.com Mon Jul 15 11:38:30 2002 From: mkorb at versuslaw.com (Martin Korb) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: bind_param and stored procedure Message-ID: <012c01c22c1e$0d922dc0$7201a8c0@versuslaw.com> I get the following error message when I use bind_param on the following stored procedure called within a perl script. Syntax error near @P1. Can not execute...... here is the code snippet: my $sql_set_identity_shopper = "EXEC dt_IdentityOnOff(?,?)"; my $sth_set_identity_shopper = $dbh_7->prepare($sql_set_identity_shopper); $sth_set_identity_shopper->bind_param(1,"tblshopper"); $sth_set_identity_shopper->bind_param(2,"on"); $sth_set_identity_shopper->execute() or die "can not execute $!"; When I do not specify the order (which I really shouldn't have to) I get a different but also fatal error: Can't bind unknown placeholder 'tblshopper' here is the code snippet: my $sql_set_identity_shopper = "EXEC dt_IdentityOnOff(?,?)"; my $sth_set_identity_shopper = $dbh_7->prepare($sql_set_identity_shopper); $sth_set_identity_shopper->bind_param("tblshopper","on"); $sth_set_identity_shopper->execute() or die "can not execute $!"; SQL 7.0 Stored Procedure: CREATE PROCEDURE dt_identityOnOff @tablename varchar(64), @action varchar(3) as if @tablename = 'tblshopper' begin if @action = 'on' set identity_insert tblshopper on else set identity_insert tblshopper off end else begin if @action = 'on' set identity_insert tblfirms on else set identity_insert tblfirms off end Any suggestion on what I am overlooking. Thanks Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020715/015bd12e/attachment.htm From tim at consultix-inc.com Mon Jul 15 11:05:35 2002 From: tim at consultix-inc.com (SPUG-list-owner) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Finding name for sub ref In-Reply-To: <200207151653.g6FGrMH20522@mail.pm.org> References: <200207151653.g6FGrMH20522@mail.pm.org> Message-ID: <20020715090535.A2113@timji.consultix.wa.com> > I've created a subroutine to time the execution of another subroutine; so I pass in a reference to the subroutine that is to be timed. > > Zub timeThis > { > my ($sub) = shift; > my $startTime = time(); > &{$sub}(@_); > my $endTime = time(); > # if possible, I'd like to get the subroutine name from the reference right here, > # then I'd be able to print it out in the following print statement. > print " took " . ($endTime - $startTime) . " seconds\n"; > } > > timeThis(\&createTheFiles, $path, $numberOfFiles, $fileSize, $dataType); > > > Is there a way to extract the name of the subroutine from the reference to the subroutine? > > Thanks... > > -Keith I didn't know of any easy way to do this, so I asked "The Damian", while we were on a break in our Adv. OO Perl class this morning. And he says, 1) first of all, if it's an anonymous sub, it won't have a name, and 2) if it is named, you'd have to walk through the symbol tables for each of your packages looking for its address, to retrieve the name. Maybe you should ask the sub's caller to provide the name as an additional arguent! -Tim *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From adamm at wazamatta.com Mon Jul 15 12:54:42 2002 From: adamm at wazamatta.com (Adam Monsen) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: bind_param and stored procedure In-Reply-To: <012c01c22c1e$0d922dc0$7201a8c0@versuslaw.com>; from mkorb@versuslaw.com on Mon, Jul 15, 2002 at 09:38:30AM -0700 References: <012c01c22c1e$0d922dc0$7201a8c0@versuslaw.com> Message-ID: <20020715105442.A22759@wazamatta.com> On 15/07/02 09:38 -0700, Martin Korb wrote: > I get the following error message when I use bind_param on > the following stored procedure called within a perl script. > > Syntax error near @P1. Can not execute...... > > here is the code snippet: > my $sql_set_identity_shopper = "EXEC dt_IdentityOnOff(?,?)"; > my $sth_set_identity_shopper = > $dbh_7->prepare($sql_set_identity_shopper); > $sth_set_identity_shopper->bind_param(1,"tblshopper"); > $sth_set_identity_shopper->bind_param(2,"on"); > $sth_set_identity_shopper->execute() or die "can not execute $!"; Hmm, I'm not sure why this isn't working. I'm guessing this code will be run against Microsoft SQL server or Sybase. Next time, please include the code you used to create the database handle. This will tell us what database you're using and help us debug problems. For instance, did you set RaiseError => 1? If so, you don't need the "or die" after the call to $sth->execute(). If this is a query with static data being inserted for the placeholders, why are you using bind parameters? Or is this just a test? > When I do not specify the order (which I really shouldn't have to) > I get a different but also fatal error: > > Can't bind unknown placeholder 'tblshopper' > > here is the code snippet: > > my $sql_set_identity_shopper = "EXEC dt_IdentityOnOff(?,?)"; > my $sth_set_identity_shopper = > $dbh_7->prepare($sql_set_identity_shopper); > $sth_set_identity_shopper->bind_param("tblshopper","on"); > $sth_set_identity_shopper->execute() or die "can not execute $!"; Try this: my $sql_set_identity_shopper = "EXEC dt_IdentityOnOff(?,?)"; my $sth_set_identity_shopper = $dbh_7->prepare($sql_set_identity_shopper); $sth_set_identity_shopper->execute("tblshopper","on") or die "can not execute $!"; > SQL 7.0 Stored Procedure: > > CREATE PROCEDURE dt_identityOnOff > @tablename varchar(64), > @action varchar(3) > as > if @tablename = 'tblshopper' > begin > if @action = 'on' > set identity_insert tblshopper on > else > set identity_insert tblshopper off > end > else > begin > if @action = 'on' > set identity_insert tblfirms on > else > set identity_insert tblfirms off > end > > > > Any suggestion on what I am overlooking. > > Thanks > > > > Martin -- Adam Monsen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From mcrip at cac.washington.edu Mon Jul 15 15:48:40 2002 From: mcrip at cac.washington.edu (Marvin Crippen) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: July Mtg: Damian on "Time::Space::Continuum" In-Reply-To: <20020708144628.A12841@timji.consultix.wa.com> Message-ID: On Mon, 8 Jul 2002, Tim Maher wrote: > The pre-meeting dinner will be held at the Cedars restaurant, at 50th > St. and Brooklyn, in the University District, near the Safeco building > where the meeting will take place. The phone number is 527-5247. > Tim and Damian should be there around 5:45pm, traffic permitting. > If you're planning to be there, please email tim@teachmeperl.com with > your expected arrival time so we can reserve sufficient room. A quick note on traffic, parts of the "Ave" (University Way) are closed for construction. At this point it's the lower half between Campus Parkway and 41st but they'll be working north over the next, ahhh 16 months (yes the project is scheduled to last till February of 2004). If you take a bus to or from the meeting all the busses that used to go up the Ave are being rerouted up 15th. If you're not bussing this could have an impact on the traffic, depending on when you're coming in. See http://transit.metrokc.gov/bus/bulletins/sr_univwayclosure.html for more info. > As usual, those wishing to socialize after the talk are invited to > congregate at the Bigtime Brewery and Alehouse, for the usual debriefing > session after the meeting. See the SPUG web-site for more details. If anyone is interested I'll be hanging out at the Bigtime before the meeting, starting around 5:30. Look for a guy with a really long ponytail and a perl pocket reference sitting on the table. -- Marvin Crippen mcrip@cac.washington.edu DO-IT Program http://www.washington.edu/doit/ (206) 221-4166 It is by caffeine alone I set my mind in motion, It is by the beans of Java the thoughts acquire speed, The hands acquire shaking, the shaking become a warning. It is by caffeine alone I set my mind in motion. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Mon Jul 15 23:19:27 2002 From: tim at consultix-inc.com (SPUG-list-owner) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Damian talk, and Dinner Tuesday Message-ID: <20020715211927.A4058@timji.consultix.wa.com> July 2002 Seattle Perl User's Group Meeting ------------------------------------------------------ Title: "An Evening with The Damian" Speaker: Dr. Damian Conway Time: Tuesday, July 16, 2002 7-9pm Location: SAFECO bldg, Brooklyn St. and NE 45th St. Cost: Admission is free and open to the general public. Info: http://seattleperl.org/ On Tuesday, July 16th, "The Damian" will be entertaining and enlightening us with his new show-stopping talk, "Time::Space::Continuum", which debuted on 6/28 at YAPC::NA (see http://teachmeperl.com/tsc_review.html for a review). Needless to say, it's another brain-buster, along the lines of his famous "Quantum Superpositions" talk. You won't want to miss it! I'll be selling black Perl Mongers T-shirts during the break for $20 each, so please bring correct change if you want one (mostly XL, but a few L also). TRAINING OPPORTUNITIES with DAMIAN Also of note is that Damian is teaching three seminars in Kirkland this week, on "Advanced OO Perl", "Advanced Module Implementation Techniques", and "Programming Perl 6". Some seats remain in all seminars, and details are at http://teachmeperl.com. DINING OPPORTUNITIES with DAMIAN The pre-meeting dinner will be held at the Cedars restaurant, at 50th St. and Brooklyn, in the University District, near the Safeco building where the meeting will take place. The phone number is 527-5247. Tim and Damian should be there around 5:45pm, traffic permitting. If you're planning to be there, please email tim@teachmeperl.com with your expected arrival time so we can reserve sufficient room. As usual, those wishing to socialize before/after the talk are invited to congregate at the Bigtime Brewery and Alehouse, for the usual debriefing session after the meeting. See the SPUG web-site for more details. ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle 7/15-18 | | Adv. OOP * Adv. Module Techniques * Programming Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Tue Jul 16 00:26:53 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Finding name for sub ref References: <200207151653.g6FGrMH20522@mail.pm.org> <20020715090535.A2113@timji.consultix.wa.com> Message-ID: In article <20020715090535.A2113@timji.consultix.wa.com>, SPUG-list-owner wrote: >> Is there a way to extract the name of the subroutine from the reference to the subroutine? > >I didn't know of any easy way to do this, so I asked "The Damian", while we were >on a break in our Adv. OO Perl class this morning. And he says, 1) first of all, >if it's an anonymous sub, it won't have a name, and 2) if it is named, you'd >have to walk through the symbol tables for each of your packages looking >for its address, to retrieve the name. Untrue. ( 2), not 1) ) use B (); sub subname { eval { B::svref_2object(shift)->GV->NAME } || "" } sub subfullname { my $gv; eval { ($gv = B::svref_2object(shift)->GV)->STASH->NAME."::".$gv->NAME } || "" } eval's are in lieu of verifying that a coderef was passed. Will give name "__ANON__" for anonymous subs. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Thu Jul 18 10:19:33 2002 From: sweetsue at sweethomes.com (Sweethomes) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Locating shtml files in multiple directories Message-ID: I know how to search for shtml files within one directory. How would I do this for all directories from the base directory out? Thanks! www.web-dev-design.com ------------------------------------ Susanne Bullo, Developer Web Dev Design -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020718/56553351/attachment.htm From cansubaykan at hotmail.com Thu Jul 18 10:39:55 2002 From: cansubaykan at hotmail.com (Can Subaykan) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Locating shtml files in multiple directories Message-ID: Hi Susanne, check out the File::Find module http://www.perldoc.com/perl5.6.1/lib/File/Find.html do something like this (not tested): use File::Find; my $dir = "/whatever/directory/you/want"; my @the_files; find(\&get_shtmls, $dir); sub get_shtmls { push @the_files, $File::Find::name if /\.shtml$/; # in here, $_ is the name of the file (something.shtml) # and $File::Find::name is the full path to that file # "/whatever/directory/you/want/and/further/inside/something.shtml } __END__ then you can do something with the array of filenames, or instead of building an array, you can open a log file and print the list to that file #John ----Original Message Follows---- From: "Sweethomes" To: "Seattle Perl User's Group" Subject: SPUG: Locating shtml files in multiple directories Date: Thu, 18 Jul 2002 08:19:33 -0700 I know how to search for shtml files within one directory. How would I do this for all directories from the base directory out? Thanks! www.web-dev-design.com ------------------------------------ Susanne Bullo, Developer Web Dev Design _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From beckyls at u.washington.edu Thu Jul 18 12:47:47 2002 From: beckyls at u.washington.edu (Rebecca L. Schmidt) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: UW Certificate Programs In-Reply-To: Message-ID: Want to improve your Perl skills, or apply your Perl skills to UNIX or Linux system administration? Then check out these UW Certificate Programs: Certificate Program in PERL Programming http://www.outreach.washington.edu/extinfo/certprog/per/per_main.asp Certificate Program for UNIX/Linux Administration http://www.outreach.washington.edu/extinfo/certprog/uad/uad_main.asp UW Extension is accepting applications now for programs that begin this fall. Classes take place in the evenings in Seattle or Bellevue, and are taught by industry experts. Attend a free information meeting to learn more about the programs. UNIX/Linux Information Meetings: ** Thursday, July 25, 2002, 6-7 p.m., UW Educational Outreach, 2445 140th Ave. NE, Suite B-100, Bellevue. ** Monday, Aug. 19, 2002, 6-7 p.m., UW Educational Outreach, 2445 140th Ave. NE, Suite B-100, Bellevue. Perl Information Meeting: ** Wednesday, Sept. 4, 2002, 6-7 p.m., UW Extension Downtown, 1325 Fourth Ave., Suite 400, Seattle Please see the URLs above for detailed program information, and feel free to contact me if you have specific questions. Best regards, Rebecca Schmidt Academic Programs University of Washington Extension 5001 25th Ave NE, Seattle, WA 98105-4190 beckyls@u.washington.edu, rschmidt@ese.washington.edu (206) 221-6243 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From evgenyr at cs.washington.edu Thu Jul 18 16:26:00 2002 From: evgenyr at cs.washington.edu (Evgeny Roubinchtein) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Locating shtml files in multiple directories In-Reply-To: References: Message-ID: <87lm88eniv.fsf@graphon.com> >>>>> "Susanne" == Sweethomes writes: Susanne> I know how to search for shtml files within one Susanne> directory. How would I do this for all directories from Susanne> the base directory out? The File::Find module will do exactly that. Do a 'perldoc File::Find' for details, then ask if something doesn't make sense. -- Evgeny I'd rather write programs that write programs than write programs -R. Sites - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Fri Jul 19 01:29:27 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: woohoo! Perl 5.8.0 Message-ID: <20020718232927.E9372@hobart.helvella.org> http://dev.perl.org/perl5/news/2002/07/18/580ann/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Fri Jul 19 16:37:35 2002 From: sweetsue at sweethomes.com (Sweethomes) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: As some Perl and PHP are similar Message-ID: I'm wondering if anyone has some wisdom to impart on how to get the file modification date to show up. I continuously get the directory modification date and absolutely no file modification dates. If you have a moment, please contact me and I'll send ya the details. I wanted to say thank you for the directory search (File::Find) information. I will be implementing this shortly! www.web-dev-design.com ------------------------------------ Susanne Bullo, Developer Web Dev Design 16646 SE 10th Street Bellevue, WA 98008 Telephone: 425.562.6040 Facsimile: 425.671.0571 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020719/77d3a100/attachment.htm From douglas at slugstone.net Sat Jul 20 06:57:15 2002 From: douglas at slugstone.net (Douglas Kirkland) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: As some Perl and PHP are similar In-Reply-To: References: Message-ID: <200207201158.g6KBw5f67892@myvirtualserver.com> ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev, $size,$atime,$mtime,$ctime,$blksize,$blocks) = stat('file_name'); The '$mtime' gives the modification date for the file. Here is a shorter version. ($mtime) = (stat("file_name"))[9]; Douglas On Friday 19 July 2002 02:37 pm, Sweethomes wrote: > I'm wondering if anyone has some wisdom to impart on how to get the file > modification date to show up. I continuously get the directory > modification date and absolutely no file modification dates. If you have a > moment, please contact me and I'll send ya the details. > > I wanted to say thank you for the directory search (File::Find) > information. I will be implementing this shortly! > > www.web-dev-design.com > ------------------------------------ > Susanne Bullo, Developer Web Dev Design > 16646 SE 10th Street Bellevue, WA 98008 > Telephone: 425.562.6040 Facsimile: 425.671.0571 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From douglas at slugstone.net Sat Jul 20 07:10:53 2002 From: douglas at slugstone.net (Douglas Kirkland) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: CGI::Form errors? Message-ID: <200207201211.g6KCBgn68604@myvirtualserver.com> I get the following errors on my web script when I set to use the perl module CGI::Form. I have checked to make sure that the perl modules CGI, CGI::Form, CGI::Base and CGI::BasePlus are current. I do not make any calls to the module just loading the module give the error. Is this a know problem with CGI::Form or did I miss something? Thanks, Douglas [Fri Jul 19 14:37:33 2002] Base.pm: Ambiguous call resolved as CORE::close(), qualify as such or use & at /usr/lib/perl5/site_perl/5.6.1/CGI/Base.pm line 834. [Fri Jul 19 14:37:34 2002] Base.pm: Ambiguous call resolved as CORE::close(), qualify as such or use & at /usr/lib/perl5/site_perl/5.6.1/CGI/Base.pm line 1043. [Fri Jul 19 14:37:34 2002] BasePlus.pm: Ambiguous call resolved as CORE::read(), qualify as such or use & at /usr/lib/perl5/site_perl/5.6.1/CGI/BasePlus.pm line 181. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Sat Jul 20 12:10:41 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Re: CGI::Form errors? References: <200207201211.g6KCBgn68604@myvirtualserver.com> Message-ID: <01a401c23010$63d86050$2588ddd1@aciwin> These look like harmless warnings - it is unlikely that CGI::Base or CGI::BasePlus are trying to override core Perl functions like close or read. (Check the modules for methods named close or read.) If you want to shut off the warnings try the use warnings pragma (newer versions of Perl) or set the $^W variable. Sorry to ask the obvious, but if you aren't call the module, why are you loading it? Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "Douglas Kirkland" To: Sent: Saturday, July 20, 2002 5:10 AM Subject: SPUG: CGI::Form errors? > I get the following errors on my web script when I set to use the perl module > CGI::Form. I have checked to make sure that the perl modules CGI, CGI::Form, > CGI::Base and CGI::BasePlus are current. I do not make any calls to the > module just loading the module give the error. Is this a know problem with > CGI::Form or did I miss something? > > > Thanks, > > Douglas > > > > > [Fri Jul 19 14:37:33 2002] Base.pm: Ambiguous call resolved as CORE::close(), > qualify as such or use & at /usr/lib/perl5/site_perl/5.6.1/CGI/Base.pm line > 834. > [Fri Jul 19 14:37:34 2002] Base.pm: Ambiguous call resolved as CORE::close(), > qualify as such or use & at /usr/lib/perl5/site_perl/5.6.1/CGI/Base.pm line > 1043. > [Fri Jul 19 14:37:34 2002] BasePlus.pm: Ambiguous call resolved as > CORE::read(), qualify as such or use & at > /usr/lib/perl5/site_perl/5.6.1/CGI/BasePlus.pm line 181. > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From adamm at wazamatta.com Sat Jul 20 14:04:24 2002 From: adamm at wazamatta.com (Adam Monsen) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: warnings in Perl (was: CGI::Form errors?) In-Reply-To: <01a401c23010$63d86050$2588ddd1@aciwin>; from richard@richard-anderson.org on Sat, Jul 20, 2002 at 10:10:41AM -0700 References: <200207201211.g6KCBgn68604@myvirtualserver.com> <01a401c23010$63d86050$2588ddd1@aciwin> Message-ID: <20020720120424.B3907@wazamatta.com> On 20/07/02 10:10 -0700, Richard Anderson wrote: [...] > If you want to shut off the warnings try the use warnings pragma > (newer versions of Perl) or set the $^W variable. [...] I'm sure this is what Richard meant, but to shut off warnings you need to have a line like no warnings; in your code (not "use warnings;"). Also, I would recommend against playing with $^W unless you know what you're doing... it only modifies the value of $^W at runtime, so it won't catch warnings that are usually raised at compile time. I think the general consensus I got from the Perlmonks (http://www.perlmonks.com and #perl on openprojects.net -- thanks, wog) is that it's better to do 'use warnings' or 'no warnings' to toggle warnings when using a version of Perl that supports the warnings pragma. -- Adam Monsen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Sat Jul 20 16:20:26 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: That "pmd" command Damian used Message-ID: I noticed at last Tuesday's meeting that Damian used the command "pmd" at his Mac OS X shell prompt. It looked like a clever tool that finds path matches based on multiple pattern arguments. A lite search of my Mac OS X box and various Linux boxes doesn't turn up anything like this. Does any one know where this might come from? Damian's mind perhaps? If so, Damian, the least you could do is reveal this little gem (even though I can think of a couple trivial implementations). At least it will make me feel better about waiting a year to learn the "truth" behind T::S::C!! :) -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at yahoo.com Sat Jul 20 17:28:58 2002 From: asimjalis at yahoo.com (Asim Jalis) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: That Vi Execute Command that Damian Used In-Reply-To: Message-ID: <20020720222858.76252.qmail@web14207.mail.yahoo.com> Andrew Sweger wrote: > I noticed at last Tuesday's meeting that Damian > used the command "pmd" at his Mac OS X shell > prompt. Along the same lines, I noticed that Damian used a keystroke in Vi that executed his perl code and paged through the output instead of replacing the buffer's contents with the output (as :! does). How did he do that? Asim __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at yahoo.com Sat Jul 20 17:38:29 2002 From: asimjalis at yahoo.com (Asim Jalis) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: That "pmd" command Damian used In-Reply-To: Message-ID: <20020720223829.11025.qmail@web14204.mail.yahoo.com> Andrew Sweger wrote: > At least it will make me feel better about > waiting a year to learn the "truth" behind > T::S::C!! :) Here is what I suspect he did in T::S::C. He might have hinted at this when he was comparing the performance of different platforms for the decrementing loop. The code inside the block for the space-time commands is compiled to the Parrot VM's byte-code and sleep is compiled to no-op. All of this is done just before execution-time using some relative of Filter::Simple.pm If the demo had been on a Pentium I might have suspected that he was using the Pentium division bug to somehow create a time-like loop on the chip. Asim __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Sat Jul 20 17:46:24 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: That "pmd" command Damian used In-Reply-To: <20020720223829.11025.qmail@web14204.mail.yahoo.com> Message-ID: On Sat, 20 Jul 2002, Asim Jalis wrote: > If the demo had been on a Pentium I might have suspected that he was > using the Pentium division bug to somehow create a time-like loop on > the chip. ROFL. I could imagine the press release. Intel develops time-like loop on a single chip. But alas, it was a PowerPC. And for the distributed theory some of you are thinking of, there is no network connection available in the auditorium unless you've got a Token Ring card (yes, they use TCP/IP over Token Ring) and some way to punch out of the SAFECO firewall. -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From damian at conway.org Sat Jul 20 10:17:25 2002 From: damian at conway.org (Damian Conway) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Those magic commands that Damian used References: <20020720222858.76252.qmail@web14207.mail.yahoo.com> Message-ID: <3D39E88E.91EDFB0E@conway.org> Andy wrote: > I noticed at last Tuesday's meeting that Damian > used the command "pmd" at his Mac OS X shell prompt. % alias pmd cd `filemoddir !:1-$` % cat ~/bin/filemoddir #! /usr/bin/perl -w # Locate directories under my Perl source tree by giving # the first few characters of each part of the module name my $PERLDIR = "$ENV{HOME}/src/Perl"; my $pattern = join '::', @ARGV; $pattern =~ s|::|/|g; if (-d "$PERLDIR/$pattern" ) { print "$PERLDIR/$pattern\n"; exit; } my $ipattern = join '::', map {ucfirst} @ARGV; $ipattern =~ s|::|/|g; if (-d "$PERLDIR/$ipattern" ) { print "$PERLDIR/$ipattern\n"; exit; } $pattern =~ s|/|*/|g; @maybe = glob "$PERLDIR/$pattern*"; @maybe = glob "$PERLDIR/$ipattern*" unless @maybe; print join " ", @maybe if @maybe; print "." unless @maybe; Asim wrote: > Along the same lines, I noticed that Damian used a > keystroke in Vi that executed his perl code and > paged through the output instead of replacing the > buffer's contents with the output (as :! does). > How did he do that? %cat ~/.exrc # Hundreds of other customizations omitted # E is for Execute... map E :!mperl -w % %cat ~/bin/mperl #! /bin/csh perl $argv |& less - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From adamm at wazamatta.com Sat Jul 20 19:55:04 2002 From: adamm at wazamatta.com (Adam Monsen) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Time::Like::Loops idea (was: Those magic commands that Damian used) In-Reply-To: <3D39E88E.91EDFB0E@conway.org>; from damian@conway.org on Sat, Jul 20, 2002 at 08:17:25AM -0700 References: <20020720222858.76252.qmail@web14207.mail.yahoo.com> <3D39E88E.91EDFB0E@conway.org> Message-ID: <20020720175504.B6903@wazamatta.com> On 20/07/02 08:17 -0700, Damian Conway wrote: > Andy wrote: > > > I noticed at last Tuesday's meeting that Damian > > used the command "pmd" at his Mac OS X shell prompt. > > % alias pmd > > cd `filemoddir !:1-$` [...] Now if only someone could trick him into printing the output of % perldoc -m Time::Space::Continuum and % perldoc -m Time::Like::Loops ;) ...but seriously, I think I have one far-fetched idear on how that stuff worked. E=mc^2 says we can trade matter for energy with the speed of light remaining constant, correct? So, if we consider matter to be something like hard disk space and energy to be something like CPU cycles, the two are roughly interchangeable whilst processing speed (c) remains constant. This would lead me to believe that some kind of caching is being done, and hard disk space is being interchanged with CPU cycles. It would appear to the casual observer that we are actually reducing the number of CPU cycles by increasing processing speed, but processing speed _must_ be constant. This code seems to produce the same effect as Time::Like::Loops (time it!)... #!/usr/bin/perl -w use strict; use DB_File; use Memoize; tie my %cache => 'DB_File', 'money.db', O_RDWR|O_CREAT, 0666; memoize('fib', SCALAR_CACHE => [HASH => \%cache]); sub fib { my $n = shift; return $n if $n < 2; fib($n-1) + fib($n-2); } print fib($_), "\n" for 1 .. 70; So, maybe Time::Like::Loops somehow turns on memoize() for the functions that are called within a "whilst" or a "fort" loop, for instance. I think Asim may be right about sleep() being overloaded to a no-op; I have no idea what this would entail. -- Adam Monsen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jgardn at alumni.washington.edu Sun Jul 21 01:38:12 2002 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Wed Aug 4 00:09:04 2004 Subject: Data Bomb (was SPUG: Time::Like::Loops idea) In-Reply-To: <20020720175504.B6903@wazamatta.com> References: <20020720222858.76252.qmail@web14207.mail.yahoo.com> <3D39E88E.91EDFB0E@conway.org> <20020720175504.B6903@wazamatta.com> Message-ID: <200207202338.12859.jgardn@alumni.washington.edu> On Saturday 20 July 2002 05:55 pm, Adam Monsen wrote: > E=mc^2 says we can trade matter for energy with the speed of light > remaining constant, correct? So, if we consider matter to be something > like hard disk space and energy to be something like CPU cycles, the two > are roughly interchangeable whilst processing speed (c) remains > constant. This would lead me to believe that some kind of caching is > being done, and hard disk space is being interchanged with CPU cycles. > It would appear to the casual observer that we are actually reducing the > number of CPU cycles by increasing processing speed, but processing > speed _must_ be constant. > If the density of certain types of data exceed some threshold, then it could cause a reaction that will produce tremendous amounts of CPU cycles temporarily, destroying data in a large area. Or, in other words, someone could create a virus that could infect your hard drive and turn it into a bomb... -- Jonathan Gardner jgardn@alumni.washington.edu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dwainef at earthlink.net Sun Jul 21 17:57:47 2002 From: dwainef at earthlink.net (Dwaine Felch) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Compiling Perl-5.8.0 for Windows XP In-Reply-To: <3D39E88E.91EDFB0E@conway.org> Message-ID: <000301c2310a$089f5950$0400a8c0@angie1> I see Perl-5.8.0 is out but ActiveState does not list an *.msi file for it. Does anyone know the steps to compile it? I have Visual Studio 6.0 to use. Is there some simple steps to follow or is it a 5-6 hour nightmare not worth banging my head against the Wall over? Any suggestions are appreciated! Thanks, Dwaine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at yahoo.com Sun Jul 21 18:58:45 2002 From: asimjalis at yahoo.com (Asim Jalis) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Perl and OO and Unit Testing Message-ID: <20020721235845.33985.qmail@web14205.mail.yahoo.com> I have recently been playing with Perl again. I lay the blame for this on Damian's talk. For some reason writing unit tests in Perl feels really weird. I feel like Perl code is simply not supposed to be OO in the same way as Python and Java are. OO at the same fine granularity seems wrong in Perl somehow. Whenever I start writing Perl with tiny trivial objects -- the way Java and Python make you do -- I feel like I am being stupid and un-Perl-ish. This is how I feel when I use any of the OO techniques in Damian's book. Part of it is that Perl is built around this idea that you want to work on giant trees of data containing hashes/arrays of hashes/arrays many levels deep. While Java/Python objects are usually structs of some kind Perl objects are more naturally giant trees of hashes and arrays interspersed with each other. Any ideas? Asim __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Marc.M.Adkins at Doorways.org Sun Jul 21 21:45:49 2002 From: Marc.M.Adkins at Doorways.org (Marc M. Adkins) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Compiling Perl-5.8.0 for Windows XP In-Reply-To: <000301c2310a$089f5950$0400a8c0@angie1> Message-ID: > I see Perl-5.8.0 is out but ActiveState does not list an *.msi file for > it. Does anyone know the steps to compile it? I have Visual Studio 6.0 > to use. Is there some simple steps to follow or is it a 5-6 hour > nightmare not worth banging my head against the > Wall over? Any suggestions are appreciated! It's not a problem. I've built 5.8 RC1, 5.8 RC2, and the just-distributed 5.8 with Visual Studio. Get the zip file from the perl-5.8.0.tar.gz on one of the links on: http://dev.perl.org/perl5/news/2002/07/18/580ann/ A few days ago this file (perl-5.8.0.tar.gz) was missing on one of the distribution sites. You could get the archives for RC1 or RC2 but not the released version. A minor and hopefully temporary situation. Unzip the file into a directory somewhere. Left as an exercise for the reader, most modern tools will unzip .tar.gz. If you don't have a better one, Globalscape's CuteZip will do it. Or various faux-UNIX tool kits will give you a command line utility like gunzip or gzip with flags, sometimes followed by liberal application of tar. The way I do it is to open a DOS box and change to the directory I just created. Then go down into the win32 directory from there. Enter VCVARS32 at the command line (unless you are loading the relevant VC++ symbols elsewise). Use plain old NMAKE: nmake nmake test nmake install The last command will install into C:\perl or wherever you fix it to go (by editing Makefile in the win32 directory). It will replace whatever Perl version you might have previously had. Be forewarned. You may want to rename or delete any old perl directory since all packages must be rebuilt (not binary compatible). Doesn't look like there was an original Makefile.PL or configure.pl to execute. I don't remember doing that, and don't see those files in win32. With the separate win32 subdirectory I believe that step is unecessary. The instructions are contained in the c:\perl\html\index.html file after you've successfully built and installed. It probably lives somewhere online, maybe CPAN.org, I don't know where (sorry). The build on a 600Mhz PIII takes maybe a half hour at most, including everything. It always works for me. The ithreads support seems to be enabled by default. It's a pretty mature product, I haven't had problems with the build process, it seemed pretty bulletproof. Your mileage may vary. mma - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Sun Jul 21 21:30:20 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Perl and OO and Unit Testing In-Reply-To: <20020721235845.33985.qmail@web14205.mail.yahoo.com> Message-ID: Welcome back. I think you may be right (Perl and Java are different). But I don't see that as a bad thing. These feelings of guilt will pass with time. Don't worry, Asim. There's nothing wrong with you that writing more Perl won't cure. :) On Sun, 21 Jul 2002, Asim Jalis wrote: > I have recently been playing with Perl again. I lay the blame for this > on Damian's talk. -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Mon Jul 22 00:00:04 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Re: Compiling Perl-5.8.0 for Windows XP References: <000301c2310a$089f5950$0400a8c0@angie1> Message-ID: <005401c2313c$a5c5fd10$1888ddd1@aciwin> My experience with installing Perl from scratch on HP-UX suggests that it may be a 1-2 day nightmare. Perl was developed for Unix and the people at ActiveState have done a lot of work to get it working in the Windows environment. You would be prudent to use only ActiveState builds of Perl on Windows. Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "Dwaine Felch" To: "'Seattle Perl Users Group'" Sent: Sunday, July 21, 2002 3:57 PM Subject: SPUG: Compiling Perl-5.8.0 for Windows XP > > I see Perl-5.8.0 is out but ActiveState does not list an *.msi file for > it. Does anyone know the steps to compile it? I have Visual Studio 6.0 > to use. Is there some simple steps to follow or is it a 5-6 hour > nightmare not worth banging my head against the > Wall over? Any suggestions are appreciated! > > Thanks, > Dwaine > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dancerboy at strangelight.com Mon Jul 22 13:54:56 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Perl and OO and Unit Testing In-Reply-To: <20020721235845.33985.qmail@web14205.mail.yahoo.com> References: <20020721235845.33985.qmail@web14205.mail.yahoo.com> Message-ID: At 4:58 pm -0700 2002-07-21, Asim Jalis wrote: >I have recently been playing with Perl again. I >lay the blame for this on Damian's talk. > >For some reason writing unit tests in Perl feels >really weird. I feel like Perl code is simply not >supposed to be OO in the same way as Python and >Java are. OO at the same fine granularity seems >wrong in Perl somehow. > >Whenever I start writing Perl with tiny trivial >objects -- the way Java and Python make you do -- >I feel like I am being stupid and un-Perl-ish. >This is how I feel when I use any of the OO >techniques in Damian's book. I can totally relate: I feel the same vague un-ease when writing truly OO Perl as well. My suggestion: ignore the discomfort and create tiny, Java-esque classes anyway. > >Part of it is that Perl is built around this idea >that you want to work on giant trees of data >containing hashes/arrays of hashes/arrays many >levels deep. Keep in mind that in Perl, objects *are* references to data structures, so when you create objects whose data members are objects whose data members are objects... etc. you are, in fact, creating hashes/arrays of hashes/arrays many levels deep -- only you're "hiding" those trees (encapsulating them) behind the OO interface. This is a Good Thing: instead of having to write procedural code to traverse those trees yourself, you can write OO code that ignores the underlying tree structure, and let the Perl interpreter traverse the tree for you. (This just made me think of a nice metaphor: in Perl, OOP lets you see the forest instead of the trees.) Also, remember that no language is perfect (no, not even Perl! ;-) Sometimes you have to "fight" the language a little bit to do things right: so just because something is "un-Perlish" doesn't necessarily mean that it's wrong. Personally, I consider Java to be the closest thing to a "perfect" computer language yet invented, with Perl being a close second. So whenever I can "twist" Perl to behave more like Java, I do so. It may not be "Perl-ish", but so what? I consider Java-esque Perl to be *better* than Perl-ish Perl. -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jimfl at tensegrity.net Mon Jul 22 15:24:05 2002 From: jimfl at tensegrity.net (Jim Flanagan) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Perl and OO and Unit Testing In-Reply-To: References: <20020721235845.33985.qmail@web14205.mail.yahoo.com> Message-ID: <2147483647.1027344245@d-128-208-200-118.dhcp2.washington.edu> --On Monday, July 22, 2002 11:54 AM -0700 dancerboy wrote: > I consider Java-esque Perl to be *better* than Perl-ish Perl. But Perl-ish Java is strictly to be avoided :^) -- Flanagan::Jim http://jimfl.tensegrity.net mailto:jimfl%40t%65ns%65gr%69ty.n%65t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From kirbyk at Idiom.com Mon Jul 22 15:38:07 2002 From: kirbyk at Idiom.com (Kirby Krueger) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Perl and OO and Unit Testing In-Reply-To: References: <20020721235845.33985.qmail@web14205.mail.yahoo.com> <20020721235845.33985.qmail@web14205.mail.yahoo.com> Message-ID: <5.1.0.14.0.20020722133429.00a87ca0@smtp.idiom.com> At 11:54 AM 7/22/02, dancerboy wrote: >Also, remember that no language is perfect (no, not even Perl! ;-) >Sometimes you have to "fight" the language a little bit to do things >right: so just because something is "un-Perlish" doesn't necessarily mean >that it's wrong. Personally, I consider Java to be the closest thing to a >"perfect" computer language yet invented, with Perl being a close >second. So whenever I can "twist" Perl to behave more like Java, I do >so. It may not be "Perl-ish", but so what? I consider Java-esque Perl to >be *better* than Perl-ish Perl. One of the best things about perl, and the "There's more than one way to do it" philosophy, is that it values the mind of the programmer. An underrated kind of efficiency is how easy it is for the programmer to work with the language - often, an extra hour of the programmer's time is worth quite a bit more than an extra few seconds of run-time. (And sometimes not, of course.) So, better is very much in the eye of the beholder - what fits your brain more is clearly better for you. (The downside is when other people have to maintain your code. Perl is notorious for catering to quirky coders.) -- Kirby (P.S. Just moved to Seattle, looking for Perl-heavy jobs. Send private email if you have any leads, I'd be most appreciative!) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Wed Jul 24 00:02:44 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: OSCON/SPUGers Wed 6:30 PM Message-ID: (No one else mentioned this yet...) Any SPUGers at the Perl Conference... meet your friends in the Sheraton main reception lobby tomorrow (Wednesday) at 6:30 PM for socializing. Sorry for the delay. I sent this message much earlier but neglected to use my correct "From" address. And congratulations to Tim Maher for winning that Perl Monger award (announced tonight by that guy with the lower-case, fixed-point typeface name) for creating a Perl Users Group before there ever was Perl Mongers. It's about time! -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Wed Jul 24 09:36:08 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: Tim Maher wins White Camel Award! Message-ID: <20020724073608.A18725@hobart.helvella.org> SPUGers, I am pleased to let you all know that our Tim Maher has one one of the prestigious White Camel awards, presented by brian d foy and the Perl Mongers. Tim was selected for starting the Seattle Perl Users' Group, before the existence of Perl Mongers, and for promoting the use of Perl everywhere. -Colin. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Wed Jul 24 17:19:43 2002 From: tim at consultix-inc.com (SPUG-list-owner) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: White Camel Award? Message-ID: <20020724151943.A15062@timji.consultix.wa.com> On Wed, Jul 24, 2002 at 07:36:08AM -0700, Colin Meyer wrote: > SPUGers, > > I am pleased to let you all know that our Tim Maher has won one of the > prestigious White Camel awards, presented by brian d foy and the Perl > Mongers Huhh?? I won something? Cool! But I must admit I've really enjoyed creating this forum for the interchange of Perl knowledge, that has let us all bask in the Perl brilliance of such prominent visitors as Larry Wall, Mark-Jason Dominus, Nat Torkington, Gisle Ais, "The Damian" Conway (MANY times over!), and others. And apart from the "celebrity" speakers, we've also learned a lot from our local comrades, such as Brian Ingerson, Jeremy Kahn, Colin Meyer, Jim Flanagan, and Brian Akers, to name only a few. In the interest of the group, I'll seize this opportunity to make an important appeal: if you like what SPUG is doing, and want to contribute to the local Perl community, please volunteer to present a talk from 5-120 minutes in length about something related to Perl at a future meeting. The "sharing of knowledge" is the fundamental characteristic around which this group was formed, and upon which it delivers the most value to its members. As a personal aside, I'm convinced that one of the main reasons SPUG has managed to stay alive for these past 4+ years is that I've been willing to pinch-hit as the main speaker whenever nobody else could be convinced to do so! And this is important, because many groups lose their memberships because they're always wondering "Is there a meeting this month?". For the record, we've had a meeting EVERY MONTH since our inception on 3/17/98 (and sometimes two per month)! But there are limits to how much I can personally do for the group, so I encourage the rest of you to contribute more in the future. For unlike many other PM groups, which focus primarily on collective Beer Ingestion, we also have an educational component to our meetings (between the pre- and post-meeting ingestional sessions). This makes us special, but requires more from the participants. And this might also explain why we have 2-3 times as many subscribers on our mailing list as any other PM group! We talk about *more* than BEER! (which is a worthy subject in itself, but alas, not everything). So please consider sharing your Perl knowledge with the rest of us in an upcoming meeting! You may contact me at spug@seattleperl.org with your ideas. And finally, thanks to all who've helped make SPUG what it is today, including AV whiz and long-time SPUGmeister Andy Sweger, his associate Dora Choi, and the inestimable Colin "Shroomy" Meyer, who's second only to yours truly in the number of presentations he's made! Vive la SPUG! -Tim ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From lists at dansanderson.com Wed Jul 24 23:13:40 2002 From: lists at dansanderson.com (Dan Sanderson) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG Talk Topics? (was Re: SPUG: White Camel Award?) In-Reply-To: <20020724151943.A15062@timji.consultix.wa.com> Message-ID: On Wed, 24 Jul 2002, SPUG-list-owner wrote: > In the interest of the group, I'll seize this opportunity > to make an important appeal: if you like what SPUG is > doing, and want to contribute to the local Perl community, > please volunteer to present a talk from 5-120 minutes > in length about something related to Perl at a future > meeting. The "sharing of knowledge" is the fundamental > characteristic around which this group was formed, and > upon which it delivers the most value to its members. So what topics would people like to see presentations on? What'd be useful? What'd be fun? If we throw together a wishlist, it'd be easier to say, "Hey, I can talk for 5 minutes on that." Or have we addressed this question already and I just don't remember? I still haven't come down from Damian's Perl 6 lecture and feel like talking about it, though I feel like I'd have to study for a few months before feeling up to relaying most of the material. Maybe the attendees of that lecture could get together for a tag-team SPUG presentation (dibs on regexps! ooh, and can I do 'given', too?). The best part is, if we get anything wrong, it doesn't matter, because nobody can use it anyway. ;) -- Dan S. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Thu Jul 25 01:32:59 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG Talk Topics? (was Re: SPUG: White Camel Award?) In-Reply-To: Message-ID: On Wed, 24 Jul 2002, Dan Sanderson wrote: > The best part is, if we get anything wrong, it doesn't matter, because > nobody can use it anyway. ;) Ahem. Perhaps you missed Damian's talk about Perl6::.* There's no need to wait for Perl 6 to start using it under perl 5 now. Hey folks, be sure to check out search-beta.cpan.org. Way, way better. Graham Barr, et al, did a knock-out job building a better CPAN search facility. Keep in mind that it is currently running on a slower machine until the new system can be moved into "production". -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From lists at dansanderson.com Thu Jul 25 03:22:54 2002 From: lists at dansanderson.com (Dan Sanderson) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG Talk Topics? (was Re: SPUG: White Camel Award?) In-Reply-To: Message-ID: On Wed, 24 Jul 2002, Andrew Sweger wrote: > Ahem. Perhaps you missed Damian's talk about Perl6::.* There's no need to > wait for Perl 6 to start using it under perl 5 now. Are there more than just the six feature modules and the Bundle::Perl6? It is neat to recognize how much of Perl 6 we already have in Perl 5, and the Perl6::.* modules bridge some gaps, but it still seems too far away to really know what it'll be like to live with. When I've tried to broach the subject with folks since Damian's Perl 6 class last week, reactions have ranged from passive interest ("I won't really care until it's available, but that's interesting") to averse disinterest ("Ick! It's sounds so different from Perl 5, we'll never have a reason to use it!"). All such reactions are understandable-- unless you're involved in Perl 6's development, it's mostly academic-- but it seems like continued discussion, and maybe even a little evangelism, is called for. Making Perl 6 a more concrete subject through discussion of the design details will foster support and interest in Perl 6's development, and facilitate adoption when the language is ready for use. The Perl6::.* modules help make the ideas seem more concrete, though possibly only for those already very interested in the ideas. There are probably more practical topics of equal interest for SPUG talks, I was just throwing it out there. (And I'm not volunteering, either. :) -- Dan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Thu Jul 25 06:25:16 2002 From: tim at consultix-inc.com (SPUG-list-owner) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG Talk Topics? (was Re: SPUG: White Camel Award?) In-Reply-To: References: <20020724151943.A15062@timji.consultix.wa.com> Message-ID: <20020725042516.A15712@timji.consultix.wa.com> On Wed, Jul 24, 2002 at 09:13:40PM -0700, Dan Sanderson wrote: > > So what topics would people like to see presentations on? What'd be > useful? What'd be fun? If we throw together a wishlist, it'd be easier > to say, "Hey, I can talk for 5 minutes on that." Or have we addressed > this question already and I just don't remember? I echo Dan's question; what do SPUGsters want to hear about at upcoming meetings? The only constraint is that we need to keep at least 25% of the talks at the beginner level. So let us know what appeals to you! And what you personally would be willing and able to talk about. ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Thu Jul 25 06:05:09 2002 From: tim at consultix-inc.com (SPUG-list-owner) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG Talk Topics? (was Re: SPUG: White Camel Award?) In-Reply-To: References: <20020724151943.A15062@timji.consultix.wa.com> Message-ID: <20020725040509.A15637@timji.consultix.wa.com> On Wed, Jul 24, 2002 at 09:13:40PM -0700, Dan Sanderson wrote: > On Wed, 24 Jul 2002, SPUG-list-owner wrote: > > > In the interest of the group, I'll seize this opportunity > > to make an important appeal: if you like what SPUG is > > doing, and want to contribute to the local Perl community, > > please volunteer to present a talk from 5-120 minutes > > in length about something related to Perl at a future meeting > > So what topics would people like to see presentations on? What'd be > useful? What'd be fun? If we throw together a wishlist, it'd be easier > to say, "Hey, I can talk for 5 minutes on that." Or have we addressed > this question already and I just don't remember? I agree completely, and will be coming up with a "wish-list" soon. In the meantime, keep those spontaneous ideas coming (I've gotten several proposals already!) -Tim ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From chuck.orr at attws.com Thu Jul 25 12:50:52 2002 From: chuck.orr at attws.com (Orr, Chuck (NOC)) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? Message-ID: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> > Hello, > > I am hoping to use Perl to solve an equation like the below: > > A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > > I know that each of the variables A - E is a whole number in the range > 1-36. > > Could I load those numbers (1 -36) in an array and substitute each number > for each variable until this is solved? > > Any ideas would be greatly appreciated. > > > Thanks, > Chuck Orr > AT&T Wireless Services > 425 288 2386 > chuck.orr@attws.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From SeattlePerlFJ92 at Langenberg.Com Thu Jul 25 13:01:40 2002 From: SeattlePerlFJ92 at Langenberg.Com (Chuck Langenberg) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG Talk Topics? (was Re: SPUG: White Camel Award?) References: <20020724151943.A15062@timji.consultix.wa.com> <20020725042516.A15712@timji.consultix.wa.com> Message-ID: <005301c23405$6223f640$17020202@c172974a> > > Dan said... > > So what topics would people like to see presentations on... > > Tim replied... > I echo Dan's question... I reword Dan's question, "What do I want to hear about?" Answer: 25% of the evening alloted to an open forum in which mere mortal users (the U in SPUG) are encouraged to ask questions & provide answers -- right out loud in front of everybody. Maybe a moderator could keep it moving & on topic. This informal forum would give participants a heads up on who to interact with at a break which follows. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Marc.M.Adkins at Doorways.org Thu Jul 25 13:40:18 2002 From: Marc.M.Adkins at Doorways.org (Marc M. Adkins) Date: Wed Aug 4 00:09:04 2004 Subject: SPUG: RE: SPUG Talk Topics? In-Reply-To: Message-ID: > When I've tried to broach the subject with folks since Damian's Perl 6 > class last week, reactions have ranged from passive interest... to averse > disinterest ("Ick! It's sounds so different from Perl 5, we'll never have > a reason to use it!"). I've been using the term Classic Perl for a while now...referring to Perl 5...vs. New Perl (Perl 6). A conscious effort to remind people about the New Coke debacle: the end result of which was to validate the old recipe. There _will_ be people who will reject Perl 6 for being too different and want to stick with what already works. Having attempted to follow the various Apocalypsii I must admit I'm personally becoming seduced by the new features. And there is such an obvious (and documented) effort to _not_ break existing code or diverge too much from "Perl as we know and love it." I suspect I will be among the group who embrace the new version. Still, it'll be interesting to see what happens. mma - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Daniel.Pommert at verizonwireless.com Thu Jul 25 14:42:35 2002 From: Daniel.Pommert at verizonwireless.com (Pommert, Daniel) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? Message-ID: <9B30436F511ED5118EDF0002A55C3180057902DC@cairvexmb03.uswin.ad.vzwcorp.com> This is an integer programming problem. But if you look at it, you see that E can only be values from 1 through 17. You don't care about the value of A: it will be whatever it needs to be. So, you could do a simple exhostive search for solutions by looping through the 36 * 36 * 36 * 17 values of B, C, D, and E (respectively). This shouldn't take more than a couple seconds of computer time and could be written in under 20 lines of code. -- Daniel Pommert Verizon Wireless 425-603-8612 -----Original Message----- From: Orr, Chuck (NOC) [mailto:chuck.orr@attws.com] Sent: Thursday, July 25, 2002 10:51 AM To: 'spug-list@pm.org' Subject: SPUG: FW: Help..Any Math GENIUS out there? > Hello, > > I am hoping to use Perl to solve an equation like the below: > > A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > > I know that each of the variables A - E is a whole number in the range > 1-36. > > Could I load those numbers (1 -36) in an array and substitute each number > for each variable until this is solved? > > Any ideas would be greatly appreciated. > > > Thanks, > Chuck Orr > AT&T Wireless Services > 425 288 2386 > chuck.orr@attws.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Daniel.Pommert at verizonwireless.com Thu Jul 25 14:51:48 2002 From: Daniel.Pommert at verizonwireless.com (Pommert, Daniel) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? Message-ID: <9B30436F511ED5118EDF0002A55C3180057902DD@cairvexmb03.uswin.ad.vzwcorp.com> Oops. This one is simpler than I thought. E must = 17. The equation reduces to: A + (36*B) + (360*C) + (3600*D) = 103812. This implies that D must a value from 25 through 28. Now, you only have 36 * 36 * 4 choices to search. That's a little over 5,000. -- Daniel -----Original Message----- From: Orr, Chuck (NOC) [mailto:chuck.orr@attws.com] Sent: Thursday, July 25, 2002 10:51 AM To: 'spug-list@pm.org' Subject: SPUG: FW: Help..Any Math GENIUS out there? > Hello, > > I am hoping to use Perl to solve an equation like the below: > > A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > > I know that each of the variables A - E is a whole number in the range > 1-36. > > Could I load those numbers (1 -36) in an array and substitute each number > for each variable until this is solved? > > Any ideas would be greatly appreciated. > > > Thanks, > Chuck Orr > AT&T Wireless Services > 425 288 2386 > chuck.orr@attws.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Thu Jul 25 13:51:11 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? References: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> Message-ID: In article <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02>, "Orr, Chuck (NOC)" wrote: >> I am hoping to use Perl to solve an equation like the below: >> >> A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 >> >> I know that each of the variables A - E is a whole number in the range >> 1-36. >> >> Could I load those numbers (1 -36) in an array and substitute each number >> for each variable until this is solved? You could (though an array is unneccessary). A slightly better approach would be to compute A for all different combos of B,C,D,E and see if it is valid (integer in 1-36). In your example, there appears to be a relationship between the coefficients (1 (implied), 36, 360, 3600, 129600). If that is true in general, you can solve it without going through all the combinations. For instance, you can easily find E = 17 and A = 24 in the above, leaving you with: B + 10*C + 100*D = 2883 which has several solutions (by inspection, about 14). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From chuck.orr at attws.com Thu Jul 25 15:30:41 2002 From: chuck.orr at attws.com (Orr, Chuck (NOC)) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Math Geniuses Message-ID: <67AC2DB52118D411A8F300508B957F120A1F2C18@WA-MSG02> Hello All, Thank you for the great responses. I am really impressed with the willingness to help out and the skill and thought process behind the many responses I have received. I am still digesting some of them, but it appears that this will be a difficult, if not impossible task. I have over 1000 different numbers to stick in at the end of the equation, all of which are between 1 and 3 million. I need a unique solution for each of these numbers, which is unattainable without more information (that I probably can't get.) If this sparks anyone's interest, I can provide a little more information about the whole project and maybe someone will pick up on something I am missing. For the example provided, I already had the "correct answer", and it is provided by each of the scripts that you folks have been kind enough to send me. Unfortunately, so are 14 of its friends that are also correct. Please email or give me a call if this interests you and you have time to dig deeper, I don't want to clog up the list with my problem. Thanks again for the incredible responses, Chuck 425 288 2386 chuck.orr@attws.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From oubiwann at myrealbox.com Thu Jul 25 15:38:06 2002 From: oubiwann at myrealbox.com (Duncan McGreggor) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? Message-ID: <1027629486.67065ff7oubiwann@myrealbox.com> Man, it's been a really long time since linear algebra... but I think that since you don't have 5 equations (to go with your 5 vars), you can't solve it with a matrix... It's not a quad, cubic, etc., so you can't solve it with those methods... What about brute forcing it: for ($a=1;$a<=36;$a++) { $A=$a; for ($b=1;$b<=36;$b++) { $B=36*$b; for ($c=1;$c<=36;$c++) { $C=360*$c; for ($d=1;$d<=36;$d++) { $D=3600*$d; for ($e=1;$e<=36;$e++) { $E=129600*$e; if ( $A + $B + $C + $D + $E == 2307012 ) { print "found a solution:\n\t$a, $b, $c, $d, $e\n"; } } } } } } I don't know if my math is right, but I got the following results: found a solution: 24, 3, 8, 28, 17 found a solution: 24, 3, 18, 27, 17 found a solution: 24, 3, 28, 26, 17 found a solution: 24, 13, 7, 28, 17 found a solution: 24, 13, 17, 27, 17 found a solution: 24, 13, 27, 26, 17 found a solution: 24, 23, 6, 28, 17 found a solution: 24, 23, 16, 27, 17 found a solution: 24, 23, 26, 26, 17 found a solution: 24, 23, 36, 25, 17 found a solution: 24, 33, 5, 28, 17 found a solution: 24, 33, 15, 27, 17 found a solution: 24, 33, 25, 26, 17 found a solution: 24, 33, 35, 25, 17 Duncan -----Original Message----- From: "Orr, Chuck (NOC)" To: "'spug-list@pm.org'" Date: Thu, 25 Jul 2002 10:50:52 -0700 Subject: SPUG: FW: Help..Any Math GENIUS out there? > Hello, > > I am hoping to use Perl to solve an equation like the below: > > A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > > I know that each of the variables A - E is a whole number in the range > 1-36. > > Could I load those numbers (1 -36) in an array and substitute each number > for each variable until this is solved? > > Any ideas would be greatly appreciated. > > > Thanks, > Chuck Orr > AT&T Wireless Services > 425 288 2386 > chuck.orr@attws.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Thu Jul 25 13:51:11 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? References: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> Message-ID: In article <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02>, "Orr, Chuck (NOC)" wrote: >> I am hoping to use Perl to solve an equation like the below: >> >> A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 >> >> I know that each of the variables A - E is a whole number in the range >> 1-36. >> >> Could I load those numbers (1 -36) in an array and substitute each number >> for each variable until this is solved? You could (though an array is unneccessary). A slightly better approach would be to compute A for all different combos of B,C,D,E and see if it is valid (integer in 1-36). In your example, there appears to be a relationship between the coefficients (1 (implied), 36, 360, 3600, 129600). If that is true in general, you can solve it without going through all the combinations. For instance, you can easily find E = 17 and A = 24 in the above, leaving you with: B + 10*C + 100*D = 2883 which has several solutions (by inspection, about 14). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Marc.M.Adkins at Doorways.org Thu Jul 25 16:01:56 2002 From: Marc.M.Adkins at Doorways.org (Marc M. Adkins) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? In-Reply-To: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> Message-ID: At first I thought you were attempting to convert a base 10 number into base 36. The general solution for that type of problem is to repeatedly divide your source number by the base (in this case 36) and collect the remainders. Something like: my $n = 2_307_012; my @r = ( ); print "start: $n\n"; while ($n) { push @r, $n % 36; $n = int($n / 36); } my $i = ord('A'); my $d = 1; map { printf "%c=%2d x %7d = %7d\n", $i++, $_, $d, $_ * $d; $n += $_ * $d; $d *= 36; } @r; print "total: $n\n"; Then I looked at it again and that's not in fact what you're doing. There is a pattern to the numbers, but it's not multiplying by 36 each time. So I modified the general solution to use a list to represent the multipliers: my $n = 2_307_012; my @r = ( ); my @z = ( 36, 10, 10, 36 ); print "start: $n\n"; map { push @r, $n % $_; $n = int($n / $_); } @z; push @r, $n; $n = 0; my $a = ord('A'); my $d = 1; for (my $i = 0; $i < @r; $i++) { printf "%c=%2d x %7d = %7d\n", $a + $i, $r[$i], $d, $r[$i] * $d; $n += $r[$i] * $d; $d *= $z[$i]; } printf "total: %7d\n", $n; which seems to work on my system (W2K using Perl 5.8). Caveat: I didn't do a lot of testing. I must admit, I'm curious about the problem domain. mma > -----Original Message----- > From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of > Orr, Chuck (NOC) > Sent: Thursday, July 25, 2002 10:51 AM > To: 'spug-list@pm.org' > Subject: SPUG: FW: Help..Any Math GENIUS out there? > > > > > > Hello, > > > > I am hoping to use Perl to solve an equation like the below: > > > > A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > > > > I know that each of the variables A - E is a whole number in the range > > 1-36. > > > > Could I load those numbers (1 -36) in an array and substitute > each number > > for each variable until this is solved? > > > > Any ideas would be greatly appreciated. > > > > > > Thanks, > > Chuck Orr > > AT&T Wireless Services > > 425 288 2386 > > chuck.orr@attws.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From stephen.m.baker at intel.com Thu Jul 25 16:07:10 2002 From: stephen.m.baker at intel.com (Baker, Stephen M) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: HASH help Message-ID: <288F9BF66CD9D5118DF400508B68C446020DA671@orsmsx113.jf.intel.com> I need to make a multi-dimensional hash. The top level has "$user" as keys, and the values are references to another hash, hash2. Hash2 has "$item" as keys, and the values are references to an array. The array has any number of element in it... the goal being to be able to create a portable database wherein the following is possible: by specifying a user, you can look to see the various items associated with them, and then get specifics about any of those items... I need a starting point... I'm somewhat familiar with perl but if anyone could give me some direction that would be helpful. Stephen Baker Office: 253.371.4188 Intel Corporation Mobile: 253.678.0556 Intel Architecture Group Email: stephen.m.baker@intel.com Mail Stop DP3-307 2800 Center Dr. Dupont, WA 98327 **************************************************************************** ************** The information contained in this email are the opinions and views of the author(s), and are not on behalf of Intel unless specifically stated. **************************************************************************** ************** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Marc.M.Adkins at Doorways.org Thu Jul 25 16:24:22 2002 From: Marc.M.Adkins at Doorways.org (Marc M. Adkins) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG Talk Topics? (was Re: SPUG: White Camel Award?) In-Reply-To: <005301c23405$6223f640$17020202@c172974a> Message-ID: > Answer: 25% of the evening alloted to an open forum in which > mere mortal users (the U in SPUG) are encouraged to ask > questions & provide answers -- right out loud in front of > everybody. Maybe a moderator could keep it moving & on > topic. This informal forum would give participants a heads > up on who to interact with at a break which follows. I second the motion. mma - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jimfl at tensegrity.net Thu Jul 25 16:16:25 2002 From: jimfl at tensegrity.net (Jim Flanagan) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? In-Reply-To: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> References: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> Message-ID: <2147483647.1027606585@d-128-208-200-118.dhcp2.washington.edu> --On Thursday, July 25, 2002 10:50 AM -0700 "Orr, Chuck (NOC)" wrote: >> I am hoping to use Perl to solve an equation like the below: >> >> A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 >> >> I know that each of the variables A - E is a whole number in the >> range 1-36. >> >> Could I load those numbers (1 -36) in an array and substitute each >> number for each variable until this is solved? I'm no genius, but here's a possible way to do it. It may not work for all equations, but seems to work for this one. The strategy is to take as many multiples (not exceeding the maximum, in this case 36) of the largest number out first, then subtract that from the total, then work on the next largest, and so on. The first step is to subtract at least 1 times each of the "factors" from the total, since none of the variables can be 0. The answer in this case is: 24 + 3*36 + 8*360 + 28*3600 + 17*129600 = 2307012 Here's a quick and dirty: my @factors = (1,36,360,3600,129600); my $target = 2307012; my @multipliers = (); my $max = 36; my $min = 1; # Assume each factor is multiplied by at least $min map {$target -= $min * $_} @factors; for my $factor (sort {$b <=> $a} @factors) { $mult = int($target/$factor); $mult = ($mult <= $max) ? $mult : $max; $target -= $mult * $factor; unshift @multipliers, $min + $mult; } # Show the list of multipliers @tmp = @multipliers; print join(' + ', (map {shift(@tmp) . "*$_"} @factors)); print "\n"; # Check our work my $foo = 0; map {$foo += $_ * shift @multipliers} @factors; print $foo; ~ -- Flanagan::Jim http://jimfl.tensegrity.net mailto:jimfl%40t%65ns%65gr%69ty.n%65t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From myocom at winse.microsoft.com Thu Jul 25 16:21:39 2002 From: myocom at winse.microsoft.com (Mark Yocom) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? (SPOILER) Message-ID: <8250BC4583B78C41B23CAD377CFB971B52C429@winse-msg-02.segroup.winse.corp.microsoft.com> This can be done iteratively rather than using just brute force. What you really have here is just a different counting system. Given: A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 Rewrite this as: 2307012 = 129600*E + 3600*D + 360*C + 36*B + A ...and it starts to look analogous to this sort of thing: 12345 = 10000*1 + 1000*2 + 100*3 + 10*4 + 1*5 This is easy to derive because we have a nice decimal system that has predictable columns like "ones", "tens", "hundreds", etc. In the case of this problem, though, we have columns of "ones", "thirty-sixes", "three-hundred sixties", "thirty-six hundreds", and "one hundred twenty-nine thousand six-hundreds" (phew!). So even though those are goofy columns, you can still solve it the same way: 2307012 = 129600*E + 3600*D + 360*C + 36*B + A int(2,307,012 / 129600) = 17, so E must be 17 (there are 17 129600's) 2307012 - 129600*17 = 103812 (our new total) 103812 = 3600*D + 360*C + 36*B + A int(103812 / 3600) = 28, so D must be 28 (there are 28 3600's) 103812 - 3600*28 = 3012 (new total) 3012 = 360*C + 36*B + A int(3012 / 360) = 8, so C must be 8 (there are 8 360's) 3012 - 360*8 = 132 (new total) 132 = 36*B + A int(132 / 36) = 3, so B must be 3 (there are 3 36's) 132 - 36*3 = 24 24 = A, and there you have it. A = 24 B = 3 C = 8 D = 28 E = 17 > -----Original Message----- > From: Pommert, Daniel [mailto:Daniel.Pommert@verizonwireless.com] > Sent: Thursday, July 25, 2002 12:43 PM > To: 'Orr, Chuck (NOC)'; 'spug-list@pm.org' > Subject: RE: SPUG: FW: Help..Any Math GENIUS out there? > > > This is an integer programming problem. But if you look at > it, you see that E can only be values from 1 through 17. You > don't care about the value of > A: it will be whatever it needs to be. So, you could do a > simple exhostive search for solutions by looping through the > 36 * 36 * 36 * 17 values of B, C, D, and E (respectively). > This shouldn't take more than a couple seconds of computer > time and could be written in under 20 lines of code. > > -- Daniel Pommert > Verizon Wireless > 425-603-8612 > > -----Original Message----- > From: Orr, Chuck (NOC) [mailto:chuck.orr@attws.com] > Sent: Thursday, July 25, 2002 10:51 AM > To: 'spug-list@pm.org' > Subject: SPUG: FW: Help..Any Math GENIUS out there? > > > > > > Hello, > > > > I am hoping to use Perl to solve an equation like the below: > > > > A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > > > > I know that each of the variables A - E is a whole number > in the range > > 1-36. > > > > Could I load those numbers (1 -36) in an array and substitute each > > number for each variable until this is solved? > > > > Any ideas would be greatly appreciated. > > > > > > Thanks, > > Chuck Orr > > AT&T Wireless Services > > 425 288 2386 > > chuck.orr@attws.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address For daily traffic, use spug-list for LIST ; > for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address For daily traffic, use spug-list for LIST ; > for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From mathin at mathin.com Thu Jul 25 16:20:37 2002 From: mathin at mathin.com (Dan Ebert) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? In-Reply-To: References: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> Message-ID: <1027632037.1326.35.camel@algernon.lan.enic.cc> On Thu, 2002-07-25 at 11:51, Yitzchak Scott-Thoennes wrote: > In article <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02>, > "Orr, Chuck (NOC)" wrote: > >> I am hoping to use Perl to solve an equation like the below: > >> > >> A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > >> > >> I know that each of the variables A - E is a whole number in the range > >> 1-36. > >> > >> Could I load those numbers (1 -36) in an array and substitute each number > >> for each variable until this is solved? > > You could (though an array is unneccessary). A slightly better > approach would be to compute A for all different combos of B,C,D,E and > see if it is valid (integer in 1-36). > > In your example, there appears to be a relationship between the coefficients > (1 (implied), 36, 360, 3600, 129600). If that is true in general, you can > solve it without going through all the combinations. For instance, you > can easily find E = 17 and A = 24 in the above, leaving you with: > > B + 10*C + 100*D = 2883 > OK, I see how you got E=17 ... less than that and the total cannot = 2,307,012 even if A,B,C, and D all = 36. if E > 17 the total will be too big even ig A,B,C, and D all = 1. How did you arrive at a=24? Thanks. > which has several solutions (by inspection, about 14). > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > -- Dan Ebert ---------------------------------------------------------- "If you're right 90% of the time, why quibble about the remaining 3%?" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From smorton at pobox.com Thu Jul 25 16:41:00 2002 From: smorton at pobox.com (Sanford Morton) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? In-Reply-To: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> Message-ID: If A always has a unit coefficient, then it looks like a factor with A the remainder. I haven't checked this: perl -e ' $e = int (2307012 / 129600); $e1 = 2307012 % 129600; $d = int ($e1 / 3600); $d1 = $e1 % 3600; $c = int ($d1 / 360); $c1 = $e1 % 360; $b = int ($c1 / 36); $a = $c1 % 36; print "$a $b $c $d $e \n"; ' On Thu, 25 Jul 2002, Orr, Chuck (NOC) wrote: > > > > Hello, > > > > I am hoping to use Perl to solve an equation like the below: > > > > A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > > > > I know that each of the variables A - E is a whole number in the range > > 1-36. > > > > Could I load those numbers (1 -36) in an array and substitute each number > > for each variable until this is solved? > > > > Any ideas would be greatly appreciated. > > > > > > Thanks, > > Chuck Orr > > AT&T Wireless Services > > 425 288 2386 > > chuck.orr@attws.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From chuck.orr at attws.com Thu Jul 25 16:51:22 2002 From: chuck.orr at attws.com (Orr, Chuck (NOC)) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: And The Winner is... Message-ID: <67AC2DB52118D411A8F300508B957F120A1F2C1F@WA-MSG02> Hello Everyone, Mark Yocom has provided the solution I needed. His approach was unique and fits my needs perfectly. I was overwhelmed with incredibly thought out and practical answers within minutes of sending my request. This is the first time I have sent out a request and I am very impressed with the results. Thank you all for your willingness to help out. Thanks, Chuck - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cansubaykan at hotmail.com Thu Jul 25 16:55:25 2002 From: cansubaykan at hotmail.com (Can Subaykan) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? Message-ID: How long did that take you to run? This was my first idea, I was going to do like this, but after I got an idea of how long this was going to take, I decided to control-C and wait for math PhD perl programmers to respond to the question. @a = @b = @c = @d = @e = (1..36); $sols=0; for $a (@a) { for $b (@b) { for $c (@c) { for $d (@d) { for $e (@e) { print "trying $a $b $c $d $e\t$sols solutions\n"; if ($a + 36*$b + 360*$c + 3600*$d + 129600*$e == 2307012) { print "A = $a, B = $b, C = $c, D = $d, E = $e\n"; $sols++; } } } } } } print "\n\n$sols solutions\n\n"; ----Original Message Follows---- From: "Duncan McGreggor" To: chuck.orr@attws.com CC: spug-list@pm.org Subject: Re: SPUG: FW: Help..Any Math GENIUS out there? Date: Thu, 25 Jul 2002 16:38:06 -0400 Man, it's been a really long time since linear algebra... but I think that since you don't have 5 equations (to go with your 5 vars), you can't solve it with a matrix... It's not a quad, cubic, etc., so you can't solve it with those methods... What about brute forcing it: for ($a=1;$a<=36;$a++) { $A=$a; for ($b=1;$b<=36;$b++) { $B=36*$b; for ($c=1;$c<=36;$c++) { $C=360*$c; for ($d=1;$d<=36;$d++) { $D=3600*$d; for ($e=1;$e<=36;$e++) { $E=129600*$e; if ( $A + $B + $C + $D + $E == 2307012 ) { print "found a solution:\n\t$a, $b, $c, $d, $e\n"; } } } } } } I don't know if my math is right, but I got the following results: found a solution: 24, 3, 8, 28, 17 found a solution: 24, 3, 18, 27, 17 found a solution: 24, 3, 28, 26, 17 found a solution: 24, 13, 7, 28, 17 found a solution: 24, 13, 17, 27, 17 found a solution: 24, 13, 27, 26, 17 found a solution: 24, 23, 6, 28, 17 found a solution: 24, 23, 16, 27, 17 found a solution: 24, 23, 26, 26, 17 found a solution: 24, 23, 36, 25, 17 found a solution: 24, 33, 5, 28, 17 found a solution: 24, 33, 15, 27, 17 found a solution: 24, 33, 25, 26, 17 found a solution: 24, 33, 35, 25, 17 Duncan -----Original Message----- From: "Orr, Chuck (NOC)" To: "'spug-list@pm.org'" Date: Thu, 25 Jul 2002 10:50:52 -0700 Subject: SPUG: FW: Help..Any Math GENIUS out there? > Hello, > > I am hoping to use Perl to solve an equation like the below: > > A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > > I know that each of the variables A - E is a whole number in the range > 1-36. > > Could I load those numbers (1 -36) in an array and substitute each number > for each variable until this is solved? > > Any ideas would be greatly appreciated. > > > Thanks, > Chuck Orr > AT&T Wireless Services > 425 288 2386 > chuck.orr@attws.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From kenslinux at shaw.ca Thu Jul 25 17:00:15 2002 From: kenslinux at shaw.ca (Ken Clarke) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Re: FW: Help..Any Math GENIUS out there? References: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> Message-ID: <008e01c23426$a88b53a0$94c54618@gv.shawcable.net> Cute little afternoon distraction. I used a brute force approach because I'd rather spend 2 minutes of computer time running the program than 20 minutes of my time determining and implementing a more elegant solution. There were 14 possible solutions. Here's your result set: A B C D E 24 3 8 28 17 24 3 18 27 17 24 3 28 26 17 24 13 7 28 17 24 13 17 27 17 24 13 27 26 17 24 23 6 28 17 24 23 16 27 17 24 23 26 26 17 24 23 36 25 17 24 33 5 28 17 24 33 15 27 17 24 33 25 26 17 24 33 35 25 17 >> Ken Clarke >> Contract Web Programmer / E-commerce Technologist >> www.perlprogrammer.net :: www.modperldev.com ----- Original Message ----- From: "Orr, Chuck (NOC)" To: Sent: July 25, 2002 10:50 AM Subject: SPUG: FW: Help..Any Math GENIUS out there? > > > > Hello, > > > > I am hoping to use Perl to solve an equation like the below: > > > > A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > > > > I know that each of the variables A - E is a whole number in the range > > 1-36. > > > > Could I load those numbers (1 -36) in an array and substitute each number > > for each variable until this is solved? > > > > Any ideas would be greatly appreciated. > > > > > > Thanks, > > Chuck Orr > > AT&T Wireless Services > > 425 288 2386 > > chuck.orr@attws.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From doug at beaver.net Thu Jul 25 17:02:16 2002 From: doug at beaver.net (Doug Beaver) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? In-Reply-To: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02>; from chuck.orr@attws.com on Thu, Jul 25, 2002 at 10:50:52AM -0700 References: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> Message-ID: <20020725180216.A57352@beaver.net> On Thu, Jul 25, 2002 at 10:50:52AM -0700, Orr, Chuck (NOC) wrote: > > > > Hello, > > > > I am hoping to use Perl to solve an equation like the below: > > > > A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 > > > > I know that each of the variables A - E is a whole number in the > > range 1-36. > > > > Could I load those numbers (1 -36) in an array and substitute each > > number for each variable until this is solved? > > > > Any ideas would be greatly appreciated. I would take a different approach from Daniel's. He is looking at the variables and reducing the number of moving parts in the calculation, but it's not a generic solution. Is the equation you mentioned the one you really want to solve or just an example? I'm assuming it's an example. You'll have a heck of a time writing code to do what Daniel is doing, he has the advantage of being a human and being able to understand algebraic expressions. Perl doesn't have either of those things working in it's favor. :-) I would suggest that you instead look on search.cpan.org and search for modules starting with Math::. Or perhaps there is an existing C/C++ library you can wrap with SWIG or XS to get the functionality into your perl scripts. I'm positive there are C/C++ libraries that already do this, and I wouldn't be surprised if there was a CPAN module that did so as well... This is moot if that is the only equation you want to solve and you're sure it will never change, but things rarely work out that way. Doug -- Space Ghost: Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. Moltar: Okay, but that's not the cd burner... Space Ghost: Moltar! Yes! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cwilkes-spug at ladro.com Thu Jul 25 17:09:08 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Math Geniuses In-Reply-To: <67AC2DB52118D411A8F300508B957F120A1F2C18@WA-MSG02>; from chuck.orr@attws.com on Thu, Jul 25, 2002 at 01:30:41PM -0700 References: <67AC2DB52118D411A8F300508B957F120A1F2C18@WA-MSG02> Message-ID: <20020725150908.A80603@www.ladro.com> On Thu, Jul 25, 2002 at 01:30:41PM -0700, Orr, Chuck (NOC) wrote: > > I need a unique solution for each of these > numbers, which is unattainable without more information (that I probably > can't get.) What you're doing is called a "Diophantine Equation" which is usually in the simple form of ax + by = c See http://mathworld.wolfram.com/DiophantineEquation.html for more info. However you've got it a little tougher as you have more than 2 variables on the left side. You can break it down into simplier equations, ie A + 36B + 360C + 3600D + 29600E = 2307012 becomes (since most of the left side is divisiable by 36): A + 36Q = 2307012 = 12 * 192251 = 12*(3*64084 - 1) = 36*64084 - 12 solving for the integer Q: Q = 64084 - (A+12)/36 For Q to be an integer the A+12/36 needs to be one as well. Since you said 0 <= integers <= 36 you find out that A = 24. Note: this isn't a constraint in the normal Diophantine equations. So you continue on from there with A = 24 and you get something like B + 10C + 100D + 3600E = 64083 and you continue on from there with the same style of equation: B + 10Q = 64083 = 6408*10 + 3 Finding out that B has to be 3,13,23, or 33 to satisfy Q being an integer. Its not so easy to continue on as you have 4 potential values for B, which then leads to 4*4 for C, etc. How to do this in perl? To me this looks like a tree where each branch (ie A=24 being a branch) then has another branch (B = 3,13,23,33) which will then have more branches. Eventually you'll get to the end with E and you'll see if it all adds up to your number. Maybe a hash like: $hash{A}{B}{C}{D}{E} = A + 36B + 360C + 3600D + 29600E would be the best way to model it. Its been a long time since I've looked at these equation so I could be wrong on the easiest way to solve them. That less than 36 constraint seems a little contrived to me too, how did that come up? Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cansubaykan at hotmail.com Thu Jul 25 17:25:14 2002 From: cansubaykan at hotmail.com (Can Subaykan) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: HASH help Message-ID: see if this model helps, if you need more info look at chapter 9 "data structures" in the camel book (3rd Ed) %people = ( john => {akas => [jack, johnny], pets => [bird, spider, coyote], talents => [eating, sleeping]}, jacko => {akas => [michael, mike, mikhail], pets => [elephant, llama, bubbles], talents => [singing, dancing, scandals]}, pres => {akas => [george, dubya, bush], pets => [dog, cat, horse], talents => [bombing, misspelling, choking]} ); print "john's first pet is $people{john}->{pets}->[0] \n"; # bird print "pres's second talent is $people{pres}->{talents}->[1] \n"; # misspelling ----Original Message Follows---- From: "Baker, Stephen M" To: "'spug-list@pm.org'" Subject: SPUG: HASH help Date: Thu, 25 Jul 2002 14:07:10 -0700 I need to make a multi-dimensional hash. The top level has "$user" as keys, and the values are references to another hash, hash2. Hash2 has "$item" as keys, and the values are references to an array. The array has any number of element in it... the goal being to be able to create a portable database wherein the following is possible: by specifying a user, you can look to see the various items associated with them, and then get specifics about any of those items... I need a starting point... I'm somewhat familiar with perl but if anyone could give me some direction that would be helpful. Stephen Baker Office: 253.371.4188 Intel Corporation Mobile: 253.678.0556 Intel Architecture Group Email: stephen.m.baker@intel.com Mail Stop DP3-307 2800 Center Dr. Dupont, WA 98327 **************************************************************************** ************** The information contained in this email are the opinions and views of the author(s), and are not on behalf of Intel unless specifically stated. **************************************************************************** ************** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ced at carios2.ca.boeing.com Thu Jul 25 17:12:39 2002 From: ced at carios2.ca.boeing.com (ced@carios2.ca.boeing.com) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: HASH help Message-ID: <200207252212.PAA09774@carios2.ca.boeing.com> To: spug-list@pm.org, stephen.m.baker@intel.com Subject: Re: SPUG: HASH help > I need to make a multi-dimensional hash. The top level has "$user" as keys, > and the values are references to another hash, hash2. Hash2 has "$item" as > keys, and the values are references to an array. The array has any number > of element in it... the goal being to be able to create a portable database > wherein the following is possible: > by specifying a user, you can look to see the various items > associated with them, and then get specifics about any of those items... > I need a starting point... I'm somewhat familiar with perl but if anyone > could give me some direction that would be helpful. You can get a feel for Perl data structures by looking at the docs (perllol, perldata, perlref for example). Most of the recommended books deal with this in depth. Here're a few specific items: my %people; .... # step 1: create an array ref. within the data structure $people{$user}{$item} = []; set up an anonymous array # step 2: populate above array push( @{ $people{$user}{$item} }, 'value1'; push( @{ $people{$user}{$item} }, 'value2'; # prettier alteratives for step 2: $people{$user}{$item}->[0] = 'value1'; $people{$user}{$item}->[1] = 'value1'; my @array = qw( value1 value2 ); $people{$user}{$item} = \@array; but, note, you could leave out 'step 1' altogether and Perl will create the array references for you at 'step 2'. Rgds, -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From chuck.orr at attws.com Thu Jul 25 17:52:45 2002 From: chuck.orr at attws.com (Orr, Chuck (NOC)) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Math Genius Message-ID: <67AC2DB52118D411A8F300508B957F120A1F2C26@WA-MSG02> Hello Everyone, This request has spurred a lot of interest. I have had a couple requests to post more information. So, here is the whole story: I have a magical unnamed box living far away that needs me to send it cell numbers. On my side, these cell "numbers" are actually five character alphanumerics. The far off box doesn't speak alphanumeric, it only wants digits. This dilemma was reached long ago, before my time. Despite the fact that this problem took place long ago when technology was primitive, they realized that Perl was the solution. So, some guy wrote a Perl Script to turn the five character alphanumerics into 7 digit numbers. Jumping to the present, It is critical that I know which of the 5 character alphanumeric is sending which digits where. Unfortunately, the spreadsheet housing such information has no reference to the 5 character alphanumeric. It is keyed on the 7 digit number. Bummer for me... So, I set out to undo the ancient script. The reason I need the unique answer is that only one combination can be "packed" back to the correct 5 character alphanumeric string. Mark Yocom provided the solution I needed by essentially figuring out the logic the first guy used to encode the string ( I think). In any case, I have been very impressed with everyone's responses and have probably learned more in this one day of reading email responses than in any other single day. (With the obvious exception of Dr. Tim Maher's Consultix Courses). I really appreciate everyone's interest and kindness. I received over 30 responses and no one made me feel the least bit stupid for asking this question (which I was hesitant to post). Thank You! Thanks, Chuck Orr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cel1 at ix.netcom.com Thu Jul 25 18:29:27 2002 From: cel1 at ix.netcom.com (cel1) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Math GENIUS topic Message-ID: <3D4089D7.33C8EC01@ix.netcom.com> The problem submitted by Chuck Orr falls under what is called Diophantine analysis, which includes equations with integral coefficients and integral values for the unknowns, like this one. In general, there are no analytic solutions which allow you to plug in coefficients and crank out results, after the fashion of (for example) the known solution to quadratic equations. Some Diophantine equations have one and only one solution, but in general this is not so. Writing a script to go through the possibilities is probably as good as you can do, and there were several responses showing how to do this, with one response actually exhibiting the multiple solutions possible for the problem as stated. I echo one piece of curiosity expressed by another of the responders: What is the problem domain? Curtis Lacy cel1@ix.netcom.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From chuck.orr at attws.com Thu Jul 25 18:53:56 2002 From: chuck.orr at attws.com (Orr, Chuck (NOC)) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Math Genius Message-ID: <67AC2DB52118D411A8F300508B957F120A1F2C28@WA-MSG02> OK, all I need to do now is PACK, (I think) a hexedecimal into an alphanumeric...I've read SAMS book on the subject, but no help yet. Thanks, Chuck -----Original Message----- From: Orr, Chuck (NOC) [mailto:chuck.orr@attws.com] Sent: Thursday, July 25, 2002 3:53 PM To: 'spug-list@pm.org' Subject: SPUG: Math Genius Hello Everyone, This request has spurred a lot of interest. I have had a couple requests to post more information. So, here is the whole story: I have a magical unnamed box living far away that needs me to send it cell numbers. On my side, these cell "numbers" are actually five character alphanumerics. The far off box doesn't speak alphanumeric, it only wants digits. This dilemma was reached long ago, before my time. Despite the fact that this problem took place long ago when technology was primitive, they realized that Perl was the solution. So, some guy wrote a Perl Script to turn the five character alphanumerics into 7 digit numbers. Jumping to the present, It is critical that I know which of the 5 character alphanumeric is sending which digits where. Unfortunately, the spreadsheet housing such information has no reference to the 5 character alphanumeric. It is keyed on the 7 digit number. Bummer for me... So, I set out to undo the ancient script. The reason I need the unique answer is that only one combination can be "packed" back to the correct 5 character alphanumeric string. Mark Yocom provided the solution I needed by essentially figuring out the logic the first guy used to encode the string ( I think). In any case, I have been very impressed with everyone's responses and have probably learned more in this one day of reading email responses than in any other single day. (With the obvious exception of Dr. Tim Maher's Consultix Courses). I really appreciate everyone's interest and kindness. I received over 30 responses and no one made me feel the least bit stupid for asking this question (which I was hesitant to post). Thank You! Thanks, Chuck Orr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From thasone at yahoo.com Thu Jul 25 19:12:41 2002 From: thasone at yahoo.com (c k) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Re: SPUG Talk Topics? In-Reply-To: <005301c23405$6223f640$17020202@c172974a> Message-ID: <20020726001241.73394.qmail@web21005.mail.yahoo.com> perl and bar codes? --- Chuck Langenberg wrote: > > > Dan said... > > > So what topics would people like to see > presentations on... > > > > Tim replied... > > I echo Dan's question... > > I reword Dan's question, "What do I want to hear > about?" > > Answer: 25% of the evening alloted to an open forum > in which > mere mortal users (the U in SPUG) are encouraged to > ask > questions & provide answers -- right out loud in > front of > everybody. Maybe a moderator could keep it moving & > on > topic. This informal forum would give participants a > heads > up on who to interact with at a break which follows. > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://seattleperl.org > __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From kenslinux at shaw.ca Thu Jul 25 20:00:06 2002 From: kenslinux at shaw.ca (Ken Clarke) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Re: Math Genius References: <67AC2DB52118D411A8F300508B957F120A1F2C26@WA-MSG02> Message-ID: <003401c2343f$c8bcde00$94c54618@gv.shawcable.net> ... So, I > set out to undo the ancient script. The reason I need the unique answer is > that only one combination can be "packed" back to the correct 5 character > alphanumeric string. Ahhh, that's what you mean by unique! Mark Yocom provided the solution I needed by > essentially figuring out the logic the first guy used to encode the string ( > I think). Red flag (the "I think" part :). Why don't you cut and paste the encoding portion of the script (assuming it doesn't contain sensitive or proprietary information) so that we can verify that Mark's algorithm chooses the correct one from the result set? After all, that one example produced 13 WRONG number combinations, and the fact that it got the example right may just be coincidental. >> Ken Clarke >> Contract Web Programmer / E-commerce Technologist >> www.perlprogrammer.net :: www.modperldev.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Thu Jul 25 20:51:48 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Math Genius In-Reply-To: <67AC2DB52118D411A8F300508B957F120A1F2C28@WA-MSG02> Message-ID: Uhh, yeah. I'm supposedly writing a tutorial on the use of the pack()/unpack() functions in Perl. But I'm taking my sweet time about it (I conveniently forget everything I know about it when I'm not using it). There is a new tutorial on pack()/unpack() included in the Perl 5.8.0 release written by Simon Cozens (who I'm told looks suspiciously like former ESPUG Emperor Erwin) and Wolfgang Laun. If you haven't made that particular jump (to 5.8), I have made it available in HTML format: http://perlocity.org/perlpacktut In response to your email (finally), I'm not sure I understand: You want to pack (convert) a hexadecimal (string) into an alphanumeric (string)? Or do you need to convert a hexadecimal string into its corresponding byte representation (which is what one normally does with pack())? $hexstring = "EFAECA"; $bytes = pack("H*", $hexstring); This is packed "high-nybble" first. The first byte output is 0xEF, then 0xAE instead of 0xFE, followed by 0xEA. If this isn't what you need, can you give an example of what you want to do? Like, print convert("ABCD") (a series of bytes representing a bit vector issues forth) pack() loves me pack() loves me not pack() loves me pack() loves me not pack() loves me pack() loves me not pack() loves me pack() loves me knot [sic] On Thu, 25 Jul 2002, Orr, Chuck (NOC) wrote: > OK, all I need to do now is PACK, (I think) a hexedecimal into an > alphanumeric...I've read SAMS book on the subject, but no help yet. -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From chuck.orr at attws.com Thu Jul 25 20:56:26 2002 From: chuck.orr at attws.com (Orr, Chuck (NOC)) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Math Genius Message-ID: <67AC2DB52118D411A8F300508B957F120A1F2C2E@WA-MSG02> Thanks for all the replies, I actually did not need pack or tr. The previous script writer had made up his own system where by 0-9 maintains its value and 10-35 become the letters A-Z respectively. A kind gentleman named David Dyck helped me out with the following suggestion: substr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", $_, 1) which worked like a charm. Thanks again to all, Chuck -----Original Message----- From: Andrew Sweger [mailto:andrew@sweger.net] Sent: Thursday, July 25, 2002 6:52 PM To: Orr, Chuck (NOC) Cc: Seattle Perl Users Group Subject: RE: SPUG: Math Genius Uhh, yeah. I'm supposedly writing a tutorial on the use of the pack()/unpack() functions in Perl. But I'm taking my sweet time about it (I conveniently forget everything I know about it when I'm not using it). There is a new tutorial on pack()/unpack() included in the Perl 5.8.0 release written by Simon Cozens (who I'm told looks suspiciously like former ESPUG Emperor Erwin) and Wolfgang Laun. If you haven't made that particular jump (to 5.8), I have made it available in HTML format: http://perlocity.org/perlpacktut In response to your email (finally), I'm not sure I understand: You want to pack (convert) a hexadecimal (string) into an alphanumeric (string)? Or do you need to convert a hexadecimal string into its corresponding byte representation (which is what one normally does with pack())? $hexstring = "EFAECA"; $bytes = pack("H*", $hexstring); This is packed "high-nybble" first. The first byte output is 0xEF, then 0xAE instead of 0xFE, followed by 0xEA. If this isn't what you need, can you give an example of what you want to do? Like, print convert("ABCD") (a series of bytes representing a bit vector issues forth) pack() loves me pack() loves me not pack() loves me pack() loves me not pack() loves me pack() loves me not pack() loves me pack() loves me knot [sic] On Thu, 25 Jul 2002, Orr, Chuck (NOC) wrote: > OK, all I need to do now is PACK, (I think) a hexedecimal into an > alphanumeric...I've read SAMS book on the subject, but no help yet. -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Thu Jul 25 19:19:18 2002 From: tim at consultix-inc.com (SPUG-list-owner) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Math Genius In-Reply-To: <67AC2DB52118D411A8F300508B957F120A1F2C26@WA-MSG02> References: <67AC2DB52118D411A8F300508B957F120A1F2C26@WA-MSG02> Message-ID: <20020725171918.B16648@timji.consultix.wa.com> On Thu, Jul 25, 2002 at 06:52:45PM -0400, Orr, Chuck (NOC) wrote: > Hello Everyone, > > This request has spurred a lot of interest. I have had a couple requests to > post more information. So, here is the whole story: > > ... have probably learned more in this one day of reading email responses > than in any other single day. (With the obvious exception of Dr. Tim > Maher's Consultix Courses). Thanks for the plug! 8-} FYI, this week I'm working on converting the U.S.A.F. in NC to using Perl for many of their military operations (could tell you more, but then I'd have to ... you know!), and they are totally awestruck at how cool Perl is, and how much money they will save on licensing fees for Excel, SAS, Oracle, etc. when they make the switch. So there's hope for the US Govt., and the war effort! 8-} > > I really appreciate everyone's interest and kindness. I received over > 30 responses and no one made me feel the least bit stupid for asking this > question (which I was hesitant to post). Thank You! > Chuck Orr Well, you're just confirming the validity of the old Klingon saying: If you want to be humiliated, castigated, and vanquished in the glory of open combat, post to comp.lang.perl.misc. If you want to be helped by anonymous hackers you'll never meet, post your problem to beginners.perl.org, or perlmonks.org. But if you want instant help from people you can actually shake hands with and buy beer for at the next SPUG meeting, post to the spug-list! Chuck, what you're discovering is that SPUGsters are the most awesome Perl practitioners on the planet! That's why we have over 400 people on our mailing list, compared to the relatively puny 30-80 of the other groups! Even *The Damian* reads our list! 8-} (albeit primarily for altruistic, not self-serving purposes). Please tell your managers over there at AT&T/WS how much SPUG rocks, and that they can help support SPUG by sponsoring some of our activities. My #1 priority at the moment is obtaining funds for plane-fare and hotel accommodations to support a proposed one-week visit by Mark-Jason Dominus to speak to us in September or October. The expected cost is around $1.5k, and the expected benefit is about $300 to each of the 70 people I expect to attend a single talk (and we'll probably have several), which comes to a $21,000 value! Not a bad bargain! Any companies that want to help in this effort, are invited to contact spug@seattle.perl.org for details! A free "sponsor acknowledgment" on the SPUG web-page is in it for you, along with an obvious mass transfusion of additional Perl knowledge to your employees! -Tim *==============================================================================* | Tim Maher, CEO, CONSULTIX (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX | | tim@consultix-inc.com teachmeunix.com teachmeperl.com teachmelinux.net | | 7/29:D'base w/Perl 8/19:UNIX 8/26:Perl Prog 9/18:Int Perl 9/23:Sh & Utils | *==============================================================================* ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at yahoo.com Fri Jul 26 01:22:17 2002 From: asimjalis at yahoo.com (Asim Jalis) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Math Genius In-Reply-To: Message-ID: <20020726062217.63513.qmail@web14206.mail.yahoo.com> > There is a new tutorial on pack()/unpack() > included in the Perl 5.8.0 release written by > Simon Cozens (who I'm told looks suspiciously > like former ESPUG Emperor Erwin) and Wolfgang > Laun. Also I have never seen all three of them together in the same room. The plot thickens. Asim __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From creede at penguinsinthenight.com Fri Jul 26 01:23:14 2002 From: creede at penguinsinthenight.com (Creede Lambard) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Math Genius In-Reply-To: <20020725171918.B16648@timji.consultix.wa.com> References: <67AC2DB52118D411A8F300508B957F120A1F2C26@WA-MSG02> <20020725171918.B16648@timji.consultix.wa.com> Message-ID: <1027664594.26983.106.camel@svetlana> > Please tell your managers over there at AT&T/WS how much SPUG rocks, > and that they can help support SPUG by sponsoring some of our activities. For that matter, they can help support SPUG by sponsoring jobs for some of its members, right? Heck, Tim, while you're illuminating the Air Force in the Way of the Camel you should definitely let them know where they can find its most proficient practicioners. :) -- * .~. `( --------------------------------------------------------- ` / V \ . Creede Lambard : Never rush a miracle man. /( )\ creede@penguinsinthenight.com : You get rotten miracles. ^^-^^ --------------------------------------------------------- Perl Programmer and Linux Sysadmin, reasonable rates. Inquire within. GPG key at http://www.penguinsinthenight.com/creede_public_key.asc -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: This is a digitally signed message part Url : http://mail.pm.org/archives/spug-list/attachments/20020725/7a21c419/attachment.bin From andrew at sweger.net Fri Jul 26 04:21:40 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: SPUG is on the map (of course) Message-ID: Even without the White Camel Award to Tim Maher this year at OSCON'02, SPUG has received significant mention several times during the conference. People from all around the world recognize SPUG as one of the oldest, largest, and most successful Perl User Groups. I've known this for years but I had no idea so many other people knew it. Case in point: I hung out with The Perl Foundation folks in a BOF session tonight. It was a discussion on organization and funding. Advocacy, training, and the relationship of the Perl Monger community to TPF kept coming up. The Perl Mongers form one of the backbones of the Perl community. Nathan Torkington raised SPUG as an example of how it should be done (but even London.pm does good things for Perl too!). Since I've been to just about every SPUG meeting ever (until recently), I pointed out that the reason SPUG is so successful is due in large part to Tim's extensive efforts to keep the group focussed and consistent (and stepping to the plate many, many times to share his (growing) knowledge of Perl). It's a great deal of work and personal investment (but hopefully no sacrifices). The Perl community will be turning to SPUG (and other PM's) to put together the manual on how to make and keep healthy Perl Monger groups around the world. Healthy Perl Mongers are one of the best ways to encourage the use of Perl and make people's lives easier (and possible). I know we've done this a few times in the past, but this is a topic that should be reviewed periodically. Please put forward the things you feel make SPUG work. What are we doing right? What is it about SPUG that makes you go to the meetings (besides location!)? What makes you keep reading this mailing list (the Math Genius thread may be an example)? And finally, would you pay $5.00 a month to continue being a member? I was about to say I'm kidding (cause it ain't legal). But I've changed my mind. I want you to really think about it. Do you get any personal value from Perl (does it make your work easier than the alternatives or maybe you simply enjoy the elegance of expressing your ideas in the Perl medium)? If you could see yourself dropping a fiver into the basket at each meeting or maybe when you've learned a better way to solve a problem, why not consider just rolling that into a check to The Perl Foundation for $50 each year. If you really get value for the effort, think about making sure this resource will be here tomorrow for everyone. I'm not asking anyone to go broke doing this. Perl is for everyone, even those who cannot or will not donate. You decide. If you have made donations (whether monetary, goods or services to the community), Thank You! If you want to help, your donation is tax-deductible (for now anyway, and it might not be someday if I have my way). For details, see the foundation's web site (below). There are several ways to donate. You may send a check made payable to "The Perl Foundation" addressed to: The Perl Foundation 170 College Avenue, Suite 230 Holland, Michigan USA 49423 You may also make contributions online securely using Visa, Mastercard, or American Express. A PayPal option will be coming soon I'm told. Please forgive the state of the web site. Dan Sugalski informed us that it is undergoing a much needed rewrite. One of the more requested changes is to clearly identify the relationships between (and history of) the various organizations involved (YAS, TPF, PM, etc.). The official web site is: http://perlfoundation.org/ Thank you for listening. -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Fri Jul 26 11:17:47 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: FW: Help..Any Math GENIUS out there? References: <67AC2DB52118D411A8F300508B957F120A1F2C0B@WA-MSG02> Message-ID: In article , sthoenna@efn.org (Yitzchak Scott-Thoennes) wrote: >>> A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012 >>> >>> I know that each of the variables A - E is a whole number in the range >>> 1-36. >In your example, there appears to be a relationship between the coefficients >(1 (implied), 36, 360, 3600, 129600). If that is true in general, you can >solve it without going through all the combinations. For instance, you >can easily find E = 17 and A = 24 in the above, leaving you with: > >B + 10*C + 100*D = 2883 > >which has several solutions (by inspection, about 14). I got several requests for explanation. You can solve for E by doing 2307012/129600, since even with maximum values, A+36*B+360*C+3600*D is much less than 129600. (This also means many numbers will have no solutions). Then, since the coefficients of B-E are multiples of 36, A is the remainder from 2307012/36, or 36 if there is no remainder. >From the simplified equation in B,C, and D, you can see that the last digit of B is 3, so B is one of 3,13,23,33. Substituting each of these leads to an equation C+10*D=X, where the last digit of C is the same as the last digit of X, giving 4 solutions for C if X ends in 1..6 and 3 solutions otherwise. Total number of solutions is (solutions for B) times (avg solutions for C for a given B), or about 14. Here is Perl code to apply the above to any answer: ================ use strict; use warnings; # solve A + 36*B + 360*C + 3600*D + 129600*E = F # for integral A-E in 1..36 my ($A, $B, $C, $D, $E, $F, $tmp, $tmp2, @F); chomp(@F = ); # read in sample data and remove newlines for $F (@F) { # 129600 is greater than all the other terms, even if A-D are all 36, so # we can just integer-divide to get E $E = do { use integer; $F/129600 }; $tmp = $F-$E*129600; $A = $tmp % 36 || 36; # all other terms are divisible by 36, so A must be $tmp -= $A; # the remainder of $tmp/36, or 36 if no remainder $tmp /= 36; # remove common factor of 36 # Now we have a reduced equation to solve: # $B + 10 * $C + 100 * $D == $tmp # since the coefficients of C and D are multiples of 10, # the last digit of $tmp is the same as the last digit of B, # so loop through all B's that have matching last digit TRY_B: for ($B = $tmp % 10 || 10; $B <= 36; $B += 10) { $tmp2 = ($tmp - $B) / 10; # now, $C + 10 * $D == $tmp2 # same as above. last digit of $tmp2 is same as # last digit of C. for ($C = $tmp2 % 10 || 10; $C <= 36; $C += 10) { # does that leave us with an acceptable D? $D = ($tmp2 - $C) / 10; if ($D > 0 && $D <= 36) { print "$A + 36*$B + 360*$C + 3600*$D + 129600*$E == $F\n"; # last TRY_B; # uncomment to generate only one solution } } } } __DATA__ 1393940 1983444 2307012 2934888 3072934 3930488 ================ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Fri Jul 26 11:44:37 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Re: Math Genius References: <67AC2DB52118D411A8F300508B957F120A1F2C26@WA-MSG02> <003401c2343f$c8bcde00$94c54618@gv.shawcable.net> Message-ID: <1xXQ9gzkgGbZ092yn@efn.org> In article <003401c2343f$c8bcde00$94c54618@gv.shawcable.net>, Ken Clarke wrote: >... So, I >> set out to undo the ancient script. The reason I need the unique answer >is >> that only one combination can be "packed" back to the correct 5 character >> alphanumeric string. > > Ahhh, that's what you mean by unique! > > Mark Yocom provided the solution I needed by >> essentially figuring out the logic the first guy used to encode the string >( >> I think). > > Red flag (the "I think" part :). Why don't you cut and paste the >encoding portion of the script (assuming it doesn't contain sensitive or >proprietary information) so that we can verify that Mark's algorithm chooses >the correct one from the result set? After all, that one example produced >13 WRONG number combinations, and the fact that it got the example right may >just be coincidental. I think that algorithm will always give the solution that has B and C as digits, not letters. If this is known to be always the case, the algorithm is ok. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Fri Jul 26 15:33:35 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Beating a dead snake Message-ID: Bashing snakes has been a favorite pastime here at the conference (and a fair amount of camel bashing, but no bash bashing). I just wanted to add to my last message. Before you send your hard earned money in donation to The Perl Foundation, please check with your employer. Some will match donations to 501(c)(3) non-profit organizations. TPF is incorporated in Holland, Michigan. Some employers may limit matching donations by amount, geography, or other criteria. Remember, it never hurts to ask (uh, usually). -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Sat Jul 27 00:38:17 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: "The syntax don't enter into it. It's stone dead." Message-ID: The following is an adaptation of a "Python" script about a dead Parrot. I pieced it together (and made minor edits) from a few postings on Slashdot's scripting language poll. Apologies if you have seen it a million times already. http://slashdot.org/comments.pl?sid=36818&cid=3960391 "I wish to complain about this scripting language what I purchased not half an hour ago from this very boutique..." "It's not dead, it's just sleeping." "All right, then if it's resting, I'll wake it up! HELLO MR. POLLY PARROT! I'VE GOT A NICE FRESH ASSEMBLER FOR YOU IF YOU--" "There, it called a method!" "No it didn't! That was you executing bytecode!" "I never!" "You did! I saw you hit the hot key!" "Look, if I hadn't have executed that byte code to slow it down, that script would have loaded into memory, jumped into the interpreter, and VROOM!!! ... finished before you even saw it start" "VROOM???" "yes VROOM.." "Look Matey, that PARROT script wouldn't VROOM on ASCII WHITE! It's bleeding demised!!!" "NO NO it's sleeping" "It's not sleeping it's stuck on line 1... ?? This script is no more... ?? It has ceased to be... ?? It's expired and gone to meet the recycle bin... ?? It's a like Microsoft product... ?? Bereft of life, it rests in peace, if you hadn't executed that byte code it'd be at 0% processor usage. ?? It's off the process list... ?? It's shuffled off ps -ef... ?? It's run down /dev/null and joined the bleeding choir invisible... ?? (looks at script) It f---ing blue screened. (hits CTRL-ALT-DEL repeatedly) ?? It's off the job queue, (picks up mouse and starts banging it on the keyboard with each statement being said) ?? It's had its lot, ?? All statements to the effect that this script is still a going concern are for now on inoperative, ?? This is an EX PARROT!!!" (drops keyboard and mouse in trash can) ... Enjoy wisely. And if you haven't seen Parrot, the new VM behind Perl 6 and just about everything else, check out http://dev.perl.org/ Three cheers for Dan and Leon, et al, for our dead parrot. Long live parrot! -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dwainef at earthlink.net Sat Jul 27 18:06:48 2002 From: dwainef at earthlink.net (Dwaine Felch) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Compiling Perl5.8.0 for Windows XP Message-ID: <000801c235c2$4926c3c0$0200a8c0@angie1> About a week ago I asked about compiling the source code to use on Windows; it works! Thank you very, very much to the fellow that replied with directions on how to do it, I don't have the mail he Sent so I don't have his name. Here is how to do it in detail with Visual Studio 6.0: 1) Remove the spaces in the pathnames for the build environment and add one or two as listed in Makefile. 2) Cd to c:\perl5.8.0\win32 3) Read perlwin32.html and edit the Makefile with what it says; about three or four things usually just uncommenting. 4) From a cmd prompt type: VCVARS32.BAT 5) Type: nmake 6) Type: nmake test 7) Type: nmake install 8) Add environment path to perl. 9) Associate an icon of your choosing with .pl files. It works very well I have not detected any problems at all! Thanks, Dwaine -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020727/485e95a7/attachment.htm From stephen.m.baker at intel.com Mon Jul 29 15:44:49 2002 From: stephen.m.baker at intel.com (Baker, Stephen M) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: reg exp generator Message-ID: <288F9BF66CD9D5118DF400508B68C446020DA683@orsmsx113.jf.intel.com> I have a program needing with the following array: @LINES = qw( #any line from file here ); That at the present time I want to do the following: foreach $line (@LINES){ $line =~ s/$line/$CONSTANT_MOD_LINE/ } The goal is that a user can put a line from an output file into the array, and my program will take the line and essentially comment out any lines in all files that contain the user's selected line... however, my original idea was to do this using regular expressions and since some lines have a or multiple period(s) or asteric(s) the reg exp is giving me some trouble... any ideas on how to change ordinary text, especially periods and asterics into reg exp friendly characters? Stephen Baker Office: 253.371.4188 Intel Corporation Mobile: 253.678.0556 Intel Architecture Group Email: stephen.m.baker@intel.com Mail Stop DP3-307 2800 Center Dr. Dupont, WA 98327 **************************************************************************** ************** The information contained in this email are the opinions and views of the author(s), and are not on behalf of Intel unless specifically stated. **************************************************************************** ************** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From bjturner at mac.com Mon Jul 29 16:17:56 2002 From: bjturner at mac.com (Benjamin Turner) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: reg exp generator In-Reply-To: <288F9BF66CD9D5118DF400508B68C446020DA683@orsmsx113.jf.intel.com> Message-ID: On Monday, July 29, 2002, at 01:44 PM, Baker, Stephen M wrote: > > I have a program needing with the following array: > > @LINES = qw( #any line from file here > > ); > > That at the present time I want to do the following: > > foreach $line (@LINES){ > $line =~ s/$line/$CONSTANT_MOD_LINE/ > } > > The goal is that a user can put a line from an output file into > the array, > and my program will take the line and essentially comment out > any lines in > all files that contain the user's selected line... however, my > original idea > was to do this using regular expressions and since some lines have a or > multiple period(s) or asteric(s) the reg exp is giving me some > trouble... > any ideas on how to change ordinary text, especially periods > and asterics > into reg exp friendly characters? You want your regexp line to look like this: $line =~ s/\Q$line\E/$CONSTANT_MOD_LINE/; The \Q...\E will regexp-escape all regexp-special characters between them. This should be documented in 'perldoc perlre' if you need further explanation. Ben -- Benjamin John Turner | bjturner@bigfoot.com http://www.usfca.edu/turner/ | bjturner@mac.com "The happiest of people don't necessarily have the best of everything; they just make the most of everything that comes along their way." - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Wed Jul 31 23:05:09 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:09:05 2004 Subject: SPUG: Beating a dead snake In-Reply-To: References: Message-ID: Andrew Sweger writes: [...] > Some employers may limit matching donations by amount, geography, or > other criteria. Remember, it never hurts to ask (uh, usually). I've applied this logic to much benefit: You can't hear "yes" if you don't ask!!! It's amazing how often the world suprises me with it's generosity in this respect. -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org