From joshua.mcadams at gmail.com Thu Jun 1 08:13:48 2006 From: joshua.mcadams at gmail.com (Joshua McAdams) Date: Thu, 1 Jun 2006 11:13:48 -0400 Subject: [Omaha.pm] YAPC::NA Message-ID: <49d805d70606010813g4d1d09fbi6339cb006a291bc8@mail.gmail.com> Hi there fellow Perl Mongers. I'm writing to remind you all that YAPC::NA is only a few weeks away. The conference will be held in Chicago June 26th through 28th and will feature four simultaneous sessions of Perl talks for three days in addition to a job fair, banquet, and auction. After the conference Damian Conway, Randal Schwartz, and brian d foy will be sticking around and conducting professional training classes and extremely reduced prices. This email is a little spammy (sorry about that), but I just wanted to remind you all about the conference and also ask for your help in promoting it so that we can fill up the few spots that are remaining. For more information check out http://www.yapcchicago.org. We invite you to put up posters: http://yapcchicago.org/yapc_poster.pdf http://yapcchicago.org/yapc_poster_white.pdf Or maybe a web banner: http://www.yapcchicago.org/yapc_banner_wide.jpg http://www.yapcchicago.org/yapc_banner_narrow.jpg Thank you for your help in making YAPC a success once again, Josh McAdams From jbisbee at gmail.com Mon Jun 5 00:06:09 2006 From: jbisbee at gmail.com (Jeff Bisbee) Date: Mon, 5 Jun 2006 03:06:09 -0400 Subject: [Omaha.pm] JavaScript::XRay Message-ID: I've just released a new module to the CPAN today. (FYI, this is the code I was talking about at the last Duck meeting - aka South Florida Perl Mongers Social Meeting) JavaScript::XRay - See What JavaScript is Doing http://search.cpan.org/~jbisbee/JavaScript-XRay/ Basically, it's and HTML sourcce filter and the idea is that you plug it into your application server to give you a much needed edge when developing, debugging, and/or refactoring javascript code. Here is a quick no frills static example... Before: http://www.jbisbee.com/test.html After: http://www.jbisbee.com/test-xrayed.html I'd like to ask for assistance from you guys in putting the finishing touches on the module. (You guys meaning SouthFlorida.pm, Omaha.pm, and perl folks that I know are into coding javascript). The call for help includes: * Using the module. Plug the module into your application framework and give it a spin. I'd appriciate any feedback (good, bad, etc) to help make it more useful. * Finding and fixing bugs. The code is far from bug free so let's see if we can find and discuess issues or short comings. Also feel free to question the interface or suggest improvements to make the code more elegant or robust. * Cleaning up the pod. If something doesn't sound right or you don't get it, let's rewrite it so it makes sense. Also fix any grammar or spelling errors, etc. We can us AnnoCPAN to facilitate this. If you haven't seen or used AnnoCPAN yet, give i. http://annocpan.org/dist/JavaScript-XRay * Adding functionality. I need to finalize how the inlining of external js files in going to work. A generic solution would just use LWP, but if the script is used from the command line, it may be a relative directory issue. It also could be that the user could specify a list of root directories to look for javascript files if their located on the same server as the one serving the page. * Tests! Tests are pretty much non existant right now. It's on my to do list, but haven't gotten around to it yet. (shame on me for not doing test first development). Anyway, if you want to help out by writing tests, feel free (just let me know because I still plan working on them this week) I use the logging console on a daily basis now and it has helped me figure out, debug, and fix javascript code that I wouldn't have a clue with before this tool. We can use the southflorida-pm list for discussion now. (the only traffic it gets now is from me remind folks of when the next meeting is) Feel free to pass this message on to other people who might be interested in using the module or helping out. BTW, for those folks who I CC'd or get forwarded this message, if you're not signed up to the southflorida-pm list but would like to help, you can sign up to the southflorida-pm list here http://mail.pm.org/mailman/listinfo/southflorida-pm -- Jeff Bisbee / jbisbee at gmail.com / jbisbee.com From jay at jays.net Mon Jun 5 13:17:12 2006 From: jay at jays.net (Jay Hannah) Date: Mon, 05 Jun 2006 15:17:12 -0500 Subject: [Omaha.pm] Benchmarking new versions of a module Message-ID: <44849148.7030707@jays.net> So we re-wrote a module today for the sake of speed. Twice. Did we make it faster or slower? How much faster or slower? Quick temp directory and "use Benchmark;"... j $ ls -al total 53 drwxr-xr-x 2 jhannah users 168 2006-06-05 15:14 . drwxrwxrwx 5 pbaker resmis 1024 2006-06-05 15:13 .. -rw-r--r-- 1 jhannah users 1479 2006-06-05 15:07 j.pl -rwxr-xr-x 1 jhannah users 13886 2006-06-05 14:54 RateRule_new2.pm -rwxr-xr-x 1 jhannah users 13748 2006-06-05 14:53 RateRule_new.pm -rwxr-xr-x 1 jhannah users 12760 2006-06-05 14:44 RateRule_old.pm $ cat j.pl use strict; use RateRule_old; use RateRule_new; use RateRule_new2; use Benchmark; timethese(10000, { 'old' => sub { my $obj = Model::omares::Complex::Rates::RateRule_old->new(); set_get($obj); }, 'new' => sub { my $obj = Model::omares::Complex::Rates::RateRule_new->new(); set_get($obj); }, 'new2' => sub { my $obj = Model::omares::Complex::Rates::RateRule_new2->new(); set_get($obj); } }); sub set_get { my ($obj) = @_; my @fields = qw( date discount valid_arrival valid_days advance_purchase min_night_stay max_night_stay min_adults max_adults max_persons free_sale accepted_len_stay active_status discount how_disc extra_money how_apply_money package_code allotment commission commission_amt max_advance min_advance ); my %values = qw( commission Y date 06/05/2006 ); my $field; foreach $field (@fields) { my $get = "get_$field"; my $set = "set_$field"; #print "$field...\n"; my $value = $values{$field} || 100; $obj->$set($value); my $check = $obj->$get; die "[$field] failed on obj $obj ($check ne $value)" unless ($check eq $value); } } $ perl j.pl Benchmark: timing 10000 iterations of new, new2, old... new: 5 wallclock secs ( 5.44 usr + 0.00 sys = 5.44 CPU) @ 1838.24/s (n=10000) new2: 2 wallclock secs ( 2.05 usr + 0.00 sys = 2.05 CPU) @ 4878.05/s (n=10000) old: 18 wallclock secs (17.61 usr + 0.01 sys = 17.62 CPU) @ 567.54/s (n=10000) From jay at jays.net Tue Jun 13 03:42:37 2006 From: jay at jays.net (Jay Hannah) Date: Tue, 13 Jun 2006 05:42:37 -0500 Subject: [Omaha.pm] Meeting tonight Message-ID: <448E969D.8010104@jays.net> http://omaha.pm.org/ It's that time of month again! On Friday I had my wisdom teeth yanked and it doesn't seem to be going very well, so I promise not to be much fun at the meeting tonight. :) I haven't prepped anything. Here's some stuff I've been doing over the last month if no one has any suggestions / requests / cool stuff they've done lately: - Bioinformatics: http://openlab.jays.net - Devel::Timer - Jay's report patch. Jay to take over CPAN maintenance? - http://pm.org - Jay might become grand poobah this summer. Automation? - Genealogy: Finding a bug in lines2perl (relation.lines vs. relation.pl) - Benchmarking stuff I've posted to the list recently See you there! (ouch! -grin- -wince-) j From jay at jays.net Fri Jun 16 14:57:53 2006 From: jay at jays.net (Jay Hannah) Date: Fri, 16 Jun 2006 16:57:53 -0500 Subject: [Omaha.pm] Fwd: Perl Authors at YAPC::NA, Chicago, IL--June 26-28 Message-ID: <44932961.9060505@jays.net> Snipped... j ***Perl Authors at YAPC::NA, Chicago, IL--June 26-28 The Chicago Perl Mongers are hosting Yet Another Perl Conference North America. Come hear Larry Wall ("Programming Perl"), Damian Conway (Perl Best Practices & Perl Hacks), Randal Schwartz ("Learning Perl & Intermediate Perl"), brian d foy ("Learning Perl and Intermediate Perl"), chromatic ("Perl Testing: A Developer's Notebook & Perl Hacks"), Allison Randal ("Perl 6 & Parrot Essentials"), and Andy Lester ("Mac OS X Tiger in a Nutshell"). Find out what is new in Perl 5 and what is happening with Perl 6 and Parrot. From andy at petdance.com Fri Jun 16 20:36:07 2006 From: andy at petdance.com (Andy Lester) Date: Fri, 16 Jun 2006 22:36:07 -0500 Subject: [Omaha.pm] Fwd: Perl Authors at YAPC::NA, Chicago, IL--June 26-28 In-Reply-To: <44932961.9060505@jays.net> References: <44932961.9060505@jays.net> Message-ID: <1CD3FAC2-D235-4E47-9A0E-BAA1B399DFBB@petdance.com> , > Allison Randal ("Perl 6 & Parrot Essentials"), and Andy Lester > ("Mac OS > X Tiger in a Nutshell"). And _Pro Perl Debugging_! -- Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance From jbisbee at gmail.com Sat Jun 17 04:38:27 2006 From: jbisbee at gmail.com (Jeff Bisbee) Date: Sat, 17 Jun 2006 06:38:27 -0500 Subject: [Omaha.pm] YAPC::NA 2006 Message-ID: Anyone on the Omaha.pm list going to YAPC (other than Andy?) :) -- Jeff Bisbee / jbisbee at gmail.com / jbisbee.com From jay at jays.net Fri Jun 23 13:26:21 2006 From: jay at jays.net (Jay Hannah) Date: Fri, 23 Jun 2006 15:26:21 -0500 Subject: [Omaha.pm] Pick your brain? In-Reply-To: <6.2.3.4.2.20060623085236.05c87008@mail.aurora-e-solutions.com> References: <6.2.3.4.2.20060623085236.05c87008@mail.aurora-e-solutions.com> Message-ID: <449C4E6D.2070809@jays.net> Michael D. Maynard wrote: > Can I pick your brain for a minute? I've got a perl script that imports > tables from SQL server and inserts them into MySQL. The script does the > inserts to one of two servers depending on the arguments that you give > it. It has been running stably for almost a year. Recently some > changes were made to the tables in the SQL server. A few fields were > added and a few taken away. The SELECT and REPLACE statements were > updated accordingly. What is a REPLACE statement? A wacky variation of an UPDATE statement? Does that exist in MySQL, MS-SQL, or both? > The SQL server is updated twice a day. Client pushes data to me which I > scrub and populate the MySQL database. This is the odd thing. The first > time the script is run after an update of the SQL server, I get errors > saying that required fields are empty. They are not. If I run the > script again, it works fine. Sometimes it will error on another table, > but if I run it enough times and get through all the tables then it runs > fine until the next update. The failed REPLACE statement isn't in the > bin log. :-( > > I haven't made any updates to perl, perl modules, SQL server, OS, etc. > > Any thoughts? Yikes. Are you using DBD::Sybase and freetds to connect to MS-SQL server (that is what I use) or some other combination? Can you tell me exactly what errors you are getting? Can you trap the line of data in the source database that it is complaining about? (RaiseError 0, PrintError 1, + a little loop for error handling to print all the values in the fatal row?) HTH, j in PHX until Sunday night From jay at jays.net Sat Jun 24 12:05:06 2006 From: jay at jays.net (Jay Hannah) Date: Sat, 24 Jun 2006 14:05:06 -0500 Subject: [Omaha.pm] Pick your brain? In-Reply-To: <6.2.3.4.2.20060623163035.06329ad0@mail.aurora-e-solutions.com> References: <6.2.3.4.2.20060623085236.05c87008@mail.aurora-e-solutions.com> <449C4E6D.2070809@jays.net> <6.2.3.4.2.20060623163035.06329ad0@mail.aurora-e-solutions.com> Message-ID: <449D8CE2.2040302@jays.net> Michael D. Maynard wrote: > REPLACE is a MySQL function that does a DELETE/INSERT when it finds a > record with a conflicting unique key rather than throwing an error. It > comes in very handy when you are wanting to update records. > > http://dev.mysql.com/doc/refman/5.0/en/replace.html Ahh... My software usually knows whether to INSERT or UPDATE based on a SELECT statement (typically executed some time earlier). I guess REPLACE would be handy if you don't care whether or not data already exists. I often find myself tweaking a few columns in a table with many columns. In those cases REPLACE doesn't strike me as very useful, since I wouldn't want to blank out all the other columns accidentally... :) Thanks for the tip! > The error is: DBD::mysql::st execute failed: Column 'CampaignID' cannot > be null at nph-import.cgi line 395. The column name is different in a > couple tables, but the error is the same. The field is defined as not > null and there is a Unique index for it. > > RaiseError=>1, PrintError=>1. I haven't written anything for the error > handling yet, but I am planning on doing that this weekend. When I > print the data to STDOUT rather than doing the REPLACE, all the data is > there. That's the next thing I would try. You can do very verbose error handling on that insert that fails one time out of a thousand (or whatever). (oh... I just remembered placeholders don't work through freetds. bummer... source code would be a lot cleaner with them...) Something like... (not tested): my $dbh1 = ...({RaiseError => 0, PrintError => 1}); # Source connection my $dbh2 = ...({RaiseError => 0, PrintError => 1}); # Target connection my $sth1 = $dbh1->prepare("select col1, col2, col3 from x"); $sth1->execute; my @row; # ... bind variables might be cleaner here while (@row = $sth1->fetchrow) { my sth2 = $dbh2->prepare("REPLACE into x (col1, col2, col3) values ('$row[0]', '$row[1]', '$row[2]')"); $sth2->execute; if ($DBI::err) { my $error = "[" . $DBI::err . "|" . $DBI::errstr . "]"; print "Ack! Here's our error: [$error]\n"; print "Our source data record was: ["; print join "|", @row; print "]\n"; } } ? Does that help? I hate errors that don't happen EVERY TIME. Good luck! :) j PHX in June. yee ha! From jhannah at omnihotels.com Fri Jun 30 07:17:14 2006 From: jhannah at omnihotels.com (Jay Hannah) Date: Fri, 30 Jun 2006 09:17:14 -0500 Subject: [Omaha.pm] Perl & XML presentation? Message-ID: <29AB736ABCE5C745ABF9C93B02F2C27B05A37881@exchange2k3.omnihotels.net> Hi Kent -- Welcome back to the Omaha Perl Mongers! Nice talking to you last night & the .NET user group. (I was only 4 minutes late picking up my son. Not too bad. -grin-) Since I missed it three years ago, any chance I can talk you into presenting this again? http://www.tegels.org/tegels_index.html Kent's Perl & XML presentation for Omaha's Perl Mongers on 24 July 2003. j