From merlyn at stonehenge.com Thu May 24 11:17:25 2001 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:19 2004 Subject: possible social event (since we don't seem to be having technical events) Message-ID: Since the party about my felonious status was such a success, the pdx-singles people nudged me into inviting y'all to their "Cosmic Bowling" party on Jun 1st starting at 6pm at Tigard Bowl (findable via your favorite mapping service). Should be fun. I'll be there, although I'll have been teaching all day so I'm not sure how fun I'll be personally. If you can give me a head count, I'll pass it along to the organizers. Perl questions will be welcome. More welcome if you buy me a beverage of my choice, but still welcome otherwise. Or talk to me about Llama3, since it's now official. Etc etc. Bowling is optional, although you can certainly watch me gutter a few for laughs. -- 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! TIMTOWTDI From markymoon at zenbydesign.com Thu May 24 21:21:41 2001 From: markymoon at zenbydesign.com (MarkyMoon) Date: Wed Aug 4 00:05:19 2004 Subject: possible social event (since we don't seem to be having technical events) References: Message-ID: <3B0DC1B4.C10F1419@zenbydesign.com> "Randal L. Schwartz" wrote: > > Since the party about my felonious status was such a success, I may never be able to watch Kermit sing again without giggling... > If you can give me a head count, I'll pass it along to the organizers. Do you suppose it would be o.k. to drag along the wife or do they have a limited number of spaces? It would be much easier than explaining why I'm going to a singles club event! A junior perl mongrel, MarkyMoon -- My very first japh's! (Sure... they're not fancy, but I'm a graphic designer dang-it!) -- @a = ("a".."z"," ","-","\n");foreach $b ( 12,0,17,10,24,12,14,14,13,26,8,18,26,0,26, 22,0,13,13,0,27,1,4,26,15,4,17,11,26,7,0, 2,10,4,17) {print "$a[$b]"};print $a[28]; --numero dos -- @a = ("a".."z"," ",",","\n","!");foreach $b ( 28,0,26,14,13,4,26,11,26,17,0,13,3,0,11,26,22,17,14,19,4,26,19,7,4,26,1,14,14,10,27,28, 0,26,19,22,14,26,11,26,11,11,0,12,0,26,5,14,17,26,19,7,4,26,11,14,14,10,27,28, 1,20,19,26,19,14,26,22,7,14,12,26,22,4,26,14,22,4,26,8,19,26,0,11,11,27,28, 8,18,26,19,7,4,26,19,7,17,4,4,26,11,26,11,0,17,17,24,26,22,0,11,11,29,28,28, 17,0,13,3,0,11,28) {print "$a[$b]"};print $a[28]; TIMTOWTDI From merlyn at stonehenge.com Tue May 29 10:11:08 2001 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:19 2004 Subject: Damian Conway free presentation in portland - your input needed Message-ID: As a part of the package that Damian offers in delivering three days of training Aug 1-3 at CPD, he's giving me a chance to offer a one-night free event, which I'm inclined to make co-sponsored by PDX.pm and Stonehenge in all my literature. This is where y'all come in. Here's the list of topics: I'd be happy to do something on Perl 6, especially if I have access to both screen projection and a whiteboard. Otherwise (with just screen projection) I'll be happy to give any of the following: * Quantum::Superpositions * Perligata : Perl for the XXIimum Century * Extreme Perl: The Horror that is SelfGOL * Life, The Universe, And Everything * New Modules from The Conway Channel There are blurbs for all except the last of these (which is self explanatory) at: http://www.yetanother.org/damian/events/ Which would you like to see? I've seen Q::S and it's damn funny, and Perligata ditto. I'm leaning towards either the Perl6 thing because this is the week right after TPC5 and there's likely to be big fresh news, or perhaps the "Life..." one because I know he'll be talking about (the other) Conway's Life Game. So, feedback requested. And timely as well, because we wanna start promoting the hell out of this event. We've got a room that can hold probably about 150, and I'd like to see it filled with the local community. -- 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! TIMTOWTDI From gene at ology.net Tue May 29 12:55:54 2001 From: gene at ology.net (Gene Boggs) Date: Wed Aug 4 00:05:19 2004 Subject: Damian Conway free presentation in portland - your input needed In-Reply-To: Message-ID: > ... > * Quantum::Superpositions > * Perligata : Perl for the XXIimum Century > * Extreme Perl: The Horror that is SelfGOL > * Life, The Universe, And Everything > * New Modules from The Conway Channel > ... > Which would you like to see? ... Quantum::Superpositions is one of the most hilarious talks that I have ever heard. :-) -gb Gene Boggs Software Engineer at-large ___________________________ TIMTOWTDI From ckuskie at tality.com Tue May 29 15:31:47 2001 From: ckuskie at tality.com (Colin Kuskie) Date: Wed Aug 4 00:05:19 2004 Subject: Damian Conway free presentation in portland - your input needed In-Reply-To: Message-ID: On 29 May 2001, Randal L. Schwartz wrote: > As a part of the package that Damian offers in delivering three days > of training Aug 1-3 at CPD, he's giving me a chance to offer a > one-night free event, which I'm inclined to make co-sponsored by > PDX.pm and Stonehenge in all my literature. Cool! Uh, what's CPD? Is that like CPR (the McMenamins in Hillsboro :) ? > This is where y'all come in. Here's the list of topics: > > I'd be happy to do something on Perl 6, especially if I have access to > both screen projection and a whiteboard. > > Otherwise (with just screen projection) I'll be happy to give any of the > following: > > * Quantum::Superpositions > * Perligata : Perl for the XXIimum Century > * Extreme Perl: The Horror that is SelfGOL > * Life, The Universe, And Everything > * New Modules from The Conway Channel I have to say Perl 6 is the way to go. Colin TIMTOWTDI From merlyn at stonehenge.com Tue May 29 15:57:22 2001 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:19 2004 Subject: Damian Conway free presentation in portland - your input needed In-Reply-To: References: Message-ID: >>>>> "Colin" == Colin Kuskie writes: Colin> On 29 May 2001, Randal L. Schwartz wrote: >> As a part of the package that Damian offers in delivering three days >> of training Aug 1-3 at CPD, he's giving me a chance to offer a >> one-night free event, which I'm inclined to make co-sponsored by >> PDX.pm and Stonehenge in all my literature. Colin> Cool! Uh, what's CPD? Is that like CPR (the McMenamins in Hillsboro :) ? Oh, sorry. I meant to include the link. cpd.ogi.edu. If you search for "Damian", you'll find his classes. If you search for "Stonehenge", you'll find both his and ours. Colin> I have to say Perl 6 is the way to go. Thanks for your input. -- 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! TIMTOWTDI From gene at ology.net Tue May 29 18:24:40 2001 From: gene at ology.net (Gene Boggs) Date: Wed Aug 4 00:05:19 2004 Subject: Perl nerds: Bend.pm is rolling out! Message-ID: *** This is not not spam! :-) *** Fellow geeks: For a while, I have threatened to create a Perl users group for Bend, and now it's done! I have submitted a request to pm.org to start a new user group, and am awaiting approval. This will be a monthly user group with *no* "dues" - it's open source! We will likely alternate between technical and social meetings. This is an *excellent* way for folks to share information and rub elbows. It's also a great opportunity for recruiters and employers to mingle with real live programmers. :-) Of course, I hope to wrangle some great speakers to visit our humble metropolis... So, please mention to your perl-slinging friends, that a new Perl users group is right around the corner in good ol' Bend, Oregon! :-) (Since perl is so incredibly useful for the Internet, a web-developer group will likely evolve out of the folks involved (or their associates) to occur immediately before or after.) Special thanks goes to Greg Freeman (evisions.net), a long-time client of mine, is sponsoring and physically housing the website and the (majordomo) mailing list. When it goes through, you will be able to access http://bend.pm.org/. From there, you will be able to browse our mailing list archives. Also, he is willing to host meetings in his (small but DSL enabled) downtown office for us. YAY! Thanks Greg!! Ivan Snyder, of Cafe Internet, offered to be a meeting location with yummy edibles and bandwidth. Excellent! Thanks Ivan! Write back to me directly if you are interested in the details, and I will mail again with the specifics when they surface. :-) Thanks, -gb Gene Boggs Software Engineer at-large ___________________________ TIMTOWTDI From masque at pound.perl.org Wed May 30 10:07:55 2001 From: masque at pound.perl.org (Masque) Date: Wed Aug 4 00:05:19 2004 Subject: Damian Conway free presentation in portland - your input needed In-Reply-To: ; from merlyn@stonehenge.com on Tue, May 29, 2001 at 08:11:08AM -0700 References: Message-ID: <20010530100755.C11675@pound.perl.org> On Tue, May 29, 2001 at 08:11:08AM -0700, Randal L. Schwartz wrote: > > As a part of the package that Damian offers in delivering three days > of training Aug 1-3 at CPD, he's giving me a chance to offer a > one-night free event, which I'm inclined to make co-sponsored by > PDX.pm and Stonehenge in all my literature. WOOOOHOOOO! Go Randal! Fantastic! Spectacular! Bonus! Hot DOG! Wow! If ANY of you miss this event...well, your quality of life will suffer. Don't miss Mr. Conway speaking. Ever. > I'd be happy to do something on Perl 6, especially if I have access to > both screen projection and a whiteboard. Honestly, I'm not excited about this. I WOULD be, but... > * Quantum::Superpositions ...is something I could view daily and still enjoy thoroughly. It gets my vote. I think hearing his thoughts on perl6 would be spiffy, but as you said it'll be right after TPC5 and I'll probably have had my fill of that by then. Plus, this is a talk that really shouldn't be missed. > * Perligata : Perl for the XXIimum Century Great as well, but Q::S is superior. Barely. > * Extreme Perl: The Horror that is SelfGOL > * Life, The Universe, And Everything > * New Modules from The Conway Channel The fact that these are new (at least to me) gnaws at me, but I'm still for Q::S. > So, feedback requested. And timely as well, because we wanna start > promoting the hell out of this event. We've got a room that can hold > probably about 150, and I'd like to see it filled with the local > community. Let me know how I can help. Paul. TIMTOWTDI From ckuskie at tality.com Wed May 30 12:08:12 2001 From: ckuskie at tality.com (Colin Kuskie) Date: Wed Aug 4 00:05:19 2004 Subject: Damian Conway free presentation in portland - your input needed In-Reply-To: Message-ID: On 29 May 2001, Randal L. Schwartz wrote: > Oh, sorry. I meant to include the link. cpd.ogi.edu. If you search > for "Damian", you'll find his classes. If you search for > "Stonehenge", you'll find both his and ours. WooHoo! Just got a P.O. approved from the wife to spend some fun money on the Text Munging course. My day job is designing analog chips and I've never been exposed to parsers before. This should be a blast! Thanks for the tip! Colin p.s. Maybe we should list places where Perl training is locally offered on the portland.pm.org website? TIMTOWTDI From merlyn at stonehenge.com Wed May 30 13:14:16 2001 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:19 2004 Subject: Damian Conway free presentation in portland - your input needed In-Reply-To: References: Message-ID: >>>>> "Colin" == Colin Kuskie writes: Colin> On 29 May 2001, Randal L. Schwartz wrote: >> Oh, sorry. I meant to include the link. cpd.ogi.edu. If you search >> for "Damian", you'll find his classes. If you search for >> "Stonehenge", you'll find both his and ours. Sorry, I thought they searched the full text. Search for "perl" for everything. :) -- 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! TIMTOWTDI From joshua_keroes at eli.net Wed May 30 13:57:43 2001 From: joshua_keroes at eli.net (Joshua Keroes) Date: Wed Aug 4 00:05:19 2004 Subject: flocking issues Message-ID: <0105301157430W.26987@surly> flock has been giving me headaches for a week now. Help! Here are the ingredients: 1. Demo.pm emulates an access-server - essentially a bank of modems at your ISP. It stores lists of fake users, logged into fakes dialups, and other associated fake info. 2. foo.pl, bar.pl, and baz.pl all read from Demo.pm, but can write to it as well. A lookup (who's on what dialup) is a read operation. They can also disconnect users. That's a write-operation. 3. update_demo.pl writes to Demo.pm. Real dialup traffic peaks after work, right around 7-8PM, as people go home and log into their home computers to check email and whatnot. It drops off at 4-5AM as they go to sleep. The amount of traffic resembles a sine wave. update_demo.pl emulates this by logging fake users on and off. update_demo.pl stores userids and the dialups they're on in a state file. It would be bad for more than one program to update the state file at the same time. update_demo.pl runs out of cron every minute. On average, it takes 4-5 seconds to complete. The other programs are run by users. All of these programs attempting to update the state file at the same time is a recipe for disaster. --- Q: how do we get update_demo.pl to play nicely with foo, bar, and baz.pl? A: flock. Create a file-lock when somebody's updating the state file. Make everyone wait until the flock is gone before they get to work. --- Implementation: use constant STALE_SECS => 60 * 60; use constant MAX_TIMEOUT => 15; # in seconds # Take control. # Let nobody else play. # Do not play nice. # Do not share. # # Accepts an optional filename to use as the flockfile. # sub Demo::_lock { my ($self, $lockfile) = @_; $lockfile ||= $self->{_lockfile}; my $timeout = 0; if ( -f $lockfile ) { # Remove the file lock if it's stale # my ($mtime) = (stat $lockfile)[9]; if ($mtime < time - STALE_SECS) { unlink $lockfile or die "Can't remove stale lockfile '$lockfile': $!"; } # XXX spinlocks are bad, I think. # XXX How do I do this correctly? # # Wait MAX_TIMEOUT seconds until an old filelock # is gone before giving up. # while ( -f $lockfile ) { if ($timeout++ < MAX_TIMEOUT) { sleep; } else { die "Can't acquire lock on $lockfile: timed out"; } } } sysopen LOCK, $lockfile, O_RDWR|O_CREAT, 0660 or die "Can't open file $lockfile: $!"; flock LOCK, LOCK_EX or die "Can't acquire lock on $lockfile: $!"; } sub _unlock { my ($self, $lockfile) = @_; $lockfile ||= $self->{_lockfile}; flock LOCK, LOCK_UN or warn "Can't unlock $lockfile: $!"; close LOCK or warn "Can't close $lockfile: $!"; unlink $lockfile or warn "Can't remove $lockfile: $!"; } sub Demo::DESTROY { my $self = shift; if ($self->updated) { my $statefile = $self->{_statefile}; $self->save_state(); } $self->_unlock; } __END__ That should take care of everything, uh... right? Misc Questions: Will DESTROY get called if the user hits ^C, sending SIGINT? If not, should one use $SIG{__DIE__} or $SIG{INT} to call Demo::_unlock? Is that spinlock as bad as my conscience thinks it is? --- Tried, fried and tired, Joshua TIMTOWTDI From merlyn at stonehenge.com Wed May 30 15:15:40 2001 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:19 2004 Subject: flocking issues In-Reply-To: <0105301157430W.26987@surly> References: <0105301157430W.26987@surly> Message-ID: >>>>> "Joshua" == Joshua Keroes writes: Joshua> Will DESTROY get called if the user hits ^C, sending SIGINT? Not unless you trap that signal and die.. use sigtrap qw(die INT QUIT); I didn't look at the rest of the code. -- 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! TIMTOWTDI From tex at off.org Wed May 30 18:05:44 2001 From: tex at off.org (Austin Schutz) Date: Wed Aug 4 00:05:19 2004 Subject: flocking issues In-Reply-To: <0105301157430W.26987@surly>; from joshua_keroes@eli.net on Wed, May 30, 2001 at 11:57:43AM -0700 References: <0105301157430W.26987@surly> Message-ID: <20010530160544.H536@gblx.net> > while ( -f $lockfile ) { > if ($timeout++ < MAX_TIMEOUT) { > sleep; > } else { > die "Can't acquire lock on $lockfile: timed out"; > } > } > } > > sysopen LOCK, $lockfile, O_RDWR|O_CREAT, 0660 > or die "Can't open file $lockfile: $!"; I think this code suffers from a race condition, since while and sysopen aren't atomic. maybe try: while ( $timeout++ <= MAX_TIMEOUT ) { if( sysopen LOCK, $lockfile, O_RDWR|O_CREAT|O_EXCL, 0660 ) { $got_lock=1; } sleep 1; } die "Can't open file $lockfile: $!" unless $got_lock; Using sysopen with O_EXCL seems to be an alternative method to sharing a lock file with flock. The problem is no matter how you program it, you may always end up with stale lock files, as noted by your code for detecting that. Also, doesn't your code sleep forever since nothing is passed to sleep()? > > flock LOCK, LOCK_EX > or die "Can't acquire lock on $lockfile: $!"; You could put a while() loop around flock() and use LOCK_NB. I think, though, by using sysopen with O_EXCL it's probably not necessary to lock the file, at least so the docs indicate. I think flock is for locking access to existing files, not necessarily locking the creation of files. > Will DESTROY get called if the user hits ^C, sending SIGINT? > > If not, should one use $SIG{__DIE__} or $SIG{INT} to call Demo::_unlock? > One point here that is maybe obvious. You can't trap a KILL, so when your program catches one it _will_ leave a stale lockfile. Austin TIMTOWTDI From protek_2000 at yahoo.com Wed May 30 18:17:18 2001 From: protek_2000 at yahoo.com (Michael Mitchell) Date: Wed Aug 4 00:05:19 2004 Subject: Damian Conway free presentation in portland - your input needed In-Reply-To: Message-ID: Note to webmaster for portland.pm.org: I second the motion (see the P.S.) -----Original Message----- From: owner-pdx-pm-list@pm.org [mailto:owner-pdx-pm-list@pm.org]On Behalf Of Colin Kuskie Sent: Wednesday, May 30, 2001 10:08 AM To: pdx-pm-list@pm.org Subject: Re: Damian Conway free presentation in portland - your input needed On 29 May 2001, Randal L. Schwartz wrote: >p.s. Maybe we should list places where Perl training is locally >offered on the portland.pm.org website? > >TIMTOWTDI _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com TIMTOWTDI