From sfryer at sourcery.ca Thu Sep 3 14:05:28 2009 From: sfryer at sourcery.ca (Shaun Fryer) Date: Thu, 3 Sep 2009 17:05:28 -0400 Subject: [tpm] Available for contracting Message-ID: <982579710909031405q3fbf2e69u3f2847a9a66d27ec@mail.gmail.com> Hi Guys, I'm (immediately) available part-time for (telecommute) Perl/AJAX development. I have close to 10 years experience developing with Perl (system & web-apps, various frameworks & methodologies), and around 4-5 years with JavaScript (incl. prototype, et al). I also do shell scripting and a bit of PHP as needed. Although it could use some editing, my website has code samples and a fairly recent copy of my resume in a variety of formats. References available upon request. My financial needs are modest. I require about $1500/month worth of work (typically at $50/hr). I'm presently participating in an (unpaid) internship at an organic farm in Cannington Ontario which will last until around mid-November. I have an excellent internet connection and around 4 hours each weeknight available to do telecommute work. I still need to pay rent while I'm away, and have a few bucks for transportation expenses, etc. So, if you have work available, or know anyone who does, please put them in touch as soon as possible (off-list). Thanks, and hope you're all enjoying the summer! :) Cheers, -- Shaun Fryer http://sourcery.ca/ 1-866-920-9209 -------------- next part -------------- An HTML attachment was scrubbed... URL: From fulko.hew at gmail.com Fri Sep 4 06:19:27 2009 From: fulko.hew at gmail.com (Fulko Hew) Date: Fri, 4 Sep 2009 09:19:27 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> Message-ID: <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> 3 weeks and counting... With one week gone and only 3 weeks to go, our count has skyrocketed from one all the way up to an amazing TWO scheduled sessions! We need more! Pick your pet project, pick your pet module, pick your pet peeve, pick your favorite Perl 6 feature, pick a fight... pick your nose, pick something and talk about it. Let me know what you picked. Thanks Fulko -------------- next part -------------- An HTML attachment was scrubbed... URL: From fulko.hew at gmail.com Sat Sep 5 06:30:41 2009 From: fulko.hew at gmail.com (Fulko Hew) Date: Sat, 5 Sep 2009 09:30:41 -0400 Subject: [tpm] suggestion for a lightning talk Message-ID: <8204a4fe0909050630k6a6a1e22u55059e1b2d9bab57@mail.gmail.com> While I'm not going to do it... here's a subject idea for someone willing to take it on as a lightning talk: "How does one deal with supporting multiple languages (ie prompts) in Perl programs?" -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkeen at verizon.net Sun Sep 6 10:48:56 2009 From: jkeen at verizon.net (James E Keenan) Date: Sun, 06 Sep 2009 13:48:56 -0400 Subject: [tpm] Yet another suggestion for a lightning talk Message-ID: <18D4C6EA-0A30-4861-837A-D4BCDC466638@verizon.net> Since I'm back in NYC, I won't be seen at TPM for an undefined number of months. But here is something someone could do at your September Lightning Talks meeting that flows from what I was talking about at the August meeting. 1. Write a specification for tests for one feature of ExtUtils::ParseXS. ParseXS is essential for Perl extensions but the scope of its formal testing is minimal. We're trying to expand its test coverage, which entails writing little sample.xs files to serve as inputs for tests in the module's test suite. But before we write those sample.xs files, we should have a list of all such files we will eventually need. That means going through 'perldoc perlxs' paragraph-by- paragraph and writing a human-language description of the various sample.xs files we'll need to test the features in each paragraph. At the Lightning Talk, display a paragraph from 'perlxs', then display a list of the sample.xs files we'll need to thoroughly test the features needed in that paragraph. Reference: http://tech.groups.yahoo.com/group/parsexs/message/30 2. Extra credit: Write one of the sample.xs files described in the test spec written for (1). Write a .t file for ExtUtils::ParseXS and use the sample .xs file as its input. Get the XS to compile and the test to pass. Jim Keenan From linux at alteeve.com Thu Sep 10 06:08:06 2009 From: linux at alteeve.com (Madison Kelly) Date: Thu, 10 Sep 2009 09:08:06 -0400 Subject: [tpm] Makefile and proper use of t/*.t Message-ID: <4AA8FA36.9020907@alteeve.com> Hi all, This is a follow-up to my last question on testing. I followed Adam and Michael's advice and read up on and became comfortable with Test::* (Harness, Tutorial, Simple and More, specifically). My test code is much cleaner and more concise now, so thank you again. The two topic I still need help on are; First - I couldn't find a good overview of the proper use of the t/*.t files. For now, I've created a base 'test.pl' in the root of my module that makes sure I can do the basics of loading my "parent" (main sibling) module. Then it uses 'require_ok(t/Foo.t)' for each of the test files. The exact name of each *.t file matches the corresponding *.pm file it tests. However, I've seen references to these files being automatically loaded is some regard, but found no specifics. Also, I understood the reasoning behind breaking up testing between *.t files was to keep the test count under 255. The way I am doing it currently runs them concurrently with the test number constantly growing. As simple as my tests are, I'm already over 40 tests and I have a *lot* more methods to create still. Second - The last thing I need to do before I can even think about getting my modules on CPAN is to learn how to create a Makefile.pl. I've looked at other modules for examples, but none have any comments I found useful. I know that there is a reference to using h2xs to create a framework which sets up a module from the beginning, but my modules are already well under way. Also, I'd like to understand the theory better so that my talk next month will be as complete as possible. Thanks again!! Madi From talexb at gmail.com Thu Sep 10 06:43:07 2009 From: talexb at gmail.com (Alex Beamish) Date: Thu, 10 Sep 2009 09:43:07 -0400 Subject: [tpm] Makefile and proper use of t/*.t In-Reply-To: <4AA8FA36.9020907@alteeve.com> References: <4AA8FA36.9020907@alteeve.com> Message-ID: Hi Madison, I'd recommend you check out Andy Lester's [1] excellent Module::Builder -- he demoed it to me when he was in town 2-3 years and, and it basically automates everything to do with the creation of a module destined to go to CPAN, creating tests, POD, a makefile, and so forth. The same information can be dug out of the Camel, but Module::Builder is a way more hands-on approach. -- Alex Beamish Toronto, Ontario aka talexb 1. Also known as petdance. From talexb at gmail.com Thu Sep 10 10:40:23 2009 From: talexb at gmail.com (Alex Beamish) Date: Thu, 10 Sep 2009 13:40:23 -0400 Subject: [tpm] Makefile and proper use of t/*.t In-Reply-To: <4AA92797.1030508@alteeve.com> References: <4AA8FA36.9020907@alteeve.com> <4AA92797.1030508@alteeve.com> Message-ID: Sorry, my bad, it's actually called Module::Starter. http://search.cpan.org/~petdance/Module-Starter-1.52/lib/Module/Starter.pm That should give you enough reading for a while. -- Alex Beamish Toronto, Ontario aka talexb From jkeen at verizon.net Thu Sep 10 14:44:14 2009 From: jkeen at verizon.net (James E Keenan) Date: Thu, 10 Sep 2009 17:44:14 -0400 Subject: [tpm] Makefile and proper use of t/*.t In-Reply-To: <4AA8FA36.9020907@alteeve.com> References: <4AA8FA36.9020907@alteeve.com> Message-ID: <63A7F071-481A-4617-92A0-3D1F644BBA4A@verizon.net> On Sep 10, 2009, at 9:08 AM, Madison Kelly wrote: > Hi all, > > This is a follow-up to my last question on testing. I followed > Adam and Michael's advice and read up on and became comfortable > with Test::* (Harness, Tutorial, Simple and More, specifically). My > test code is much cleaner and more concise now, so thank you again. > > The two topic I still need help on are; > > Second - > > The last thing I need to do before I can even think about getting > my modules on CPAN is to learn how to create a Makefile.pl. I've > looked at other modules for examples, but none have any comments I > found useful. I know that there is a reference to using h2xs to > create a framework which sets up a module from the beginning, but > my modules are already well under way. Also, I'd like to understand > the theory better so that my talk next month will be as complete as > possible. You only *really* need h2xs if you're going to be creating C extensions with the XS glue language. That almost certainly is not the case here. Instead you should install CPAN distro ExtUtils::ModuleMaker, then use its 'modulemaker' command-line utility to prompt you to create the directory and file structure needed for CPAN. Here's a slideshow I prepared on the subject a couple of years back. > First - > > I couldn't find a good overview of the proper use of the t/*.t > files. For now, I've created a base 'test.pl' in the root of my > module that makes sure I can do the basics of loading my > "parent" (main sibling) module. Then it uses 'require_ok(t/Foo.t)' > for each of the test files. The exact name of each *.t file matches > the corresponding *.pm file it tests. Look at the test suite for ExtUtils::ModuleMaker. Or, for simpler cases, the test suite for any of my distros on CPAN: http:// search.cpan.org/~jkeenan/. People take different approaches to how they name/number their .t files. Generally speaking, I create one .t file for each exported subroutine or public method. But other approaches are quite plausible as well. Jim Keenan From fulko.hew at gmail.com Thu Sep 10 19:36:18 2009 From: fulko.hew at gmail.com (Fulko Hew) Date: Thu, 10 Sep 2009 22:36:18 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> Message-ID: <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> Its now 2 weeks and counting... We are now up to THREE presentations! We still need some more! Do you like to talk? We like to listen! Consider us 'professional listeners', we might actually pay attention too. Pick a subject... any subject. You know... it doesn't even have to be something you tell us... it could be something you ask us! Just email me with your idea. Thanks Fulko -------------- next part -------------- An HTML attachment was scrubbed... URL: From thakore.kartik at gmail.com Fri Sep 11 07:56:27 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Fri, 11 Sep 2009 10:56:27 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> Message-ID: <7BE11770-4A04-4F23-AE4B-7B4C00FEE0DA@gmail.com> I will do a lightning about SDL perl, and the importance of developing end user application for perl. Also can I get details on the event. There is some conflicting information on the website and august mailing archives. Kartik Thakore On 10-Sep-09, at 10:36 PM, Fulko Hew wrote: > > Its now 2 weeks and counting... > > We are now up to THREE presentations! > We still need some more! > > Do you like to talk? > We like to listen! > Consider us 'professional listeners', > we might actually pay attention too. > > Pick a subject... any subject. > You know... it doesn't even have to be something you tell us... > it could be something you ask us! > > Just email me with your idea. > > Thanks > Fulko > > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm From abram.hindle at softwareprocess.us Fri Sep 11 08:28:51 2009 From: abram.hindle at softwareprocess.us (Abram Hindle) Date: Fri, 11 Sep 2009 11:28:51 -0400 (EDT) Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <7BE11770-4A04-4F23-AE4B-7B4C00FEE0DA@gmail.com> (sfid-20090911_110006_192042_E38D8FB1) References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> <7BE11770-4A04-4F23-AE4B-7B4C00FEE0DA@gmail.com> (sfid-20090911_110006_192042_E38D8FB1) Message-ID: Didn't Michael ask if anyone wanted to take his tpm-web-admin job? abram On Fri, 11 Sep 2009, Kartik Thakore wrote: > I will do a lightning about SDL perl, and the importance of developing end > user application for perl. Also can I get details on the event. There is some > conflicting information on the website and august mailing archives. > > Kartik Thakore > > On 10-Sep-09, at 10:36 PM, Fulko Hew wrote: > >> >> Its now 2 weeks and counting... >> >> We are now up to THREE presentations! >> We still need some more! >> >> Do you like to talk? >> We like to listen! >> Consider us 'professional listeners', >> we might actually pay attention too. >> >> Pick a subject... any subject. >> You know... it doesn't even have to be something you tell us... >> it could be something you ask us! >> >> Just email me with your idea. >> >> Thanks >> Fulko >> >> >> _______________________________________________ >> toronto-pm mailing list >> toronto-pm at pm.org >> http://mail.pm.org/mailman/listinfo/toronto-pm > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm From dave.s.doyle at gmail.com Fri Sep 11 09:26:53 2009 From: dave.s.doyle at gmail.com (Dave Doyle) Date: Fri, 11 Sep 2009 12:26:53 -0400 Subject: [tpm] Fwd: September lightning Talks (call for participation) In-Reply-To: References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> <7BE11770-4A04-4F23-AE4B-7B4C00FEE0DA@gmail.com> Message-ID: Keep forgetting to hit reply-all dammit. -- dave.s.doyle at gmail.com ---------- Forwarded message ---------- From: Dave Doyle Date: Fri, Sep 11, 2009 at 12:26 PM Subject: Re: [tpm] September lightning Talks (call for participation) To: Abram Hindle He did, and I volunteered and then got ridiculously busy so that's my bad. Not sure if I'm the best man for the job for the moment. Any other volunteers? -- dave.s.doyle at gmail.com On Fri, Sep 11, 2009 at 11:28 AM, Abram Hindle < abram.hindle at softwareprocess.us> wrote: > Didn't Michael ask if anyone wanted to take his tpm-web-admin job? > > abram > > > On Fri, 11 Sep 2009, Kartik Thakore wrote: > > I will do a lightning about SDL perl, and the importance of developing end >> user application for perl. Also can I get details on the event. There is >> some conflicting information on the website and august mailing archives. >> >> Kartik Thakore >> >> On 10-Sep-09, at 10:36 PM, Fulko Hew wrote: >> >> >>> Its now 2 weeks and counting... >>> >>> We are now up to THREE presentations! >>> We still need some more! >>> >>> Do you like to talk? >>> We like to listen! >>> Consider us 'professional listeners', >>> we might actually pay attention too. >>> >>> Pick a subject... any subject. >>> You know... it doesn't even have to be something you tell us... >>> it could be something you ask us! >>> >>> Just email me with your idea. >>> >>> Thanks >>> Fulko >>> >>> >>> _______________________________________________ >>> toronto-pm mailing list >>> toronto-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/toronto-pm >>> >> _______________________________________________ >> toronto-pm mailing list >> toronto-pm at pm.org >> http://mail.pm.org/mailman/listinfo/toronto-pm >> > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From psema4 at gmail.com Fri Sep 11 09:33:36 2009 From: psema4 at gmail.com (Scott Elcomb) Date: Fri, 11 Sep 2009 12:33:36 -0400 Subject: [tpm] Fwd: September lightning Talks (call for participation) In-Reply-To: References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> <7BE11770-4A04-4F23-AE4B-7B4C00FEE0DA@gmail.com> Message-ID: <99a6c38f0909110933q63678561tcc965c6d4d6e4f@mail.gmail.com> On Fri, Sep 11, 2009 at 12:26 PM, Dave Doyle wrote: > Keep forgetting to hit reply-all dammit. ... > He did, and I volunteered and then got ridiculously busy so that's my bad. > > Not sure if I'm the best man for the job for the moment.? Any other > volunteers? How much time and effort is required? If it's only periodic maintenance, I'll offer to help. -- Scott Elcomb http://www.psema4.com/ @psema4 Member of the Pirate Party of Canada http://www.pirateparty.ca/ From linux at alteeve.com Sat Sep 12 10:29:59 2009 From: linux at alteeve.com (Madison Kelly) Date: Sat, 12 Sep 2009 13:29:59 -0400 Subject: [tpm] Math::BigInt issue Message-ID: <4AABDA97.7000601@alteeve.com> Hi all, Not sure if I am being daft or something, but it looks like Math::BigInt isn't returning a value I expected. I'm doing a test to make sure that 1 exbibyte (2**60) returns, as I manually calculated, "1152921504606846976". Instead though, I get "1152921504606850000". This looks like it rounded off.. Can anyone see why then: my $size=1; my $bytes=Math::BigInt->new($size*(2**60)); Rounds off? Thanks! Madi From sergio at salvi.ca Sat Sep 12 11:01:54 2009 From: sergio at salvi.ca (Sergio Salvi) Date: Sat, 12 Sep 2009 14:01:54 -0400 Subject: [tpm] Math::BigInt issue In-Reply-To: <4AABDA97.7000601@alteeve.com> References: <4AABDA97.7000601@alteeve.com> Message-ID: <568473410909121101v162f4009h26c26456e3cb1e81@mail.gmail.com> You're letting Perl do the "2 ** 60" calculation, which will indeed be limited. You want to tell Math::BigInt do to it for you: my $value = Math::BigInt->new("2")->bpow("60"); # $value is 1152921504606846976 Sergio On Sat, Sep 12, 2009 at 1:29 PM, Madison Kelly wrote: > Hi all, > > ?Not sure if I am being daft or something, but it looks like Math::BigInt > isn't returning a value I expected. > > ?I'm doing a test to make sure that 1 exbibyte (2**60) returns, as I > manually calculated, "1152921504606846976". Instead though, I get > "1152921504606850000". This looks like it rounded off.. > > ?Can anyone see why then: > > my $size=1; > my $bytes=Math::BigInt->new($size*(2**60)); > > ?Rounds off? > > Thanks! > > Madi > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > From linux at alteeve.com Sat Sep 12 13:09:05 2009 From: linux at alteeve.com (Madison Kelly) Date: Sat, 12 Sep 2009 16:09:05 -0400 Subject: [tpm] Math::BigInt issue In-Reply-To: <568473410909121101v162f4009h26c26456e3cb1e81@mail.gmail.com> References: <4AABDA97.7000601@alteeve.com> <568473410909121101v162f4009h26c26456e3cb1e81@mail.gmail.com> Message-ID: <4AABFFE1.8040804@alteeve.com> Sergio Salvi wrote: > You're letting Perl do the "2 ** 60" calculation, which will indeed be > limited. You want to tell Math::BigInt do to it for you: > > my $value = Math::BigInt->new("2")->bpow("60"); > # $value is 1152921504606846976 > > Sergio > > On Sat, Sep 12, 2009 at 1:29 PM, Madison Kelly wrote: >> Hi all, >> >> Not sure if I am being daft or something, but it looks like Math::BigInt >> isn't returning a value I expected. >> >> I'm doing a test to make sure that 1 exbibyte (2**60) returns, as I >> manually calculated, "1152921504606846976". Instead though, I get >> "1152921504606850000". This looks like it rounded off.. >> >> Can anyone see why then: >> >> my $size=1; >> my $bytes=Math::BigInt->new($size*(2**60)); >> >> Rounds off? >> >> Thanks! >> >> Madi Yup, that was it. *Doh*. Here's what I needed to do to include the (variable) size multiplied against it. my $size=1; my $bytes=Math::BigInt->new('2')->bpow('60')->bmul($size); Thanks!! Madi From abuzarchaudhary at yahoo.com Tue Sep 15 08:14:42 2009 From: abuzarchaudhary at yahoo.com (Abuzar Chaudhary) Date: Tue, 15 Sep 2009 08:14:42 -0700 (PDT) Subject: [tpm] Playing MIDI notes using Perl? Message-ID: <152629.96902.qm@web52911.mail.re2.yahoo.com> Hi, Does anyone know how to play MIDI notes using Perl on Windows? I'm using Win32API::MIDI and in the example, they're using these hex codes to turn notes on and off: $mo->ShortMsg(0x00403C90) $mo->ShortMsg(0x00003C90) These hex codes, where can I find a spec for them? I've been googling and going through the microsoft website for hours (which the perldoc recommends), but I can't find anything. All I want to do is play music notes. Is that too much to ask for? With Commodore, it was really easy. Like this: play "CDEFGAB" How difficult can this be?! As time goes by, programming gets worse :( Abuzar p.s. Please, no elitism, like I should be using Linux instead, or I'm not RTFM, or I'm too dumb (I already know that). Thanks. From cj at cr-jay.ca Wed Sep 16 15:37:15 2009 From: cj at cr-jay.ca (Chris Jones) Date: Wed, 16 Sep 2009 18:37:15 -0400 Subject: [tpm] Renaming files Message-ID: <20090916223709.EMOK6916.tomts20-srv.bellnexxia.net@toip7.srvr.bell.ca> I want to go to the DOS prompt and rename all the files in that directory with a date prefix if there is no prefix there: dsc_0023.jpg becomes 16_09_09_dsc_0023.jpg. I am sure the following can be improved on: #!/usr/bin/perl use strict; use warnings; use Date::Format; my $dir = '.\'; my $date; my @info; # Time in seconds since epoch # atime = info[8] # mtime = info[9] # ctime = info[10] # Convert epoch timestamp to YYYYMMDD my $created; my @fileList = glob "${dir}???_????.jpg*"; foreach (@fileList) { next if -d; @info = stat($_) || die "Error $!"; $date = time2str('%Y%m%d', $info[10]); my $oldname = $_; s/"???_???.jpg"/"$date_???_???.jpg"/; rename $oldname, $_ or $_ = $oldname, warn $_, ' not renamed: ', $!; } Chris Jones 14 Oneida Avenue Toronto, ON M5J 2E3. Tel. 416-203-7465 Fax. 416-946-1005 From legrady at gmail.com Wed Sep 16 16:16:55 2009 From: legrady at gmail.com (Tom Legrady) Date: Wed, 16 Sep 2009 19:16:55 -0400 Subject: [tpm] Renaming files In-Reply-To: <20090916223709.EMOK6916.tomts20-srv.bellnexxia.net@toip7.srvr.bell.ca> References: <20090916223709.EMOK6916.tomts20-srv.bellnexxia.net@toip7.srvr.bell.ca> Message-ID: <3c9af5830909161616u248f62f1ub1be74aaf6290026@mail.gmail.com> If you're going to assign $_ to $oldname, why not do it straight off the bat? I believe in always naming variables, anyway. Just because some commands will fill in $_ automatically doesn't mean it's the best way to do things. for my $oldname ( @fileList ) { .... Then you can copy the old name to the new name and re-work it in one step. my ( $newname = $oldname ) =~ s/..... or if you really don't like that, keep the steps separate: my $newname = $oldname; $newname =~ s/... If you only want field '10' of stats, why capture the whole array? my $info = ( stats $oldname )[10] Your date formatting does not provide the underscores your specification says you want: $date = time2str '%y_%m_%d', $info[10]; Most importantly, the search-and-replace is wrong. There are no quotes in the name. There are four digits not three. You aren't capturing the xurrent name to reuse in the replace portion. Worst of all, this isn';t a search-and-replace problem at all my $newname = $date . '_' . $oldname On Wed, Sep 16, 2009 at 6:37 PM, Chris Jones wrote: > I want to go to the DOS prompt and rename all the files in that directory > with a date prefix if there is no prefix there: > > dsc_0023.jpg becomes 16_09_09_dsc_0023.jpg. > > I am sure the following can be improved on: > #!/usr/bin/perl > > use strict; > use warnings; > use Date::Format; > > my $dir = '.\'; > my $date; > > my @info; > # Time in seconds since epoch > # atime = info[8] > # mtime = info[9] > # ctime = info[10] > > # Convert epoch timestamp to YYYYMMDD > my $created; > > my @fileList = glob "${dir}???_????.jpg*"; > > foreach (@fileList) { > next if -d; > @info = stat($_) || die "Error $!"; > $date = time2str('%Y%m%d', $info[10]); > my $oldname = $_; > s/"???_???.jpg"/"$date_???_???.jpg"/; ##### <=== > rename $oldname, $_ or > $_ = $oldname, > warn $_, ' not renamed: ', $!; > } > > > > Chris Jones > 14 Oneida Avenue > Toronto, ON M5J 2E3. > Tel. 416-203-7465 > Fax. 416-946-1005 > > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cj at cr-jay.ca Wed Sep 16 18:14:26 2009 From: cj at cr-jay.ca (Chris Jones) Date: Wed, 16 Sep 2009 21:14:26 -0400 Subject: [tpm] Renaming files In-Reply-To: <3c9af5830909161616u248f62f1ub1be74aaf6290026@mail.gmail.co m> References: <20090916223709.EMOK6916.tomts20-srv.bellnexxia.net@toip7.srvr.bell.ca> <3c9af5830909161616u248f62f1ub1be74aaf6290026@mail.gmail.com> Message-ID: <20090917011420.VHGV14748.tomts40-srv.bellnexxia.net@toip4.srvr.bell.ca> Thank you. That was exactly the kind of optimization I was looking for. At 07:16 PM 9/16/2009, you wrote: >If you're going to assign $_ to $oldname, why not do it straight off >the bat? I believe in always naming variables, anyway. Just because >some commands will fill in $_ automatically doesn't mean it's the >best way to do things. > >for my $oldname ( @fileList ) { .... > >Then you can copy the old name to the new name and re-work it in one step. > >my ( $newname = $oldname ) =~ s/..... > >or if you really don't like that, keep the steps separate: > >my $newname = $oldname; >$newname =~ s/... > >If you only want field '10' of stats, why capture the whole array? > >my $info = ( stats $oldname )[10] > >Your date formatting does not provide the underscores your >specification says you want: > >$date = time2str '%y_%m_%d', $info[10]; > > > >Most importantly, the search-and-replace is wrong. There are no >quotes in the name. There are four digits not three. You aren't >capturing the xurrent name to reuse in the replace portion. Worst of >all, this isn';t a search-and-replace problem at all > >my $newname = $date . '_' . $oldname > > > >On Wed, Sep 16, 2009 at 6:37 PM, Chris Jones ><cj at cr-jay.ca> wrote: >I want to go to the DOS prompt and rename all the files in that >directory with a date prefix if there is no prefix there: > >dsc_0023.jpg becomes 16_09_09_dsc_0023.jpg. > >I am sure the following can be improved on: >#!/usr/bin/perl > >use strict; >use warnings; >use Date::Format; > >my $dir = '.\'; >my $date; > >my @info; ># Time in seconds since epoch ># atime = info[8] ># mtime = info[9] ># ctime = info[10] > ># Convert epoch timestamp to YYYYMMDD >my $created; > >my @fileList = glob "${dir}???_????.jpg*"; > >foreach (@fileList) { > next if -d; > @info = stat($_) || die "Error $!"; > $date = time2str('%Y%m%d', $info[10]); > my $oldname = $_; > s/"???_???.jpg"/"$date_???_???.jpg"/; ##### <=== > rename $oldname, $_ or > $_ = $oldname, > warn $_, ' not renamed: ', $!; >} > > > >Chris Jones >14 Oneida Avenue >Toronto, ON M5J 2E3. >Tel. 416-203-7465 >Fax. 416-946-1005 > > >_______________________________________________ >toronto-pm mailing list >toronto-pm at pm.org >http://mail.pm.org/mailman/listinfo/toronto-pm > Chris Jones 14 Oneida Avenue Toronto, ON M5J 2E3. Tel. 416-203-7465 Fax. 416-946-1005 -------------- next part -------------- An HTML attachment was scrubbed... URL: From drew at ss.org Wed Sep 16 20:00:55 2009 From: drew at ss.org (Drew Sullivan) Date: Wed, 16 Sep 2009 23:00:55 -0400 Subject: [tpm] Renaming files In-Reply-To: <3c9af5830909161616u248f62f1ub1be74aaf6290026@mail.gmail.com> References: <20090916223709.EMOK6916.tomts20-srv.bellnexxia.net@toip7.srvr.bell.ca> <3c9af5830909161616u248f62f1ub1be74aaf6290026@mail.gmail.com> Message-ID: <1253156381.27102.14.camel@quartz.ss.org> On Wed, 2009-09-16 at 19:16 -0400, Tom Legrady wrote: > > s/"???_???.jpg"/"$date_???_???.jpg"/; ##### <=== > rename $oldname, $_ or > $_ = $oldname, > warn $_, ' not renamed: ', $!; > } NEVER EVER trust a substitute works on unknown data. if the substitute fails then you are trying to rename the file to itself. At best you get a needles warning, at worst the file goes away since: perldoc -f rename says: Changes the name of a file; an existing file NEWNAME will be clobbered. Returns true for success, false otherwise. This can be implemented by a "DOS delete" followed by a "DOS rename" which will fail if the files exists so the delete must be executed first. So since newname exists, it is first deleted then the rename fails with a no such file error :-( From thakore.kartik at gmail.com Thu Sep 17 05:21:49 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Thu, 17 Sep 2009 08:21:49 -0400 Subject: [tpm] Playing MIDI notes using Perl? In-Reply-To: <152629.96902.qm@web52911.mail.re2.yahoo.com> References: <152629.96902.qm@web52911.mail.re2.yahoo.com> Message-ID: <3EFACCEC-D799-42BD-8B3B-E353DFE11C26@gmail.com> You can do this with SDL perl. I have script example. Let me find it and get it for you Kartik Thakore On 15-Sep-09, at 11:14 AM, Abuzar Chaudhary wrote: > Hi, > > Does anyone know how to play MIDI notes using Perl on Windows? > > I'm using Win32API::MIDI and in the example, they're using these hex > codes to turn notes on and off: > $mo->ShortMsg(0x00403C90) > $mo->ShortMsg(0x00003C90) > > These hex codes, where can I find a spec for them? I've been > googling and going through the microsoft website for hours (which > the perldoc recommends), but I can't find anything. > > All I want to do is play music notes. Is that too much to ask for? > With Commodore, it was really easy. Like this: > > play "CDEFGAB" > > How difficult can this be?! As time goes by, programming gets worse :( > > Abuzar > > p.s. Please, no elitism, like I should be using Linux instead, or > I'm not RTFM, or I'm too dumb (I already know that). Thanks. > > > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm From quantum.mechanic.1964 at gmail.com Thu Sep 17 13:25:27 2009 From: quantum.mechanic.1964 at gmail.com (Quantum Mechanic) Date: Thu, 17 Sep 2009 16:25:27 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> Message-ID: <77f3972e0909171325w176fb28fj2e7de1048876cd72@mail.gmail.com> On Thu, Sep 10, 2009 at 10:36 PM, Fulko Hew wrote: > > Its now 2 weeks and counting... > I've been using DBM::Deep for the last year. I can run through that in 5 minutes. I also have a "Facebook Word Twister" word generator, which might be of interest to those who do word puzzles. -- -QM Quantum Mechanics: The dreams stuff is made of -------------- next part -------------- An HTML attachment was scrubbed... URL: From w_smith at compusmiths.com Fri Sep 18 06:00:25 2009 From: w_smith at compusmiths.com (William P.N. Smith) Date: Fri, 18 Sep 2009 09:00:25 -0400 Subject: [tpm] CPAN Recursive Dependencies In-Reply-To: <3c9af5830906231516mbd6549dkd0817005385b00de@mail.gmail.com> References: <3c9af5830906231516mbd6549dkd0817005385b00de@mail.gmail.com> Message-ID: <4AB38469.7050200@compusmiths.com> I managed to fix this problem by correcting the date/time on my Linux box. Some pieces won't install if the timestamp is more than (a megasecond?) in the future. Just a thought. 'date' is your friend. 8*) From thakore.kartik at gmail.com Sat Sep 19 05:30:10 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Sat, 19 Sep 2009 08:30:10 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <77f3972e0909171325w176fb28fj2e7de1048876cd72@mail.gmail.com> References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> <77f3972e0909171325w176fb28fj2e7de1048876cd72@mail.gmail.com> Message-ID: Is anyone bringing a laptop? if so will what version of Perl do you have? Can you install SDL on it? On Thu, Sep 17, 2009 at 4:25 PM, Quantum Mechanic < quantum.mechanic.1964 at gmail.com> wrote: > > > On Thu, Sep 10, 2009 at 10:36 PM, Fulko Hew wrote: > >> >> Its now 2 weeks and counting... >> > > I've been using DBM::Deep for the last year. I can run through that in 5 > minutes. > > I also have a "Facebook Word Twister" word generator, which might be of > interest to those who do word puzzles. > > -- > -QM > Quantum Mechanics: The dreams stuff is made of > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From psema4 at gmail.com Sat Sep 19 08:49:09 2009 From: psema4 at gmail.com (Scott Elcomb) Date: Sat, 19 Sep 2009 11:49:09 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> <77f3972e0909171325w176fb28fj2e7de1048876cd72@mail.gmail.com> Message-ID: <99a6c38f0909190849p32c96c9ew1885f849f738ad91@mail.gmail.com> On Sat, Sep 19, 2009 at 8:30 AM, Kartik Thakore wrote: > Is anyone bringing a laptop? if so will what version of Perl do you have? > Can you install SDL on it? Hi Kartik, I haven't played around with SDL Perl for a couple years, but I am a fan. I'll be there with a copy of Perl 5.10 and SDL. =) -- Scott Elcomb http://www.psema4.com/ @psema4 Member of the Pirate Party of Canada http://www.pirateparty.ca/ From geoff.flarity at gmail.com Mon Sep 21 07:54:54 2009 From: geoff.flarity at gmail.com (Geoff Flarity) Date: Mon, 21 Sep 2009 10:54:54 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> Message-ID: <49499a2b0909210754l5442eb9cwddcfa3e6b8e2fe8d@mail.gmail.com> I'm willing to give a brief introduction to Google Protocol Buffers and using them with Perl (Google::ProtocolBuffers). Cheers, Geoff On Fri, Aug 28, 2009 at 8:41 AM, Fulko Hew wrote: > Well another year has gone by, and so now is the time for another call > for 'Lightning Talk' submissions for our Sept 24th meeting. > > All you have to do is talk for 5 minutes... > ? ... 5 slides is the most it could need! > ? ?OK, it might take you an hour to prepare... > ? ? ?OK, as Damian once responded when I asked... > ? ? ? ? 'Well it took me 5 years of learning to get to the point where I > could do it in an hour' > > But don't let that discourage you. > I've seen each of you talk before for 5 minutes without even taking a > breath! > Its not hard...? I know you can do it... > I just want you to do it formally, on a topic that may be borderline > relate to Perl, and I'm asking you to do it in front of a small audience. > And if you need more than 5 minutes, I thing that can be arranged if you ask > nicely.? :-) > > Is that too much to ask???? No! > > To start the submission process I'll offer my own talk entitled: > > ?? "Kevorkian'ing VMware" > > As your gong-master for this TPM session, please send your submissions > to me (so I can sift through the hundreds of entries I hope to receive > in the next few weeks and select the top 5 or 6 entertaining and > informative entries). > > But seriously... I will accept anyone and everyone. > So let those entries come flooding in! > > Fulko > > > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > > From magog at the-wire.com Mon Sep 21 08:23:38 2009 From: magog at the-wire.com (Michael Graham) Date: Mon, 21 Sep 2009 11:23:38 -0400 Subject: [tpm] Volunteers needed for posting meeting details on web site and to mailing list Message-ID: <20090921112338.1f8471e7@caliope> I've brought this up before, but I thought I'd put it out to the list again. Until now, I've been responsible for posting upcoming meetings on the web site and sending notices out to the mailing list. I haven't been doing a very good job of it, and that's been especially true this past summer when I was missing meetings as well, so I was out of the loop. I'm looking for one or two volunteers to take over the following roles. 1) Finding out who is talking each month and chasing up speakers for titles/descriptions This is a pretty easy task, but involves some organizational skills. 2) Announcing meetings to the web site and to the list. This is very easy, and takes very little time each month (about 10 minutes). Edit one HTML file and send out an email to the list. 3) Redesign of the web site for better usability and easier maintenance. This is a pretty big job. Doesn't necessarily involve programming, but it could. Better organization and cleaner HTML and styles would be fantastic. A blog with an event calendar would be nifty. Of these three jobs, the first two are more important, and very easy. Any takers? Please respond to me privately or we'll discuss at the next meeting. Which is this Thursday, BTW. Michael On Fri, 11 Sep 2009 12:33:36 -0400 Scott Elcomb wrote: > On Fri, Sep 11, 2009 at 12:26 PM, Dave Doyle > wrote: > > Keep forgetting to hit reply-all dammit. > ... > > He did, and I volunteered and then got ridiculously busy so that's > > my bad. > > > > Not sure if I'm the best man for the job for the moment.? Any other > > volunteers? > > How much time and effort is required? If it's only periodic > maintenance, I'll offer to help. > -- Michael Graham From magog at the-wire.com Mon Sep 21 08:25:06 2009 From: magog at the-wire.com (Michael Graham) Date: Mon, 21 Sep 2009 11:25:06 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <7BE11770-4A04-4F23-AE4B-7B4C00FEE0DA@gmail.com> References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> <7BE11770-4A04-4F23-AE4B-7B4C00FEE0DA@gmail.com> Message-ID: <20090921112506.2b2be353@caliope> On Fri, 11 Sep 2009 10:56:27 -0400 Kartik Thakore wrote: > Also can I get details on the event. There is some conflicting > information on the website and august mailing archives. Sorry - the web site has now been updated. We don't know the room number yet, but the evening is now listed in "upcoming talks." Michael -- Michael Graham From magog at the-wire.com Mon Sep 21 08:27:58 2009 From: magog at the-wire.com (Michael Graham) Date: Mon, 21 Sep 2009 11:27:58 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> References: <8204a4fe0908280541j5967e676v3990be306254048b@mail.gmail.com> <8204a4fe0908281032n1eb354bam56709c9107bc57d7@mail.gmail.com> <8204a4fe0909040619n6ef98a27wbf515500cea579cd@mail.gmail.com> <8204a4fe0909101936r5fb53bfekd6bd8024e243635b@mail.gmail.com> Message-ID: <20090921112758.58b58e67@caliope> I will try to do two talks, if I can get them prepared in time: 1) Generating test data with Test::Sims and Test::DBIx::Class 2) Model-based authorization with Catalyst, DBIx::Class and Moose. Michael On Thu, 10 Sep 2009 22:36:18 -0400 Fulko Hew wrote: > Its now 2 weeks and counting... > > We are now up to THREE presentations! > We still need some more! > > Do you like to talk? > We like to listen! > Consider us 'professional listeners', > we might actually pay attention too. > > Pick a subject... any subject. > You know... it doesn't even have to be something you tell us... > it could be something you ask us! > > Just email me with your idea. > > Thanks From swilliams at nexientlearning.com Mon Sep 21 09:26:33 2009 From: swilliams at nexientlearning.com (Scott Williams) Date: Mon, 21 Sep 2009 13:26:33 -0300 Subject: [tpm] September lightning Talks (call for participation) Message-ID: <78D34A74EB88214C91C63B9D6D6E0A5601A5C7EA@ExchangeBE.corp.crossoff.com> Sorry for the delay... classroom 11 on the 8th floor. ----- Original Message ----- From: toronto-pm-bounces+swilliams=nexientlearning.com at pm.org To: Kartik Thakore Cc: tpm at to.pm.org Sent: Mon Sep 21 12:25:06 2009 Subject: Re: [tpm] September lightning Talks (call for participation) On Fri, 11 Sep 2009 10:56:27 -0400 Kartik Thakore wrote: > Also can I get details on the event. There is some conflicting > information on the website and august mailing archives. Sorry - the web site has now been updated. We don't know the room number yet, but the evening is now listed in "upcoming talks." Michael -- Michael Graham _______________________________________________ toronto-pm mailing list toronto-pm at pm.org http://mail.pm.org/mailman/listinfo/toronto-pm From magog at the-wire.com Mon Sep 21 10:09:53 2009 From: magog at the-wire.com (Michael Graham) Date: Mon, 21 Sep 2009 13:09:53 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <78D34A74EB88214C91C63B9D6D6E0A5601A5C7EA@ExchangeBE.corp.crossoff.com> References: <78D34A74EB88214C91C63B9D6D6E0A5601A5C7EA@ExchangeBE.corp.crossoff.com> Message-ID: <20090921130953.13e5fd78@caliope> Awesome - thanks, Scott!! Michael On Mon, 21 Sep 2009 13:26:33 -0300 "Scott Williams" wrote: > classroom 11 on the 8th floor -- Michael Graham From Shane.Boyce at gennum.com Mon Sep 21 13:06:08 2009 From: Shane.Boyce at gennum.com (Shane Boyce) Date: Mon, 21 Sep 2009 16:06:08 -0400 Subject: [tpm] Single thread Perl 5.8.8 vs. Multi-threaded Perl 5.10.1 Message-ID: Just wondering if anyone has experience with multi-threaded Perl? And if the following benchmarks are typical of people's experiences? I'm using a Solaris 10 system on a sun-sparc workstation and just went from the precompiled package from www.sunfreeware.com of Perl 5.8.8 to a compiled source version of Perl 5.10.1 /w multi-threading turned on. Benchmarks of a program I used went like this: SUMMARY: ######## I had to got to 12 threads to make it worth my while! That's a bit nuts. Is multi-threaded Perl 5.10.1 really so much slower than single threaded Perl 5.8.8? Or have I likely hindered it somehow? (I pretty sure debug mode was turned off) Thanks. Final Results D5, Initial was A1: (A1) [1:13.57 min] "real" wall clock time (D5) [0:32.46 min] "real" wall clock time But that is still using real seconds (summing thread totals of): (A1) [1:03.13 + 0.64] = [1:03.77 min] User + Sys time (D5) [2:09.34 + 2.97] = [2:12.31 min] User + Sys time So D5 ends up being faster and takes up 44% of original time, but uses 209% more CPU time and +12 CPU threads to do it! DETAILS: ######## Measurements using Benchmark.pm /w Hi::Res timing inside the file to benchmark individual subroutines are not shown. Shown here are the "timex" values of the main process' overall performance. System: 1 CPU /w 8 core /w 4 threads per core = 32 available threads. 16 GB RAM (8 GB available for apps) Oracle backend running (using 8 GB of RAM) on same server as Perl application. Data: - 468 tests - 1270 devices tested with those tests - 565003 individual measurements in total (Lower than 468x1270=594360 as not all devices were tested for all tests). A1) Non-optimized, /wo use strict version: real 1:13.57 user 1:03.13 sys 0.64 A2) Original single threaded Perl 5.8.8: real 1:00.90 user 54.53 sys 0.63 B) Original code, but switched to multi-threaded Perl 5.10.1 as compiler: real 1:24.91 user 1:17.95 sys 0.61 I then went multi-threaded, but did it for a section of the code after many 100's of MB of data had been fetched (not a great idea once I understood that the threads copy EVERYTHING, not just what's passed to the thread subroutine): C1) #Timing: Perl 5.10.1 /w threading enabled (2 threads): real 1:17.28 user 1:43.31 sys 2.93 C2) #Timing: Perl 5.10.1 /w threading enabled (8 threads): real 1:23.73 user 1:43.18 sys 10.35 C3) #Timing: Perl 5.10.1 /w threading enabled (4 threads): real 1:10.04 user 1:37.59 sys 1.26 Then I got a bit smarter and went multi-threaded before fetching data, and only fetched the data from Oracle required by each thread (so results in more database accesses, but less memory copies): Used Thread::Queue to feed test list to threads. Each thread then processed that test and moved on to next one in the queue. D1) #Timing: Perl 5.10.1 /w threading enabled (2 thread) (thread whole fetch process per test): real 1:51.23 user 3:04.13 sys 4.71 D2) #Timing: Perl 5.10.1 /w threading enabled (4 thread) (thread whole fetch process per test): real 1:01.82 user 2:19.19 sys 3.40 D3) #Timing: Perl 5.10.1 /w threading enabled (6 thread) (thread whole fetch process per test): real 46.43 user 2:08.68 sys 3.08 D4) #Timing: Perl 5.10.1 /w threading enabled (8 thread) (thread whole fetch process per test): real 42.35 user 2:09.36 sys 3.09 D5) #Timing: Perl 5.10.1 /w threading enabled (12 thread) (thread whole fetch process per test): real 32.46 user 2:09.34 sys 2.97 D6) #Timing: Perl 5.10.1 /w threading enabled (16 thread) (thread whole fetch process per test): real 30.63 user 2:11.11 sys 2.94 D7) #Timing: Perl 5.10.1 /w threading enabled (32 thread) (thread whole fetch process per test): real 31.26 user 2:13.50 sys 3.13 Thanks, Shane K. Boyce This communication contains confidential information intended only for the addressee(s). If you have received this communication in error, please notify us immediately and delete this communication from your mail box. From stuart at morungos.com Mon Sep 21 13:19:37 2009 From: stuart at morungos.com (Stuart Watt) Date: Mon, 21 Sep 2009 16:19:37 -0400 Subject: [tpm] Single thread Perl 5.8.8 vs. Multi-threaded Perl 5.10.1 In-Reply-To: References: Message-ID: <4AB7DFD9.2050908@morungos.com> I do remember the Perl documentation saying somewhere that threading did have about a 20-25% performance penalty, and that's just inherent in any Perl compiled to enable threads. I can't remember where I got that from, though. If you want high performance, you may find it easier to use processes with some form of IPC rather than relying on Perl threads. We do this (on Windows, admittedly) and it does seem that our Perl without threads is about 25% faster than ActivePerl. So your original results are exactly in line with that. We do use a lot of multiprocessing, but we do it by laboriously creating and coordinating Windows processes. As to the more detailed test differences, I hesitate to comment without knowing more about the architecture of the test, especially if SQL databases are involved. Of course, you could try the same benchmark using either UNIX fork()s rather than Perl threads, to see whether you get a different result. All the best Stuart Shane Boyce wrote: > Just wondering if anyone has experience with multi-threaded Perl? And if the following benchmarks are typical of people's experiences? > > I'm using a Solaris 10 system on a sun-sparc workstation and just went from the precompiled package from www.sunfreeware.com of Perl 5.8.8 to a compiled source version of Perl 5.10.1 /w multi-threading turned on. > > Benchmarks of a program I used went like this: > > SUMMARY: > ######## > I had to got to 12 threads to make it worth my while! That's a bit nuts. Is multi-threaded Perl 5.10.1 really so much slower than single threaded Perl 5.8.8? Or have I likely hindered it somehow? (I pretty sure debug mode was turned off) Thanks. > > From thakore.kartik at gmail.com Mon Sep 21 13:35:09 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Mon, 21 Sep 2009 16:35:09 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <20090921130953.13e5fd78@caliope> References: <78D34A74EB88214C91C63B9D6D6E0A5601A5C7EA@ExchangeBE.corp.crossoff.com> <20090921130953.13e5fd78@caliope> Message-ID: <47B911EB-6611-475F-ADA5-30EBFD83885A@gmail.com> Can someone summarize these details? Kartik Thakore On 21-Sep-09, at 1:09 PM, Michael Graham wrote: > > Awesome - thanks, Scott!! > > > Michael > > On Mon, 21 Sep 2009 13:26:33 -0300 > "Scott Williams" wrote: > >> classroom 11 on the 8th floor > > -- > Michael Graham From adam.prime at utoronto.ca Mon Sep 21 13:42:17 2009 From: adam.prime at utoronto.ca (Adam Prime) Date: Mon, 21 Sep 2009 16:42:17 -0400 Subject: [tpm] September lightning Talks (call for participation) In-Reply-To: <47B911EB-6611-475F-ADA5-30EBFD83885A@gmail.com> References: <78D34A74EB88214C91C63B9D6D6E0A5601A5C7EA@ExchangeBE.corp.crossoff.com> <20090921130953.13e5fd78@caliope> <47B911EB-6611-475F-ADA5-30EBFD83885A@gmail.com> Message-ID: <4AB7E529.5020606@utoronto.ca> Kartik Thakore wrote: > Can someone summarize these details? > http://to.pm.org/#2009-09 From arocker at vex.net Mon Sep 21 14:43:35 2009 From: arocker at vex.net (arocker at vex.net) Date: Mon, 21 Sep 2009 17:43:35 -0400 Subject: [tpm] Single thread Perl 5.8.8 vs. Multi-threaded Perl 5.10.1 In-Reply-To: <4AB7DFD9.2050908@morungos.com> References: <4AB7DFD9.2050908@morungos.com> Message-ID: <5945404d61f9a1ec5ab7f88a47649837.squirrel@webmail.vex.net> > If you want high performance, you may find it easier to use > processes with some form of IPC rather than relying on Perl threads. People will keep trying to get the application level to do the OS's jobs. Unfortunately, threading seems to be a problem even the OS people haven't solved yet. From fulko.hew at gmail.com Mon Sep 21 19:42:45 2009 From: fulko.hew at gmail.com (Fulko Hew) Date: Mon, 21 Sep 2009 22:42:45 -0400 Subject: [tpm] September 2009 - Lightning Talk Lineup Message-ID: <8204a4fe0909211942j76ebc93dwdb32d6be761e0fac@mail.gmail.com> I'm amazed... and thank you. Given the slow start, the final number of submissions this year has been impressive. Given the number of talks we have scheduled, and the true meaning of lightning talks, everyone will be getting their allotted FIVE minutes. In no particular order, our agenda will hopefully be: Fulko Hew - Kevorkian'ing VMware Dave Doyle - Padre: A Perl IDE... in Perl! Antonio Sun - An Introduction to Virtualization Olaf Alders - T.B.D. Kartik Thakore - SDL Perl Scott Elcomb - IP/Copyright Legislation Alan Rocker - The Unix Philosophy Quantum Mechanic - DBM::Deep Quantum Mechanic - Facebook Word Twister Geoff Flarity - Google::ProtocolBuffers Michael Graham - Generating test data with Test::Sims and Test::DBIx::Class Michael Graham - Model-based authorization with Catalyst, DBIx::Class and Moose Fulko -------------- next part -------------- An HTML attachment was scrubbed... URL: From abuzarchaudhary at yahoo.com Tue Sep 22 14:38:52 2009 From: abuzarchaudhary at yahoo.com (Abuzar Chaudhary) Date: Tue, 22 Sep 2009 14:38:52 -0700 (PDT) Subject: [tpm] Playing MIDI notes using Perl? In-Reply-To: <3EFACCEC-D799-42BD-8B3B-E353DFE11C26@gmail.com> Message-ID: <181665.32756.qm@web52907.mail.re2.yahoo.com> Hi Kartik, Thanks, I didn't know you could do MIDI through SDL. Yes, I'd be into trying it out. Thanks, Abuzar --- On Thu, 9/17/09, Kartik Thakore wrote: > From: Kartik Thakore > Subject: Re: [tpm] Playing MIDI notes using Perl? > To: "abuzar at abuzar.com" , "tpm at to.pm.org" > Date: Thursday, September 17, 2009, 8:21 AM > You can do this with SDL perl. I have > script example. Let me find it and get it for you > > Kartik Thakore > > On 15-Sep-09, at 11:14 AM, Abuzar Chaudhary > wrote: > > > Hi, > > > > Does anyone know how to play MIDI notes using Perl on > Windows? > > > > I'm using Win32API::MIDI and in the example, they're > using these hex codes to turn notes on and off: > > $mo->ShortMsg(0x00403C90) > > $mo->ShortMsg(0x00003C90) > > > > These hex codes, where can I find a spec for > them?? I've been googling and going through the > microsoft website for hours (which the perldoc recommends), > but I can't find anything. > > > > All I want to do is play music notes.? Is that > too much to ask for? With Commodore, it was really > easy.? Like this: > > > > play "CDEFGAB" > > > > How difficult can this be?! As time goes by, > programming gets worse :( > > > > Abuzar > > > > p.s. Please, no elitism, like I should be using Linux > instead, or I'm not RTFM, or I'm too dumb (I already know > that).? Thanks. > > > > > > > > _______________________________________________ > > toronto-pm mailing list > > toronto-pm at pm.org > > http://mail.pm.org/mailman/listinfo/toronto-pm > From thakore.kartik at gmail.com Tue Sep 22 16:06:58 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Tue, 22 Sep 2009 19:06:58 -0400 Subject: [tpm] Playing MIDI notes using Perl? In-Reply-To: <181665.32756.qm@web52907.mail.re2.yahoo.com> References: <181665.32756.qm@web52907.mail.re2.yahoo.com> Message-ID: <10B441A8-4073-4F93-A57D-668F2F981770@gmail.com> I will see if I can find that script before thusday Kartik Thakore On 22-Sep-09, at 5:38 PM, Abuzar Chaudhary wrote: > Hi Kartik, > > Thanks, I didn't know you could do MIDI through SDL. Yes, I'd be > into trying it out. > > Thanks, > Abuzar > > --- On Thu, 9/17/09, Kartik Thakore wrote: > >> From: Kartik Thakore >> Subject: Re: [tpm] Playing MIDI notes using Perl? >> To: "abuzar at abuzar.com" , "tpm at to.pm.org" > > >> Date: Thursday, September 17, 2009, 8:21 AM >> You can do this with SDL perl. I have >> script example. Let me find it and get it for you >> >> Kartik Thakore >> >> On 15-Sep-09, at 11:14 AM, Abuzar Chaudhary > > >> wrote: >> >>> Hi, >>> >>> Does anyone know how to play MIDI notes using Perl on >> Windows? >>> >>> I'm using Win32API::MIDI and in the example, they're >> using these hex codes to turn notes on and off: >>> $mo->ShortMsg(0x00403C90) >>> $mo->ShortMsg(0x00003C90) >>> >>> These hex codes, where can I find a spec for >> them? I've been googling and going through the >> microsoft website for hours (which the perldoc recommends), >> but I can't find anything. >>> >>> All I want to do is play music notes. Is that >> too much to ask for? With Commodore, it was really >> easy. Like this: >>> >>> play "CDEFGAB" >>> >>> How difficult can this be?! As time goes by, >> programming gets worse :( >>> >>> Abuzar >>> >>> p.s. Please, no elitism, like I should be using Linux >> instead, or I'm not RTFM, or I'm too dumb (I already know >> that). Thanks. >>> >>> >>> >>> _______________________________________________ >>> toronto-pm mailing list >>> toronto-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/toronto-pm >> > > > From linux at alteeve.com Thu Sep 24 08:05:50 2009 From: linux at alteeve.com (Madison Kelly) Date: Thu, 24 Sep 2009 11:05:50 -0400 Subject: [tpm] perldoc and utf8 not working Message-ID: <4ABB8ACE.5030204@alteeve.com> Hi all, I've got a POD for a module of mine with Japanese text in it. The POD file itself is saved as UTF8 and I used '=encoding utf8' at the top of the pod, but the formatting is still broken. When I vim the file or use the 'perldoc -t' switch, the Japanese characters render properly. Any idea what might be wrong? Here is a stripped out version of my POD with normal and '-t' switch decoding samples: -------------- =pod =encoding utf8 =head1 METHODS Below are the detailed usage instructions for the methods provided by this module. =head2 get =head3 Example # This time specify to read from the Japanese word strings. $an->String->get({key=>"t_0002",variable=>["?", "?"],language=>"jp"}); # The same, but in the shorter array-type call: $an->String->get("t_0002",["?", "?"],"jp"); print "$say_string\n"; # Prints: "???? ??: [?]/[?]?" =head3 Details Foo... =cut -------------- And here is how it renders: -------------- TEST(1) User Contributed Perl Documentation TEST(1) METHODS Below are the detailed usage instructions for the methods provided by this module. get Example # This time specify to read from the Japanese word strings. $an->String->get({key=>"t_0002",variable=>["X", "X"],language=>"jp"}); # The same, but in the shorter array-type call: $an->String->get("t_0002",["X", "X"],"jp"); print "$say_string\n"; # Prints: "XXXX XX: [X]/[X]X" Details Foo... perl v5.10.0 2009-09-24 TEST(1) -------------- But when I use the '-t' switch it renders ok: -------------- METHODS Below are the detailed usage instructions for the methods provided by this module. get Example # This time specify to read from the Japanese word strings. $an->String->get({key=>"t_0002",variable=>["?", "?"],language=> "jp"}); # The same, but in the shorter array-type call: $an->String->get("t_0002",["?", "?"],"jp"); print "$say_string\n"; # Prints: "???? ??: [?]/[?]?" Details Foo... -------------- Madi From talexb at gmail.com Thu Sep 24 08:56:00 2009 From: talexb at gmail.com (talexb) Date: Thu, 24 Sep 2009 11:56:00 -0400 Subject: [tpm] perldoc and utf8 not working In-Reply-To: <4ABB8ACE.5030204@alteeve.com> References: <4ABB8ACE.5030204@alteeve.com> Message-ID: Checking the docs for perldoc, it seems that it does pod2man | nroff -man | $PAGER so that suggests the problem might be with nroff not handling utf-8 characters. Sure enough, Google suggests http://www.simplicidade.org/notes/archives/2009/05/fixing_the_pod.html as a possible fix. Good luck with that. -- Alex Beamish Toronto, Ontario aka talexb From linux at alteeve.com Thu Sep 24 12:11:53 2009 From: linux at alteeve.com (Madison Kelly) Date: Thu, 24 Sep 2009 15:11:53 -0400 Subject: [tpm] perldoc and utf8 not working In-Reply-To: References: <4ABB8ACE.5030204@alteeve.com> Message-ID: <4ABBC479.2050007@alteeve.com> talexb wrote: > Checking the docs for perldoc, it seems that it does > > pod2man | nroff -man | $PAGER > > so that suggests the problem might be with nroff not handling utf-8 > characters. Sure enough, Google suggests > > http://www.simplicidade.org/notes/archives/2009/05/fixing_the_pod.html > > as a possible fix. > > Good luck with that. > Hrm, so it's not bad formatting of my POD then? Well, I am not so concerned about how I see it, I am concerned about how my users will see it. I can't ask them to recompile nroff... Should I file a bug report do you think? Madi From antoniosun at lavabit.com Fri Sep 25 15:04:16 2009 From: antoniosun at lavabit.com (Antonio Sun) Date: Fri, 25 Sep 2009 18:04:16 -0400 Subject: [tpm] OT: presentation tools Message-ID: Hi, To all last night presenters, great talk and great presentations too. I'm wondering which tool did you use to create your presentation (other than open office). Thanks Antonio -------------- next part -------------- An HTML attachment was scrubbed... URL: From thakore.kartik at gmail.com Fri Sep 25 15:39:07 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Fri, 25 Sep 2009 18:39:07 -0400 Subject: [tpm] Playing MIDI notes using Perl? In-Reply-To: References: <181665.32756.qm@web52907.mail.re2.yahoo.com> <10B441A8-4073-4F93-A57D-668F2F981770@gmail.com> Message-ID: Ya no problem. Kartik Thakore On 25-Sep-09, at 6:32 PM, Antonio Sun wrote: > > > On Tue, Sep 22, 2009 at 7:06 PM, Kartik Thakore > wrote: > I will see if I can find that script before thusday > > Hi Kartik, > > Can I have it as well? I thought you'd talked about it last night. > Very impressive presentation BTW, this is the first time that I know > a person can give public speeches while playing computer game. > > cheers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thakore.kartik at gmail.com Fri Sep 25 15:53:59 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Fri, 25 Sep 2009 18:53:59 -0400 Subject: [tpm] OT: presentation tools In-Reply-To: References: Message-ID: <4B21D6C4-1605-4258-86C4-4DCC91367301@gmail.com> Perl + SDL :p . But seriously what did you guys use? I liked the one Olaf had. Kartik Thakore On 25-Sep-09, at 6:04 PM, Antonio Sun wrote: > Hi, > > To all last night presenters, great talk and great presentations > too. I'm wondering which tool did you use to create your > presentation (other than open office). > > Thanks > > Antonio > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm From thakore.kartik at gmail.com Fri Sep 25 17:04:36 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Fri, 25 Sep 2009 20:04:36 -0400 Subject: [tpm] TPM SDL Presentation: Post-Mortem Notes Message-ID: Hi Guys, Since I didn't have a fancy pants presentation slides like you guys I guess I have to make the notes now. How I started Perl: -Got into to it at work -Coworker suggested CPAN -Tried to make a decent game with SDL Perl 2005 version ( http://search.cpan.org/~dgoehrig/SDL_Perl-2.1.3/) - Ratings were PASS (1) FAIL (72) UNKNOWN (119) (I think the 1 pass was luck) - Got ticked off and started fixing it in GitHub - Got David (old maintainer) to give me access (David also helped me a lot) - Doing that for the last month and here I am What SDL is (this is for Richard mostly): - simple answer www.libsdl.org Why I think SDL + Perl will be a good gaming platform: - Perl's philosophy (Simple things easy. Complex things possible). - SDL is very stable and fast now - Perl has already proven it can make good games ( http://www.frozen-bubble.org/ ) What I am going to be doing: - Making SDL Perl not leak like a diaper of a two tonne baby who just at mexican for a week. (http://rt.cpan.org/Public/Bug/Display.html?id=49084) - Updating SDL Perl's docs with good tutorials - The falling block game (Tetris) I had in the presentation is being cleaned and turned into a tutorial (http://github.com/kthakore/TetrisPL) - Update to new SDL API Future Plans: - Follow in Perl's philosophy and make (Simple Games Easy. Complex Games Possible) - I have registered three name-spaces that will help accomplish this - SDL::Game - Regular SDL Specific widgets (high scores, grids, ...) , extensions and so on (Breuno++ aka garu for this ) - Game::Tool - C/Perl implementations of Game Design Patterns, Algorithms (A*, Swarm) - Game::Base - Genre Specific but not SDL Specific base to make a game in that genre. Game::Action, Game::Shooter (this is very simple but it shows the idea) - Adhering to our philosophy of Simple Games Easy: -The version for the modules in these namespaces will -Make a simple game: Tetris - Get core logic: 2d collision detection, linear game event manager - Move it into appropriate name space as modules that work independently: Game::Tool::Collision, Game::EventManager - release v0.01 with new tutorial of Tetris in less then 100 lines of code. - Repeat with Pong, Breakout, SideScroller (Mario) ... so on - This way modules released are necessity designed not fantasy designed Micheal as for your question to start as a game developer its simple. Think of a game. ( Or help with the tutorials in SDL Perl :P ) Think of good data structures for it. Hack Hack Hack. Then go back and find out why your data structure was wrong. Repeat to step 2 Kartik Thakore -------------- next part -------------- An HTML attachment was scrubbed... URL: From olaf at vilerichard.com Fri Sep 25 17:22:31 2009 From: olaf at vilerichard.com (Olaf Alders) Date: Fri, 25 Sep 2009 20:22:31 -0400 Subject: [tpm] OT: presentation tools In-Reply-To: <4B21D6C4-1605-4258-86C4-4DCC91367301@gmail.com> References: <4B21D6C4-1605-4258-86C4-4DCC91367301@gmail.com> Message-ID: <1AC07F97-33E6-4F09-B0CA-C429A381CE37@vilerichard.com> I used S5, which Dave Doyle had recommended. It's actually really easy to set up a presentation. I just took the example slide show and altered the content. http://meyerweb.com/eric/tools/s5/ Having said that, I'd also be interested to know what other folks used. Olaf On 25-Sep-09, at 6:53 PM, Kartik Thakore wrote: > Perl + SDL :p . But seriously what did you guys use? I liked the one > Olaf had. > > Kartik Thakore > > On 25-Sep-09, at 6:04 PM, Antonio Sun wrote: > >> Hi, >> >> To all last night presenters, great talk and great presentations >> too. I'm wondering which tool did you use to create your >> presentation (other than open office). >> >> Thanks >> >> Antonio >> >> _______________________________________________ >> toronto-pm mailing list >> toronto-pm at pm.org >> http://mail.pm.org/mailman/listinfo/toronto-pm > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > From antoniosun at lavabit.com Sat Sep 26 07:04:14 2009 From: antoniosun at lavabit.com (Antonio Sun) Date: Sat, 26 Sep 2009 10:04:14 -0400 Subject: [tpm] OT: presentation tools In-Reply-To: <1AC07F97-33E6-4F09-B0CA-C429A381CE37@vilerichard.com> References: <4B21D6C4-1605-4258-86C4-4DCC91367301@gmail.com> <1AC07F97-33E6-4F09-B0CA-C429A381CE37@vilerichard.com> Message-ID: On Fri, Sep 25, 2009 at 8:22 PM, Olaf Alders wrote: > I'd also be interested to know what other folks used. > I know that Abram Hindle uses LaTeX, but whether it was Prosper or Beamer or something else I am not sure. I used to use Prosper, but this time I found Beamer to be better. -------------- next part -------------- An HTML attachment was scrubbed... URL: From psema4 at gmail.com Tue Sep 29 07:22:03 2009 From: psema4 at gmail.com (Scott Elcomb) Date: Tue, 29 Sep 2009 10:22:03 -0400 Subject: [tpm] OT: presentation tools In-Reply-To: References: Message-ID: <99a6c38f0909290722k25c54217gc16492f3fc1b38c7@mail.gmail.com> On Fri, Sep 25, 2009 at 6:04 PM, Antonio Sun wrote: > To all last night presenters, great talk and great presentations too. I'm > wondering which tool did you use to create your presentation (other than > open office). I whipped up a custom app the night before. It's similar (in some ways) to an early version of S5; I'm hoping to extend it with additional features at some point. Unfortunately, I didn't have time to deal with multiple resolutions (which bit me during the presentation) and browsers other than Firefox. This has slowed my posting of the slides. I may just export them as a PDF for now until I get around to correcting the code. -- Scott Elcomb http://www.psema4.com/ @psema4 Member of the Pirate Party of Canada http://www.pirateparty.ca/ From linux at alteeve.com Wed Sep 30 08:39:14 2009 From: linux at alteeve.com (Madison Kelly) Date: Wed, 30 Sep 2009 11:39:14 -0400 Subject: [tpm] Fast(er) way of deleting X lines from start of a file Message-ID: <4AC37BA2.90608@alteeve.com> Hi all, Thus far, I've opened a file, read it in, shifted/ignored the first X number of line and then wrote out the resulting file. This works, but strikes me as horribly inefficient. Doubly so when the file could be larger than RAM. So then, is there a more efficient/faster way of saying "Delete the first X number of lines from file foo"? Thanks all! Madi From uri at StemSystems.com Wed Sep 30 08:53:58 2009 From: uri at StemSystems.com (Uri Guttman) Date: Wed, 30 Sep 2009 11:53:58 -0400 Subject: [tpm] Fast(er) way of deleting X lines from start of a file In-Reply-To: <4AC37BA2.90608@alteeve.com> (Madison Kelly's message of "Wed\, 30 Sep 2009 11\:39\:14 -0400") References: <4AC37BA2.90608@alteeve.com> Message-ID: <87tyykv36x.fsf@quad.sysarch.com> >>>>> "MK" == Madison Kelly writes: MK> Hi all, MK> Thus far, I've opened a file, read it in, shifted/ignored the first MK> X number of line and then wrote out the resulting file. This works, MK> but strikes me as horribly inefficient. Doubly so when the file could MK> be larger than RAM. MK> So then, is there a more efficient/faster way of saying "Delete the MK> first X number of lines from file foo"? this is a file system problem, not a perl one. the file system (other than on things like vms) doesn't allow deleting from the front of the file. it has to be copied in and out with the edits being done on the fly. there are many perlish ways to do this including tie::file, reading line by line and printing but ignoring the early lines using $. and slurping in the whole file (file::slurp::read_file) into an array, splicing off the lines and printing it out again (with file::slurp::write_file). uri -- Uri Guttman ------ uri at stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- From talexb at gmail.com Wed Sep 30 08:57:27 2009 From: talexb at gmail.com (Alex Beamish) Date: Wed, 30 Sep 2009 11:57:27 -0400 Subject: [tpm] Fast(er) way of deleting X lines from start of a file In-Reply-To: <4AC37BA2.90608@alteeve.com> References: <4AC37BA2.90608@alteeve.com> Message-ID: On Wed, Sep 30, 2009 at 11:39 AM, Madison Kelly wrote: > Hi all, > > ?Thus far, I've opened a file, read it in, shifted/ignored the first X > number of line and then wrote out the resulting file. This works, but > strikes me as horribly inefficient. Doubly so when the file could be larger > than RAM. > > ?So then, is there a more efficient/faster way of saying "Delete the first X > number of lines from file foo"? I would expect you could fashion something workable like this # Get the number of lines in the file .. wc -l file # tail the desired number of lines to a new file .. tail -n $numberOfLinesInFile-$numberOfLinesYouDontWant file >newfile # and move the files around. rm file; mv newfile file -- Alex Beamish Toronto, Ontario aka talexb From matt at starnix.com Wed Sep 30 09:16:32 2009 From: matt at starnix.com (G. Matthew Rice) Date: Wed, 30 Sep 2009 12:16:32 -0400 Subject: [tpm] Fast(er) way of deleting X lines from start of a file In-Reply-To: <4AC37BA2.90608@alteeve.com> References: <4AC37BA2.90608@alteeve.com> Message-ID: <1254327392.11743.0.camel@hatsya.starnix.com> On Wed, 2009-09-30 at 11:39 -0400, Madison Kelly wrote: > Thus far, I've opened a file, read it in, shifted/ignored the first X > number of line and then wrote out the resulting file. This works, but > strikes me as horribly inefficient. Doubly so when the file could be > larger than RAM. > > So then, is there a more efficient/faster way of saying "Delete the > first X number of lines from file foo"? Do you have to do it in Perl? You could do: tail -n +N out.txt where: N = X + 1 Regards, --matt From shlomif at iglu.org.il Wed Sep 30 09:17:57 2009 From: shlomif at iglu.org.il (Shlomi Fish) Date: Wed, 30 Sep 2009 18:17:57 +0200 Subject: [tpm] Fast(er) way of deleting X lines from start of a file In-Reply-To: <4AC37BA2.90608@alteeve.com> References: <4AC37BA2.90608@alteeve.com> Message-ID: <200909301817.57674.shlomif@iglu.org.il> On Wednesday 30 Sep 2009 17:39:14 Madison Kelly wrote: > Hi all, > > Thus far, I've opened a file, read it in, shifted/ignored the first X > number of line and then wrote out the resulting file. This works, but > strikes me as horribly inefficient. Doubly so when the file could be > larger than RAM. > > So then, is there a more efficient/faster way of saying "Delete the > first X number of lines from file foo"? > What I would do in pure-Perl is: (untested) <<<<<<<<<<<<<<< my $num_lines_to_del = shift(@ARGV); my $filename = shift(@ARGV); # Maybe use File::Temp here my $temp_fn = $filename.".new"; open my $in_fh, "<", $filename or die "Could not open '$filename' - $! !"; open my $temp_out_fh, ">", $temp_fn or die "Could not open temp filename - $!"; foreach my $i (1 .. $num_lines_to_del) { # Read one line. scalar(<$in_fh>); } my $buf_len = 1024 * 16; my $buffer; while (read($in_fh, $buffer, $buf_len)) { print {$temp_out_fh} $buffer; } close($temp_out_fh); close($in_fh); rename($temp_fn, $filename); >>>>>>>>>>>>>>>>>>>>>>> Like I said - untested, but I hope you get the idea. Regards, Shlomi Fish > Thanks all! > > Madi > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Interview with Ben Collins-Sussman - http://shlom.in/sussman Chuck Norris read the entire English Wikipedia in 24 hours. Twice. From shlomif at iglu.org.il Wed Sep 30 09:17:57 2009 From: shlomif at iglu.org.il (Shlomi Fish) Date: Wed, 30 Sep 2009 18:17:57 +0200 Subject: [tpm] Fast(er) way of deleting X lines from start of a file In-Reply-To: <4AC37BA2.90608@alteeve.com> References: <4AC37BA2.90608@alteeve.com> Message-ID: <200909301817.57674.shlomif@iglu.org.il> On Wednesday 30 Sep 2009 17:39:14 Madison Kelly wrote: > Hi all, > > Thus far, I've opened a file, read it in, shifted/ignored the first X > number of line and then wrote out the resulting file. This works, but > strikes me as horribly inefficient. Doubly so when the file could be > larger than RAM. > > So then, is there a more efficient/faster way of saying "Delete the > first X number of lines from file foo"? > What I would do in pure-Perl is: (untested) <<<<<<<<<<<<<<< my $num_lines_to_del = shift(@ARGV); my $filename = shift(@ARGV); # Maybe use File::Temp here my $temp_fn = $filename.".new"; open my $in_fh, "<", $filename or die "Could not open '$filename' - $! !"; open my $temp_out_fh, ">", $temp_fn or die "Could not open temp filename - $!"; foreach my $i (1 .. $num_lines_to_del) { # Read one line. scalar(<$in_fh>); } my $buf_len = 1024 * 16; my $buffer; while (read($in_fh, $buffer, $buf_len)) { print {$temp_out_fh} $buffer; } close($temp_out_fh); close($in_fh); rename($temp_fn, $filename); >>>>>>>>>>>>>>>>>>>>>>> Like I said - untested, but I hope you get the idea. Regards, Shlomi Fish > Thanks all! > > Madi > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Interview with Ben Collins-Sussman - http://shlom.in/sussman Chuck Norris read the entire English Wikipedia in 24 hours. Twice. From stuart at morungos.com Wed Sep 30 09:52:43 2009 From: stuart at morungos.com (Stuart Watt) Date: Wed, 30 Sep 2009 12:52:43 -0400 Subject: [tpm] Fast(er) way of deleting X lines from start of a file In-Reply-To: <87tyykv36x.fsf@quad.sysarch.com> References: <4AC37BA2.90608@alteeve.com> <87tyykv36x.fsf@quad.sysarch.com> Message-ID: <4AC38CDB.9040703@morungos.com> I have been known to use sed for this, e.g.: sed '1,1 d' newfile The second "1" can be X, but I often have to delete a single header line, for example for a database bulk load file. The GnuWin32 version works well on Windows too, but usually needs double quotes for the command. sed is generally memory friendly, but has about the second worst command syntax ever invented. (There's a special award for edlin). All the best Stuart -- Stuart Watt ARM Product Developer Information Balance -------------- next part -------------- An HTML attachment was scrubbed... URL: From antoniosun at lavabit.com Wed Sep 30 10:03:45 2009 From: antoniosun at lavabit.com (Antonio Sun) Date: Wed, 30 Sep 2009 13:03:45 -0400 Subject: [tpm] Fast(er) way of deleting X lines from start of a file In-Reply-To: References: <4AC37BA2.90608@alteeve.com> Message-ID: On Wed, Sep 30, 2009 at 11:57 AM, Alex Beamish wrote: > > So then, is there a more efficient/faster way of saying "Delete the > first X > > number of lines from file foo"? > > I would expect you could fashion something workable like this > > # Get the number of lines in the file .. > wc -l file > > # tail the desired number of lines to a new file .. > tail -n $numberOfLinesInFile-$numberOfLinesYouDontWant file >newfile > > # and move the files around. > rm file; mv newfile file > If using shell script instead of Perl is an option, then sed is the best tool ToDel=20 sed -i "1,${ToDel}d" file will delete the first 20 lines from the file. HTH Antonio -------------- next part -------------- An HTML attachment was scrubbed... URL: From vvp at cogeco.ca Wed Sep 30 11:29:54 2009 From: vvp at cogeco.ca (Viktor Pavlenko) Date: Wed, 30 Sep 2009 14:29:54 -0400 Subject: [tpm] Fast(er) way of deleting X lines from start of a file In-Reply-To: References: <4AC37BA2.90608@alteeve.com> Message-ID: <19139.41890.796217.428615@hetman.ua> >>>>> "AS" == Antonio Sun writes: AS> [...] AS> If using shell script instead of Perl is an option, then sed is the best AS> tool AS> ToDel=20 AS> sed -i "1,${ToDel}d" file AS> will delete the first 20 lines from the file. perl -i -ne 'print if $. > 20' file (my two cents in Perl) -- Viktor From liam at holoweb.net Wed Sep 30 14:20:01 2009 From: liam at holoweb.net (Liam R E Quin) Date: Wed, 30 Sep 2009 17:20:01 -0400 Subject: [tpm] Fast(er) way of deleting X lines from start of a file In-Reply-To: <87tyykv36x.fsf@quad.sysarch.com> References: <4AC37BA2.90608@alteeve.com> <87tyykv36x.fsf@quad.sysarch.com> Message-ID: <1254345601.7509.35.camel@desktop.barefootcomputing.com> On Wed, 2009-09-30 at 11:53 -0400, Uri Guttman wrote: > >>>>> "MK" == Madison Kelly writes: > > MK> Hi all, > MK> Thus far, I've opened a file, read it in, shifted/ignored the first > MK> X number of line and then wrote out the resulting file. This works, > MK> but strikes me as horribly inefficient. Doubly so when the file could > MK> be larger than RAM. In this case I'd consider a short C program that used mmap() and bcopy() and ftrunc(). The point is to avoid per-line processing, and to avoid having the whole file in memory (mmap() maps the file on disk into memory locations without actually reading it). In perl, you can use sysread and syswrite to avoid per-line processing. Watch out, if something is writing to the file while you do this, you can end up with corruption, though. You can use file locking, However, Liam's Rule of Optimization :-) is that the fastest way to do something is not to do it at all. For example, what if you had a separate file for every X lines? Then you'd just delete the oldest file. Or, buy more memory so it all fits :-) Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org www.advogato.org From thakore.kartik at gmail.com Wed Sep 30 14:18:37 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Wed, 30 Sep 2009 17:18:37 -0400 Subject: [tpm] Flexible scheduling scripts Message-ID: <9B64CF03-E583-43C9-946F-9549EC50F796@gmail.com> Hi all, After building an arsenal of Perl scripts to ease my work load I am looking for a way to schedule this perl scripts. When I say flexibilty I would like to be able to change a text file the scheduler is running against and not have to restart the scheduler. Here is my idea: Tasks.conf -------------- script= some.pl args args time = 1430 Scheduler.pl ---------------- sub check_sum_file () { $new = gen_check_sum; if ($new != $old) { $old = $new; return 1; } return 0; } sub reload { .... # copy old file to tmp file # replace old filehandle } while(1) { reload if check_sum_file; foreach $node ( $nodes) { system $node->script if $node->time == time } } Is there a better way to accoplush this. One problem I see is that if the conf file is huge it will kill the memory. Kartik Thakore From stuart at morungos.com Wed Sep 30 14:32:46 2009 From: stuart at morungos.com (Stuart Watt) Date: Wed, 30 Sep 2009 17:32:46 -0400 Subject: [tpm] Flexible scheduling scripts In-Reply-To: <9B64CF03-E583-43C9-946F-9549EC50F796@gmail.com> References: <9B64CF03-E583-43C9-946F-9549EC50F796@gmail.com> Message-ID: <4AC3CE7E.5020008@morungos.com> Kartik Thakore wrote: > Hi all, > > After building an arsenal of Perl scripts to ease my work load I am > looking for a way to schedule this perl scripts. When I say flexibilty > I would like to be able to change a text file the scheduler is running > against and not have to restart the scheduler. It might be worth looking at TaskForest (http://www.taskforest.com/), which is a Perl scheduler and claims to do a lot of this. We did look at this, as we needed some of this functionality, but (a) we were using Windows mostly, and (b) we needed to run things in parallel with dependencies, so we ended up crafting a different approach. It may be worth looking into, though. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance -------------- next part -------------- An HTML attachment was scrubbed... URL: From thakore.kartik at gmail.com Wed Sep 30 15:01:21 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Wed, 30 Sep 2009 18:01:21 -0400 Subject: [tpm] Flexible scheduling scripts In-Reply-To: <4AC3CE7E.5020008@morungos.com> References: <9B64CF03-E583-43C9-946F-9549EC50F796@gmail.com> <4AC3CE7E.5020008@morungos.com> Message-ID: I am on a win box. This is local. Also I don't have access to at (windows scheduler) On Wed, Sep 30, 2009 at 5:32 PM, Stuart Watt wrote: > Kartik Thakore wrote: > > Hi all, > > After building an arsenal of Perl scripts to ease my work load I am looking > for a way to schedule this perl scripts. When I say flexibilty I would like > to be able to change a text file the scheduler is running against and not > have to restart the scheduler. > > It might be worth looking at TaskForest (http://www.taskforest.com/), > which is a Perl scheduler and claims to do a lot of this. We did look at > this, as we needed some of this functionality, but (a) we were using Windows > mostly, and (b) we needed to run things in parallel with dependencies, so we > ended up crafting a different approach. It may be worth looking into, > though. > > All the best > Stuart > -- > Stuart Watt > ARM Product Developer > Information Balance > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vvp at cogeco.ca Wed Sep 30 16:15:44 2009 From: vvp at cogeco.ca (Viktor Pavlenko) Date: Wed, 30 Sep 2009 19:15:44 -0400 Subject: [tpm] Flexible scheduling scripts In-Reply-To: <4AC3CE7E.5020008@morungos.com> References: <9B64CF03-E583-43C9-946F-9549EC50F796@gmail.com> <4AC3CE7E.5020008@morungos.com> Message-ID: <19139.59040.727446.596327@hetman.ua> >>>>> "SW" == Stuart Watt writes: SW> Kartik Thakore wrote: >> Hi all, >> >> After building an arsenal of Perl scripts to ease my work load >> I am looking for a way to schedule this perl scripts. When I >> say flexibilty I would like to be able to change a text file >> the scheduler is running against and not have to restart the >> scheduler. SW> It might be worth looking at TaskForest SW> (http://www.taskforest.com/), which is a Perl scheduler and SW> claims to do a lot of this. We did look at this, as we needed SW> some of this functionality, but (a) we were using Windows SW> mostly, and (b) we needed to run things in parallel with SW> dependencies, so we ended up crafting a different approach. It SW> may be worth looking into, though. I wish I could publish the code I wrote for my company (some 2500 lines of dense perl) but my request to release it under GPL is still in the air. Before writing it myself I did look at what's available out there ... nothing is. TaskForest is pathetic, SOS is terribly complicated and buggy. Kartik, your approach is good, just add more features as you need them. -- Viktor From thakore.kartik at gmail.com Wed Sep 30 17:07:19 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Wed, 30 Sep 2009 20:07:19 -0400 Subject: [tpm] Flexible scheduling scripts In-Reply-To: <19139.59040.727446.596327@hetman.ua> References: <9B64CF03-E583-43C9-946F-9549EC50F796@gmail.com> <4AC3CE7E.5020008@morungos.com> <19139.59040.727446.596327@hetman.ua> Message-ID: Viktor Can you give me a hint for handling large config files? Kartik Thakore On 30-Sep-09, at 7:15 PM, Viktor Pavlenko wrote: >>>>>> "SW" == Stuart Watt writes: > > SW> Kartik Thakore wrote: >>> Hi all, >>> >>> After building an arsenal of Perl scripts to ease my work load >>> I am looking for a way to schedule this perl scripts. When I >>> say flexibilty I would like to be able to change a text file >>> the scheduler is running against and not have to restart the >>> scheduler. > > SW> It might be worth looking at TaskForest > SW> (http://www.taskforest.com/), which is a Perl scheduler and > SW> claims to do a lot of this. We did look at this, as we needed > SW> some of this functionality, but (a) we were using Windows > SW> mostly, and (b) we needed to run things in parallel with > SW> dependencies, so we ended up crafting a different approach. It > SW> may be worth looking into, though. > > I wish I could publish the code I wrote for my company (some 2500 > lines of dense perl) but my request to release it under GPL is still > in the air. Before writing it myself I did look at what's available > out there ... nothing is. TaskForest is pathetic, SOS is terribly > complicated and buggy. > > Kartik, your approach is good, just add more features as you need > them. > > -- > Viktor > From vvp at cogeco.ca Wed Sep 30 17:18:26 2009 From: vvp at cogeco.ca (Viktor Pavlenko) Date: Wed, 30 Sep 2009 20:18:26 -0400 Subject: [tpm] Flexible scheduling scripts In-Reply-To: References: <9B64CF03-E583-43C9-946F-9549EC50F796@gmail.com> <4AC3CE7E.5020008@morungos.com> <19139.59040.727446.596327@hetman.ua> Message-ID: <19139.62802.278169.457533@hetman.ua> >>>>> "KT" == Kartik Thakore writes: KT> Viktor KT> Can you give me a hint for handling large config files? How large can they be? Our most complicated schedules are 120 jobs. I don't reload them automatically, but by request (it's client/server app). If you have much more, take the same approach or reload them every minute or so. -- Viktor From thakore.kartik at gmail.com Wed Sep 30 17:55:18 2009 From: thakore.kartik at gmail.com (Kartik Thakore) Date: Wed, 30 Sep 2009 20:55:18 -0400 Subject: [tpm] Flexible scheduling scripts In-Reply-To: <19139.62802.278169.457533@hetman.ua> References: <9B64CF03-E583-43C9-946F-9549EC50F796@gmail.com> <4AC3CE7E.5020008@morungos.com> <19139.59040.727446.596327@hetman.ua> <19139.62802.278169.457533@hetman.ua> Message-ID: Kartik Thakore On 30-Sep-09, at 8:18 PM, Viktor Pavlenko wrote: >>>>>> "KT" == Kartik Thakore writes: > > KT> Viktor > KT> Can you give me a hint for handling large config files? > > How large can they be? Our most complicated schedules are 120 jobs. I have 12 scripts but due to args several different combos. I have 200+ entries. But I think I can cut them as extensions of scripts. > I > don't reload them automatically, but by request (it's client/server > app). If you have much more, take the same approach or reload them > every minute or so. > > -- > Viktor > From vvp at cogeco.ca Wed Sep 30 18:00:32 2009 From: vvp at cogeco.ca (Viktor Pavlenko) Date: Wed, 30 Sep 2009 21:00:32 -0400 Subject: [tpm] Flexible scheduling scripts In-Reply-To: References: <9B64CF03-E583-43C9-946F-9549EC50F796@gmail.com> <4AC3CE7E.5020008@morungos.com> <19139.59040.727446.596327@hetman.ua> <19139.62802.278169.457533@hetman.ua> Message-ID: <19139.65328.124377.206442@hetman.ua> >>>>> "KT" == Kartik Thakore writes: >> How large can they be? Our most complicated schedules are 120 >> jobs. KT> I have 12 scripts but due to args several different combos. I KT> have 200+ entries. But I think I can cut them as extensions of KT> scripts. Put some sleep in your loop and you will be fine. You don't change your scripts every second, do you? The standard *NIX approach is to send HUP signal when your config file changes. -- Viktor From lz at isx.ca Wed Sep 30 19:56:56 2009 From: lz at isx.ca (L Zulauf) Date: Wed, 30 Sep 2009 22:56:56 -0400 Subject: [tpm] Need a PERL programmer Message-ID: <3CFC3BB2-FD05-4E05-AC1E-0B523F0DBBAD@isx.ca> We are a travel company needing someone to take over our database work. It is currently in PERL, and we require upgrades and maintenance from time to time. We may consider full-time IT position for the appropriate person. Contact me at: lz at isx.ca, to discuss Thanks L Zulauf ISX Canada lz at isx.ca