From dora.raymaker at xo.com Tue Oct 1 14:10:54 2002 From: dora.raymaker at xo.com (Raymaker, Dora) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] new elist for programming technique study stuff Message-ID: <45EDA71CFF25D411A2E400508B6FC52A0A53D8E8@orportexch1.internal.nextlink.net> Hello all, the following list is now set up so that we can organize & argue about the technique/review study group in a more appropriate forum: http://mail.patch.com/mailman/listinfo/pdxpm-study Thanks to Mike for providing the list! (still waiting to hear about the conference room - HR tells me that she'll bug people if she doesn't hear back today) -D. From chromatic at wgz.org Tue Oct 1 14:38:11 2002 From: chromatic at wgz.org (chromatic) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Reading Group Publicity Message-ID: <200210011238.11752.chromatic@wgz.org> Hi all, I really like Dora's idea for the reading group. I like it so much, I wrote a weblog about it: http://www.oreillynet.com/pub/wlg/2083 Hopefully, it'll spark some interest in others. Best, -- c From ckuskie at dalsemi.com Tue Oct 1 17:11:49 2002 From: ckuskie at dalsemi.com (Colin Kuskie) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Reading Group Publicity In-Reply-To: <200210011238.11752.chromatic@wgz.org> References: <200210011238.11752.chromatic@wgz.org> Message-ID: <20021001221149.GA4166@dalsemi.com> On Tue, Oct 01, 2002 at 12:38:11PM -0700, chromatic wrote: > Hi all, > > I really like Dora's idea for the reading group. I like it so much, I wrote a > weblog about it: > > http://www.oreillynet.com/pub/wlg/2083 > > Hopefully, it'll spark some interest in others. Has anyone else seen this when trying to go O'Reilly Network? "This site is no longer available. However, we have good news for you! " I get it at www.oreillynet.com, but not at chromatic's link, and to www.oreilly.com Maybe someone should give Ask a holler. Colin From ckuskie at dalsemi.com Tue Oct 1 17:59:17 2002 From: ckuskie at dalsemi.com (Colin Kuskie) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Reading Group Publicity In-Reply-To: <20021001153533.A23767@patch.com> References: <200210011238.11752.chromatic@wgz.org> <20021001221149.GA4166@dalsemi.com> <20021001153533.A23767@patch.com> Message-ID: <20021001225917.GC4166@dalsemi.com> On Tue, Oct 01, 2002 at 03:35:33PM -0700, mikeraz@PATCH.COM wrote: > On Tue, Oct 01, 2002 at 03:11:49PM -0700, Colin Kuskie typed: > > > http://www.oreillynet.com/pub/wlg/2083 > > Has anyone else seen this when trying to go O'Reilly Network? > > > > "This site is no longer available. > > However, we have good news for you! " > > Pops right up for me. > Just did it again to confirm. Must be something on my end. I quit and restarted the browser, cleared both caches, set it to validate "Every Time". Maybe our company proxy is having problems. Colin From merlyn at stonehenge.com Tue Oct 1 18:13:12 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Reading Group Publicity In-Reply-To: <20021001221149.GA4166@dalsemi.com> References: <200210011238.11752.chromatic@wgz.org> <20021001221149.GA4166@dalsemi.com> Message-ID: <863crp3g8n.fsf@red.stonehenge.com> >>>>> "Colin" == Colin Kuskie writes: Colin> Has anyone else seen this when trying to go O'Reilly Network? Colin> "This site is no longer available. Colin> However, we have good news for you! " Colin> I get it at www.oreillynet.com, but not at chromatic's link, Colin> and to www.oreilly.com I don't see it at either place. How new is your browser? Are you going through a proxy of some kind? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From ckuskie at dalsemi.com Tue Oct 1 18:36:00 2002 From: ckuskie at dalsemi.com (Colin Kuskie) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Reading Group Publicity In-Reply-To: <863crp3g8n.fsf@red.stonehenge.com> References: <200210011238.11752.chromatic@wgz.org> <20021001221149.GA4166@dalsemi.com> <863crp3g8n.fsf@red.stonehenge.com> Message-ID: <20021001233600.GE4166@dalsemi.com> On Tue, Oct 01, 2002 at 04:13:12PM -0700, Randal L. Schwartz wrote: > >>>>> "Colin" == Colin Kuskie writes: > > Colin> Has anyone else seen this when trying to go O'Reilly Network? > > Colin> "This site is no longer available. > Colin> However, we have good news for you! " > > Colin> I get it at www.oreillynet.com, but not at chromatic's link, > Colin> and to www.oreilly.com > > I don't see it at either place. How new is your browser? Are > you going through a proxy of some kind? I have 3 strikes against me: Netscape 4.75 and a proxy which isn't well maintained, our network doesn't have 1 9 of uptime (it's usually down at least a day per week) Take now, for example. Which is why you aren't getting this when I wrote it. Colin From cp at onsitetech.com Wed Oct 2 11:39:57 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Next meeting References: <200210011238.11752.chromatic@wgz.org> <20021001221149.GA4166@dalsemi.com> <863crp3g8n.fsf@red.stonehenge.com> <20021001233600.GE4166@dalsemi.com> Message-ID: <001d01c26a32$57fc0b40$1a01a8c0@ot.onsitetech.com> Hi all, The next meeting is ready to go. The details are at http://portland.pm.org/. Allison Randal, of the Perl 6 designers, will be giving a talk on Perl 6 "topics" and "topicalizers". Here's a chance to learn even more about the new language and impress your friends with your knowledge :) -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! From wwalker at bybent.com Tue Oct 8 20:15:49 2002 From: wwalker at bybent.com (Wayne Walker) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Testing, please ignore Message-ID: <20021009011549.GC31653@bybent.com> Just testing, please ignore. -- Wayne Walker From cp at onsitetech.com Tue Oct 8 11:49:48 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Head count? References: <200210011238.11752.chromatic@wgz.org><20021001221149.GA4166@dalsemi.com> <863crp3g8n.fsf@red.stonehenge.com> Message-ID: <003301c26eea$b6e41a00$1a01a8c0@ot.onsitetech.com> Hi all, As you know about the meeting tomorrow, I won't remind you :), but I was wondering if I could get a tentative headcount. If you don't reply to this, you're still invited, but we're trying to get a better idea of the number of chairs to rent. We frequently have twice as much as we need, but I imagine that tomorrow might be a popular meeting. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! From cp at onsitetech.com Tue Oct 8 17:17:39 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Help a high school teacher teach Perl References: <200210011238.11752.chromatic@wgz.org> <20021001221149.GA4166@dalsemi.com> Message-ID: <000c01c26f18$83fbca10$1a01a8c0@ot.onsitetech.com> Hi all, I've done a bit of work helping a local (Canby?) high school teacher set up a Perl class. Unfortunately, due to some other things that I need to take care of, I simply don't have the time to help him that he needs. A bit of background is at http://www.perlmonks.org/index.pl?node_id=190792. He needs help, he didn't know any Perl before the class started, and if anyone has some spare time and would volunteer to help him, that would be great. The stronger your Perl *and* communication skills, the better. He's primarily looking for someone to review his lesson packets and offer suggestions to help his class. If you're interested, let me know (off list). Other info about this can be found at my journal: http://use.perl.org/~Ovid/journal/7188 http://use.perl.org/~Ovid/journal/7330 -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! From cp at onsitetech.com Wed Oct 9 11:17:33 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Meeting Time. Important! References: <200210011238.11752.chromatic@wgz.org><20021001221149.GA4166@dalsemi.com> <863crp3g8n.fsf@red.stonehenge.com> <003301c26eea$b6e41a00$1a01a8c0@ot.onsitetech.com> Message-ID: <001901c26faf$5fe35890$1a01a8c0@ot.onsitetech.com> There appear to have been some problems with the list email. I sent an email yesterday which referred to "tomorrow's" meeting. However, mail.pm.org did not receive it until this morning. The meeting is TONIGHT!! I've already received confirmation from some people that they will be here tomorrow instead of tonight. The headers of the email show that it was sent out yesterday, but the pm mailing list didn't receive it until this morning. I contacted the list administrator yesterday and he was looking into the problem. It appears to have been resolved. Sorry for any confusion. -- Cheers, Curtis Poe For the curious: Received: from mail.pm.org (localhost [127.0.0.1]) by mail.pm.org (8.11.6/8.11.3) with ESMTP id g997NJ309784; Wed, 9 Oct 2002 02:23:19 -0500 Received: from otserver.onsitetech.com ([207.189.100.164]) by mail.pm.org (8.11.6/8.11.3) with ESMTP id g98GoqA02012 for ; Tue, 8 Oct 2002 11:50:53 -0500 Received: from OTd1 (unverified [66.89.133.66]) by otserver.onsitetech.com (Rockliffe SMTPRA 4.5.6) with ESMTP id for ; Tue, 8 Oct 2002 09:33:41 -0700 From rb-pdx-pm at redcat.com Thu Oct 10 01:05:27 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Puzzle discussion In-Reply-To: <003301c26eea$b6e41a00$1a01a8c0@ot.onsitetech.com> Message-ID: Blame it on Ovid: Some of us were discussing these puzzles (and the program which randomly generates them for me) before tonight's meeting. For anyone who is interested, a few sample puzzles and the explanation of how to play are available here: http://www.redcat.com/puzzles.pdf I'd like to fix up my output routines to directly output PostScript (or Acrobat, really) so that the diagrams will have real lines instead of punctuation. But this will do for now. Follow-up discussion, if any, should probably not go to this list unless it's more on-topic than this message is. :-) --Tom From cp at onsitetech.com Thu Oct 10 10:18:34 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Wednesday night's meeting References: Message-ID: <00db01c27070$4ce3f0d0$1a01a8c0@ot.onsitetech.com> Well, one would think that I would learn not to refer to days in relative terms when it comes to email, particularly to this list. Assuming that most of you received this email roughly when I did, then some might be led to believe that the meeting is "tonight", Thursday, October 10. It was last night, Wednesday, October 9. Given that a few emails appear to have been sent *after* the meeting, I am hoping that the email problems with pm.org have been cleared up. I suppose I'll find out if I don't see this show up for a few hours. If you don't get this email, let me know ;) If you weren't there last night (see first paragraph :), you missed a great presentation by Allison Randal. It was a humorous way of explaining to mortals like myself what topics and topicalizers in Perl 6 are (will be?). Every time I look at something in Perl 6, my head spins. Then when I start to pay attention (a rarity, at the best of times), I am shocked at how simple it really is. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! From wwalker at bybent.com Thu Oct 10 21:39:30 2002 From: wwalker at bybent.com (Wayne Walker) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Testing, please reply Message-ID: <20021011023930.GP7451@bybent.com> Just seeing how long it takes this one to get to people. Anyone who wants to can reply to me (wwalker@bybent.com). That'll give me an idea of how fast things are going out now. -- Wayne Walker From lemming at attbi.com Thu Oct 10 22:07:10 2002 From: lemming at attbi.com (lemming@attbi.com) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Testing, please reply Message-ID: <20021011030710.LZMM4193.rwcrmhc51.attbi.com@rwcrwbc55> Howdy > > Just seeing how long it takes this one to get to people. > > Anyone who wants to can reply to me (wwalker@bybent.com). That'll give > me an idea of how fast things are going out now. > > -- > > Wayne Walker > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@mail.pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list From tex at off.org Thu Oct 10 22:53:20 2002 From: tex at off.org (Austin Schutz) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Testing, please reply In-Reply-To: <20021011030710.LZMM4193.rwcrmhc51.attbi.com@rwcrwbc55>; from lemming@attbi.com on Fri, Oct 11, 2002 at 03:07:10AM +0000 References: <20021011030710.LZMM4193.rwcrmhc51.attbi.com@rwcrwbc55> Message-ID: <20021010205320.H1081@gblx.net> On Fri, Oct 11, 2002 at 03:07:10AM +0000, lemming@attbi.com wrote: > Howdy > > > > Just seeing how long it takes this one to get to people. > > > > Anyone who wants to can reply to me (wwalker@bybent.com). That'll give > > me an idea of how fast things are going out now. > > >From pdx-pm-list-admin@mail.pm.org Thu Oct 10 20:09:51 2002 Return-Path: Received: from mail.pm.org (mail.pm.org [64.49.222.22]) by peace.off.org (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id g9B39oD141 85 for ; Thu, 10 Oct 2002 20:09:51 -0700 Moo. Austin From tcaine at eli.net Mon Oct 14 10:52:05 2002 From: tcaine at eli.net (Todd Caine) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Perl Quiz of the Week Message-ID: <20021014155205.GB26090@eli.net> This message was posted to ny.pm this weekend. >From MJD: > >I taught a class in Illinois last week, and one of the students asked >if there was a mailing list that would deliver a weekly Perl quiz or >programming puzzle. I said I didn't know of one, but that it sounded >like a good idea, and that I would set one up when I got back. > >I am now back. If you want to get the quiz-of-the-week, send a note >to > > perl-qotw-subscribe@plover.com > > >Please feel free to circulate this announcement to appropriate venues. > >Thanks. From creelan at engr.orst.edu Wed Oct 16 20:11:50 2002 From: creelan at engr.orst.edu (Tyler F. Creelan) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] RE: [Pdx-pm] Software development and The Rules In-Reply-To: <20020925133423.N2465@gblx.net> Message-ID: > Of course, there's still some point where you have to wonder. > A modern pentium 4 processes what, 2.5 billion instructions per second? > If it takes Windows two minutes to boot, how many of the billions of > instructions were pure bloat? > Most of the boot-up sequence consists of loading pages into memory from disk or initializing devices, so the cpu is largely idle. Hence, Window's two minute (or 5+ minutes in some cases) boot time derives more from the extra time needed to read bloated code off the disk than execute it. :) Interestly enough, MS is trying to address the problem in new versions of Windows with "informed prefetching" - storing the page fault sequence and throwing it deterministically on every boot. You'd think programmer time would be better spent making the initialization sequence more modular, reducing the need for frequent reboots like unix-based systems. Instead, they just try to make it reboot faster. :) Tyler ----------------------------- Tyler F. Creelan College of Engineering Oregon State University 503-640-3101 ----------------------------- On Wed, 25 Sep 2002, Austin Schutz wrote: > > For example: > > > > Q: What's the fastest, most space-efficient way to sort all > > of Portland's 503 phone numbers? > > > > for(@numbers) { > s/[^\d]//g; > } > > @sorted = sort { $a <=> $b }(@numbers); > > Oh, you meant fast and small for the computer. Does it matter? > Most of the time optimal solutions are ones that are easy to > write, unless you have a specific need for performance. > > Of course, there's still some point where you have to wonder. > A modern pentium 4 processes what, 2.5 billion instructions per second? > If it takes Windows two minutes to boot, how many of the billions of > instructions were pure bloat? > > Austin > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@mail.pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > From creelan at engr.orst.edu Wed Oct 16 20:12:14 2002 From: creelan at engr.orst.edu (Tyler F. Creelan) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] [SOLUTION] Telephone number sorting In-Reply-To: <20020927235302.GM28192@eli.net> Message-ID: On Fri, 27 Sep 2002, Joshua Keroes wrote: > > Q: What's the fastest, most space-efficient way to sort all > > of Portland's 503 phone numbers? > e.g. To indicate that telephone number 555-1234 is in use, turn the > 5,551,234th bit on. Just a heads up - The overhead of packing and unpacking sub-word quantities makes this approach less efficient than it might appear. Modern architectures have a large datapath and referencing individual bits will introduce additional work. This is reflected in how, for example, booleans are represented with 32-bit variables in Java and C++ implementations. More info: M. Stephenson and J. Babb and S. Amarasinghe. Bitwidth Analysis with Application to Silicon Compilation. In Proceedings of the SIGPLAN conference on Programming Language Design and Implementation, Vancouver, British Columbia, June 2000. Tyler ----------------------------- Tyler F. Creelan College of Engineering Oregon State University 503-640-3101 ----------------------------- On Fri, 27 Sep 2002, Joshua Keroes wrote: > > Q: What's the fastest, most space-efficient way to sort all > > of Portland's 503 phone numbers? > > A: Use a bit vector. To allocate enough space for all > 10,000,000 numbers, allocate 10,000,000 bits. [1] > > To signify that a telephone number is in use, turn the bit on. > > e.g. to indicate that the number 411 is in use, turn the 411th bit on. > > e.g. To indicate that telephone number 555-1234 is in use, turn the > 5,551,234th bit on. > > This makes sorting very easy: we don't *have* to sort anything, we just > iterate through all of the bits, printing the index if the bit is turned > on. > > I implemented this with Bit::Vector, a C-Perl hybrid module. You can > play with the code, I'll put it up for grabs at http://ua.sez.hellyeah.org/perl/ > > -Joshua > > [1] Actually, the computer will take a little bit more, to make it > align with the computer's word-byte boundary. > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@mail.pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > From bprew at logiccloud.com Tue Oct 22 23:36:52 2002 From: bprew at logiccloud.com (Benjamin Prew) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] [OT] weightlifting partner in portland/vancouver area Message-ID: <1035347813.640.12.camel@laptop> Hey, I know this is /way/ off-topic, but I'm looking for a workout partner in the area. I currently go to the Y, but I would be willing to switch to a different gym. I would like to workout at least twice a week, preferably before or after work. I'm not real big, but I'm motivated. Thanks -- Ben http://www.logiccloud.com bprew (at) logiccloud.com From rb-pdx-pm at redcat.com Wed Oct 23 20:53:36 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] [OT] Chrononauts and Perl programming clinic In-Reply-To: <1035347813.640.12.camel@laptop> Message-ID: Here's another off-topic message. Particularly sensitive subscribers should probably filter all list messages with [OT] in the subject.... I'm looking to get together with other Perl folks (or anyone else who is interested) for a game or two of Chrononauts. It's a time-travel card game without much strategy or stress; if you ever enjoyed a time-travel SF story or watched more than one Back To The Future movie, or if you just wanted to see what would happen if JFK hadn't been assassinated, you'll probably have fun with it. http://www.wunderland.com/LooneyLabs/Chrononauts/ PDX-Perl connection: I learned about Chrononauts from Schwern, last month at YAPC::Europe. So as to make this at least a little more Perl-related, this event will also be a Perl programming clinic. Bring along a printout (or laptop) and someone will help you improve your program. Guaranteed, or your code will be cheerfully returned to you. Beginners and experts welcome; experts get to help everyone else while I play Chrononauts. It will happen tomorrow (Thursday) evening, the 24th, starting at about 6 PM, at a pub/restaurant somewhere in downtown Portland. But it won't happen if I don't hear from at least one person who is willing to try Chrononauts! Let me know (by private e-mail to , not to the list) before 3:00 PM that you're coming, even if you don't want to play the game, and I'll send you the location if it's a go. Okay, if nobody wants to play Chrononauts, I'll do the clinic anyway. But I'll be grumpy about it. You'll see. --Tom Phoenix From cp at onsitetech.com Thu Oct 24 14:41:27 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] [OT] Chrononauts and Perl programming clinic References: Message-ID: <006901c27b95$582887f0$1a01a8c0@ot.onsitetech.com> Regrettably, I will not be able to make it the clinic tonight (but if another one is held and there is a bit more notice, I might even be persuaded to try Chrononauts :) In the meantime, if you would like to have your Perl brains stretched, check out http://perl.plover.com/book/. This is information on Mark-Jason Dominus' Perl Advanced Techniques Handbook. If you subscribe to the mailing list, you get a link to his current "work in progress" sample chapter. Right now, he's doing some nifty stuff with iterators that has led me to create some code to generate Fibonacci numbers. If you create a Fibonacci series (f(n) = f(n-1) + f(n-2) -- 1,1,2,3,5,8,13 ... etc), as you get further along the series, you find that f(n) / f(n-1) gets fairly close to 1.618034, which is roughly the Fibonaccci number. Of the many curious properties about this number, this number (you can do a search on google), you discover that 1 / f(n) = f(n) - 1 (roughly 0.618034) And f(n) * f(n) = f(n) + 1 (roughly 2.618034) In other words, the number after the decimal point doesn't change. In the following code, I have an iterator that produces the Fibonacci series (which is a nifty trick when one needs to generate an infinite, but precomputing the list would be a wee bit expensive :), and I use a second iterator which uses the first iterator to generate numbers closer and closer to the Fibonacci number. Finally, I have a couple of "iterator maps" that transform the iterators into different iterators. This code uses "bignum", but it's optional. If you don't use it, you'll just get less precision and less interesting results (and there's an "undefined" warning at one point that I didn't worry about because this was just a quick hack). MJD's stuff is very interesting so I heartily recommend checking it out! Tom, I don't suppose I can talk you into an "email" code review, eh? ;) (no, don't bother. You might get swamped! I just wish I could have made it to the clinic tonight) #!/usr/bin/perl -w use strict; use bignum; use constant FORMAT => "%12s %s\n"; sub NEXT ($) { $_[0]->() }; sub imap (&$) { my ($transform, $it) = @_; return sub { local $_ = NEXT $it; return unless defined; return $transform->($_); } } sub fibonacci_series { my @numbers = (1,1); return sub { my $next = shift @numbers; push @numbers => $numbers[0] + $next; $next; } } sub fibonacci_number { my @numbers = (0,0); my $series = fibonacci_series; return sub { shift @numbers; push @numbers => NEXT $series; return $numbers[0] ? $numbers[1] / $numbers[0] : undef; } } my $series = fibonacci_series; my $fib = fibonacci_number; my $reciprocal = imap { 1 / $_ } fibonacci_number; my $square = imap { $_ * $_ } fibonacci_number; for ( 1 .. 50 ) { printf FORMAT, NEXT $series, NEXT $fib; printf FORMAT, 'Reciprocal:', NEXT $reciprocal; printf FORMAT, 'Square:', NEXT $square; print "\n"; } From rb-pdx-pm at redcat.com Thu Oct 24 17:36:19 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] [OT] Chrononauts and Perl programming clinic In-Reply-To: <006901c27b95$582887f0$1a01a8c0@ot.onsitetech.com> Message-ID: Okay, I've heard some positive responses, so this event will be happening. We'll meet at Kelly's Olympian, near Fifth and Washington in downtown Portland (426 SW Washington, 503-228-3669). We'll start at about 6:00 tonight (Thursday), but it's okay if you're a little late. In case you're new and wouldn't recognize local Perl people, just approach random folks and say "chomp's default" until someone replies "dollar underscore". --Tom Phoenix From jhoblitt at ifa.hawaii.edu Fri Oct 25 21:45:39 2002 From: jhoblitt at ifa.hawaii.edu (Joshua Hoblitt) Date: Mon Aug 2 21:34:14 2004 Subject: [Pdx-pm] Changing contructors w/o breaking compat. Message-ID: I was using Net::Ping the other day and became irritated with the contructor. It would be fairly simple to just subclass it and add a own contructor but it got me thinking about how one would update the contructor and not break legacy code. These are the first few lines of the constructor for Net::Ping. Not only would it be much "prettier" to use a hash in the contructor there are several settings with must be set via a method call. Of course I could just wait for perl6 then test 2nd param to see if it is a scalar or a slice but I'm assuming there must be some clever way of dealing with this now. sub new { my ($this, $proto, # Optional protocol to use for pinging $timeout, # Optional timeout in seconds $data_size, # Optional additional bytes of data $device, # Optional device to use ) = @_; . . . Cheers, -J -- "Suppose you were an idiot. And suppose you were a member of Congress. But I repeat myself." -- Mark Twain From merlyn at stonehenge.com Fri Oct 25 23:44:15 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:15 2004 Subject: [Pdx-pm] Changing contructors w/o breaking compat. In-Reply-To: References: Message-ID: <867kg5zu5c.fsf@red.stonehenge.com> >>>>> "Joshua" == Joshua Hoblitt writes: Joshua> I was using Net::Ping the other day and became irritated with the contructor. It would be fairly simple to just subclass it and add a own contructor but it got me thinking about how one would update the contructor and not break legacy code. Joshua> These are the first few lines of the constructor for Net::Ping. Not only would it be much "prettier" to use a hash in the contructor there are several settings with must be set via a method call. Of course I could just wait for perl6 then test 2nd param to see if it is a scalar or a slice but I'm assuming there must be some clever way of dealing with this now. Joshua> sub new Joshua> { Joshua> my ($this, Joshua> $proto, # Optional protocol to use for pinging Joshua> $timeout, # Optional timeout in seconds Joshua> $data_size, # Optional additional bytes of data Joshua> $device, # Optional device to use Joshua> ) = @_; Joshua> . Joshua> . Joshua> . sub new { my $self = shift; my %param; if (ref $_[0] and ref $_[0] eq "HASH") { # damn warnings %param = %{+shift}; } else { @param{qw(proto timeout data_size device)} = @_; } ... } Old style new: my $object = Net::Ping->new($proto, $timeout, $data_size); New style new: my $object = Net::Ping->new({proto => $proto, device => $device}); It's been done before. Not sure where I saw it. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From jhoblitt at ifa.hawaii.edu Fri Oct 25 23:55:29 2002 From: jhoblitt at ifa.hawaii.edu (Joshua Hoblitt) Date: Mon Aug 2 21:34:15 2004 Subject: [Pdx-pm] Changing contructors w/o breaking compat. In-Reply-To: <867kg5zu5c.fsf@red.stonehenge.com> Message-ID: This was of course the very first thing I thought of however the difficulty is that you now have to pass in a ref to hash. You know I think I've seen that somewhere before too. I wonder if this is one of those things that morphed into knowledge because we all "read it someone". > my $object = Net::Ping->new({proto => $proto, device => $device}); ^ ^ I was hoping to find a way to allow Net::Ping support both the old systax and the "newer 'more' conventional" one so I could send a patch to the author. Cheers, -J From tex at off.org Sat Oct 26 08:09:34 2002 From: tex at off.org (Austin Schutz) Date: Mon Aug 2 21:34:15 2004 Subject: [Pdx-pm] Changing contructors w/o breaking compat. In-Reply-To: ; from jhoblitt@ifa.hawaii.edu on Fri, Oct 25, 2002 at 06:55:29PM -1000 References: <867kg5zu5c.fsf@red.stonehenge.com> Message-ID: <20021026060934.E20269@gblx.net> On Fri, Oct 25, 2002 at 06:55:29PM -1000, Joshua Hoblitt wrote: > > This was of course the very first thing I thought of however the difficulty is that you now have to pass in a ref to hash. You know I think I've seen that somewhere before too. I wonder if this is one of those things that morphed into knowledge because we all "read it someone". > > > my $object = Net::Ping->new({proto => $proto, device => $device}); > ^ ^ > I was hoping to find a way to allow Net::Ping support both the old systax and the "newer 'more' conventional" one so I could send a patch to the author. > Cheers, > Err.. Randal's solution supports both forms of the syntax. Btw, never seen the %{+shift} syntax before. Is that a new thing, a sneaky trick, or have I been living under a rock? Austin From poec at yahoo.com Sat Oct 26 13:20:31 2002 From: poec at yahoo.com (Ovid) Date: Mon Aug 2 21:34:15 2004 Subject: [Pdx-pm] Changing contructors w/o breaking compat. In-Reply-To: <20021026060934.E20269@gblx.net> Message-ID: <20021026182031.97561.qmail@web40401.mail.yahoo.com> --- Austin Schutz wrote: > Err.. Randal's solution supports both forms of the syntax. > > Btw, never seen the %{+shift} syntax before. Is that a new thing, > a sneaky trick, or have I been living under a rock? That's an old trick. A unary plus sign can be used to ensure that that function name is used as a function name rather than being interprested as an argument list. See perldoc perlop. [ovid@ovid ovid]$ perl -MO=Deparse -e '%{shift}' %shift; -e syntax OK [ovid@ovid ovid]$ perl -MO=Deparse -e '%{+shift}' %{shift @ARGV;}; -e syntax OK [ovid@ovid ovid]$ As for changing the constructor, another solution may be to take the Sub::NamedParams module (http://search.cpan.org/author/OVID/Sub-NamedParams-1.01/) and extend it to work with methods in addition to functions. I had never bothered to do that. Perhaps it's time ... Cheers, Curtis "Ovid" Poe ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ From merlyn at stonehenge.com Sat Oct 26 13:48:15 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:15 2004 Subject: [Pdx-pm] Changing contructors w/o breaking compat. In-Reply-To: <20021026060934.E20269@gblx.net> References: <867kg5zu5c.fsf@red.stonehenge.com> <20021026060934.E20269@gblx.net> Message-ID: <86pttxxci8.fsf@red.stonehenge.com> >>>>> "Austin" == Austin Schutz writes: >> I was hoping to find a way to allow Net::Ping support both the old systax and the "newer 'more' conventional" one so I could send a patch to the author. Austin> Err.. Randal's solution supports both forms of the syntax. Right. If it's a hashref, then use hash-ish (:-) keyword interpretation. If it's not, then use the older invocation. Austin> Btw, never seen the %{+shift} syntax before. Is that a Austin> new thing, a sneaky trick, or have I been living under a rock? Well, %{shift} is the same as %shift - a hash named shift. But adding + in front changes the syntax interpretation without changing any values. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From jhoblitt at ifa.hawaii.edu Sat Oct 26 15:59:44 2002 From: jhoblitt at ifa.hawaii.edu (Joshua Hoblitt) Date: Mon Aug 2 21:34:15 2004 Subject: [Pdx-pm] Changing contructors w/o breaking compat. In-Reply-To: <20021026060934.E20269@gblx.net> Message-ID: > Err.. Randal's solution supports both forms of the syntax. It supports two different syntaxs but the hash style form is different then what I would intuitively expect. I see this alot - so much that I'm calling it the conventional OO constructor sytax for perl. $sock = IO::Socket::INET->new(PeerAddr => 'www.perl.org', PeerPort => 'http(80)', Proto => 'tcp'); Turning the params into a hash ref will certainly work but IMHO if it wasn't my class it would be confusing. I did like the idea of havingto double check the docs for every class constructor it see if I need to add {}'s. $sock = IO::Socket::INET->new({PeerAddr => 'www.perl.org', PeerPort => 'http(80)', Proto => 'tcp'}); > Btw, never seen the %{+shift} syntax before. Is that a new thing, > a sneaky trick, or have I been living under a rock? I most have missed a message because I never saw where this was mentioned. Maybe it's because I have the flu. :) -J From jhoblitt at ifa.hawaii.edu Sat Oct 26 16:38:39 2002 From: jhoblitt at ifa.hawaii.edu (Joshua Hoblitt) Date: Mon Aug 2 21:34:15 2004 Subject: [Pdx-pm] Changing contructors w/o breaking compat. In-Reply-To: <20021026182031.97561.qmail@web40401.mail.yahoo.com> Message-ID: > As for changing the constructor, another solution may be to take the Sub::NamedParams module > (http://search.cpan.org/author/OVID/Sub-NamedParams-1.01/) and extend it to work with methods in > addition to functions. I had never bothered to do that. Perhaps it's time ... Thats kinda a neat idea... I'll have to ponder that one. I was wondering if it's possible to get enough information about the caller to decide if a hashish syntax was used. I suspect that "$a => $b" will have been turned into "$a, $b" before Devel::Caller gets to take a peek. hmmm... -J